summaryrefslogtreecommitdiff
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2021-08-19 10:22:01 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2021-08-19 10:22:01 +0000
commitb9752e03054def2202e4cbfb3f4d7de1c0b870b8 (patch)
tree3af7f03630ec85a667958772ec97b7232bcaf2cd /sys/net/if_ethersubr.c
parentc9a4c6632710d26607c991523aa3973b322e2a04 (diff)
implement reception of "VLAN 0 priority tagged" packets.
according to 802.1Q, vlan 0 on the wire is special and should be interpreted as if it was a packet received on the parent interface, but you get the packet priority information encoded in the vlan header. historically we drop vlan tagged packets that don't have a vlan interface configured for the received tag number. historically we have deviated from 802.1Q by allowing for the configuration of a vlan subinterface with the vnetid "unset". this works just like any other vlan interface, but it uses tag 0 on the wire. however, if you're in a situation where you're receiving vlan tagged 0 packets that really are part of the same layer 2 ethernet domain as the parent inteface, this doesnt work well. landry@ is in such a situation at work where the network is sending his OpenBSD boxes packets with VLAN tag 0. sometimes. most of the time the packets are untagged, which is expected, but sometimes they have a VLAN header set. this causes problems, particularly with arp. this diff does the smallest possible change to enable reception of these vlan 0 priority tagged packets. if an "unset" vlan interface is not configured on the parent, then vlan 0 tagged packets get their header stripped and continue stack processing as if they didnt have the tag at all. landry has been running this for months. ok sthen@ claudio@
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 87e8f0146ed..f4ec4ff9696 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.275 2021/07/07 20:19:01 sashan Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.276 2021/08/19 10:22:00 dlg Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -404,12 +404,12 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
if (ISSET(m->m_flags, M_VLANTAG) ||
etype == ETHERTYPE_VLAN || etype == ETHERTYPE_QINQ) {
#if NVLAN > 0
- m = vlan_input(ifp, m);
+ m = vlan_input(ifp, m, &sdelim);
if (m == NULL)
return;
-#endif /* NVLAN > 0 */
-
+#else
sdelim = 1;
+#endif
}
/*
@@ -497,6 +497,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
* At this point it is known that the packet is destined
* for layer 3 protocol handling on the local port.
*/
+ etype = ntohs(eh->ether_type);
switch (etype) {
case ETHERTYPE_IP: