diff --git a/holo-interface/src/ibus.rs b/holo-interface/src/ibus.rs index 99cae8bc..7f9f5be1 100644 --- a/holo-interface/src/ibus.rs +++ b/holo-interface/src/ibus.rs @@ -108,17 +108,12 @@ pub(crate) fn notify_router_id_update( } pub(crate) fn notify_interface_update(ibus_tx: &IbusSender, iface: &Interface) { - let mut ip_addresses: Vec = vec![]; - iface.addresses.iter().for_each(|(net, _addr)| { - ip_addresses.push(*net); - }); let msg = IbusMsg::InterfaceUpd(InterfaceUpdateMsg { ifname: iface.name.clone(), ifindex: iface.ifindex.unwrap_or(0), mtu: iface.mtu.unwrap_or(0), flags: iface.flags, mac_address: iface.mac_address, - addresses: ip_addresses, }); notify(ibus_tx, msg); } diff --git a/holo-utils/src/southbound.rs b/holo-utils/src/southbound.rs index ed52028f..6f21a00d 100644 --- a/holo-utils/src/southbound.rs +++ b/holo-utils/src/southbound.rs @@ -74,9 +74,6 @@ pub struct InterfaceUpdateMsg { #[serde(skip)] pub mac_address: [u8; 6], - - #[serde(skip)] - pub addresses: Vec, } #[derive(Clone, Debug)] diff --git a/holo-vrrp/src/network.rs b/holo-vrrp/src/network.rs index d6ce2b21..a56dddbc 100644 --- a/holo-vrrp/src/network.rs +++ b/holo-vrrp/src/network.rs @@ -21,6 +21,8 @@ use crate::packet::{ArpPacket, EthernetHdr, Ipv4Packet, VrrpHdr, VrrpPacket}; use crate::tasks::messages::input::VrrpNetRxPacketMsg; use crate::tasks::messages::output::NetTxPacketMsg; +pub const MAX_VRRP_HDR_LENGTH: usize = 96; + pub fn socket_vrrp_tx( interface: &Interface, vrid: u8, @@ -244,7 +246,7 @@ pub(crate) async fn vrrp_read_loop( socket_vrrp: Arc>, vrrp_net_packet_rxp: Sender, ) -> Result<(), SendError> { - let mut buf = [0u8; 96]; + let mut buf = [0u8; MAX_VRRP_HDR_LENGTH]; loop { match socket_vrrp .async_io(tokio::io::Interest::READABLE, |sock| { diff --git a/holo-vrrp/src/southbound/rx.rs b/holo-vrrp/src/southbound/rx.rs index 3ef50da9..c56c411d 100644 --- a/holo-vrrp/src/southbound/rx.rs +++ b/holo-vrrp/src/southbound/rx.rs @@ -4,10 +4,8 @@ // SPDX-License-Identifier: MIT // -use std::collections::BTreeSet; - use holo_utils::southbound::{AddressMsg, InterfaceUpdateMsg}; -use ipnetwork::{IpNetwork, Ipv4Network}; +use ipnetwork::IpNetwork; use crate::interface::Interface; @@ -23,14 +21,6 @@ pub(crate) fn process_iface_update( iface.system.ifindex = Some(msg.ifindex); iface.system.mac_address = msg.mac_address; - let mut ips: BTreeSet = BTreeSet::default(); - msg.addresses.iter().for_each(|addr| { - if let IpNetwork::V4(v4addr) = addr { - ips.insert(*v4addr); - } - }); - iface.system.addresses = ips; - // update names for all macvlans for (vrid, instance) in iface.instances.iter_mut() { instance.mac_vlan.name = format!("mvlan-vrrp-{}", vrid); @@ -50,14 +40,6 @@ pub(crate) fn process_iface_update( mvlan_iface.system.ifindex = Some(msg.ifindex); mvlan_iface.system.mac_address = msg.mac_address; - let mut ips: BTreeSet = BTreeSet::default(); - msg.addresses.iter().for_each(|addr| { - if let IpNetwork::V4(v4addr) = addr { - ips.insert(*v4addr); - } - }); - - mvlan_iface.system.addresses = ips; target_vrid = Some(*vrid); break 'outer; diff --git a/holo-vrrp/src/southbound/tx.rs b/holo-vrrp/src/southbound/tx.rs index f4a52dd1..3473bd49 100644 --- a/holo-vrrp/src/southbound/tx.rs +++ b/holo-vrrp/src/southbound/tx.rs @@ -4,11 +4,9 @@ // SPDX-License-Identifier: MIT // -use holo_utils::{ - ibus::{IbusMsg, IbusSender}, - southbound::{ - InterfaceIpAddRequestMsg, InterfaceIpDeleteRequestMsg, MacvlanCreateMsg, - }, +use holo_utils::ibus::{IbusMsg, IbusSender}; +use holo_utils::southbound::{ + InterfaceIpAddRequestMsg, InterfaceIpDeleteRequestMsg, MacvlanCreateMsg, }; use ipnetwork::IpNetwork;