summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
authorSri Mohana Singamsetty <srimohans@gmail.com>2019-06-14 02:55:59 +0200
committerGitHub <noreply@github.com>2019-06-14 02:55:59 +0200
commit0590d2d209d2697402ca1f1976cb04ffa48b9d76 (patch)
tree91140b612f3e7a8f24e9a65a475e80fb050878ff /bgpd/bgpd.c
parentMerge pull request #4499 from kssoman/core (diff)
parentbgpd: auto router-id should not change configured vpn RD/RT (diff)
downloadfrr-0590d2d209d2697402ca1f1976cb04ffa48b9d76.tar.xz
frr-0590d2d209d2697402ca1f1976cb04ffa48b9d76.zip
Merge pull request #4512 from mjstapp/fix_bgp_auto_rid
bgpd: auto router-id should not change configured vpn RD/RT
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r--bgpd/bgpd.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 181b3d706..8be6cec0c 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -234,8 +234,11 @@ static int bgp_config_check(struct bgp *bgp, int config)
return CHECK_FLAG(bgp->config, config);
}
-/* Set BGP router identifier. */
-static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id)
+/* Set BGP router identifier; distinguish between explicit config and other
+ * cases.
+ */
+static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id,
+ bool is_config)
{
struct peer *peer;
struct listnode *node, *nnode;
@@ -247,7 +250,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id)
if (is_evpn_enabled())
bgp_evpn_handle_router_id_update(bgp, TRUE);
- vpn_handle_router_id_update(bgp, TRUE);
+ vpn_handle_router_id_update(bgp, TRUE, is_config);
IPV4_ADDR_COPY(&bgp->router_id, id);
@@ -266,7 +269,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id)
if (is_evpn_enabled())
bgp_evpn_handle_router_id_update(bgp, FALSE);
- vpn_handle_router_id_update(bgp, FALSE);
+ vpn_handle_router_id_update(bgp, FALSE, is_config);
return 0;
}
@@ -300,7 +303,7 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("RID change : vrf %u, RTR ID %s",
bgp->vrf_id, inet_ntoa(*addr));
- bgp_router_id_set(bgp, addr);
+ bgp_router_id_set(bgp, addr, FALSE);
}
}
}
@@ -320,7 +323,7 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("RID change : vrf %u, RTR ID %s",
bgp->vrf_id, inet_ntoa(*addr));
- bgp_router_id_set(bgp, addr);
+ bgp_router_id_set(bgp, addr, FALSE);
}
}
@@ -331,7 +334,8 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
int bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
{
bgp->router_id_static = id;
- bgp_router_id_set(bgp, id.s_addr ? &id : &bgp->router_id_zebra);
+ bgp_router_id_set(bgp, id.s_addr ? &id : &bgp->router_id_zebra,
+ TRUE /* is config */);
return 0;
}
@@ -3185,7 +3189,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
bgp = bgp_create(as, name, inst_type);
if (bgp_option_check(BGP_OPT_NO_ZEBRA) && name)
bgp->vrf_id = vrf_generate_id();
- bgp_router_id_set(bgp, &bgp->router_id_zebra);
+ bgp_router_id_set(bgp, &bgp->router_id_zebra, TRUE);
bgp_address_init(bgp);
bgp_tip_hash_init(bgp);
bgp_scan_init(bgp);