]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Ensure link bandwidth extcommunity is not repeated
authorvivek <vivek@cumulusnetworks.com>
Tue, 24 Mar 2020 20:53:09 +0000 (13:53 -0700)
committervivek <vivek@cumulusnetworks.com>
Tue, 31 Mar 2020 03:12:31 +0000 (20:12 -0700)
The BGP link bandwidth extended community must not be repeated. If the
attribute already carries this and the route-map specifies a new value,
the implementation will honor the policy configuration and overwrite
the existing values.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
bgpd/bgp_routemap.c

index 2be49bbc00da7a987a3da77818365173f0022cea..ffcb65555be7fe468dca3f9a8acae2cc458c354a 100644 (file)
@@ -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;