diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-07-07 16:52:24 -0400 |
|---|---|---|
| committer | Martin Winter <mwinter@opensourcerouting.org> | 2021-07-25 15:17:37 +0200 |
| commit | 393c126db11ff03e66e5802f22150acf0452b35c (patch) | |
| tree | 48c65098ac038d38b44fd4c4300918a3c45d47c0 /zebra/zapi_msg.c | |
| parent | 235bcb4b4aa8fdf12ef91858968e30daba492177 (diff) | |
zebra: When passing lookup information back pass the fully resolved
In the reachability code we auto pass back the fully resolved
nexthops. Modify the ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB code
to do the exact same thing so that the zclient_lookup_nexthop
code does not need to recursively look for the data that
zebra already has.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 544bb07fbe..223a8ca438 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -681,6 +681,8 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, stream_put_in_addr(s, &addr); if (re) { + struct nexthop_group *nhg; + stream_putc(s, re->distance); stream_putl(s, re->metric); num = 0; @@ -688,15 +690,11 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, nump = stream_get_endp(s); /* reserve room for nexthop_num */ stream_putc(s, 0); - /* - * Only non-recursive routes are elegible to resolve the - * nexthop we are looking up. Therefore, we will just iterate - * over the top chain of nexthops. - */ - for (nexthop = re->nhe->nhg.nexthop; nexthop; - nexthop = nexthop->next) - if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)) + nhg = rib_get_fib_nhg(re); + for (ALL_NEXTHOPS_PTR(nhg, nexthop)) { + if (rnh_nexthop_valid(re, nexthop)) num += zserv_encode_nexthop(s, nexthop); + } /* store nexthop_num */ stream_putc_at(s, nump, num); |
