BFD doesn't account for FSM state when reacting to peer's Demand mode

Aperta
#861 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Inizia dalla macchina a stati BFD e dal test esistente demand_mode_suppresses_unsolicited_sends, quindi consulta le sezioni 6.6, 6.8, 6.8.6 e 6.8.7 di RFC 5880. Il lavoro è completo quando lo stato della sessione remota viene monitorato, Demand mode viene rispettato solo per una sessione Up/Up, gli invii periodici riprendono quando si esce da Up e i casi Down, Init e Up elencati sono coperti dai test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bfd Bug mgd needs testing rust

The following is an issue identified by AI when I asked it to do an adversarial code review of #795. This was pre-existing in the sync/pthread impl, which is why it was not addressed as part of the async swap-out.

Problem

The BFD state machine currently treats the last received Demand bit as
sufficient to suppress unsolicited control packets.

RFC 5880 defines remote Demand mode as active only when all of the
following are true:

  • the remote D bit is set;
  • the local session state is Up;
  • the last reported remote session state is Up.

The implementation does not retain the remote session state needed to
apply this rule. As a result, a packet carrying D can suppress periodic
transmission while the session is Down or Init.

Failure scenario

  1. The local session starts in Down.
  2. It receives a packet with State=Down and D=1.
  3. The local state transitions to Init.
  4. Periodic transmission is suppressed because the remote D bit is set.
  5. The peer may never observe the local Init state, preventing the
    handshake from converging.

A stale D bit can similarly prevent periodic Down packets from being sent
while recovering from a failed Up session.

Impact

A premature, stale, or non-conforming Demand bit can deadlock session
establishment or recovery.

Proposed direction

Track RemoteSessionState as required by RFC 5880.

Remote Demand mode should be active only when:

remote_demand_mode && local_state == Up && remote_state == Up

When any condition stops being true, periodic control transmission must
resume immediately.

The local D bit must likewise not be transmitted unless local Demand mode
is configured and both sides are perceived Up.

Testing

Cover at least:

  • Down+D while local Down;
  • Init+D while local Down or Init;
  • Up+D while local is not Up;
  • Up/Up+D suppresses periodic transmission;
  • leaving Up resumes periodic transmission even if the last received D
    bit remains set.

The existing demand_mode_suppresses_unsolicited_sends test should be
updated because it currently asserts the overbroad behavior.

References

  • RFC 5880 §6.6
  • RFC 5880 §6.8
  • RFC 5880 §6.8.6
  • RFC 5880 §6.8.7
Lingua principale
Rust
Stelle
100
Fork
8
Merge medio
2g 1h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di oxidecomputer/maghemite

Tutte le issue di oxidecomputer/maghemite

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.