summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-06-12 08:54:56 +0300
committerGitHub <noreply@github.com>2020-06-12 08:54:56 +0300
commit54d3c464056ee6b92a19340bbc98bed9f18ba33a (patch)
treee27339beda23820a5554f139294b277d63b6889d
parent110597aa04169a1594549e0d6a53859b7e7be8ff (diff)
parent1995cb77bfc8a2b437044763054f417d4c1d8de6 (diff)
Merge pull request #6564 from dslicenc/leak-bgp-xcommunity
bgpd: remove extcommunity attribute on leaked route if empty
-rw-r--r--bgpd/bgp_mplsvpn.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 46dcd2864e..3b82c60ae9 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -1095,6 +1095,14 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
new_ecom = ecommunity_dup(old_ecom);
ecommunity_strip_rts(new_ecom);
static_attr.ecommunity = new_ecom;
+
+ if (new_ecom->size == 0) {
+ UNSET_FLAG(static_attr.flag,
+ ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
+ ecommunity_free(&new_ecom);
+ static_attr.ecommunity = NULL;
+ }
+
if (!old_ecom->refcnt)
ecommunity_free(&old_ecom);
}