summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhinay Ramesh <rabhinay@vmware.com>2021-03-31 11:05:56 +0000
committerAbhinay Ramesh <rabhinay@vmware.com>2021-04-07 06:09:42 +0000
commitef7c53e244d5d0cd7c0ba2536fc931abf28df656 (patch)
tree1621b49aa404504baaddecdb41f57e4d273ecb53
parentf19d77a086d526171bb19f24c1a4ff9e77ab5b7a (diff)
bgpd: vrf route leaking, fix the bgp instance delete and re-add
Description: FRR doesn't re-install the routes, imported from a tenant VRF, when bgp instance for source vrf is deleted and re-added again. When bgp instance is removed and re-added, when import statement is already there, then route leaking stops between two VRFs. Every 'router bgp' command should trigger re-export of all the routes to the importing bgp vrf instances. When a router bgp is configured, there could be bgp vrf instance(s) importing routes from this newly configured bgp vrf instance. We need to export routes from configured bgp vrf to VPN. This can impact performance, whenever we are testing scale from vrf route-leaking perspective. We should not trigger re-export for already existing bgp vrf instances. Co-authored-by: Santosh P K <sapk@vmware.com> Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com> Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
-rw-r--r--bgpd/bgp_nb_config.c7
-rw-r--r--bgpd/bgpd.c2
-rw-r--r--bgpd/bgpd.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c
index 5a88bd08d9..94ff362d1a 100644
--- a/bgpd/bgp_nb_config.c
+++ b/bgpd/bgp_nb_config.c
@@ -123,7 +123,12 @@ int bgp_router_create(struct nb_cb_create_args *args)
if (is_new_bgp && inst_type == BGP_INSTANCE_TYPE_DEFAULT)
vpn_leak_postchange_all();
- if (inst_type == BGP_INSTANCE_TYPE_VRF)
+ /*
+ * Check if we need to export to other VRF(s).
+ * Leak the routes to importing bgp vrf instances,
+ * only when new bgp vrf instance is configured.
+ */
+ if (ret != BGP_INSTANCE_EXISTS)
bgp_vpn_leak_export(bgp);
UNSET_FLAG(bgp->vrf_flags, BGP_VRF_AUTO);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index d37b9fa48c..bad62f9946 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -3402,7 +3402,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
return ret;
case BGP_SUCCESS:
if (*bgp_val)
- return ret;
+ return BGP_INSTANCE_EXISTS;
}
bgp = bgp_create(as, name, inst_type);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 51134dc8c5..f9aa62c682 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1844,6 +1844,7 @@ enum bgp_clear_type {
/* BGP error codes. */
#define BGP_SUCCESS 0
#define BGP_CREATED 1
+#define BGP_INSTANCE_EXISTS 2
#define BGP_ERR_INVALID_VALUE -1
#define BGP_ERR_INVALID_FLAG -2
#define BGP_ERR_INVALID_AS -3