Skip to content

Commit

Permalink
vrrp: add advertisement on shutdown
Browse files Browse the repository at this point in the history
Add an advertisement with priority 0
sent when shutdown event is called.

Signed-off-by: Paul Wekesa <paul1tw1@gmail.com>
  • Loading branch information
Paul-weqe committed Dec 11, 2024
1 parent 7f4e714 commit 321a438
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion holo-vrrp/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,20 @@ impl Instance {
pub(crate) fn shutdown(&mut self, interface: &InterfaceView) {
if self.state.state == fsm::State::Master {
// Send an advertisement with Priority = 0.
// TODO
let src_ip = interface.system.addresses.first().unwrap();
let net = self.net.as_ref().unwrap();

let mut pkt = self.generate_vrrp_packet();
pkt.priority = 0;
pkt.generate_checksum();

let packet = VrrpPacket {
ip: self.generate_ipv4_packet(src_ip.ip()),
vrrp: pkt,
};

let msg = NetTxPacketMsg::Vrrp { packet };
let _ = net.net_tx_packetp.send(msg);
}

// Transition to the Initialize state.
Expand Down

0 comments on commit 321a438

Please sign in to comment.