]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
batman-adv: Map VID 0 to untagged TT VLAN
authorSven Eckelmann <sven@narfation.org>
Mon, 16 Dec 2024 18:37:12 +0000 (19:37 +0100)
committerSimon Wunderlich <sw@simonwunderlich.de>
Tue, 17 Dec 2024 06:35:05 +0000 (07:35 +0100)
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 ad1afb003939 ("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 <sven@narfation.org>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/main.c
net/batman-adv/soft-interface.c

index 8e0f44c71696f642d80304ec2724e8b5e56a5d93..333e947afcce7ca4128be8406f23295df723515c 100644 (file)
@@ -637,6 +637,13 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
 
        vhdr = (struct vlan_ethhdr *)(skb->data + header_len);
        vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
+
+       /* VID 0 is only used to indicate "priority tag" frames which only
+        * contain priority information and no VID.
+        */
+       if (vid == 0)
+               return BATADV_NO_FLAGS;
+
        vid |= BATADV_VLAN_HAS_TAG;
 
        return vid;
index 5666c268cead28c54a406a30d5e610a2f4654a01..822d788a5f86bb8f034d0bdedebf18ec5f044ade 100644 (file)
@@ -637,6 +637,14 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto,
        if (proto != htons(ETH_P_8021Q))
                return -EINVAL;
 
+       /* VID 0 is only used to indicate "priority tag" frames which only
+        * contain priority information and no VID. No management structures
+        * should be created for this VID and it should be handled like an
+        * untagged frame.
+        */
+       if (vid == 0)
+               return 0;
+
        vid |= BATADV_VLAN_HAS_TAG;
 
        /* 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,
        if (proto != htons(ETH_P_8021Q))
                return -EINVAL;
 
+       /* "priority tag" frames are handled like "untagged" frames
+        * and no softif_vlan needs to be destroyed
+        */
+       if (vid == 0)
+               return 0;
+
        vlan = batadv_softif_vlan_get(bat_priv, vid | BATADV_VLAN_HAS_TAG);
        if (!vlan)
                return -ENOENT;