[BIRD 2.0.x] Netlink: ignore dead routes

Vincent Bernat vincent at bernat.ch
Thu Oct 22 16:16:36 CEST 2020


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.

This patch could be backported to 1.6.x.

Signed-off-by: Vincent Bernat <vincent at 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



More information about the Bird-users mailing list