Hi all, I'll pop up this old discussion. I've found a bug with bird handling its routes when ignore_routes_with_linkdown is enabled. And I suspect it is related to this patch. The problem is that bird does not replace or delete the routes it installed when they are marked as dead. For example if we stop it with "graceful restart", the routes are left in the table and after we start bird again with updated config, this old route remains in the table. I can reproduce it with bird compiled from master branch now. Now, that I have found this thread, I suppose, that this changes blind bird for all such routes during the scan. As a result bird also ignores its own routes (proto bird), which causes problems. I think there should be an exception for the routes that are installed by bird itself. They should not be exported to the other protocols anyway, I suppose. So the original question of this thread should not be affected. Steps to reproduce follows. Output from 2 consoles is mixed here. bird{1,2}.conf are attached, the second one has static routes commented out. Prepare: # ip netns add a # ip netns exec a bash # ip link set lo up # ip link add type veth # sysctl -w net.ipv4.conf.veth0.ignore_routes_with_linkdown=1 # ip link set veth0 up # ip addr add 10.0.0.1/24 dev veth0 Test: # ip ro 10.0.0.0/24 dev veth0 proto kernel scope link src 10.0.0.1 dead linkdown # bird -d -l -c bird1.conf bird: Chosen router ID 10.0.0.1 according to interface veth0 bird: Started # ip ro 10.0.0.0/24 dev veth0 proto kernel scope link src 10.0.0.1 dead linkdown 192.168.1.0/24 via 10.0.0.2 dev veth0 proto bird metric 32 dead linkdown 192.168.2.0/24 dev lo proto bird scope link metric 32 # birdc -l graceful restart BIRD 2.0.8 ready. Graceful restart requested bird: Shutting down for graceful restart bird: Shutdown completed # ip ro 10.0.0.0/24 dev veth0 proto kernel scope link src 10.0.0.1 dead linkdown 192.168.1.0/24 via 10.0.0.2 dev veth0 proto bird metric 32 dead linkdown 192.168.2.0/24 dev lo proto bird scope link metric 32 # bird -d -l -c bird2.conf -R bird: Chosen router ID 10.0.0.1 according to interface veth0 bird: Graceful restart started bird: Graceful restart done bird: Started # ip ro 10.0.0.0/24 dev veth0 proto kernel scope link src 10.0.0.1 dead linkdown 192.168.1.0/24 via 10.0.0.2 dev veth0 proto bird metric 32 dead linkdown <---- tihs route should have been deleted On Thu, Jan 14, 2021 at 4:22 AM Ondrej Zajicek <santiago@crfreenet.org> wrote:
On Thu, Oct 22, 2020 at 04:16:36PM +0200, Vincent Bernat wrote:
With net.ipv4.conf.XXX.ignore_routes_with_linkdown sysctl, a user can ensure the kernel does not use a route whose target interface is down. The route is marked with a "dead"/RTNH_F_DEAD flag. Currently, BIRD still uses and distributes this route. This patch just ignores such a route.
Hi
(Noticed while looking for some missed / forgotten e-mails)
Thanks, merged with some changes (handling of direct and multipath routes):
https://gitlab.nic.cz/labs/bird/-/commit/df83f626973fda1e67769d295c47d4d246e...
Although it would make sense to handle dead routes as withdraws instead of just ingore them (for async notification), it does not matter for sync scan, and as i noticed during testing, Linux kernel does not send async notifications (when the flag changes to dead) anyways, so it does not really matter.
This patch could be backported to 1.6.x.
Signed-off-by: Vincent Bernat <vincent@bernat.ch> --- sysdep/linux/netlink.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index f85bcf35685b..c28126510e6e 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -1690,6 +1690,9 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h) if (i->rtm_flags & RTNH_F_ONLINK) ra->nh.flags |= RNF_ONLINK;
+ if (i->rtm_flags & RTNH_F_DEAD) + return; + neighbor *nbr; nbr = neigh_find(&p->p, ra->nh.gw, ra->nh.iface, (ra->nh.flags & RNF_ONLINK) ? NEF_ONLINK : 0); -- 2.28.0
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."