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_route.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'bgpd/bgp_route.c') diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4f3847d6..8d992495 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -213,10 +213,26 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist) /* 4. AS path length check. */ if (! bgp_flag_check (bgp, BGP_FLAG_ASPATH_IGNORE)) { - if (new->attr->aspath->count < exist->attr->aspath->count) - return 1; - if (new->attr->aspath->count > exist->attr->aspath->count) - return 0; + if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_CONFED)) + { + if ((new->attr->aspath->count + + new->attr->aspath->confed_count) + < (exist->attr->aspath->count + + exist->attr->aspath->confed_count)) + return 1; + if ((new->attr->aspath->count + + new->attr->aspath->confed_count) + > (exist->attr->aspath->count + + exist->attr->aspath->confed_count)) + return 0; + } + else + { + if (new->attr->aspath->count < exist->attr->aspath->count) + return 1; + if (new->attr->aspath->count > exist->attr->aspath->count) + return 0; + } } /* 5. Origin check. */ -- cgit v1.2.1