summaryrefslogtreecommitdiff
path: root/bgpd/bgp_aspath.c
diff options
context:
space:
mode:
authorhasso <hasso>2005-04-08 15:40:36 +0000
committerhasso <hasso>2005-04-08 15:40:36 +0000
commit6811845b67999861388cf00d3ca0ee8471d29876 (patch)
tree1f7f08f171164b1a75b66a45093ccb44217dff12 /bgpd/bgp_aspath.c
parent4a8164e5b310094315e2c50d73aeea489766a48a (diff)
* bgpd.texi: Document new "bgp bestpath as-path confed" command.
* bgp_aspath.[ch], bgp_route.c, bgp_vty.c, bgpd.[ch]: Allow to enable the length of confederation path segments to be included during the as-path length check in the best path decision.
Diffstat (limited to 'bgpd/bgp_aspath.c')
-rw-r--r--bgpd/bgp_aspath.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 5d497751..0c50f6a6 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -138,6 +138,7 @@ aspath_make_str_count (struct aspath *as)
int str_pnt;
char *str_buf;
int count = 0;
+ int confed_count = 0;
/* Empty aspath. */
if (as->length == 0)
@@ -145,6 +146,7 @@ aspath_make_str_count (struct aspath *as)
str_buf = XMALLOC (MTYPE_AS_STR, 1);
str_buf[0] = '\0';
as->count = count;
+ as->confed_count = confed_count;
return str_buf;
}
@@ -208,14 +210,21 @@ aspath_make_str_count (struct aspath *as)
space = 0;
- /* Increment count - ignoring CONFED SETS/SEQUENCES */
- if (assegment->type != AS_CONFED_SEQUENCE
- && assegment->type != AS_CONFED_SET)
+ /* Increment counts */
+ switch (assegment->type)
{
- if (assegment->type == AS_SEQUENCE)
- count += assegment->length;
- else if (assegment->type == AS_SET)
- count++;
+ case AS_SEQUENCE:
+ count += assegment->length;
+ break;
+ case AS_SET:
+ count++;
+ break;
+ case AS_CONFED_SEQUENCE:
+ confed_count += assegment->length;
+ break;
+ case AS_CONFED_SET:
+ confed_count++;
+ break;
}
for (i = 0; i < assegment->length; i++)
@@ -247,6 +256,7 @@ aspath_make_str_count (struct aspath *as)
str_buf[str_pnt] = '\0';
as->count = count;
+ as->confed_count = confed_count;
return str_buf;
}