diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1586,9 +1586,7 @@ struct m_snd_tag **mstp) { - if (ifp->if_snd_tag_alloc == NULL) - return (EOPNOTSUPP); - return (ifp->if_snd_tag_alloc(ifp, params, mstp)); + return (if_snd_tag_alloc(ifp, params, mstp)); } void @@ -1620,13 +1618,13 @@ u_short idx, gen; M_ASSERTPKTHDR(m); - idx = m->m_pkthdr.rcvif->if_index; - gen = m->m_pkthdr.rcvif->if_idxgen; + idx = if_getindex(m->m_pkthdr.rcvif); + gen = if_getidxgen(m->m_pkthdr.rcvif); m->m_pkthdr.rcvidx = idx; m->m_pkthdr.rcvgen = gen; if (__predict_false(m->m_pkthdr.leaf_rcvif != NULL)) { - idx = m->m_pkthdr.leaf_rcvif->if_index; - gen = m->m_pkthdr.leaf_rcvif->if_idxgen; + idx = if_getindex(m->m_pkthdr.leaf_rcvif); + gen = if_getidxgen(m->m_pkthdr.leaf_rcvif); } else { idx = -1; gen = 0; diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4295,6 +4295,12 @@ return ((struct ifnet *)ifp)->if_index; } +int +if_getidxgen(const if_t ifp) +{ + return (ifp->if_idxgen); +} + void if_setdescr(if_t ifp, char *descrbuf) { @@ -4845,6 +4851,16 @@ ((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn; } +int +if_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **mstp) +{ + + if (ifp->if_snd_tag_alloc == NULL) + return (EOPNOTSUPP); + return (ifp->if_snd_tag_alloc(ifp, params, mstp)); +} + void if_setgetcounterfn(if_t ifp, if_get_counter_t fn) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -578,6 +578,7 @@ int if_getcapenable(const if_t ifp); int if_getdunit(const if_t ifp); int if_getindex(const if_t ifp); +int if_getidxgen(const if_t ifp); const char *if_getdname(const if_t ifp); void if_setdname(if_t ifp, const char *name); const char *if_name(if_t ifp); @@ -650,6 +651,8 @@ void *if_getafdata(if_t ifp, int); +int if_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **mstp); /* * Traversing through interface address lists. */