From d44da8aa970f2b64b9386fb6bdcf40adfd69a19b Mon Sep 17 00:00:00 2001 From: Paul Wekesa Date: Tue, 8 Oct 2024 12:07:09 +0300 Subject: [PATCH] vrrp: remove binding to multicast interface Remove the binding of vrrp's tx socket from the multicast binding to fix socket layer and packet formatting issues. Signed-off-by: Paul Wekesa --- holo-vrrp/src/interface.rs | 2 +- holo-vrrp/src/network.rs | 37 ++++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/holo-vrrp/src/interface.rs b/holo-vrrp/src/interface.rs index 0b9d0061..71c889e4 100644 --- a/holo-vrrp/src/interface.rs +++ b/holo-vrrp/src/interface.rs @@ -250,7 +250,7 @@ impl Interface { buf: buf.to_vec(), }; if let Some(net) = &instance.mac_vlan.net { - net.net_tx_packetp.send(msg); + let _ = net.net_tx_packetp.send(msg); } } else { error_span!("send-vrrp").in_scope(|| { diff --git a/holo-vrrp/src/network.rs b/holo-vrrp/src/network.rs index 923cddc9..c36bf799 100644 --- a/holo-vrrp/src/network.rs +++ b/holo-vrrp/src/network.rs @@ -32,25 +32,28 @@ pub fn socket_vrrp_tx( let instance = interface.instances.get(&vrid).unwrap(); let sock = capabilities::raise(|| { - Socket::new(Domain::IPV4, Type::RAW, Some(Protocol::from(112))) + Socket::new(Domain::PACKET, Type::RAW, Some(Protocol::from(112))) })?; + capabilities::raise(|| sock.set_nonblocking(true))?; - if let Some(addr) = instance.mac_vlan.system.addresses.first() { - capabilities::raise(|| { - match sock.set_multicast_if_v4(&addr.ip()) { - Ok(_res) => { - debug_span!("socket-vrrp").in_scope(|| { - debug!("successfully joined multicast interface"); - }); - } - Err(err) => { - debug_span!("socket-vrrp").in_scope(|| { - debug!(%addr, %err, "unable to join multicast interface"); - }); - } - } - }); - } + + // to be uncommented in due time. + //if let Some(addr) = instance.mac_vlan.system.addresses.first() { + // capabilities::raise(|| { + // match sock.set_multicast_if_v4(&addr.ip()) { + // Ok(_res) => { + // debug_span!("socket-vrrp").in_scope(|| { + // debug!("successfully joined multicast interface"); + // }); + // } + // Err(err) => { + // debug_span!("socket-vrrp").in_scope(|| { + // debug!(%addr, %err, "unable to join multicast interface"); + // }); + // } + // } + // }); + //} // Confirm if we should bind to the primary interface's address... // bind it to the primary interface's name