Link-up re-adds an unchanged static IPv4 address, and FreeBSD silently drops the FRR routes using it
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 1.2k
- Fork
- 932
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opnsense/plugins
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsĐang mởsupport
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
opnsense/plugins#5983 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveCó thể đã có người làm @fraenki đã nhận 6 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opnsense/plugins#5973 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Có thể đã có người làm @bringha1 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opnsense/plugins
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/blocks-engine#7881 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
iruzen-dono/workless#117 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
magicsunday/webtrees-docker#285 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Đang mởarea/tests type/bug when/soon
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookCó thể đã có người làm @mayankmajeji đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
WordPress/hosting-handbook#521 ·