diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-01-29 12:49:37 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-01-29 12:49:37 +0100 |
commit | 85ad5855a02e8b185a61bbcb601f005d2e6747db (patch) | |
tree | 9e5cdb4f9c8255551c97ac921e48b82d44211577 /nest/rt-table.c | |
parent | 345e50d59ff299e466fab6d0e0d37c210d624d96 (diff) |
Nest: Fix corner case in recursive next hop lookup
Thanks to Svenne Krap for the bugreport.
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r-- | nest/rt-table.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index 4640d6a9..6ee261e8 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -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); } |