]> git.puffer.fish Git - matthieu/frr.git/commitdiff
atomic-aggregate is lost when we aggregate another aggregate that has atomic-aggregate
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 20 May 2015 00:47:21 +0000 (17:47 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 20 May 2015 00:47:21 +0000 (17:47 -0700)
bgpd/bgp_attr.c
bgpd/bgp_attr.h
bgpd/bgp_route.c

index 7709ff4a4c1c7a5a487eb57b53bb4e16a96b6923..f76309640b56a0ffb5c107681a4b42f4f18d6ec0 100644 (file)
@@ -649,7 +649,8 @@ bgp_attr_default_intern (u_char origin)
 struct attr *
 bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
                           struct aspath *aspath,
-                          struct community *community, int as_set)
+                          struct community *community, int as_set,
+                          u_char atomic_aggregate)
 {
   struct attr attr;
   struct attr *new;
@@ -683,7 +684,7 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
 #ifdef HAVE_IPV6
   attre.mp_nexthop_len = IPV6_MAX_BYTELEN;
 #endif
-  if (! as_set)
+  if (! as_set || atomic_aggregate)
     attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
   attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
   if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
index 91626f25c67a9514291ca23f8e346ef62cf2a376..4285c75522237f80a91f31e9c82a77b4757f3299 100644 (file)
@@ -169,7 +169,7 @@ extern struct attr *bgp_attr_default_set (struct attr *attr, u_char);
 extern struct attr *bgp_attr_default_intern (u_char);
 extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char,
                                         struct aspath *, 
-                                        struct community *, int as_set);
+                                        struct community *, int as_set, u_char);
 extern bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *,
                                        struct stream *, struct attr *,
                                        struct prefix *, afi_t, safi_t,
index 4638d75129c1693967ca1fc66c01545f68aae182..5e8eec3929fafb27427761fface4bf57354465d4 100644 (file)
@@ -4819,6 +4819,7 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
   struct bgp_info *new;
   int first = 1;
   unsigned long match = 0;
+  u_char atomic_aggregate = 0;
 
   /* Record adding route's nexthop and med. */
   if (rinew)
@@ -4874,6 +4875,9 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
              }
 #endif /* AGGREGATE_NEXTHOP_CHECK */
 
+            if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
+              atomic_aggregate = 1;
+
            if (ri->sub_type != BGP_ROUTE_AGGREGATE)
              {
                if (aggregate->summary_only)
@@ -4960,7 +4964,8 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
       rn = bgp_node_get (table, p);
       new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, bgp->peer_self,
                      bgp_attr_aggregate_intern(bgp, origin, aspath, community,
-                                               aggregate->as_set), rn);
+                                               aggregate->as_set,
+                                                atomic_aggregate), rn);
       SET_FLAG (new->flags, BGP_INFO_VALID);
 
       bgp_info_add (rn, new);
@@ -5065,6 +5070,7 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
   struct aspath *asmerge = NULL;
   struct community *community = NULL;
   struct community *commerge = NULL;
+  u_char atomic_aggregate = 0;
 
   table = bgp->rib[afi][safi];
 
@@ -5086,6 +5092,9 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
            if (BGP_INFO_HOLDDOWN (ri))
              continue;
 
+            if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
+              atomic_aggregate = 1;
+
            if (ri->sub_type != BGP_ROUTE_AGGREGATE)
              {
                /* summary-only aggregate route suppress aggregated
@@ -5141,7 +5150,8 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
       rn = bgp_node_get (table, p);
       new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, bgp->peer_self,
                      bgp_attr_aggregate_intern(bgp, origin, aspath, community,
-                                               aggregate->as_set), rn);
+                                               aggregate->as_set,
+                                                atomic_aggregate), rn);
       SET_FLAG (new->flags, BGP_INFO_VALID);
 
       bgp_info_add (rn, new);