Skip to content

Commit d304815

Browse files
committed
vrrp: ignore advertisements received in the Initialize state
An advertisement can reach the event handler while the VRRP router is in the Initialize state: the receive task may enqueue a packet just before the instance is shut down and transitioned back to Initialize. The handler matched the Initialize state with unreachable!(), so this race panicked the process. Handle the Initialize state by ignoring the advertisement. Signed-off-by: Gus Bourg <gus@bourg.net>
1 parent c52e1aa commit d304815

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

holo-vrrp/src/events.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@ pub(crate) fn process_vrrp_packet(
9595

9696
// RFC 3768: Section 6.4.2 ("If an ADVERTISEMENT is received")
9797
match instance.state.state {
98-
fsm::State::Initialize => {
99-
unreachable!()
100-
}
98+
// An advertisement can still be delivered while the router is in the
99+
// Initialize state: the receive task may have enqueued the packet just
100+
// before the instance was shut down and transitioned back to
101+
// Initialize. Ignore it rather than treating it as unreachable, which
102+
// would panic the process.
103+
fsm::State::Initialize => {}
101104
fsm::State::Backup => {
102105
if packet.priority == 0 {
103106
let duration =

0 commit comments

Comments
 (0)