Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
zebra: Error if the ifp lookup fails for an NHE
If the lookup for an interface pointer fails when creating
the NHE, log an error message.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
  • Loading branch information
sworleys committed Oct 25, 2019
1 parent 98cda54 commit 7f1abf7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions zebra/zebra_errors.c
Expand Up @@ -310,6 +310,12 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion =
"Check to see if the nexthop group on the route you tried to install is valid."
},
{
.code = EC_ZEBRA_IF_LOOKUP_FAILED,
.title = "Zebra interface lookup failed",
.description = "Zebra attempted to look up a interface for a particular vrf_id and interface index, but didn't find anything.",
.suggestion = "If you entered a command to trigger this error, make sure you entered the arguments correctly. Check your config file for any potential errors. If these look correct, seek help.",
},
/* Warnings */
{
.code = EC_ZEBRAING_LM_PROTO_MISMATCH,
Expand Down
1 change: 1 addition & 0 deletions zebra/zebra_errors.h
Expand Up @@ -75,6 +75,7 @@ enum zebra_log_refs {
EC_ZEBRA_NHG_TABLE_INSERT_FAILED,
EC_ZEBRA_NHG_SYNC,
EC_ZEBRA_NHG_FIB_UPDATE,
EC_ZEBRA_IF_LOOKUP_FAILED,
/* warnings */
EC_ZEBRA_NS_NOTIFY_READ,
EC_ZEBRAING_LM_PROTO_MISMATCH,
Expand Down
9 changes: 8 additions & 1 deletion zebra/zebra_nhg.c
Expand Up @@ -355,7 +355,14 @@ static void *zebra_nhg_alloc(void *arg)

ifp = if_lookup_by_index(nhe->nhg->nexthop->ifindex,
nhe->vrf_id);
zebra_nhg_set_if(nhe, ifp);
if (ifp)
zebra_nhg_set_if(nhe, ifp);
else
flog_err(
EC_ZEBRA_IF_LOOKUP_FAILED,
"Zebra failed to lookup an interface with ifindex=%d in vrf=%u for NHE id=%u",
nhe->nhg->nexthop->ifindex, nhe->vrf_id,
nhe->id);
}

/* Add to id table as well */
Expand Down

0 comments on commit 7f1abf7

Please sign in to comment.