Link-up re-adds an unchanged static IPv4 address, and FreeBSD silently drops the FRR routes using it
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
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- backend, networking
Direzione di ricerca
Start with rc.linkup and interfaces.inc at the linked call sites, then trace how interface_configure() flushes and restores addresses and routes. Check how interface_suspend() preserves static addresses and compare the behavior with FRR routes through the interface. Done means a link-up with an unchanged static IPv4 address leaves routes installed by FRR in the kernel; reproduce with the listed BGP setup and verify using netstat -rn -f inet.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- I have read the contributing guidelines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
- I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue
- AI tools were used to create at least part of the text submitted herewith.
If AI was used, please disclose:
- Model used: Claude Opus 5.5
- Extent of AI involvement: drafted this text from my own logs and source reading; I checked the logs, code references and commands before posting.
Describe the bug
When the LAN link comes back up, rc.linkup start <dev> calls interface_configure(), which deletes the interface's static IPv4 address and adds it back (interfaces_addresses_flush() → legacy_interface_deladdress() → ifconfig <dev> inet <addr> -alias). The address is the same before and after, but deleting it makes FreeBSD remove every route whose next hop uses it (in_difaddr() → in_ifadown()), and those deletions are not reported on the routing socket.
OPNsense's own routes come back, because interface_configure() runs system_routing_configure() afterwards. Routes installed by a routing daemon don't. With os-frr, zebra keeps listing the BGP routes as B>*, the sessions stay up so nothing is announced again, and traffic to those prefixes goes out the default route until FRR is restarted.
For us that was every LoadBalancer address of a Kubernetes cluster that peers with the router over BGP. A switch reboot bounced the LAN link three times within a minute. The rc.linkup runs are serialized behind configd, so the last start for the LAN ran 36 seconds after the link settled, after the BGP sessions had come back, and that flush took the routes out for good.
interface_suspend() already avoids this on link down: its comment says it keeps static addresses because "This helps to retain routes". The attach path flushes them anyway.
- https://github.com/opnsense/core/blob/26.7.10/src/etc/rc.linkup#L66-L69
- https://github.com/opnsense/core/blob/26.7.10/src/etc/inc/interfaces.inc#L2305-L2307
- https://github.com/opnsense/core/blob/26.7.10/src/etc/inc/interfaces.inc#L2212-L2235
- https://github.com/opnsense/core/blob/26.7.10/src/etc/inc/interfaces.lib.inc#L140-L148
- https://github.com/freebsd/freebsd-src/blob/releng/15.1/sys/netinet/in.c#L774-L780 (FreeBSD's own comment there: "This is not quite the right thing to do, but at least if we are running a routing process they will come back.")
- https://github.com/freebsd/freebsd-src/blob/releng/15.1/sys/net/route/route_helpers.c#L199-L212 (the walk runs with
reportset to 0)
No last known working version that I know of.
To Reproduce
Steps to reproduce the behavior:
- Set up os-frr with a BGP neighbor on a LAN with a static IPv4 address (here
192.0.2.1/24onice1) that advertises a few host routes. - Check that they are installed:
vtysh -c 'show ip route bgp'showsB>* 198.51.100.13/32 ... via 192.0.2.55, ice1, andnetstat -rn -f inetlists198.51.100.13 192.0.2.55 UGH1 ice1. - Bounce the LAN link (replug the cable or reboot the switch), or run what devd runs on link-up:
configctl interface linkup start ice1. netstat -rn -f inetno longer has the BGP routes, whilevtysh -c 'show ip route bgp'still shows them asB>*andshow bgp summaryhas every session established.configctl quagga restartbrings them back.
The FreeBSD half reproduces without OPNsense; I've reported it to FRR here: https://github.com/FRRouting/frr/issues/24572.
Expected behavior
A link-up on an interface whose configured static address is already present leaves that address alone, so routes through it survive. If the flush has to stay, routing plugins should get a hook after the re-add, the same way system_routing_configure() does for the gateway and static routes.
Describe alternatives you considered
Restarting FRR whenever zebra's installed routes and the kernel table disagree: a cron job compares vtysh -c 'show ip route json' with netstat -rnW every minute and runs configctl quagga restart when routes are missing twice in a row. It works, but the routes are gone for one to two minutes each time. A user in opnsense/core#7113 reported that commenting out the -alias in legacy_interface_deladdress() avoided the same symptom, but that's not something to run in production.
Relevant log files
System log on the router (the LAN is ice1; the VLANs on the same port go through the same sequence and are left out):
23:32:51 kernel: ice1: link state changed to DOWN
23:32:51 /usr/local/etc/rc.linkup: DEVD: Ethernet detached event for lan(ice1)
23:33:26 kernel: ice1: link state changed to UP
23:33:26 /usr/local/etc/rc.linkup: ROUTING: entering configure using lan
23:33:26 /usr/local/etc/rc.linkup: DEVD: Ethernet attached event for lan(ice1)
23:33:29 kernel: ice1: link state changed to DOWN
23:33:32 kernel: ice1: link state changed to UP
23:33:40 kernel: ice1: link state changed to DOWN
23:33:40 kernel: ice1: link state changed to UP
23:33:48 /usr/local/etc/rc.linkup: DEVD: Ethernet detached event for lan(ice1)
23:33:50 /usr/local/etc/rc.linkup: ROUTING: entering configure using lan
23:33:50 /usr/local/etc/rc.linkup: DEVD: Ethernet attached event for lan(ice1)
23:34:15 /usr/local/etc/rc.linkup: DEVD: Ethernet detached event for lan(ice1)
23:34:16 /usr/local/etc/rc.linkup: ROUTING: entering configure using lan
23:34:16 /usr/local/etc/rc.linkup: DEVD: Ethernet attached event for lan(ice1)
The peers had their sessions back between 23:34:00 and 23:34:15. After 23:34:16 the kernel had none of the BGP routes until the router was rebooted almost an hour later.
Additional context
opnsense/core#7113 asks rc.linkup to coalesce devd events. That would shorten the window here, but a single link-up while BGP is established also runs the flush. opnsense/plugins#5624 (OSPF routes O>* in zebra but missing from the kernel after a reboot) and opnsense/plugins#5897 (static FRR routes missing after a reboot, fixed by restarting FRR) may be the same thing, if an interface address gets re-added after FRR has installed its routes. I haven't confirmed that on those setups.
Environment
OPNsense 26.7.9_3 when it happened, upgraded to 26.7.10 since; the code above is unchanged between the two (amd64)
os-frr 2.1_1, FRR 10.7.1
FreeBSD 15.1-RELEASE-p7
Network Intel® E810 (ice), 10 Gbps LAN with VLANs on the same port
- Lingua principale
- PHP
- Stelle
- 1.2k
- Fork
- 932
- Merge medio
- 1g 11h
- PR unite (30g)
- 22
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opnsense/plugins
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsApertasupport
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
opnsense/plugins#5983 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveForse già presa @fraenki l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
opnsense/plugins#5973 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Forse già presa @bringha1 l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di opnsense/plugins
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#7881 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
iruzen-dono/workless#117 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
magicsunday/webtrees-docker#285 ·
I maintainer di solito rispondono entro 1 giorno
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Apertaarea/tests type/bug when/soon
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookForse già presa @mayankmajeji l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
WordPress/hosting-handbook#521 ·