]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Use the correct bgp instance for cli commands issuing clear
authorDon Slice <dslice@cumulusnetworks.com>
Mon, 18 Jul 2016 14:32:46 +0000 (10:32 -0400)
committerDon Slice <dslice@cumulusnetworks.com>
Mon, 18 Jul 2016 14:32:46 +0000 (10:32 -0400)
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

index 5a9d431d2ebb9ff589c4f9396ed1ea1ed7b6b8b3..c429623e7eabf80a4a53a09ba04239ea27cafd1c 100644 (file)
@@ -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);