]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/brvlan: parse_vlanid() accepts zero, hence PVID may be zero
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Nov 2023 10:28:24 +0000 (19:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 12 Nov 2023 18:58:46 +0000 (03:58 +0900)
So, the default value should not be zero.

src/network/networkd-bridge-vlan.c
src/network/networkd-network.c

index bfc404f154dc340b222b62ab6e4ef71e92cdb701..969a7da30b4b4310a7b139564f763d72b7461b1a 100644 (file)
@@ -83,7 +83,7 @@ static int bridge_vlan_append_set_info(Link *link, sd_netlink_message *m) {
 
         for (uint16_t k = 0; k < BRIDGE_VLAN_BITMAP_MAX; k++) {
 
-                if (k > 0 && k == link->network->pvid) {
+                if (k == link->network->pvid) {
                         /* PVID needs to be sent alone. Finish previous bits. */
                         if (begin != UINT16_MAX) {
                                 assert(begin < k);
@@ -189,7 +189,7 @@ void network_adjust_bridge_vlan(Network *network) {
                 return;
 
         /* pvid might not be in br_vid_bitmap yet */
-        if (network->pvid)
+        if (vlanid_is_valid(network->pvid))
                 set_bit(network->pvid, network->br_vid_bitmap);
 }
 
index 72ed2abd95706f2adb4add29248711515ce6091e..e3735842e26e9a3b1d10d7a06fd166ae3ecfaf23 100644 (file)
@@ -450,6 +450,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .priority = LINK_BRIDGE_PORT_PRIORITY_INVALID,
                 .multicast_router = _MULTICAST_ROUTER_INVALID,
 
+                .pvid = UINT16_MAX,
+
                 .lldp_mode = LLDP_MODE_ROUTERS_ONLY,
                 .lldp_multicast_mode = _SD_LLDP_MULTICAST_MODE_INVALID,