bridge: make hotplug-added vlans default to tagged
authorFelix Fietkau <nbd@nbd.name>
Fri, 23 Jun 2023 09:48:20 +0000 (11:48 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 23 Jun 2023 09:48:24 +0000 (11:48 +0200)
This simplifies adding extra vlans and ranges

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

index 0338f14905cb97e8aa9a7ecab1c4c96aaa6969ff..fb1f196ad3c892ddb7d22b80396017b417ca2895 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -801,7 +801,7 @@ bridge_hotplug_set_member_vlans(struct bridge_state *bst, struct blob_attr *vlan
 
        blobmsg_for_each_attr(cur, vlans, rem) {
                struct bridge_vlan_hotplug_port *port;
-               uint16_t flags = BRVLAN_F_UNTAGGED;
+               uint16_t flags = 0;
                char *name_buf;
                unsigned int vid;
                char *end;
@@ -828,8 +828,8 @@ bridge_hotplug_set_member_vlans(struct bridge_state *bst, struct blob_attr *vlan
 
                        for (end++; *end; end++) {
                                switch (*end) {
-                               case 't':
-                                       flags &= ~BRVLAN_F_UNTAGGED;
+                               case 'u':
+                                       flags |= BRVLAN_F_UNTAGGED;
                                        break;
                                case '*':
                                        flags |= BRVLAN_F_PVID;
diff --git a/vlan.c b/vlan.c
index 0d53c312e55946c79fea48c0e8814c2fa8fbd6a0..4e843442af07b5063d7d9146ffb6bab316becd65 100644 (file)
--- a/vlan.c
+++ b/vlan.c
@@ -51,7 +51,7 @@ __vlan_hotplug_op(struct device *dev, struct device *member, struct blob_attr *v
 
        blob_buf_init(&b, 0);
        a = blobmsg_open_array(&b, "vlans");
-       blobmsg_printf(&b, NULL, "%d", vldev->id);
+       blobmsg_printf(&b, NULL, "%d:u", vldev->id);
        if (vlan && blobmsg_len(vlan))
                blob_put_raw(&b, blobmsg_data(vlan), blobmsg_len(vlan));
        blobmsg_close_array(&b, a);
index bf527bb4ff3bf0bd955e9b935058ba88a4673314..43efc17319dfc5c4d8ea00d73fff25eba9ff9de2 100644 (file)
--- a/vlandev.c
+++ b/vlandev.c
@@ -72,7 +72,7 @@ __vlandev_hotplug_op(struct device *dev, struct device *member, struct blob_attr
 
        blob_buf_init(&b, 0);
        a = blobmsg_open_array(&b, "vlans");
-       blobmsg_printf(&b, NULL, "%d", mvdev->config.vid);
+       blobmsg_printf(&b, NULL, "%d:u", mvdev->config.vid);
        if (vlan && blobmsg_len(vlan))
                blob_put_raw(&b, blobmsg_data(vlan), blobmsg_len(vlan));
        blobmsg_close_array(&b, a);