bridge: add support for configuring extra vlans for the bridge itself
authorFelix Fietkau <nbd@nbd.name>
Tue, 27 Jun 2023 08:48:26 +0000 (10:48 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 27 Jun 2023 08:48:28 +0000 (10:48 +0200)
Can be configured in the same way as extra bridge member vlans

Signed-off-by: Felix Fietkau <nbd@nbd.name>
bridge.c

index 2e9cca3bcd84c495de8e48e82043bfb5ead8c24e..b4dddb8e11487514c45f25b68c64b76aa19b82c4 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -351,13 +351,14 @@ static void bridge_stp_notify(struct bridge_state *bst)
 static int
 bridge_enable_interface(struct bridge_state *bst)
 {
-       int ret;
+       struct device *dev = &bst->dev;
+       int i, ret;
 
        if (bst->active)
                return 0;
 
        bridge_stp_notify(bst);
-       ret = system_bridge_addbr(&bst->dev, &bst->config);
+       ret = system_bridge_addbr(dev, &bst->config);
        if (ret < 0)
                return ret;
 
@@ -368,6 +369,10 @@ bridge_enable_interface(struct bridge_state *bst)
                bridge_set_local_vlans(bst, true);
        }
 
+       for (i = 0; i < dev->n_extra_vlan; i++)
+               system_bridge_vlan(dev->ifname, dev->extra_vlan[i].start,
+                                  dev->extra_vlan[i].end, true, BRVLAN_F_SELF);
+
        bst->active = true;
        return 0;
 }