summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-03-27 14:59:05 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-27 15:52:26 -0400
commit4c66767c1018818b715ad313b51cfb438a9095a5 (patch)
treec284d734d61013146ca90071735a94a35f6c0195
parent049e899eb29e0d189c2b833be6bd37b15189b457 (diff)
zebra: Prevent crash in the off-chance we make a mistake
Prevent zebra from crashing for when the nexthop vrf has changed in some manner and the lookup fails. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/zebra_vty.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index c7951b6f0a..a9107dc4a0 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1108,7 +1108,10 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
struct vrf *vrf =
vrf_lookup_by_id(nexthop->vrf_id);
- vty_out(vty, "(vrf %s)", vrf->name);
+ if (vrf)
+ vty_out(vty, "(vrf %s)", vrf->name);
+ else
+ vty_out(vty, "(vrf UKNOWN)");
}
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
@@ -1468,7 +1471,10 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
if (nexthop->vrf_id != re->vrf_id) {
struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
- vty_out(vty, "(vrf %s)", vrf->name);
+ if (vrf)
+ vty_out(vty, "(vrf %s)", vrf->name);
+ else
+ vty_out(vty, "(vrf UKNOWN)");
}
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))