zebra: notify installing protocol when nexthops cannot be resolved

In the case where a routes nexthops cannot be resolved as part
of route processing, immmediately notify the upper level protocol
that their routes failed to install if they are interested in
being informed about this issue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-01-05 15:56:12 -05:00
parent 88ffa95dc3
commit 7e010c4b78
2 changed files with 10 additions and 4 deletions

View File

@ -2120,7 +2120,6 @@ static unsigned nexthop_active_check(struct route_node *rn,
struct interface *ifp; struct interface *ifp;
route_map_result_t ret = RMAP_PERMITMATCH; route_map_result_t ret = RMAP_PERMITMATCH;
int family; int family;
char buf[SRCDEST2STR_BUFFER];
const struct prefix *p, *src_p; const struct prefix *p, *src_p;
struct zebra_vrf *zvrf; struct zebra_vrf *zvrf;
@ -2230,10 +2229,9 @@ static unsigned nexthop_active_check(struct route_node *rn,
zvrf, re->tag); zvrf, re->tag);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
srcdest_rnode2str(rn, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%u:%s: Filtering out with NH out %s due to route map", "%u:%pRN: Filtering out with NH out %s due to route map",
re->vrf_id, buf, re->vrf_id, rn,
ifindex2ifname(nexthop->ifindex, ifindex2ifname(nexthop->ifindex,
nexthop->vrf_id)); nexthop->vrf_id));
} }

View File

@ -1107,6 +1107,9 @@ static void rib_process(struct route_node *rn)
*/ */
if (CHECK_FLAG(re->status, ROUTE_ENTRY_CHANGED)) { if (CHECK_FLAG(re->status, ROUTE_ENTRY_CHANGED)) {
if (!nexthop_active_update(rn, re)) { if (!nexthop_active_update(rn, re)) {
const struct prefix *p;
struct rib_table_info *info;
if (re->type == ZEBRA_ROUTE_TABLE) { if (re->type == ZEBRA_ROUTE_TABLE) {
/* XXX: HERE BE DRAGONS!!!!! /* XXX: HERE BE DRAGONS!!!!!
* In all honesty, I have not yet * In all honesty, I have not yet
@ -1136,6 +1139,11 @@ static void rib_process(struct route_node *rn)
ROUTE_ENTRY_REMOVED); ROUTE_ENTRY_REMOVED);
} }
info = srcdest_rnode_table_info(rn);
srcdest_rnode_prefixes(rn, &p, NULL);
zsend_route_notify_owner(re, p,
ZAPI_ROUTE_FAIL_INSTALL,
info->afi, info->safi);
continue; continue;
} }
} else { } else {