]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Bugfix in i_same (comparing of paths still does not work).
authorPavel Machek <pavel@ucw.cz>
Wed, 26 Apr 2000 09:30:12 +0000 (09:30 +0000)
committerPavel Machek <pavel@ucw.cz>
Wed, 26 Apr 2000 09:30:12 +0000 (09:30 +0000)
filter/config.Y
filter/filter.c
filter/test.conf

index ffb9a74cc401d16c36a15c6742f6aa50e1ffb592..5f362723396f1057664131a7c65c486f8cfdc362 100644 (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; }
  ;
 
 /*
index fd099a6c90beb3f519cd3e141d8487666740ff73..350cb08e91374f031927fddcf5869f24f901b8e4 100644 (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,11 +54,12 @@ 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;
   }
 }
 
-int 
+int
 val_simple_in_range(struct f_val v1, struct f_val v2)
 {
   if ((v1.type == T_PATH) && (v2.type == T_PATH_MASK))
@@ -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);
index f04417789cb480781971097331ef90740322c2bb..e03f5914dca803d3ca0ff7868cbf019dba8488dc 100644 (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