Link-up re-adds an unchanged static IPv4 address, and FreeBSD silently drops the FRR routes using it
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- php
- 領域
- backend, networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- PHP
- スター
- 1.2k
- フォーク
- 932
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 22
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opnsense/plugins のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsオープンsupport
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
opnsense/plugins#5983 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directive対応中かも @fraenki が 6 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opnsense/plugins#5973 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)対応中かも @bringha1 が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
opnsense/plugins の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/blocks-engine#7881 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
magicsunday/webtrees-docker#285 ·
メンテナーはふだん 1 日以内に返信
-
area/tests type/bug when/soon
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbook対応中かも @mayankmajeji が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
WordPress/hosting-handbook#521 ·