Currently the 8021q module always registers VLAN ID 0 and the Linux bridge always registers VLAN ID 1 if bat0 is added to a bridge (probably as a quirk for hardware network/switch device drivers). Even though we might not actually use them over the mesh. The issue is that any extra VLAN currently increases our own OGM protocol overhead quite a bit, so we want to avoid that by only adding VLANs that we are sure someone will be using. So only add VLAN IDs 0 and 1 through snooping of actual, VLAN tagged traffic, not through kernel internal network events.
Signed-off-by: Linus Lüssing linus.luessing@c0d3.blue --- net/batman-adv/soft-interface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index d08f5e99f39f..7a6287575505 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -699,6 +699,20 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto, if (proto != htons(ETH_P_8021Q)) return -EINVAL;
+ /* + * Currently the 8021q module always registers VLAN ID 0 and the Linux + * bridge always registers VLAN ID 1 if bat0 is added to a bridge + * (probably as a quirk for hardware network/switch device drivers). + * Even though we might not actually use them over the mesh. + * The issue is that any extra VLAN currently increases our own + * OGM protocol overhead quite a bit, so we want to avoid that + * by only adding VLANs that we are sure someone will be using. + * So only add VLAN IDs 0 and 1 through snooping of actual, VLAN tagged + * traffic, not through kernel internal network events. + */ + if (vid == 0 || vid == 1) + return 0; + vid |= BATADV_VLAN_HAS_TAG;
return batadv_softif_create_vlan_own(bat_priv, vid); @@ -727,6 +741,9 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto, if (proto != htons(ETH_P_8021Q)) return -EINVAL;
+ if (vid == 0 || vid == 1) + return 0; + batadv_softif_destroy_vlan_own(bat_priv, vid | BATADV_VLAN_HAS_TAG); return 0; }