summaryrefslogtreecommitdiff
path: root/nest/a-path.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-11-09 22:54:39 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-11-09 22:54:39 +0100
commit3f22fa9e74c8643d3e4f7e3a7b4f2aa992ad09f5 (patch)
tree703e2606e1f01118098ad662f0ecc54c0c48fcd6 /nest/a-path.c
parenta6bc04d59130c49a1dbfadffa4285b11e2ff4939 (diff)
parentb7c0e93ebd40cdc4f6e89067a3e5f7293263c7f9 (diff)
Merge branch 'dev' into ospf3
Diffstat (limited to 'nest/a-path.c')
-rw-r--r--nest/a-path.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index 5aacf8f2..c804619b 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -13,6 +13,7 @@
#include "lib/resource.h"
#include "lib/unaligned.h"
#include "lib/string.h"
+#include "filter/filter.h"
/* Global AS4 support, shared by all BGP instances.
@@ -188,6 +189,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;
@@ -206,7 +213,7 @@ as_path_getlen(struct adata *path)
}
int
-as_path_get_first(struct adata *path, u32 *orig_as)
+as_path_get_last(struct adata *path, u32 *orig_as)
{
int bs = bgp_as4_support ? 4 : 2;
int found = 0;
@@ -222,8 +229,7 @@ as_path_get_first(struct adata *path, u32 *orig_as)
case AS_PATH_SET:
if (len = *p++)
{
- found = 1;
- res = get_as(p);
+ found = 0;
p += bs * len;
}
break;
@@ -239,12 +245,13 @@ as_path_get_first(struct adata *path, u32 *orig_as)
}
}
- *orig_as = res;
+ if (found)
+ *orig_as = res;
return found;
}
int
-as_path_get_last(struct adata *path, u32 *last_as)
+as_path_get_first(struct adata *path, u32 *last_as)
{
u8 *p = path->data;