summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-08-24 18:21:53 (GMT)
committerThomas Haller <thaller@redhat.com>2022-08-24 18:29:08 (GMT)
commit984d6e938b8fa8e120b38fe3d31893f20de996d7 (patch)
tree39fc90c3d3b0b0db1bb0a9501db58482ec46f00b /lib
parent3662a5da0cb08d01404e44b79bc39caebab0802d (diff)
downloadlibnl-984d6e938b8fa8e120b38fe3d31893f20de996d7.zip
libnl-984d6e938b8fa8e120b38fe3d31893f20de996d7.tar.gz
libnl-984d6e938b8fa8e120b38fe3d31893f20de996d7.tar.bz2
bridge: don't normalize the u8 argument in rtnl_link_bridge_set_vlan_filtering() to boolean
In bridge-info, we have two u8 attributes (vlan-filtering and stats-enabled). In both cases, kernel only expects there a boolean value (either zero or one). In case of vlan-filtering, I think kernel actually doesn't care, and would treat any non-zero value as true. In case of stats-enabled, kernel would reject values outside the values zero or one. Previously, libnl3 would normalize the boolean value for vlan-filtering, but not for stats-enabled. That is at least inconsistent, in particular considering that kernel requires a normalized value for stats-enabled, but not for vlan-filtering. Our public API has uint8_t parameters (and not bool). That makes sense, as it follows the netlink API. It's not clear how to handle these boolean u8 attributes best. Should the API be bool or uint8_t? Should we normalize the boolean values? In any case, do something consistently. For no particular reason, choose to not add additional logic. The user can set any value, whether that value makes sense, it's up to them.
Diffstat (limited to 'lib')
-rw-r--r--lib/route/link/bridge_info.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/route/link/bridge_info.c b/lib/route/link/bridge_info.c
index de08710..33de448 100644
--- a/lib/route/link/bridge_info.c
+++ b/lib/route/link/bridge_info.c
@@ -157,7 +157,7 @@ void rtnl_link_bridge_set_vlan_filtering(struct rtnl_link *link,
IS_BRIDGE_INFO_ASSERT(link);
- bi->b_vlan_filtering = !!vlan_filtering;
+ bi->b_vlan_filtering = vlan_filtering;
bi->ce_mask |= BRIDGE_ATTR_VLAN_FILTERING;
}