[BIRD 2.0.x] Netlink: ignore dead routes

Ondrej Zajicek santiago at crfreenet.org
Thu Jan 14 04:18:31 CET 2021


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/df83f626973fda1e67769d295c47d4d246e4c1c4


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 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

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at 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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20210114/7d61fb63/attachment.sig>


More information about the Bird-users mailing list