static int bgp_aggregate_info_same(struct bgp_path_info *pi, uint8_t origin,
struct aspath *aspath,
- struct community *comm)
+ struct community *comm,
+ struct ecommunity *ecomm)
{
static struct aspath *ae = NULL;
if (!community_cmp(pi->attr->community, comm))
return 0;
+ if (!ecommunity_cmp(pi->attr->ecommunity, ecomm))
+ return 0;
+
if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID))
return 0;
struct prefix *p, uint8_t origin,
struct aspath *aspath,
struct community *community,
+ struct ecommunity *ecommunity,
uint8_t atomic_aggregate,
struct bgp_aggregate *aggregate)
{
* If the aggregate information has not changed
* no need to re-install it again.
*/
- if (bgp_aggregate_info_same(rn->info, origin, aspath,
- community)) {
+ if (bgp_aggregate_info_same(rn->info, origin, aspath, community,
+ ecommunity)) {
bgp_unlock_node(rn);
if (aspath)
aspath_free(aspath);
if (community)
community_free(community);
+ if (ecommunity)
+ ecommunity_free(&ecommunity);
return;
}
if (pi)
bgp_path_info_delete(rn, pi);
- new = info_make(
- ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0, bgp->peer_self,
- bgp_attr_aggregate_intern(bgp, origin, aspath,
- community, aggregate->as_set,
- atomic_aggregate),
- rn);
+ new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0,
+ bgp->peer_self,
+ bgp_attr_aggregate_intern(bgp, origin, aspath,
+ community, ecommunity,
+ aggregate->as_set,
+ atomic_aggregate),
+ rn);
SET_FLAG(new->flags, BGP_PATH_VALID);
bgp_path_info_add(rn, new);
struct aspath *asmerge = NULL;
struct community *community = NULL;
struct community *commerge = NULL;
+ struct ecommunity *ecommunity = NULL;
+ struct ecommunity *ecommerge = NULL;
struct bgp_path_info *pi;
unsigned long match = 0;
uint8_t atomic_aggregate = 0;
} else
aspath = aspath_dup(pi->attr->aspath);
- if (!pi->attr->community)
- continue;
+ if (pi->attr->community) {
+ if (community) {
+ commerge = community_merge(
+ community, pi->attr->community);
+ community =
+ community_uniq_sort(commerge);
+ community_free(commerge);
+ } else
+ community = community_dup(
+ pi->attr->community);
+ }
- if (community) {
- commerge = community_merge(community,
- pi->attr->community);
- community = community_uniq_sort(commerge);
- community_free(commerge);
- } else
- community = community_dup(pi->attr->community);
+ if (pi->attr->ecommunity) {
+ if (ecommunity) {
+ ecommerge = ecommunity_merge(
+ ecommunity,
+ pi->attr->ecommunity);
+ ecommunity =
+ ecommunity_uniq_sort(ecommerge);
+ ecommunity_free(&ecommerge);
+ } else
+ ecommunity = ecommunity_dup(
+ pi->attr->ecommunity);
+ }
}
if (match)
bgp_process(bgp, rn, afi, safi);
community = community_dup(
pinew->attr->community);
}
+
+ if (pinew->attr->ecommunity) {
+ if (ecommunity) {
+ ecommerge = ecommunity_merge(
+ ecommunity,
+ pinew->attr->ecommunity);
+ ecommunity =
+ ecommunity_uniq_sort(ecommerge);
+ ecommunity_free(&ecommerge);
+ } else
+ ecommunity = ecommunity_dup(
+ pinew->attr->ecommunity);
+ }
}
}
bgp_aggregate_install(bgp, afi, safi, p, origin, aspath, community,
- atomic_aggregate, aggregate);
+ ecommunity, atomic_aggregate, aggregate);
if (aggregate->count == 0) {
if (aspath)
aspath_free(aspath);
if (community)
community_free(community);
+ if (ecommunity)
+ ecommunity_free(&ecommunity);
}
}
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, 0, aggregate);
+ bgp_aggregate_install(bgp, afi, safi, &p, 0, NULL, NULL, NULL, 0,
+ aggregate);
/* Unlock aggregate address configuration. */
bgp_aggregate_set_node_info(rn, NULL);