From 6811845b67999861388cf00d3ca0ee8471d29876 Mon Sep 17 00:00:00 2001 From: hasso Date: Fri, 8 Apr 2005 15:40:36 +0000 Subject: * 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. --- bgpd/bgp_aspath.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'bgpd/bgp_aspath.c') 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; } -- cgit v1.2.1