-/* $OpenBSD: if_tun.c,v 1.144 2015/05/26 11:36:26 dlg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.145 2015/06/01 07:48:04 mpi Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
}
top->m_pkthdr.len = tlen;
- top->m_pkthdr.rcvif = ifp;
-
-#if NBPFILTER > 0
- if (ifp->if_bpf) {
- s = splnet();
- bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_IN);
- splx(s);
- }
-#endif
if (tp->tun_flags & TUN_LAYER2) {
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
+
+ ml_enqueue(&ml, top);
s = splnet();
- ether_input_mbuf(ifp, top);
+ if_input(ifp, &ml);
splx(s);
-
ifp->if_ipackets++;
return (0);
}
+#if NBPFILTER > 0
+ if (ifp->if_bpf) {
+ s = splnet();
+ bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_IN);
+ splx(s);
+ }
+#endif
+
th = mtod(top, u_int32_t *);
/* strip the tunnel header */
top->m_data += sizeof(*th);
top->m_len -= sizeof(*th);
top->m_pkthdr.len -= sizeof(*th);
top->m_pkthdr.ph_rtableid = ifp->if_rdomain;
+ top->m_pkthdr.rcvif = ifp;
switch (ntohl(*th)) {
case AF_INET: