Skip to content

Commit

Permalink
Zenoh only considers UP and RUNNING network interfaces (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Oct 26, 2023
1 parent c72fdc7 commit f8af235
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions commons/zenoh-util/src/std_only/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn get_multicast_interfaces() -> Vec<IpAddr> {
pnet_datalink::interfaces()
.iter()
.filter_map(|iface| {
if iface.is_up() && iface.is_multicast() {
if iface.is_up() && iface.is_running() && iface.is_multicast() {
for ipaddr in &iface.ips {
if ipaddr.is_ipv4() {
return Some(ipaddr.ip());
Expand Down Expand Up @@ -266,7 +266,7 @@ pub fn get_unicast_addresses_of_multicast_interfaces() -> Vec<IpAddr> {
{
pnet_datalink::interfaces()
.iter()
.filter(|iface| iface.is_up() && iface.is_multicast())
.filter(|iface| iface.is_up() && iface.is_running() && iface.is_multicast())
.flat_map(|iface| {
iface
.ips
Expand Down Expand Up @@ -295,6 +295,9 @@ pub fn get_unicast_addresses_of_interface(name: &str) -> ZResult<Vec<IpAddr>> {
if !iface.is_up() {
bail!("Interface {name} is not up");
}
if !iface.is_running() {
bail!("Interface {name} is not running");
}
let addrs = iface
.ips
.iter()
Expand Down

0 comments on commit f8af235

Please sign in to comment.