Index: netinet/if_ether.h =================================================================== RCS file: /cvs/src/sys/netinet/if_ether.h,v retrieving revision 1.79 diff -u -p -r1.79 if_ether.h --- netinet/if_ether.h 26 Feb 2021 01:12:37 -0000 1.79 +++ netinet/if_ether.h 5 Mar 2021 06:03:15 -0000 @@ -218,7 +218,8 @@ do { \ #include /* for "struct ifnet" */ struct ether_brport { - struct mbuf *(*eb_input)(struct ifnet *, struct mbuf *, void *); + struct mbuf *(*eb_input)(struct ifnet *, struct mbuf *, + uint64_t, void *); void *eb_port; }; Index: net/if_bridge.c =================================================================== RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.353 diff -u -p -r1.353 if_bridge.c --- net/if_bridge.c 1 Mar 2021 11:05:42 -0000 1.353 +++ net/if_bridge.c 5 Mar 2021 06:03:16 -0000 @@ -110,7 +110,7 @@ void bridge_spandetach(void *); int bridge_ifremove(struct bridge_iflist *); void bridge_spanremove(struct bridge_iflist *); struct mbuf * - bridge_input(struct ifnet *, struct mbuf *, void *); + bridge_input(struct ifnet *, struct mbuf *, uint64_t, void *); void bridge_process(struct ifnet *, struct mbuf *); void bridgeintr_frame(struct ifnet *, struct ifnet *, struct mbuf *); void bridge_bifgetstp(struct bridge_softc *, struct bridge_iflist *, @@ -1119,7 +1119,7 @@ bridge_ourether(struct ifnet *ifp, uint8 * not for us, and schedule an interrupt. */ struct mbuf * -bridge_input(struct ifnet *ifp, struct mbuf *m, void *null) +bridge_input(struct ifnet *ifp, struct mbuf *m, uint64_t dst, void *null) { KASSERT(m->m_flags & M_PKTHDR); Index: net/if_ethersubr.c =================================================================== RCS file: /cvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.272 diff -u -p -r1.272 if_ethersubr.c --- net/if_ethersubr.c 5 Mar 2021 03:51:41 -0000 1.272 +++ net/if_ethersubr.c 5 Mar 2021 06:03:16 -0000 @@ -398,6 +398,7 @@ ether_input(struct ifnet *ifp, struct mb */ eh = mtod(m, struct ether_header *); + dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost); etype = ntohs(eh->ether_type); if (ISSET(m->m_flags, M_VLANTAG) || @@ -426,7 +427,7 @@ ether_input(struct ifnet *ifp, struct mb smr_read_enter(); eb = SMR_PTR_GET(&ac->ac_brport); if (eb != NULL) { - m = (*eb->eb_input)(ifp, m, eb->eb_port); + m = (*eb->eb_input)(ifp, m, dst, eb->eb_port); if (m == NULL) { smr_read_leave(); return; @@ -451,7 +452,6 @@ ether_input(struct ifnet *ifp, struct mb */ eh = mtod(m, struct ether_header *); - dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost); self = ether_addr_to_e64((struct ether_addr *)ac->ac_enaddr); if (dst != self) { #if NCARP > 0 Index: net/if_switch.c =================================================================== RCS file: /cvs/src/sys/net/if_switch.c,v retrieving revision 1.42 diff -u -p -r1.42 if_switch.c --- net/if_switch.c 25 Feb 2021 02:48:21 -0000 1.42 +++ net/if_switch.c 5 Mar 2021 06:03:16 -0000 @@ -69,7 +69,7 @@ void switch_port_detach(void *); int switch_port_del(struct switch_softc *, struct ifbreq *); int switch_port_list(struct switch_softc *, struct ifbifconf *); struct mbuf * - switch_input(struct ifnet *, struct mbuf *, void *); + switch_input(struct ifnet *, struct mbuf *, uint64_t, void *); struct mbuf *switch_port_ingress(struct switch_softc *, struct ifnet *, struct mbuf *); @@ -668,7 +668,7 @@ switch_port_del(struct switch_softc *sc, } struct mbuf * -switch_input(struct ifnet *ifp, struct mbuf *m, void *null) +switch_input(struct ifnet *ifp, struct mbuf *m, uint64_t dst, void *null) { KASSERT(m->m_flags & M_PKTHDR); Index: net/if_tpmr.c =================================================================== RCS file: /cvs/src/sys/net/if_tpmr.c,v retrieving revision 1.23 diff -u -p -r1.23 if_tpmr.c --- net/if_tpmr.c 26 Feb 2021 02:09:45 -0000 1.23 +++ net/if_tpmr.c 5 Mar 2021 06:03:16 -0000 @@ -224,16 +224,8 @@ tpmr_vlan_filter(const struct mbuf *m) } static int -tpmr_8021q_filter(const struct mbuf *m) +tpmr_8021q_filter(const struct mbuf *m, uint64_t dst) { - const struct ether_header *eh; - uint64_t dst; - - if (m->m_len < sizeof(*eh)) - return (1); - - eh = mtod(m, struct ether_header *); - dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost); if (ETH64_IS_8021_RSVD(dst)) { switch (dst & 0xf) { case 0x01: /* IEEE MAC-specific Control Protocols */ @@ -292,7 +284,7 @@ tpmr_pf(struct ifnet *ifp0, int dir, str #endif /* NPF > 0 */ static struct mbuf * -tpmr_input(struct ifnet *ifp0, struct mbuf *m, void *brport) +tpmr_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst, void *brport) { struct tpmr_port *p = brport; struct tpmr_softc *sc = p->p_tpmr; @@ -325,7 +317,7 @@ tpmr_input(struct ifnet *ifp0, struct mb goto drop; if (!ISSET(ifp->if_flags, IFF_LINK0) && - tpmr_8021q_filter(m)) + tpmr_8021q_filter(m, dst)) goto drop; #if NPF > 0 Index: net/if_veb.c =================================================================== RCS file: /cvs/src/sys/net/if_veb.c,v retrieving revision 1.14 diff -u -p -r1.14 if_veb.c --- net/if_veb.c 3 Mar 2021 00:00:03 -0000 1.14 +++ net/if_veb.c 5 Mar 2021 06:03:16 -0000 @@ -334,7 +334,7 @@ veb_clone_destroy(struct ifnet *ifp) } static struct mbuf * -veb_span_input(struct ifnet *ifp0, struct mbuf *m, void *brport) +veb_span_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst, void *brport) { m_freem(m); return (NULL); @@ -914,13 +914,13 @@ drop: } static struct mbuf * -veb_port_input(struct ifnet *ifp0, struct mbuf *m, void *brport) +veb_port_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst, void *brport) { struct veb_port *p = brport; struct veb_softc *sc = p->p_veb; struct ifnet *ifp = &sc->sc_if; struct ether_header *eh; - uint64_t src, dst; + uint64_t src; #if NBPFILTER > 0 caddr_t if_bpf; #endif @@ -935,7 +935,6 @@ veb_port_input(struct ifnet *ifp0, struc eh = mtod(m, struct ether_header *); src = ether_addr_to_e64((struct ether_addr *)eh->ether_shost); - dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost); /* Is this a MAC Bridge component Reserved address? */ if (ETH64_IS_8021_RSVD(dst)) { @@ -2148,6 +2147,9 @@ vport_enqueue(struct ifnet *ifp, struct smr_read_enter(); eb = SMR_PTR_GET(&ac->ac_brport); if (eb != NULL) { + struct ether_header *eh; + uint64_t dst; + counters_pkt(ifp->if_counters, ifc_opackets, ifc_obytes, m->m_pkthdr.len); @@ -2157,7 +2159,9 @@ vport_enqueue(struct ifnet *ifp, struct bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_OUT); #endif - m = (*eb->eb_input)(ifp, m, eb->eb_port); + eh = mtod(m, struct ether_header *); + dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost); + m = (*eb->eb_input)(ifp, m, dst, eb->eb_port); error = 0; }