0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 08:38:42 +00:00

Nest: Fix corner case in recursive next hop lookup

Thanks to Svenne Krap for the bugreport.
This commit is contained in:
Ondrej Zajicek (work) 2018-01-29 12:49:37 +01:00
parent 345e50d59f
commit 85ad5855a0

View File

@ -2392,12 +2392,13 @@ static int
rt_update_hostentry(rtable *tab, struct hostentry *he)
{
rta *old_src = he->src;
int direct = 0;
int pxlen = 0;
/* Reset the hostentry */
he->src = NULL;
he->nexthop_linkable = 0;
he->dest = RTD_UNREACHABLE;
he->nexthop_linkable = 0;
he->igp_metric = 0;
net_addr he_addr;
@ -2417,9 +2418,7 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
goto done;
}
he->dest = a->dest;
he->nexthop_linkable = 1;
if (he->dest == RTD_UNICAST)
if (a->dest == RTD_UNICAST)
{
for (struct nexthop *nh = &(a->nh); nh; nh = nh->next)
if (ipa_zero(nh->gw))
@ -2432,12 +2431,13 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
goto done;
}
he->nexthop_linkable = 0;
break;
direct++;
}
}
he->src = rta_clone(a);
he->dest = a->dest;
he->nexthop_linkable = !direct;
he->igp_metric = rt_get_igp_metric(e);
}