From 849144993d13bae68f8eccf45c677e4a78e153bd Mon Sep 17 00:00:00 2001 From: Don Slice Date: Mon, 18 Jul 2016 10:32:46 -0400 Subject: [PATCH] bgpd: Use the correct bgp instance for cli commands issuing clear Some bgp commands end with doing a bgp_clear_vty, which invalidly made the assumption that the clear should always be done for the default instance. This fix derives the correct instance from the vty-index if one is supplied, and uses the default instance if it is not. Ticket: CM-10113 Signed-off-by: Don Slice Reviewed-by: Donald Sharp --- bgpd/bgp_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5a9d431d2e..c429623e7e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -523,7 +523,7 @@ bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, } else { - bgp = bgp_get_default (); + bgp = (vty->index) ? vty->index : bgp_get_default (); if (bgp == NULL) { vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); -- 2.39.5