Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106936011
D39478.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D39478.diff
View Options
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -389,9 +389,12 @@
static void bridge_linkstate(struct ifnet *ifp);
static void bridge_linkcheck(struct bridge_softc *sc);
-/* The default bridge vlan is 1 (IEEE 802.1Q-2003 Table 9-2) */
+/*
+ * Use the "null" value from IEEE 802.1Q-2014 Table 9-2
+ * to indicate untagged frames.
+ */
#define VLANTAGOF(_m) \
- (_m->m_flags & M_VLANTAG) ? EVL_VLANOFTAG(_m->m_pkthdr.ether_vtag) : 1
+ (_m->m_flags & M_VLANTAG) ? EVL_VLANOFTAG(_m->m_pkthdr.ether_vtag) : DOT1Q_VID_NULL
static struct bstp_cb_ops bridge_ops = {
.bcb_state = bridge_state_change,
@@ -1639,8 +1642,13 @@
bridge_ioctl_daddr(struct bridge_softc *sc, void *arg)
{
struct ifbareq *req = arg;
+ int vlan = req->ifba_vlan;
+
+ /* Userspace uses '0' to mean 'any vlan' */
+ if (vlan == 0)
+ vlan = DOT1Q_VID_RSVD_IMPL;
- return (bridge_rtdaddr(sc, req->ifba_dst, req->ifba_vlan));
+ return (bridge_rtdaddr(sc, req->ifba_dst, vlan));
}
static int
@@ -2886,10 +2894,6 @@
dst[3] == 0 && dst[4] == 0 && dst[5] == 0) != 0)
return (EINVAL);
- /* 802.1p frames map to vlan 1 */
- if (vlan == 0)
- vlan = 1;
-
/*
* A route for this destination might already exist. If so,
* update it, otherwise create a new one.
@@ -3100,8 +3104,8 @@
BRIDGE_RT_LOCK(sc);
/*
- * If vlan is zero then we want to delete for all vlans so the lookup
- * may return more than one.
+ * If vlan is DOT1Q_VID_RSVD_IMPL then we want to delete for all vlans
+ * so the lookup may return more than one.
*/
while ((brt = bridge_rtnode_lookup(sc, addr, vlan)) != NULL) {
bridge_rtnode_destroy(sc, brt);
@@ -3232,7 +3236,7 @@
hash = bridge_rthash(sc, addr);
CK_LIST_FOREACH(brt, &sc->sc_rthash[hash], brt_hash) {
dir = bridge_rtnode_addr_cmp(addr, brt->brt_addr);
- if (dir == 0 && (brt->brt_vlan == vlan || vlan == 0))
+ if (dir == 0 && (brt->brt_vlan == vlan || vlan == DOT1Q_VID_RSVD_IMPL))
return (brt);
if (dir > 0)
return (NULL);
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -128,6 +128,11 @@
#define VLAN_PCP_MAX 7
+#define DOT1Q_VID_NULL 0x0
+#define DOT1Q_VID_DEF_PVID 0x1
+#define DOT1Q_VID_DEF_SR_PVID 0x2
+#define DOT1Q_VID_RSVD_IMPL 0xfff
+
/*
* 802.1q full tag. Proto and vid are stored in host byte order.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 5:55 PM (1 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15724432
Default Alt Text
D39478.diff (2 KB)
Attached To
Mode
D39478: bridge: distinguish no vlan and vlan 1
Attached
Detach File
Event Timeline
Log In to Comment