diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-path.c | 14 | ||||
-rw-r--r-- | nest/attrs.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/nest/a-path.c b/nest/a-path.c index f4666911..5e3ecfd4 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -244,6 +244,20 @@ as_path_get_first(struct adata *path, u32 *orig_as) } int +as_path_get_last(struct adata *path, u32 *last_as) +{ + u8 *p = path->data; + + if ((path->length == 0) || (p[0] != AS_PATH_SEQUENCE) || (p[1] == 0)) + return 0; + else + { + *last_as = get_as(p+2); + return 1; + } +} + +int as_path_is_member(struct adata *path, u32 as) { int bs = bgp_as4_support ? 4 : 2; diff --git a/nest/attrs.h b/nest/attrs.h index aaa5f4a2..fee2c2c8 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -27,6 +27,7 @@ int as_path_convert_to_new(struct adata *path, byte *dst, int req_as); void as_path_format(struct adata *path, byte *buf, unsigned int size); int as_path_getlen(struct adata *path); int as_path_get_first(struct adata *path, u32 *orig_as); +int as_path_get_last(struct adata *path, u32 *last_as); int as_path_is_member(struct adata *path, u32 as); |