diff options
author | 2021-02-20 05:03:37 +0000 | |
---|---|---|
committer | 2021-02-20 05:03:37 +0000 | |
commit | 2e3db693425fa699ba445a3f10a43e837b3ca943 (patch) | |
tree | 57ba397239a5fe993d240e7c744bddd97580e790 /sys/net/if_mpe.c | |
parent | move gre and mgre from calling l3 input handlers to using if_vinput. (diff) | |
download | wireguard-openbsd-2e3db693425fa699ba445a3f10a43e837b3ca943.tar.xz wireguard-openbsd-2e3db693425fa699ba445a3f10a43e837b3ca943.zip |
move from calling l3 protocol input handlers to using if_vinput.
if_vinput requires mpsafe interface counters, so add those in. this
factors out some more code between drivers. monitor mode will work
on these interfaces now too.
Diffstat (limited to 'sys/net/if_mpe.c')
-rw-r--r-- | sys/net/if_mpe.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 514633e7e28..f6b39406671 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $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> @@ -108,6 +108,8 @@ mpe_clone_create(struct if_clone *ifc, int unit) 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; @@ -117,6 +119,8 @@ mpe_clone_create(struct if_clone *ifc, int unit) 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 @@ -454,7 +458,6 @@ mpe_input(struct ifnet *ifp, struct mbuf *m) 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 *); @@ -488,7 +491,7 @@ mpe_input(struct ifnet *ifp, struct mbuf *m) if (m == NULL) return; } - input = ipv4_input; + m->m_pkthdr.ph_family = AF_INET; break; } @@ -510,7 +513,7 @@ mpe_input(struct ifnet *ifp, struct mbuf *m) if (m == NULL) return; } - input = ipv6_input; + m->m_pkthdr.ph_family = AF_INET6; break; } @@ -534,21 +537,7 @@ mpe_input(struct ifnet *ifp, struct mbuf *m) 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); |