summaryrefslogtreecommitdiff
path: root/bgpd/bgp_aspath.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_aspath.c')
-rw-r--r--bgpd/bgp_aspath.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 317e9f8d..327406fa 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -434,6 +434,26 @@ aspath_size (struct aspath *aspath)
return size;
}
+/* Return highest public ASN in path */
+as_t
+aspath_highest (struct aspath *aspath)
+{
+ struct assegment *seg = aspath->segments;
+ as_t highest = 0;
+ unsigned int i;
+
+ while (seg)
+ {
+ for (i = 0; i < seg->length; i++)
+ if (seg->as[i] > highest
+ && (seg->as[i] < BGP_PRIVATE_AS_MIN
+ || seg->as[i] > BGP_PRIVATE_AS_MAX))
+ highest = seg->as[i];
+ seg = seg->next;
+ }
+ return highest;
+}
+
/* Convert aspath structure to string expression. */
static char *
aspath_make_str_count (struct aspath *as)