Skip to content

Commit bf2a5a6

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Map VID 0 to untagged TT VLAN
VID 0 is not a valid VLAN according to "802.1Q-2011" "Table 9-2—Reserved VID values". It is only used to indicate "priority tag" frames which only contain priority information and no VID. The 8021q is also redirecting the priority tagged frames to the underlying interface since commit ad1afb0 ("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)"). But at the same time, it automatically adds the VID 0 to all devices to ensure that VID 0 is in the allowed list of the HW filter. This resulted in a VLAN 0 which was always announced in OGM messages. batman-adv should therefore not create a new batadv_softif_vlan for VID 0 and handle all VID 0 related frames using the "untagged" global/local translation tables. Signed-off-by: Sven Eckelmann <[email protected]> Acked-by: Antonio Quartulli <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent fca81aa commit bf2a5a6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

net/batman-adv/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,13 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
637637

638638
vhdr = (struct vlan_ethhdr *)(skb->data + header_len);
639639
vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
640+
641+
/* VID 0 is only used to indicate "priority tag" frames which only
642+
* contain priority information and no VID.
643+
*/
644+
if (vid == 0)
645+
return BATADV_NO_FLAGS;
646+
640647
vid |= BATADV_VLAN_HAS_TAG;
641648

642649
return vid;

net/batman-adv/soft-interface.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,14 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto,
637637
if (proto != htons(ETH_P_8021Q))
638638
return -EINVAL;
639639

640+
/* VID 0 is only used to indicate "priority tag" frames which only
641+
* contain priority information and no VID. No management structures
642+
* should be created for this VID and it should be handled like an
643+
* untagged frame.
644+
*/
645+
if (vid == 0)
646+
return 0;
647+
640648
vid |= BATADV_VLAN_HAS_TAG;
641649

642650
/* if a new vlan is getting created and it already exists, it means that
@@ -684,6 +692,12 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto,
684692
if (proto != htons(ETH_P_8021Q))
685693
return -EINVAL;
686694

695+
/* "priority tag" frames are handled like "untagged" frames
696+
* and no softif_vlan needs to be destroyed
697+
*/
698+
if (vid == 0)
699+
return 0;
700+
687701
vlan = batadv_softif_vlan_get(bat_priv, vid | BATADV_VLAN_HAS_TAG);
688702
if (!vlan)
689703
return -ENOENT;

0 commit comments

Comments
 (0)