Skip to content

Commit 616450a

Browse files
committed
link vxlan: Add builder functions for label_policy, reserved_bits and mc_route
Signed-off-by: Gris Ge <cnfourt@gmail.com>
1 parent ceb2aff commit 616450a

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/link/vxlan.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,32 @@ impl LinkMessageBuilder<LinkVxlan> {
244244
pub fn udp_csum(self, udp_csum: bool) -> Self {
245245
self.append_info_data(InfoVxlan::UDPCsum(udp_csum))
246246
}
247+
248+
/// Sets the IPv6 flow label policy.
249+
///
250+
/// Kernel enum: `VXLAN_LABEL_FIXED = 0`, `VXLAN_LABEL_INHERIT = 1`.
251+
/// This is equivalent to `ip link add name NAME type vxlan id VNI
252+
/// label_policy POLICY`.
253+
pub fn label_policy(self, policy: u32) -> Self {
254+
self.append_info_data(InfoVxlan::LabelPolicy(policy))
255+
}
256+
257+
/// Tolerated reserved bits in VxLAN header.
258+
///
259+
/// When set to 1 on certain reserved bit, linux kernel will not
260+
/// reject(drop and count as error) the VxLAN packet with that reserved
261+
/// bits set to 1.
262+
/// This is equivalent to `ip link add name NAME type vxlan id VNI
263+
/// reserved_bits VALUE`.
264+
pub fn reserved_bits(self, bits: u64) -> Self {
265+
self.append_info_data(InfoVxlan::ReservedBits(bits))
266+
}
267+
268+
/// Adds the `mc_route` attribute to the VXLAN
269+
/// This is equivalent to `ip link add name NAME type vxlan id VNI
270+
/// [no]mc_route`. \[no\]mc_route - specifies if multicast routing
271+
/// is enabled.
272+
pub fn mc_route(self, mc_route: bool) -> Self {
273+
self.append_info_data(InfoVxlan::McRoute(mc_route))
274+
}
247275
}

0 commit comments

Comments
 (0)