tested on amd64 and sparc64.
-/* $OpenBSD: if_bridge.c,v 1.353 2021/03/01 11:05:42 bluhm Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.354 2021/03/05 06:44:09 dlg Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
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 *,
* 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);
-/* $OpenBSD: if_ethersubr.c,v 1.272 2021/03/05 03:51:41 dlg Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.273 2021/03/05 06:44:09 dlg Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
*/
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) ||
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;
*/
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
-/* $OpenBSD: if_switch.c,v 1.42 2021/02/25 02:48:21 dlg Exp $ */
+/* $OpenBSD: if_switch.c,v 1.43 2021/03/05 06:44:09 dlg Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
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 *);
}
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);
-/* $OpenBSD: if_tpmr.c,v 1.23 2021/02/26 02:09:45 dlg Exp $ */
+/* $OpenBSD: if_tpmr.c,v 1.24 2021/03/05 06:44:09 dlg Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
}
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 */
#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;
goto drop;
if (!ISSET(ifp->if_flags, IFF_LINK0) &&
- tpmr_8021q_filter(m))
+ tpmr_8021q_filter(m, dst))
goto drop;
#if NPF > 0
-/* $OpenBSD: if_veb.c,v 1.14 2021/03/03 00:00:03 dlg Exp $ */
+/* $OpenBSD: if_veb.c,v 1.15 2021/03/05 06:44:09 dlg Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
}
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);
}
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
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)) {
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);
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;
}
-/* $OpenBSD: if_ether.h,v 1.79 2021/02/26 01:12:37 dlg Exp $ */
+/* $OpenBSD: if_ether.h,v 1.80 2021/03/05 06:44:09 dlg Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
#include <net/if_var.h> /* 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;
};