Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/route/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use netlink_packet_route::route::{
use netlink_packet_route::{
route::{
RouteAddress, RouteAttribute, RouteFlags, RouteHeader, RouteMessage,
RouteNextHop, RouteNextHopFlags, RouteProtocol, RouteScope, RouteType,
RouteVia,
RouteMetric, RouteNextHop, RouteNextHopFlags, RouteProtocol,
RouteScope, RouteType, RouteVia,
},
AddressFamily,
};
Expand Down Expand Up @@ -103,6 +103,14 @@ impl<T> RouteMessageBuilder<T> {
self
}

/// Sets the route mtu (metric)
pub fn mtu(mut self, mtu: u32) -> Self {
self.message
.attributes
.push(RouteAttribute::Metrics(vec![RouteMetric::Mtu(mtu)]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This override future changes to other RouteMetric (e.g. cwnd).

Please create similar stuff like RouteNextHopBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't quite understand the solution you are suggestion. Should I create something like a RouteMetricsBuilder inspired by RouteNextHopBuilder?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. RouteMetricsBuilder is required. Otherwise, it is impossible to configure both cwnd and mtu.

self
}

/// Sets the route table ID.
///
/// Default is main route table.
Expand Down