forked from Mirror/frr
Fix aggregation issues found via ANVL
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
parent
c01acf98d9
commit
b5d58c32bb
|
@ -1044,6 +1044,9 @@ aspath_aggregate (struct aspath *as1, struct aspath *as2)
|
||||||
if (match != minlen || match != seg1->length
|
if (match != minlen || match != seg1->length
|
||||||
|| seg1->length != seg2->length)
|
|| seg1->length != seg2->length)
|
||||||
break;
|
break;
|
||||||
|
/* We are moving on to the next segment to reset match */
|
||||||
|
else
|
||||||
|
match = 0;
|
||||||
|
|
||||||
seg1 = seg1->next;
|
seg1 = seg1->next;
|
||||||
seg2 = seg2->next;
|
seg2 = seg2->next;
|
||||||
|
|
|
@ -646,6 +646,7 @@ bgp_attr_default_intern (u_char origin)
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create the attributes for an aggregate */
|
||||||
struct attr *
|
struct attr *
|
||||||
bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
|
bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
|
||||||
struct aspath *aspath,
|
struct aspath *aspath,
|
||||||
|
|
|
@ -4800,6 +4800,7 @@ bgp_aggregate_free (struct bgp_aggregate *aggregate)
|
||||||
XFREE (MTYPE_BGP_AGGREGATE, aggregate);
|
XFREE (MTYPE_BGP_AGGREGATE, aggregate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update an aggregate as routes are added/removed from the BGP table */
|
||||||
static void
|
static void
|
||||||
bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
|
bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
|
||||||
afi_t afi, safi_t safi, struct bgp_info *del,
|
afi_t afi, safi_t safi, struct bgp_info *del,
|
||||||
|
@ -4889,11 +4890,11 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
|
||||||
|
|
||||||
aggregate->count++;
|
aggregate->count++;
|
||||||
|
|
||||||
if (aggregate->as_set)
|
|
||||||
{
|
|
||||||
if (origin < ri->attr->origin)
|
if (origin < ri->attr->origin)
|
||||||
origin = ri->attr->origin;
|
origin = ri->attr->origin;
|
||||||
|
|
||||||
|
if (aggregate->as_set)
|
||||||
|
{
|
||||||
if (aspath)
|
if (aspath)
|
||||||
{
|
{
|
||||||
asmerge = aspath_aggregate (aspath, ri->attr->aspath);
|
asmerge = aspath_aggregate (aspath, ri->attr->aspath);
|
||||||
|
@ -4930,11 +4931,11 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
|
||||||
if (aggregate->summary_only)
|
if (aggregate->summary_only)
|
||||||
(bgp_info_extra_get (rinew))->suppress++;
|
(bgp_info_extra_get (rinew))->suppress++;
|
||||||
|
|
||||||
if (aggregate->as_set)
|
|
||||||
{
|
|
||||||
if (origin < rinew->attr->origin)
|
if (origin < rinew->attr->origin)
|
||||||
origin = rinew->attr->origin;
|
origin = rinew->attr->origin;
|
||||||
|
|
||||||
|
if (aggregate->as_set)
|
||||||
|
{
|
||||||
if (aspath)
|
if (aspath)
|
||||||
{
|
{
|
||||||
asmerge = aspath_aggregate (aspath, rinew->attr->aspath);
|
asmerge = aspath_aggregate (aspath, rinew->attr->aspath);
|
||||||
|
@ -5055,6 +5056,7 @@ bgp_aggregate_decrement (struct bgp *bgp, struct prefix *p,
|
||||||
bgp_unlock_node (child);
|
bgp_unlock_node (child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Called via bgp_aggregate_set when the user configures aggregate-address */
|
||||||
static void
|
static void
|
||||||
bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
|
bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
|
||||||
struct bgp_aggregate *aggregate)
|
struct bgp_aggregate *aggregate)
|
||||||
|
@ -5105,13 +5107,21 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
|
||||||
bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED);
|
bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED);
|
||||||
match++;
|
match++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If at least one route among routes that are aggregated has
|
||||||
|
* ORIGIN with the value INCOMPLETE, then the aggregated route
|
||||||
|
* MUST have the ORIGIN attribute with the value INCOMPLETE.
|
||||||
|
* Otherwise, if at least one route among routes that are
|
||||||
|
* aggregated has ORIGIN with the value EGP, then the aggregated
|
||||||
|
* route MUST have the ORIGIN attribute with the value EGP.
|
||||||
|
*/
|
||||||
|
if (origin < ri->attr->origin)
|
||||||
|
origin = ri->attr->origin;
|
||||||
|
|
||||||
/* as-set aggregate route generate origin, as path,
|
/* as-set aggregate route generate origin, as path,
|
||||||
community aggregation. */
|
community aggregation. */
|
||||||
if (aggregate->as_set)
|
if (aggregate->as_set)
|
||||||
{
|
{
|
||||||
if (origin < ri->attr->origin)
|
|
||||||
origin = ri->attr->origin;
|
|
||||||
|
|
||||||
if (aspath)
|
if (aspath)
|
||||||
{
|
{
|
||||||
asmerge = aspath_aggregate (aspath, ri->attr->aspath);
|
asmerge = aspath_aggregate (aspath, ri->attr->aspath);
|
||||||
|
|
Loading…
Reference in a new issue