diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 2be49bbc00..ffcb65555b 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2570,17 +2570,19 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, bw_bytes = ((uint64_t)(rels->bw * 1000 * 1000))/8; encode_lb_extcomm(as, bw_bytes, rels->non_trans, &lb_eval); - ecom_lb.size = 1; - ecom_lb.val = (uint8_t *)lb_eval.val; /* add to route or merge with existing */ old_ecom = path->attr->ecommunity; if (old_ecom) { - new_ecom = ecommunity_merge(ecommunity_dup(old_ecom), &ecom_lb); + new_ecom = ecommunity_dup(old_ecom); + ecommunity_add_val(new_ecom, &lb_eval, true, true); if (!old_ecom->refcnt) ecommunity_free(&old_ecom); - } else + } else { + ecom_lb.size = 1; + ecom_lb.val = (uint8_t *)lb_eval.val; new_ecom = ecommunity_dup(&ecom_lb); + } /* new_ecom will be intern()'d or attr_flush()'d in call stack */ path->attr->ecommunity = new_ecom;