From 1c49e8138ee377692d8b683fc4bfe292f77b5004 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 7 Oct 2021 18:27:29 +0300 Subject: [PATCH] bgpd: fix crash when using "show bgp vrf all" Any command that uses `peer_lookup_in_view` crashes when "vrf all" is used, because bgp is NULL in this case. Signed-off-by: Igor Ryzhov --- bgpd/bgpd.c | 3 +-- .../all_protocol_startup/test_all_protocol_startup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 925af80cb7..57083440b1 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7883,8 +7883,7 @@ struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp, json_no, JSON_C_TO_STRING_PRETTY)); json_object_free(json_no); } else - vty_out(vty, "No such neighbor in %s\n", - bgp->name_pretty); + vty_out(vty, "No such neighbor in this view/vrf\n"); return NULL; } diff --git a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py index 1b99fcea1f..ddb7f4e16e 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -966,7 +966,7 @@ def test_bgp_summary(): r"(192.168.7.(1|2)0|fc00:0:0:8::2000).+Active.+", "", expected ) elif "10.0.0.1" in arguments: - expected = "No such neighbor in VRF default" + expected = "No such neighbor in this view/vrf" if "terse" in arguments: expected = re.sub(r"BGP table version .+", "", expected) -- 2.39.5