summaryrefslogtreecommitdiff
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-04-13 08:52:52 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-04-13 08:52:52 +0000
commit9d892957c57d97c5a097161e70589da31bb34ad5 (patch)
treee42c7199b3c785b8c956e4e5988d1ee2152a44ff /sys/net/if_vlan.c
parent6519c8e60e1f060fbf796f09849009a73dc50960 (diff)
Move one "#ifdef NVLAN" chunk needed only if you're running bridge(4) on
to of vlan(4) from ether_input() to bridge_input(). One of the goal of the if_input() plumbing is to stop doing all possible pseudo-drivers checks on every packets. There's no reason that even if you're not running a bridge(4) you've to run this code. This change also will also makes it easier to convert vlan(4) to if_input(). Reviewed by Rafael Zalamena and mikeb@, ok markus@
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r--sys/net/if_vlan.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 072b28be3dd..83482bbbdd1 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $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
@@ -305,8 +305,20 @@ vlan_input(struct ether_header *eh, struct mbuf *m)
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)) {