network/brvlan: parse_vlanid() accepts zero, hence PVID may be zero

So, the default value should not be zero.
This commit is contained in:
Yu Watanabe 2023-11-11 19:28:24 +09:00
parent 26ba67e5ec
commit 0b8d501c27
2 changed files with 4 additions and 2 deletions

View 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);
}

View 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,