Skip to content

Commit

Permalink
utils, interface: introduce flag to identify broadcast-capable interf…
Browse files Browse the repository at this point in the history
…aces

This is useful for protocols like IS-IS, which handle network I/O
differently for broadcast vs. point-to-point interfaces.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
  • Loading branch information
rwestphal committed Sep 10, 2024
1 parent 30e721f commit 222d545
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions holo-interface/src/netlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use holo_utils::southbound::InterfaceFlags;
use ipnetwork::IpNetwork;
use netlink_packet_core::{NetlinkMessage, NetlinkPayload};
use netlink_packet_route::constants::{
AF_INET, AF_INET6, ARPHRD_LOOPBACK, IFF_RUNNING, RTNLGRP_IPV4_IFADDR,
RTNLGRP_IPV6_IFADDR, RTNLGRP_LINK,
AF_INET, AF_INET6, ARPHRD_LOOPBACK, IFF_BROADCAST, IFF_RUNNING,
RTNLGRP_IPV4_IFADDR, RTNLGRP_IPV6_IFADDR, RTNLGRP_LINK,
};
use netlink_packet_route::rtnl::RtnlMessage;
use netlink_packet_route::{AddressMessage, LinkMessage};
Expand Down Expand Up @@ -50,6 +50,9 @@ async fn process_newlink_msg(
if msg.header.flags & IFF_RUNNING != 0 {
flags.insert(InterfaceFlags::OPERATIVE);
}
if msg.header.flags & IFF_BROADCAST != 0 {
flags.insert(InterfaceFlags::BROADCAST);
}
for nla in msg.nlas.into_iter() {
match nla {
Nla::IfName(nla_ifname) => ifname = Some(nla_ifname),
Expand Down
1 change: 1 addition & 0 deletions holo-utils/src/southbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bitflags! {
pub struct InterfaceFlags: u8 {
const LOOPBACK = 0x01;
const OPERATIVE = 0x02;
const BROADCAST = 0x04;
}
}

Expand Down

0 comments on commit 222d545

Please sign in to comment.