-/* $OpenBSD: if_mpe.c,v 1.97 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.98 2021/02/20 05:03:37 dlg Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
ifp->if_softc = sc;
ifp->if_mtu = MPE_MTU;
ifp->if_ioctl = mpe_ioctl;
+ ifp->if_bpf_mtap = p2p_bpf_mtap;
+ ifp->if_input = p2p_input;
ifp->if_output = mpe_output;
ifp->if_start = mpe_start;
ifp->if_type = IFT_MPLS;
if_attach(ifp);
if_alloc_sadl(ifp);
+ if_counters_alloc(ifp);
+
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
#endif
struct mbuf *n;
uint8_t ttl, tos;
uint32_t exp;
- void (*input)(struct ifnet *, struct mbuf *);
int rxprio = sc->sc_rxhprio;
shim = mtod(m, struct shim_hdr *);
if (m == NULL)
return;
}
- input = ipv4_input;
+
m->m_pkthdr.ph_family = AF_INET;
break;
}
if (m == NULL)
return;
}
- input = ipv6_input;
+
m->m_pkthdr.ph_family = AF_INET6;
break;
}
break;
}
- /* new receive if and move into correct rtable */
- m->m_pkthdr.ph_ifidx = ifp->if_index;
- m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
-
- /* packet has not been processed by PF yet. */
- KASSERT(m->m_pkthdr.pf.statekey == NULL);
-
-#if NBPFILTER > 0
- if (ifp->if_bpf) {
- bpf_mtap_af(ifp->if_bpf, m->m_pkthdr.ph_family,
- m, BPF_DIRECTION_IN);
- }
-#endif
-
- (*input)(ifp, m);
+ if_vinput(ifp, m);
return;
drop:
m_freem(m);
-/* $OpenBSD: if_mpip.c,v 1.12 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_mpip.c,v 1.13 2021/02/20 05:03:37 dlg Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
ifp->if_xflags = IFXF_CLONED;
ifp->if_ioctl = mpip_ioctl;
+ ifp->if_bpf_mtap = p2p_bpf_mtap;
+ ifp->if_input = p2p_input;
ifp->if_output = mpip_output;
ifp->if_start = mpip_start;
ifp->if_rtrequest = p2p_rtrequest;
uint32_t shim, exp;
struct mbuf *n;
uint8_t ttl, tos;
- void (*input)(struct ifnet *, struct mbuf *);
if (!ISSET(ifp->if_flags, IFF_RUNNING))
goto drop;
if (m == NULL)
return;
}
- input = ipv4_input;
+
m->m_pkthdr.ph_family = AF_INET;
break;
}
if (m == NULL)
return;
}
- input = ipv6_input;
+
m->m_pkthdr.ph_family = AF_INET6;
break;
}
break;
}
- m->m_pkthdr.ph_ifidx = ifp->if_index;
- m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
-
- /* packet has not been processed by PF yet. */
- KASSERT(m->m_pkthdr.pf.statekey == NULL);
-
-#if NBPFILTER > 0
- {
- caddr_t if_bpf = ifp->if_bpf;
- if (if_bpf) {
- bpf_mtap_af(if_bpf, m->m_pkthdr.ph_family,
- m, BPF_DIRECTION_IN);
- }
- }
-#endif
-
- (*input)(ifp, m);
+ if_vinput(ifp, m);
return;
drop:
m_freem(m);