summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}