summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-05-14 16:22:53 -0700
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-25 11:13:40 -0400
commit7f1abf7926b71ac7c7170883d0d8d0039ba269b0 (patch)
tree9a12e3b6a111a5a35d2936e23e8941f72044de05
parent98cda54a9543ea125e5e1eea6621c453f407edb2 (diff)
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>
-rw-r--r--zebra/zebra_errors.c6
-rw-r--r--zebra/zebra_errors.h1
-rw-r--r--zebra/zebra_nhg.c9
3 files changed, 15 insertions, 1 deletions
diff --git a/zebra/zebra_errors.c b/zebra/zebra_errors.c
index 3ca1bf3971..5a0905d591 100644
--- a/zebra/zebra_errors.c
+++ b/zebra/zebra_errors.c
@@ -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,
diff --git a/zebra/zebra_errors.h b/zebra/zebra_errors.h
index 1411980ba5..f9ccc2db28 100644
--- a/zebra/zebra_errors.h
+++ b/zebra/zebra_errors.h
@@ -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,
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 144decfbb5..f43aa2f31e 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -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 */