diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-03-12 16:47:16 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-03-12 17:18:45 +0100 |
commit | 06e4e90132ad23815c6f288dd7e6be334f5ab233 (patch) | |
tree | d2e36926ed80e04a6b948baafc3a4bb065b7c02c /staticd/static_zebra.c | |
parent | zebra: Remove unused ZEBRA_NHT_EXACT_MATCH (diff) | |
download | frr-06e4e90132ad23815c6f288dd7e6be334f5ab233.tar.xz frr-06e4e90132ad23815c6f288dd7e6be334f5ab233.zip |
*: When matching against a nexthop send and process what it matched against
Currently the nexthop tracking code is only sending to the requestor
what it was requested to match against. When the nexthop tracking
code was simplified to not need an import check and a nexthop check
in b8210849b8ac1abe2d5d9a5ab2459abfde65efa5 for bgpd. It was not
noticed that a longer prefix could match but it would be seen
as a match because FRR was not sending up both the resolved
route prefix and the route FRR was asked to match against.
This code change causes the nexthop tracking code to pass
back up the matched requested route (so that the calling
protocol can figure out which one it is being told about )
as well as the actual prefix that was matched to.
Fixes: #10766
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'staticd/static_zebra.c')
-rw-r--r-- | staticd/static_zebra.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index f937492ec..bd293edeb 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -169,24 +169,25 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) { struct static_nht_data *nhtd, lookup; struct zapi_route nhr; + struct prefix matched; afi_t afi = AFI_IP; - if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { + if (!zapi_nexthop_update_decode(zclient->ibuf, &matched, &nhr)) { zlog_err("Failure to decode nexthop update message"); return 1; } - if (nhr.prefix.family == AF_INET6) + if (matched.family == AF_INET6) afi = AFI_IP6; if (nhr.type == ZEBRA_ROUTE_CONNECT) { - if (static_nexthop_is_local(vrf_id, &nhr.prefix, - nhr.prefix.family)) + if (static_nexthop_is_local(vrf_id, &matched, + nhr.prefix.family)) nhr.nexthop_num = 0; } memset(&lookup, 0, sizeof(lookup)); - lookup.nh = &nhr.prefix; + lookup.nh = &matched; lookup.nh_vrf_id = vrf_id; nhtd = hash_lookup(static_nht_hash, &lookup); @@ -194,8 +195,8 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) if (nhtd) { nhtd->nh_num = nhr.nexthop_num; - static_nht_reset_start(&nhr.prefix, afi, nhtd->nh_vrf_id); - static_nht_update(NULL, &nhr.prefix, nhr.nexthop_num, afi, + static_nht_reset_start(&matched, afi, nhtd->nh_vrf_id); + static_nht_update(NULL, &matched, nhr.nexthop_num, afi, nhtd->nh_vrf_id); } else zlog_err("No nhtd?"); |