Skip to content

Commit

Permalink
bridge: Change InfoBridge::VlanFiltering from u8 to bool
Browse files Browse the repository at this point in the history
The kernel code `net/bridge/br_vlan.c` function
`br_vlan_filter_toggle()` indicate the `IFLA_BR_VLAN_FILTERING` is
holding boolean.

Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Feb 5, 2024
1 parent aec3fc6 commit de0f47a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/link/link_info/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub enum InfoBridge {
BridgeId(BridgeId),
RootPort(u16),
VlanDefaultPvid(u16),
VlanFiltering(u8),
VlanFiltering(bool),
TopologyChange(u8),
TopologyChangeDetected(u8),
MulticastRouter(u8),
Expand Down Expand Up @@ -149,8 +149,8 @@ impl Nla for InfoBridge {

Self::GroupAddr(_) => 6,

Self::VlanFiltering(_)
| Self::TopologyChange(_)
Self::VlanFiltering(_) => 1,
Self::TopologyChange(_)
| Self::TopologyChangeDetected(_)
| Self::MulticastRouter(_)
| Self::MulticastSnooping(_)
Expand Down Expand Up @@ -217,8 +217,8 @@ impl Nla for InfoBridge {

Self::GroupAddr(value) => buffer.copy_from_slice(&value[..]),

Self::VlanFiltering(value)
| Self::TopologyChange(value)
Self::VlanFiltering(value) => buffer[0] = (*value).into(),
Self::TopologyChange(value)
| Self::TopologyChangeDetected(value)
| Self::MulticastRouter(value)
| Self::MulticastSnooping(value)
Expand Down Expand Up @@ -435,7 +435,8 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for InfoBridge {
),
IFLA_BR_VLAN_FILTERING => Self::VlanFiltering(
parse_u8(payload)
.context("invalid IFLA_BR_VLAN_FILTERING value")?,
.context("invalid IFLA_BR_VLAN_FILTERING value")?
> 0,
),
IFLA_BR_TOPOLOGY_CHANGE => Self::TopologyChange(
parse_u8(payload)
Expand Down
2 changes: 1 addition & 1 deletion src/link/tests/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fn test_parse_link_bridge_no_extention_mask() {
InfoBridge::AgeingTime(29999),
InfoBridge::StpState(0),
InfoBridge::Priority(32768),
InfoBridge::VlanFiltering(0),
InfoBridge::VlanFiltering(false),
InfoBridge::GroupFwdMask(0),
InfoBridge::BridgeId(BridgeId {
priority: 0x8000,
Expand Down

0 comments on commit de0f47a

Please sign in to comment.