0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Netlink: Parse onlink flag even on direct routes

While onlink flag is meaningful only with explicit next hops, it can be
defined also on direct routes. Parse it also in this case to avoid
periodic updates of the same route.

Thanks to Marcin Saklak for the bugreport.
This commit is contained in:
Ondrej Zajicek 2022-10-12 17:57:26 +02:00
parent 8f79e6b93e
commit 3242529750

View File

@ -812,11 +812,11 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, const net_addr
rv->gw = rta_get_via(a[RTA_VIA]); rv->gw = rta_get_via(a[RTA_VIA]);
#endif #endif
if (ipa_nonzero(rv->gw))
{
if (nh->rtnh_flags & RTNH_F_ONLINK) if (nh->rtnh_flags & RTNH_F_ONLINK)
rv->flags |= RNF_ONLINK; rv->flags |= RNF_ONLINK;
if (ipa_nonzero(rv->gw))
{
neighbor *nbr; neighbor *nbr;
nbr = neigh_find(&p->p, rv->gw, rv->iface, nbr = neigh_find(&p->p, rv->gw, rv->iface,
(rv->flags & RNF_ONLINK) ? NEF_ONLINK : 0); (rv->flags & RNF_ONLINK) ? NEF_ONLINK : 0);
@ -1708,6 +1708,9 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
ra->nh.gw = rta_get_via(a[RTA_VIA]); ra->nh.gw = rta_get_via(a[RTA_VIA]);
#endif #endif
if (i->rtm_flags & RTNH_F_ONLINK)
ra->nh.flags |= RNF_ONLINK;
if (ipa_nonzero(ra->nh.gw)) if (ipa_nonzero(ra->nh.gw))
{ {
/* Silently skip strange 6to4 routes */ /* Silently skip strange 6to4 routes */
@ -1715,9 +1718,6 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
if ((i->rtm_family == AF_INET6) && ipa_in_netX(ra->nh.gw, (net_addr *) &sit)) if ((i->rtm_family == AF_INET6) && ipa_in_netX(ra->nh.gw, (net_addr *) &sit))
return; return;
if (i->rtm_flags & RTNH_F_ONLINK)
ra->nh.flags |= RNF_ONLINK;
neighbor *nbr; neighbor *nbr;
nbr = neigh_find(&p->p, ra->nh.gw, ra->nh.iface, nbr = neigh_find(&p->p, ra->nh.gw, ra->nh.iface,
(ra->nh.flags & RNF_ONLINK) ? NEF_ONLINK : 0); (ra->nh.flags & RNF_ONLINK) ? NEF_ONLINK : 0);