static int bgp_aggregate_info_same(struct bgp_path_info *pi, uint8_t origin,
struct aspath *aspath,
struct community *comm,
- struct ecommunity *ecomm)
+ struct ecommunity *ecomm,
+ struct lcommunity *lcomm)
{
static struct aspath *ae = NULL;
if (!ecommunity_cmp(pi->attr->ecommunity, ecomm))
return 0;
+ if (!lcommunity_cmp(pi->attr->lcommunity, lcomm))
+ return 0;
+
if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID))
return 0;
struct aspath *aspath,
struct community *community,
struct ecommunity *ecommunity,
+ struct lcommunity *lcommunity,
uint8_t atomic_aggregate,
struct bgp_aggregate *aggregate)
{
* no need to re-install it again.
*/
if (bgp_aggregate_info_same(rn->info, origin, aspath, community,
- ecommunity)) {
+ ecommunity, lcommunity)) {
bgp_unlock_node(rn);
if (aspath)
community_free(community);
if (ecommunity)
ecommunity_free(&ecommunity);
+ if (lcommunity)
+ lcommunity_free(&lcommunity);
return;
}
bgp->peer_self,
bgp_attr_aggregate_intern(bgp, origin, aspath,
community, ecommunity,
+ lcommunity,
aggregate->as_set,
atomic_aggregate),
rn);
struct community *commerge = NULL;
struct ecommunity *ecommunity = NULL;
struct ecommunity *ecommerge = NULL;
+ struct lcommunity *lcommunity = NULL;
+ struct lcommunity *lcommerge = NULL;
struct bgp_path_info *pi;
unsigned long match = 0;
uint8_t atomic_aggregate = 0;
ecommunity = ecommunity_dup(
pi->attr->ecommunity);
}
+
+ if (pi->attr->lcommunity) {
+ if (lcommunity) {
+ lcommerge = lcommunity_merge(
+ lcommunity,
+ pi->attr->lcommunity);
+ lcommunity =
+ lcommunity_uniq_sort(lcommerge);
+ lcommunity_free(&lcommerge);
+ } else
+ lcommunity = lcommunity_dup(
+ pi->attr->lcommunity);
+ }
}
if (match)
bgp_process(bgp, rn, afi, safi);
ecommunity = ecommunity_dup(
pinew->attr->ecommunity);
}
+
+ if (pinew->attr->lcommunity) {
+ if (lcommunity) {
+ lcommerge = lcommunity_merge(
+ lcommunity,
+ pinew->attr->lcommunity);
+ lcommunity =
+ lcommunity_uniq_sort(lcommerge);
+ lcommunity_free(&lcommerge);
+ } else
+ lcommunity = lcommunity_dup(
+ pinew->attr->lcommunity);
+ }
}
}
bgp_aggregate_install(bgp, afi, safi, p, origin, aspath, community,
- ecommunity, atomic_aggregate, aggregate);
+ ecommunity, lcommunity, atomic_aggregate,
+ aggregate);
if (aggregate->count == 0) {
if (aspath)
community_free(community);
if (ecommunity)
ecommunity_free(&ecommunity);
+ if (lcommunity)
+ lcommunity_free(&lcommunity);
}
}
aggregate = bgp_aggregate_get_node_info(rn);
bgp_aggregate_delete(bgp, &p, afi, safi, aggregate);
- bgp_aggregate_install(bgp, afi, safi, &p, 0, NULL, NULL, NULL, 0,
- aggregate);
+ bgp_aggregate_install(bgp, afi, safi, &p, 0, NULL, NULL,
+ NULL, NULL, 0, aggregate);
/* Unlock aggregate address configuration. */
bgp_aggregate_set_node_info(rn, NULL);