Skip to content

Commit

Permalink
vrrp: remove binding to multicast interface
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Paul-weqe committed Oct 8, 2024
1 parent cd86e38 commit d44da8a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion holo-vrrp/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|| {
Expand Down
37 changes: 20 additions & 17 deletions holo-vrrp/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d44da8a

Please sign in to comment.