diff --git a/README.md b/README.md index 7bde208d7..9efe11dbd 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ Note that the REST plugin is added to the configuration by the default value of **[REST plugin](https://zenoh.io/docs/manual/plugin-http/)** (exposing a REST API): This plugin converts GET and PUT REST requests into Zenoh gets and puts respectively. -**[Storages plugin](https://zenoh.io/docs/manual/plugin-storages/)** (managing [backends and storages](https://zenoh.io/docs/manual/backends/)) +**[Storages plugin](https://zenoh.io/docs/manual/plugin-storage-manager/)** (managing [backends and storages](https://zenoh.io/docs/manual/plugin-storage-manager/#backends-and-volumes)) This plugin allows you to easily define storages. These will store key-value pairs they subscribed to, and send the most recent ones when queried. Check out [DEFAULT_CONFIG.json5](DEFAULT_CONFIG.json5) for info on how to configure them. ------------------------------- diff --git a/commons/zenoh-util/src/std_only/net/mod.rs b/commons/zenoh-util/src/std_only/net/mod.rs index d8b2c3acc..9d221eefa 100644 --- a/commons/zenoh-util/src/std_only/net/mod.rs +++ b/commons/zenoh-util/src/std_only/net/mod.rs @@ -183,7 +183,7 @@ pub fn get_multicast_interfaces() -> Vec { 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()); @@ -266,7 +266,7 @@ pub fn get_unicast_addresses_of_multicast_interfaces() -> Vec { { 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 @@ -295,6 +295,9 @@ pub fn get_unicast_addresses_of_interface(name: &str) -> ZResult> { 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() diff --git a/io/zenoh-transport/src/unicast/establishment/accept.rs b/io/zenoh-transport/src/unicast/establishment/accept.rs index c25c4bb87..412affd4e 100644 --- a/io/zenoh-transport/src/unicast/establishment/accept.rs +++ b/io/zenoh-transport/src/unicast/establishment/accept.rs @@ -658,10 +658,11 @@ pub(crate) async fn accept_link(link: &LinkUnicast, manager: &TransportManager) .map_err(|e| (e, Some(close::reason::INVALID)))); log::debug!( - "New transport link accepted from {} to {}: {}", + "New transport link accepted from {} to {}: {}. Batch size: {}.", osyn_out.other_zid, manager.config.zid, - link + link, + state.zenoh.batch_size, ); Ok(()) diff --git a/io/zenoh-transport/src/unicast/establishment/open.rs b/io/zenoh-transport/src/unicast/establishment/open.rs index 19f94cf26..dbd4872c3 100644 --- a/io/zenoh-transport/src/unicast/establishment/open.rs +++ b/io/zenoh-transport/src/unicast/establishment/open.rs @@ -573,10 +573,11 @@ pub(crate) async fn open_link( } log::debug!( - "New transport link opened from {} to {}: {}", + "New transport link opened from {} to {}: {}. Batch size: {}.", manager.config.zid, iack_out.other_zid, - link + link, + state.zenoh.batch_size, ); Ok(transport) diff --git a/io/zenoh-transport/src/unicast/lowlatency/link.rs b/io/zenoh-transport/src/unicast/lowlatency/link.rs index f9f949bf9..111936cb9 100644 --- a/io/zenoh-transport/src/unicast/lowlatency/link.rs +++ b/io/zenoh-transport/src/unicast/lowlatency/link.rs @@ -212,8 +212,11 @@ async fn rx_task_stream( let mut length = [0_u8, 0_u8, 0_u8, 0_u8]; link.read_exact(&mut length).await?; let n = u32::from_le_bytes(length) as usize; - - link.read_exact(&mut buffer[0..n]).await?; + let len = buffer.len(); + let b = buffer.get_mut(0..n).ok_or_else(|| { + zerror!("Batch len is invalid. Received {n} but negotiated max len is {len}.") + })?; + link.read_exact(b).await?; Ok(n) } diff --git a/io/zenoh-transport/src/unicast/universal/link.rs b/io/zenoh-transport/src/unicast/universal/link.rs index 8facc9b7b..c4d19d2b6 100644 --- a/io/zenoh-transport/src/unicast/universal/link.rs +++ b/io/zenoh-transport/src/unicast/universal/link.rs @@ -294,7 +294,11 @@ async fn rx_task_stream( let mut length = [0_u8, 0_u8]; link.read_exact(&mut length).await?; let n = BatchSize::from_le_bytes(length) as usize; - link.read_exact(&mut buffer[0..n]).await?; + let len = buffer.len(); + let b = buffer.get_mut(0..n).ok_or_else(|| { + zerror!("Batch len is invalid. Received {n} but negotiated max len is {len}.") + })?; + link.read_exact(b).await?; Ok(Action::Read(n)) }