summaryrefslogtreecommitdiff
path: root/nest/a-path.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-07-09 23:27:10 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2013-07-09 23:27:10 +0200
commitcc31b75a8fd7949533c12db2c3e9d67eeaf46d10 (patch)
tree33ce8dbfd3279b121cd70cca13b315d9ecc07a57 /nest/a-path.c
parentc01a94663cc18f53fd741c5d44387eead9ca88af (diff)
Implements 'bgppath ~ int set' filter op.
Diffstat (limited to 'nest/a-path.c')
-rw-r--r--nest/a-path.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index 63ac402e..712e77a3 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -264,6 +264,29 @@ as_path_is_member(struct adata *path, u32 as)
return 0;
}
+int
+as_path_match_set(struct adata *path, struct f_tree *set)
+{
+ u8 *p = path->data;
+ u8 *q = p+path->length;
+ int i, n;
+
+ while (p<q)
+ {
+ n = p[1];
+ p += 2;
+ for (i=0; i<n; i++)
+ {
+ struct f_val v = {T_INT, .val.i = get_as(p)};
+ if (find_tree(set, v))
+ return 1;
+ p += BS;
+ }
+ }
+
+ return 0;
+}
+
struct pm_pos
{