summaryrefslogtreecommitdiffstats
path: root/filter/filter.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-04-17 12:50:03 +0200
committerPavel Machek <pavel@ucw.cz>2000-04-17 12:50:03 +0200
commit4b641bab521c4fbabf931c3eac7704e8e2cab298 (patch)
tree52280a7d323d618f3adc0b0e0f05c6a85ef92aeb /filter/filter.c
parente399b6f6ad91e6f94081dfe694740451100c7a7f (diff)
downloadbird-4b641bab521c4fbabf931c3eac7704e8e2cab298.tar
bird-4b641bab521c4fbabf931c3eac7704e8e2cab298.zip
Path matching now actually works, including / * 1 2 3 * /.
Diffstat (limited to 'filter/filter.c')
-rw-r--r--filter/filter.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/filter/filter.c b/filter/filter.c
index d8124b7..a20076f 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -592,7 +592,6 @@ filters_postconfig(void)
die( "Startup function resulted in error." );
debug( "done\n" );
}
- self_test();
}
int
@@ -674,11 +673,8 @@ path_format(u8 *p, int len)
#undef PRINTF
#undef COMMA
-#define PM_END -1
-#define PM_ASTERIX -2
-
#define MASK_PLUS do { mask = mask->next; if (!mask) return next == q; \
- asterix = (mask->val == PM_ASTERIX); \
+ asterix = (mask->val == PM_ANY); \
if (asterix) { mask = mask->next; if (!mask) { return 1; } } \
} while(0)
@@ -690,6 +686,9 @@ path_match(u8 *p, int len, struct f_path_mask *mask)
u8 *q = p+len;
u8 *next;
+ asterix = (mask->val == PM_ANY);
+ if (asterix) { mask = mask->next; if (!mask) { return 1; } }
+
while (p<q) {
switch (*p++) {
case 1: /* This is a set */
@@ -789,19 +788,3 @@ adata_empty(struct linpool *pool)
res->length = 0;
return res;
}
-
-void
-self_test(void)
-{
- char path1[] = { 2, 5, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1 };
- char path2[] = { 2, 5, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1, 1, 5, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1 };
- s32 match[] = { 5, PM_ASTERIX, 2, PM_ASTERIX, 1, 3, PM_END };
-
- DBG( "Filters self-testing:\n" );
- DBG( "%s\n", path_format(path1, sizeof(path1)) );
- DBG( "%s\n", path_format(path2, sizeof(path2)) );
- DBG( "5, 6 = %d, %d\n", path_getlen(path1, sizeof(path1)), path_getlen(path2, sizeof(path2)) );
-// DBG( "%d\n", path_match(path1, sizeof(path1), match));
-// DBG( "%d\n", path_match(path2, sizeof(path2), match));
-// die( "okay" );
-}