Skip to content

Commit 30aa30f

Browse files
rwestphalcathay4t
authored andcommitted
route: Implement support for the ONLINK flag
Signed-off-by: Renato Westphal <[email protected]>
1 parent 2423645 commit 30aa30f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/route/builder.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use std::{
77

88
use netlink_packet_route::{
99
route::{
10-
RouteAddress, RouteAttribute, RouteHeader, RouteMessage, RouteProtocol,
11-
RouteScope, RouteType,
10+
RouteAddress, RouteAttribute, RouteFlags, RouteHeader, RouteMessage,
11+
RouteProtocol, RouteScope, RouteType,
1212
},
1313
AddressFamily,
1414
};
@@ -96,6 +96,15 @@ impl<T> RouteMessageBuilder<T> {
9696
self
9797
}
9898

99+
/// Marks the next hop as directly reachable (on-link).
100+
///
101+
/// Indicates that the next hop is reachable without passing through a
102+
/// connected subnet.
103+
pub fn onlink(mut self) -> Self {
104+
self.message.header.flags.insert(RouteFlags::Onlink);
105+
self
106+
}
107+
99108
/// Return a mutable reference to the request message.
100109
pub fn get_mut(&mut self) -> &mut RouteMessage {
101110
&mut self.message

0 commit comments

Comments
 (0)