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

View file

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