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>
This commit is contained in:
Stephen Worley 2019-05-14 16:22:53 -07:00
parent 98cda54a95
commit 7f1abf7926
3 changed files with 15 additions and 1 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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 */