diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2013-10-21 14:58:32 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2013-10-21 14:59:35 +0200 |
commit | a15dab76f93337b07b4b03a64ac3bac26285dfd9 (patch) | |
tree | ef2593148938733814a8b4b1a6fceb60e5c30886 /nest | |
parent | f8cc7396cf25328b002394bbd7af679188b03370 (diff) |
Implements 'allow local as' option.
Similar to allowas-in option on other routers.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-path.c | 6 | ||||
-rw-r--r-- | nest/attrs.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/nest/a-path.c b/nest/a-path.c index b1812981..dc36e653 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -244,10 +244,11 @@ as_path_get_first(struct adata *path, u32 *last_as) } int -as_path_is_member(struct adata *path, u32 as) +as_path_contains(struct adata *path, u32 as, int min) { u8 *p = path->data; u8 *q = p+path->length; + int num = 0; int i, n; while (p<q) @@ -257,7 +258,8 @@ as_path_is_member(struct adata *path, u32 as) for(i=0; i<n; i++) { if (get_as(p) == as) - return 1; + if (++num == min) + return 1; p += BS; } } diff --git a/nest/attrs.h b/nest/attrs.h index a0dae221..b6e067cb 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -35,7 +35,7 @@ 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); +int as_path_contains(struct adata *path, u32 as, int min); int as_path_match_set(struct adata *path, struct f_tree *set); struct adata *as_path_filter(struct linpool *pool, struct adata *path, struct f_tree *set, u32 key, int pos); |