BFD listen addresses could use some love

Aperta
#716 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
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Start by tracing BFD peer creation from the mgadm bfd add-peer command through the /bfd/peers API to the UdpSocket::bind() calls. Reproduce the conflict with existing specific listeners and a 0.0.0.0 or :: listener. Done means wildcard and specific listeners are handled without an unexpected 500, or the conflict is reported with a 409 response.

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

Descrizione

bfd Bug mgd rust

When configuring a BFD peer, there is a mandatory listener address field that translates to a UdpSocket::bind() call.
If the listener address is set to an unspecified IP (0.0.0.0 or ::), then the bind succeeds as a wildcard address.

However, because there are multiple listeners being bound (one per neighbor), this leaves the opportunity for a wildcard bind to conflict with a more specific bind and the OS returns EADDRINUSE. This can happen if you already have BFD peers configured with a specific listening address, then you try to configure a BFD peer with a wildcard listening address.
e.g.

root@ox:~# mgadm bfd get-peers
Peer       Listen     Required Rx  Detection Threshold  Mode       Status
fd00:1::2  fd00:1::1  300000       3                    SingleHop  Down
fd00:2::2  fd00:2::1  300000       3                    SingleHop  Down
10.0.1.2   10.0.1.1   300000       3                    SingleHop  Down
root@ox:~# mgadm bfd add-peer 10.0.0.2 0.0.0.0 300000 3 single-hop
Error: Error Response: status: 500 Internal Server Error; headers: {"content-type": "application/json", "x-request-id": "9303429a-f452-4d1a-95b2-280527ec613d", "content-length": "124", "date": "Wed, 22 Apr 2026 00:54:44 GMT"}; value: Error { error_code: Some("Internal"), message: "Internal Server Error", request_id: "9303429a-f452-4d1a-95b2-280527ec613d" }
root@ox:~# grep 500 /tmp/mgd.log
{"msg":"request completed","v":0,"name":"slog-rs","level":30,"time":"2026-04-22T00:54:44.882854638Z","hostname":"ox","pid":1615,"uri":"/bfd/peers","method":"PUT","req_id":"9303429a-f452-4d1a-95b2-280527ec613d","remote_addr":"[::1]:62670","local_addr":"[::]:4676","unit":"api_server","module":"admin","component":"mgd","error_message_external":"Internal Server Error","error_message_internal":"Address already in use (os error 125)","latency_us":470,"response_code":500}

One thought on how to avoid this is by having 1 (or 2, if we want to do it per address-family) wildcard listening socket (per BFD port, so a single-hop socket for port 3784 and a multi-hop socket for port 4784) and routing the control packets to the proper FSM... conceptually similar to how we route inbound TCP connections in BGP.

If we don't intend to address this, then a 409 seems like a much more appropriate return code than 500.

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.