Tag mbufs of all incoming frames or packets with the interface's FIB

setting (either default or if supported as set by SIOCSIFFIB, e.g.
from ifconfig).

Submitted by:	Alexander V. Chernikov (melifaro ipfw.ru)
Reviewed by:	julian
MFC after:	2 weeks
This commit is contained in:
Bjoern A. Zeeb 2011-07-03 16:08:38 +00:00
parent 43deddcdfe
commit a34c6aeb85
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223741
16 changed files with 21 additions and 0 deletions

View File

@ -308,6 +308,7 @@ icintr(device_t dev, int event, char *ptr)
top = m_devget(sc->ic_ifbuf + ICHDRLEN, len, 0, sc->ic_ifp, 0);
if (top) {
mtx_unlock(&sc->ic_lock);
M_SETFIB(top, sc->ic_ifp->if_fib);
netisr_dispatch(NETISR_IP, top);
mtx_lock(&sc->ic_lock);
}

View File

@ -2527,6 +2527,7 @@ lmc_raw_input(struct ifnet *ifp, struct mbuf *mbuf)
{
softc_t *sc = IFP2SC(ifp);
M_SETFIB(mbuf, ifp->if_fib);
# if INET
if (mbuf->m_data[0]>>4 == 4)
netisr_dispatch(NETISR_IP, mbuf);

View File

@ -585,6 +585,8 @@ lp_intr(void *arg)
if (bpf_peers_present(sc->sc_ifp->if_bpf))
lptap(sc->sc_ifp, top);
M_SETFIB(top, sc->sc_ifp->if_fib);
/* mbuf is free'd on failure. */
netisr_queue(NETISR_IP, top);
ppb_lock(ppbus);
@ -637,6 +639,8 @@ lp_intr(void *arg)
if (bpf_peers_present(sc->sc_ifp->if_bpf))
lptap(sc->sc_ifp, top);
M_SETFIB(top, sc->sc_ifp->if_fib);
/* mbuf is free'd on failure. */
netisr_queue(NETISR_IP, top);
ppb_lock(ppbus);

View File

@ -1754,6 +1754,7 @@ uhso_if_rxflush(void *arg)
/* Dispatch to IP layer */
BPF_MTAP(sc->sc_ifp, m);
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
m = m0 != NULL ? m0 : NULL;
mtx_lock(&sc->sc_mtx);

View File

@ -608,6 +608,7 @@ arc_input(struct ifnet *ifp, struct mbuf *m)
m_freem(m);
return;
}
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
}

View File

@ -332,6 +332,7 @@ atm_input(struct ifnet *ifp, struct atm_pseudohdr *ah, struct mbuf *m,
return;
}
}
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
}

View File

@ -692,6 +692,8 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
m_adj(m, ETHER_VLAN_ENCAP_LEN);
}
M_SETFIB(m, ifp->if_fib);
/* Allow ng_ether(4) to claim this frame. */
if (IFP2AC(ifp)->ac_netgraph != NULL) {
KASSERT(ng_ether_input_p != NULL,

View File

@ -550,6 +550,7 @@ fddi_input(ifp, m)
ifp->if_noproto++;
goto dropanyway;
}
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
return;

View File

@ -627,6 +627,7 @@ firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src)
return;
}
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
}

View File

@ -609,6 +609,7 @@ gif_input(m, af, ifp)
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
}

View File

@ -680,6 +680,7 @@ iso88025_input(ifp, m)
break;
}
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
return;

View File

@ -280,6 +280,8 @@ drop: ++ifp->if_ierrors;
if (! (ifp->if_flags & IFF_UP))
goto drop;
M_SETFIB(m, ifp->if_fib);
/* Check queue. */
if (netisr_queue(isr, m)) { /* (0) on success. */
if (debug)

View File

@ -737,6 +737,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
goto drop;
SPPP_UNLOCK(sp);
M_SETFIB(m, ifp->if_fib);
/* Check queue. */
if (netisr_queue(isr, m)) { /* (0) on success. */
if (debug)

View File

@ -781,6 +781,7 @@ in_stf_input(m, off)
*/
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(NETISR_IPV6, m);
}

View File

@ -929,6 +929,7 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag)
ifp->if_ibytes += m->m_pkthdr.len;
ifp->if_ipackets++;
CURVNET_SET(ifp->if_vnet);
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
CURVNET_RESTORE();
return (0);

View File

@ -777,6 +777,7 @@ ng_iface_rcvdata(hook_p hook, item_p item)
/* First chunk of an mbuf contains good junk */
if (harvest.point_to_point)
random_harvest(m, 16, 3, 0, RANDOM_NET);
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
return (0);
}