diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2022-03-12 10:47:16 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2022-03-12 11:18:45 -0500 |
| commit | 06e4e90132ad23815c6f288dd7e6be334f5ab233 (patch) | |
| tree | d2e36926ed80e04a6b948baafc3a4bb065b7c02c /zebra/zebra_rnh.c | |
| parent | 5c7861fe352c41de1b322b8960827773bd0222f9 (diff) | |
*: 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 'zebra/zebra_rnh.c')
| -rw-r--r-- | zebra/zebra_rnh.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 8ca25359be..f90eb5bee1 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -1169,6 +1169,9 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client, SET_FLAG(message, ZAPI_MESSAGE_SRTE); stream_putl(s, message); + /* + * Put what we were told to match against + */ stream_putw(s, rnh->safi); stream_putw(s, rn->p.family); switch (rn->p.family) { @@ -1186,6 +1189,26 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client, __func__, rn->p.family); goto failure; } + + /* + * What we matched against + */ + stream_putw(s, rnh->resolved_route.family); + stream_putc(s, rnh->resolved_route.prefixlen); + switch (rnh->resolved_route.family) { + case AF_INET: + stream_put_in_addr(s, &rnh->resolved_route.u.prefix4); + break; + case AF_INET6: + stream_put(s, &rnh->resolved_route.u.prefix6, IPV6_MAX_BYTELEN); + break; + default: + flog_err(EC_ZEBRA_RNH_UNKNOWN_FAMILY, + "%s: Unknown family (%d) notification attempted", + __func__, rn->p.family); + goto failure; + } + if (srte_color) stream_putl(s, srte_color); |
