diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-26 01:06:12 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-26 01:06:12 +0200 |
commit | 5004d02cb9df1f3ee231632a8e89929f4eb4f088 (patch) | |
tree | 8234ffd37efe0a3f9fc8d376f03287b6182a3184 /filter | |
parent | 1876e18d32fa4b21888aae2c984b1b61338c3e60 (diff) | |
parent | 99355da18f8598e93d0e55167582da9687eae082 (diff) |
Merge branch 'master' into dev
Diffstat (limited to 'filter')
-rw-r--r-- | filter/config.Y | 3 | ||||
-rw-r--r-- | filter/filter.c | 14 | ||||
-rw-r--r-- | filter/test.conf | 5 |
3 files changed, 18 insertions, 4 deletions
diff --git a/filter/config.Y b/filter/config.Y index 5cff47eb..ee4e638d 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -396,8 +396,9 @@ symbol: case SYM_VARIABLE | T_PATH: case SYM_VARIABLE | T_PATH_MASK: case SYM_VARIABLE | T_CLIST: - $$->code = 'C'; + $$->code = 'V'; $$->a1.p = $1->def; + $$->a2.p = $1->name; break; default: cf_error("%s: variable expected.", $1->name ); diff --git a/filter/filter.c b/filter/filter.c index 9c1dfa34..3df0f0c6 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -64,6 +64,8 @@ pm_path_compare(struct f_path_mask *m1, struct f_path_mask *m2) while (1) { if ((!m1) || (!m2)) return !((!m1) && (!m2)); + + if ((m1->kind != m2->kind) || (m1->val != m2->val)) return 1; m1 = m1->next; m2 = m2->next; } @@ -136,7 +138,8 @@ val_compare(struct f_val v1, struct f_val v2) } switch (v1.type) { case T_ENUM: - case T_INT: + case T_INT: + case T_BOOL: case T_PAIR: if (v1.val.i == v2.val.i) return 0; if (v1.val.i < v2.val.i) return -1; @@ -156,7 +159,7 @@ val_compare(struct f_val v1, struct f_val v2) case T_STRING: return strcmp(v1.val.s, v2.val.s); default: - debug( "Compare of unkown entities: %x\n", v1.type ); + debug( "Compare of unknown entities: %x\n", v1.type ); return CMP_ERROR; } } @@ -501,6 +504,7 @@ interpret(struct f_inst *what) else res.val.i = what->a2.i; break; + case 'V': case 'C': res = * ((struct f_val *) what->a1.p); break; @@ -868,10 +872,12 @@ i_same(struct f_inst *f1, struct f_inst *f2) case T_PREFIX_SET: if (!trie_same(f1->a2.p, f2->a2.p)) return 0; + break; case T_SET: if (!same_tree(f1->a2.p, f2->a2.p)) return 0; + break; case T_STRING: if (strcmp(f1->a2.p, f2->a2.p)) @@ -886,6 +892,10 @@ i_same(struct f_inst *f1, struct f_inst *f2) if (val_compare(* (struct f_val *) f1->a1.p, * (struct f_val *) f2->a1.p)) return 0; break; + case 'V': + if (strcmp((char *) f1->a2.p, (char *) f2->a2.p)) + return 0; + break; case 'p': case 'L': ONEARG; break; case '?': TWOARGS; break; case '0': case 'E': break; diff --git a/filter/test.conf b/filter/test.conf index 7c05af05..f3b79619 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -171,6 +171,9 @@ string s; b = true; print "Testing bool: ", b, ", ", !b; + + if ( b = true ) then print "Testing bool comparison b = true: ", b; + else { print "*** FAIL: TRUE test failed" ; quitbird; } pxs = [ 1.2.0.0/16, 1.4.0.0/16+]; print "Testing prefix sets: "; @@ -218,4 +221,4 @@ int j; accept "ok I take that"; } -eval __startup();
\ No newline at end of file +eval __startup(); |