Skip to content

Commit 50fbcb3

Browse files
committed
vlan: Add wrapper for setting VLAN protocol and flags
Added these methods for `LinkMessageBuilder<LinkVlan>`: * `LinkMessageBuilder<LinkVlan>::protocol()` * `LinkMessageBuilder<LinkVlan>::flags()` Signed-off-by: Gris Ge <fge@redhat.com>
1 parent 26eda64 commit 50fbcb3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ futures-channel = "0.3.11"
2323
log = "0.4.8"
2424
thiserror = "1"
2525
netlink-sys = { version = "0.8" }
26-
netlink-packet-route = { version = "0.25" }
26+
netlink-packet-route = { version = "0.26" }
2727
netlink-packet-core = { version = "0.8" }
2828
netlink-proto = { default-features = false, version = "0.12.0" }
2929
nix = { version = "0.30.0", default-features = false, features = ["fs", "mount", "sched", "signal"] }

src/link/vlan.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SPDX-License-Identifier: MIT
22

33
use crate::{
4-
packet_route::link::{InfoData, InfoKind, InfoVlan, VlanQosMapping},
4+
packet_route::link::{
5+
InfoData, InfoKind, InfoVlan, VlanFlags, VlanProtocol, VlanQosMapping,
6+
},
57
LinkMessageBuilder,
68
};
79

@@ -80,6 +82,16 @@ impl LinkMessageBuilder<LinkVlan> {
8082
self.append_info_data(InfoVlan::Id(vlan_id))
8183
}
8284

85+
/// VLAN protocol
86+
pub fn protocol(self, protocol: VlanProtocol) -> Self {
87+
self.append_info_data(InfoVlan::Protocol(protocol))
88+
}
89+
90+
/// VLAN flags
91+
pub fn flags(self, flags: VlanFlags, mask: VlanFlags) -> Self {
92+
self.append_info_data(InfoVlan::Flags((flags, mask)))
93+
}
94+
8395
/// ingress QoS and egress QoS
8496
pub fn qos<I, E>(self, ingress_qos: I, egress_qos: E) -> Self
8597
where

0 commit comments

Comments
 (0)