summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Slice <dslice@cumulusnetworks.com>2019-04-22 15:12:38 -0400
committerDon Slice <dslice@cumulusnetworks.com>2019-05-22 13:04:26 -0700
commitdd5868c2cce8b87b50667c3e0e43b2d15127eb5c (patch)
tree1392f469aa08531645fe29bfbbddaa20559f705a
parent528628cb2ea4f5a522bf1f6d5b702bb188c4e30e (diff)
bgpd: disable deleting default instance if vrf instances exist
Problem reported with deleting the default BGP instance where there are vrf instances that depend on it (like l2vpn evpn vrfs). Since importing for vrf route-leaking also requires the existence of the default instance, disallowing deleting the BGP default instance if anyt vrf instance is also defined. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_vty.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 2a08619ec3..7a283e010c 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1129,10 +1129,25 @@ DEFUN (no_router_bgp,
}
if (bgp->l3vni) {
- vty_out(vty, "%% Please unconfigure l3vni %u",
+ vty_out(vty, "%% Please unconfigure l3vni %u\n",
bgp->l3vni);
return CMD_WARNING_CONFIG_FAILED;
}
+
+ /* Cannot delete default instance if vrf instances exist */
+ if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
+ struct listnode *node;
+ struct bgp *tmp_bgp;
+
+ for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, tmp_bgp)) {
+ if (tmp_bgp->inst_type
+ == BGP_INSTANCE_TYPE_VRF) {
+ vty_out(vty,
+ "%% Cannot delete default BGP instance. Dependent VRF instances exist\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ }
+ }
}
bgp_delete(bgp);