Skip to content

Commit de0f47a

Browse files
committed
bridge: Change InfoBridge::VlanFiltering from u8 to bool
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]>
1 parent aec3fc6 commit de0f47a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/link/link_info/bridge.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum InfoBridge {
9494
BridgeId(BridgeId),
9595
RootPort(u16),
9696
VlanDefaultPvid(u16),
97-
VlanFiltering(u8),
97+
VlanFiltering(bool),
9898
TopologyChange(u8),
9999
TopologyChangeDetected(u8),
100100
MulticastRouter(u8),
@@ -149,8 +149,8 @@ impl Nla for InfoBridge {
149149

150150
Self::GroupAddr(_) => 6,
151151

152-
Self::VlanFiltering(_)
153-
| Self::TopologyChange(_)
152+
Self::VlanFiltering(_) => 1,
153+
Self::TopologyChange(_)
154154
| Self::TopologyChangeDetected(_)
155155
| Self::MulticastRouter(_)
156156
| Self::MulticastSnooping(_)
@@ -217,8 +217,8 @@ impl Nla for InfoBridge {
217217

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

220-
Self::VlanFiltering(value)
221-
| Self::TopologyChange(value)
220+
Self::VlanFiltering(value) => buffer[0] = (*value).into(),
221+
Self::TopologyChange(value)
222222
| Self::TopologyChangeDetected(value)
223223
| Self::MulticastRouter(value)
224224
| Self::MulticastSnooping(value)
@@ -435,7 +435,8 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for InfoBridge {
435435
),
436436
IFLA_BR_VLAN_FILTERING => Self::VlanFiltering(
437437
parse_u8(payload)
438-
.context("invalid IFLA_BR_VLAN_FILTERING value")?,
438+
.context("invalid IFLA_BR_VLAN_FILTERING value")?
439+
> 0,
439440
),
440441
IFLA_BR_TOPOLOGY_CHANGE => Self::TopologyChange(
441442
parse_u8(payload)

src/link/tests/bridge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn test_parse_link_bridge_no_extention_mask() {
259259
InfoBridge::AgeingTime(29999),
260260
InfoBridge::StpState(0),
261261
InfoBridge::Priority(32768),
262-
InfoBridge::VlanFiltering(0),
262+
InfoBridge::VlanFiltering(false),
263263
InfoBridge::GroupFwdMask(0),
264264
InfoBridge::BridgeId(BridgeId {
265265
priority: 0x8000,

0 commit comments

Comments
 (0)