summaryrefslogtreecommitdiff
path: root/nest/a-path.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:09:31 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:28:33 +0200
commit7a7ac656829223713f9e6bcef63d2b5a5efce7d2 (patch)
tree153afd214a815124b37fcd88c66134d716a390cf /nest/a-path.c
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
parent06edbb67ed807811654e7fd8f0f9b83766430216 (diff)
Merge branch 'master' into int-new-channels
Diffstat (limited to 'nest/a-path.c')
-rw-r--r--nest/a-path.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index c9c5aefb..32e2d27e 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -220,7 +220,7 @@ as_path_get_last(struct adata *path, u32 *orig_as)
p += BS * len;
}
break;
- default: bug("as_path_get_first: Invalid path segment");
+ default: bug("Invalid path segment");
}
}
@@ -229,6 +229,35 @@ as_path_get_last(struct adata *path, u32 *orig_as)
return found;
}
+u32
+as_path_get_last_nonaggregated(struct adata *path)
+{
+ u8 *p = path->data;
+ u8 *q = p+path->length;
+ u32 res = 0;
+ int len;
+
+ while (p<q)
+ {
+ switch (*p++)
+ {
+ case AS_PATH_SET:
+ return res;
+
+ case AS_PATH_SEQUENCE:
+ if (len = *p++)
+ res = get_as(p + BS * (len - 1));
+ p += BS * len;
+ break;
+
+ default: bug("Invalid path segment");
+ }
+ }
+
+ return res;
+}
+
+
int
as_path_get_first(struct adata *path, u32 *last_as)
{