Bugfix in i_same (comparing of paths still does not work).

This commit is contained in:
Pavel Machek 2000-04-26 09:30:12 +00:00
parent 7a86a8b08d
commit f71bded6e9
3 changed files with 11 additions and 20 deletions

View file

@ -335,7 +335,7 @@ constant:
| prefix_s {NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; } | prefix_s {NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; }
| '[' set_items ']' { DBG( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_SET; $$->a2.p = build_tree($2); DBG( "ook\n" ); } | '[' set_items ']' { DBG( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_SET; $$->a2.p = build_tree($2); DBG( "ook\n" ); }
| ENUM { $$ = f_new_inst(); $$->code = 'c'; $$->aux = $1 >> 16; $$->a2.i = $1 & 0xffff; } | ENUM { $$ = f_new_inst(); $$->code = 'c'; $$->aux = $1 >> 16; $$->a2.i = $1 & 0xffff; }
| '/' bgp_path '/' { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_PATH_MASK; $$->a2.p = $2; } | '/' bgp_path '/' { NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; val->type = T_PATH_MASK; val->val.path_mask = $2; $$->a1.p = val; }
; ;
/* /*

View file

@ -39,8 +39,10 @@ val_compare(struct f_val v1, struct f_val v2)
if (v2.type == T_VOID) if (v2.type == T_VOID)
return 1; return 1;
if (v1.type != v2.type) if (v1.type != v2.type) {
debug( "Types do not match in val_compare\n" );
return CMP_ERROR; return CMP_ERROR;
}
switch (v1.type) { switch (v1.type) {
case T_ENUM: case T_ENUM:
case T_INT: case T_INT:
@ -52,6 +54,7 @@ val_compare(struct f_val v1, struct f_val v2)
case T_PREFIX: case T_PREFIX:
return ipa_compare(v1.val.px.ip, v2.val.px.ip); return ipa_compare(v1.val.px.ip, v2.val.px.ip);
default: default:
debug( "Compare of unkown entities: %x\n", v1.type );
return CMP_ERROR; return CMP_ERROR;
} }
} }
@ -574,7 +577,7 @@ i_same(struct f_inst *f1, struct f_inst *f2)
case 'c': A2_SAME; break; case 'c': A2_SAME; break;
case 'C': case 'C':
if (val_compare(* (struct f_val *) f1->a1.p, * (struct f_val *) f2->a2.p)) if (val_compare(* (struct f_val *) f1->a1.p, * (struct f_val *) f2->a1.p))
return 0; return 0;
break; break;
case 'p': case 'L': ONEARG; break; case 'p': case 'L': ONEARG; break;
@ -629,8 +632,10 @@ filters_postconfig(void)
{ {
struct f_val res; struct f_val res;
#if 1
if (!i_same(test1_func, test2_func)) if (!i_same(test1_func, test2_func))
bug("i_same does not work"); bug("i_same does not work");
#endif
if (startup_func) { if (startup_func) {
debug( "Launching startup function...\n" ); debug( "Launching startup function...\n" );
f_pool = lp_new(&root_pool, 1024); f_pool = lp_new(&root_pool, 1024);

View file

@ -118,26 +118,12 @@ ip p;
function __test1() function __test1()
{ {
if source = RTS_STATIC then { print bgp_path ~ / 65000 /;
bgp_community = -empty-;
bgp_community.add((65000,5678));
if bgp_path ~ / 65000 / then
bgp_path.prepend(65000);
accept;
}
reject;
} }
function __test2() function __test2()
{ {
if source = RTS_STATIC then { print bgp_path ~ / 65000 /;
bgp_community = -empty-;
bgp_community.add((65000,5678));
if bgp_path ~ / 65000 / then
bgp_path.prepend(65000);
accept;
}
reject;
} }
filter testf filter testf