diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-01 19:32:41 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-01 19:32:41 +0200 |
commit | 92a72a4cbdd010f69e8d054019770e55a47637e0 (patch) | |
tree | 75c45f29473f4ad20a3ff7031ad7720273c1e149 /nest | |
parent | f429d4348275030a9f488046c4021aa377ad1a79 (diff) |
Adds support for dynamic pair and bgp mask expressions.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-path.c | 11 | ||||
-rw-r--r-- | nest/attrs.h | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/nest/a-path.c b/nest/a-path.c index f5499877..dba214d2 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -401,6 +401,7 @@ as_path_match(struct adata *path, struct f_path_mask *mask) struct pm_pos pos[2048 + 1]; int plen = parse_path(path, pos); int l, h, i, nh, nl; + u32 val; /* l and h are bound of interval of positions where are marked states */ @@ -424,14 +425,20 @@ as_path_match(struct adata *path, struct f_path_mask *mask) h = plen; break; - case PM_QUESTION: case PM_ASN: + val = mask->val; + goto step; + case PM_ASN_EXPR: + val = f_eval_asn((struct f_inst *) mask->val); + goto step; + case PM_QUESTION: + step: nh = -1; for (i = h; i >= l; i--) if (pos[i].mark) { pos[i].mark = 0; - if ((mask->kind == PM_QUESTION) || pm_match(pos + i, mask->val)) + if ((mask->kind == PM_QUESTION) || pm_match(pos + i, val)) pm_mark(pos, i, plen, &nl, &nh); } diff --git a/nest/attrs.h b/nest/attrs.h index 5542be6f..b838ce96 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -35,11 +35,12 @@ int as_path_is_member(struct adata *path, u32 as); #define PM_ASN 0 #define PM_QUESTION 1 #define PM_ASTERISK 2 +#define PM_ASN_EXPR 3 struct f_path_mask { struct f_path_mask *next; int kind; - u32 val; + uintptr_t val; }; int as_path_match(struct adata *path, struct f_path_mask *mask); |