-/* $OpenBSD: if_bridge.c,v 1.233 2015/04/07 10:46:20 mpi Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.234 2015/04/13 08:52:51 mpi Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
struct ether_header *, struct mbuf *);
void bridge_span(struct bridge_softc *, struct ether_header *,
struct mbuf *);
+struct mbuf *bridge_dispatch(struct bridge_iflist *, struct ifnet *,
+ struct ether_header *, struct mbuf *);
void bridge_stop(struct bridge_softc *);
void bridge_init(struct bridge_softc *);
int bridge_bifconf(struct bridge_softc *, struct ifbifconf *);
bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
{
struct bridge_softc *sc;
- int s;
- struct bridge_iflist *ifl, *srcifl;
- struct arpcom *ac;
- struct mbuf *mc;
+ struct bridge_iflist *ifl;
+#if NVLAN > 0
+ uint16_t etype = ntohs(eh->ether_type);
+#endif /* NVLAN > 0 */
/*
* Make sure this interface is a bridge member.
bridge_span(sc, eh, m);
+ m = bridge_dispatch(ifl, ifp, eh, m);
+
+#if NVLAN > 0
+ if ((m != NULL) && ((m->m_flags & M_VLANTAG) ||
+ etype == ETHERTYPE_VLAN || etype == ETHERTYPE_QINQ)) {
+ /* The bridge did not want the vlan frame either, drop it. */
+ ifp->if_noproto++;
+ m_freem(m);
+ m = NULL;
+ }
+#endif /* NVLAN > 0 */
+
+ return (m);
+}
+
+struct mbuf *
+bridge_dispatch(struct bridge_iflist *ifl, struct ifnet *ifp,
+ struct ether_header *eh, struct mbuf *m)
+{
+ struct bridge_softc *sc = ifl->bridge_sc;
+ struct bridge_iflist *srcifl;
+ struct arpcom *ac;
+ struct mbuf *mc;
+ int s;
+
if (m->m_flags & (M_BCAST | M_MCAST)) {
/*
* Reserved destination MAC addresses (01:80:C2:00:00:0x)
-/* $OpenBSD: if_ethersubr.c,v 1.193 2015/04/10 13:58:20 dlg Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.194 2015/04/13 08:52:51 mpi Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
}
#endif
-#if NVLAN > 0
- if ((m->m_flags & M_VLANTAG) || etype == ETHERTYPE_VLAN ||
- etype == ETHERTYPE_QINQ) {
- /* The bridge did not want the vlan frame either, drop it. */
- ifp->if_noproto++;
- m_freem(m);
- return (1);
- }
-#endif /* NVLAN > 0 */
-
#if NCARP > 0
if (ifp->if_carp) {
if (ifp->if_type != IFT_CARP && (carp_input(ifp, eh, m) == 0))
-/* $OpenBSD: if_vlan.c,v 1.115 2015/04/10 02:08:08 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.116 2015/04/13 08:52:51 mpi Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
etype == ifv->ifv_type)
break;
}
- if (ifv == NULL)
- return (1);
+
+ if (ifv == NULL) {
+#if NBRIDGE > 0
+ /*
+ * If the packet hasn't been through its bridge(4) give
+ * it a chance.
+ */
+ if (ifp->if_bridgeport && (m->m_flags & M_PROTO1) == 0)
+ return (1);
+#endif
+ ifp->if_noproto++;
+ m_freem(m);
+ return (0);
+ }
if ((ifv->ifv_if.if_flags & (IFF_UP|IFF_RUNNING)) !=
(IFF_UP|IFF_RUNNING)) {