summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nest/a-path.c6
-rw-r--r--nest/attrs.h1
-rw-r--r--proto/bgp/attrs.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index dba214d2..0a4bf829 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -188,6 +188,12 @@ int
as_path_getlen(struct adata *path)
{
int bs = bgp_as4_support ? 4 : 2;
+ return as_path_getlen_int(path, bs);
+}
+
+int
+as_path_getlen_int(struct adata *path, int bs)
+{
int res = 0;
u8 *p = path->data;
u8 *q = p+path->length;
diff --git a/nest/attrs.h b/nest/attrs.h
index b838ce96..eee6b378 100644
--- a/nest/attrs.h
+++ b/nest/attrs.h
@@ -28,6 +28,7 @@ int as_path_convert_to_old(struct adata *path, byte *dst, int *new_used);
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_getlen_int(struct adata *path, int bs);
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);
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 68f21b97..bf976a6e 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1189,7 +1189,7 @@ bgp_reconstruct_4b_atts(struct bgp_proto *p, rta *a, struct linpool *pool)
if (a4)
log(L_WARN "%s: AS4_AGGREGATOR attribute received, but AGGREGATOR attribute is missing", p->p.name);
- int p2_len = as_path_getlen(p2->u.ptr);
+ int p2_len = as_path_getlen_int(p2->u.ptr, 2);
int p4_len = p4 ? validate_as4_path(p, p4->u.ptr) : -1;
if (p4 && (p4_len < 0))