summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-08-03 09:50:15 +0000
committeryar <yar@FreeBSD.org>2006-08-03 09:50:15 +0000
commit3ff2ef88e741ff06a7de9813d21b5394b85e9f1b (patch)
tree32c93956fbcab4b9e3b8badf62fbc50dd04d4ea7 /sys/net/if_vlan.c
parenta8d66dc9fb3926969128d61766e4fe2bf4dd9845 (diff)
downloadFreeBSD-src-3ff2ef88e741ff06a7de9813d21b5394b85e9f1b.zip
FreeBSD-src-3ff2ef88e741ff06a7de9813d21b5394b85e9f1b.tar.gz
Back out rev. 1.107 because it introduced as many problems
as it tried to solve: - it smuggled hidden 802.1q details into otherwise protocol-neutral code; - it put an important code consistency check under DEBUG, which was never defined by anyone but a developer hacking this file for the moment; - lastly, the former bcopy() call had been correct as long as the "dead" code was there. (A new version of the fix for tag of -1 to come in the next commit.) Agreed by: qingli
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r--sys/net/if_vlan.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 55af9c9..34ef7ee 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -917,15 +917,21 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
__func__, ntohs(evl->evl_encap_proto)));
tag = EVL_VLANOFTAG(ntohs(evl->evl_tag));
+
+ /*
+ * Restore the original ethertype. We'll remove
+ * the encapsulation after we've found the vlan
+ * interface corresponding to the tag.
+ */
+ evl->evl_encap_proto = evl->evl_proto;
break;
default:
-#ifdef DEBUG
- /* XXX rate limit? */
- if_printf(ifp, "unsupported if_type %u", ifp->if_type);
+ tag = (uint16_t) -1;
+#ifdef INVARIANTS
+ panic("%s: unsupported if_type (%u)",
+ __func__, ifp->if_type);
#endif
- m_freem(m);
- ifp->if_noproto++; /* XXX? */
- return;
+ break;
}
}
@@ -946,12 +952,12 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
if (mtag == NULL) {
/*
* Packet had an in-line encapsulation header;
- * remove it. Note that we leave the type field
- * unchanged; we only copy up the mac addresses.
+ * remove it. The original header has already
+ * been fixed up above.
*/
bcopy(mtod(m, caddr_t),
mtod(m, caddr_t) + ETHER_VLAN_ENCAP_LEN,
- ETHER_HDR_LEN - ETHER_TYPE_LEN);
+ ETHER_HDR_LEN);
m_adj(m, ETHER_VLAN_ENCAP_LEN);
}
OpenPOWER on IntegriCloud