summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.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_route.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_route.c')
-rw-r--r--bgpd/bgp_route.c24
1 files changed, 20 insertions, 4 deletions
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. */