]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
tmp_attrs fixed.
authorPavel Machek <pavel@ucw.cz>
Wed, 1 Mar 2000 14:31:31 +0000 (14:31 +0000)
committerPavel Machek <pavel@ucw.cz>
Wed, 1 Mar 2000 14:31:31 +0000 (14:31 +0000)
I do not know if it is right since mj ingores talk once started :-(.

filter/config.Y
filter/f-util.c
filter/filter.c

index ed94b9bf8167b9264c069f058c5b5606a79c5605..c4633fc7ec7de07a2b1cbd4c3a0cee3af617c5fa 100644 (file)
@@ -424,7 +424,7 @@ cmd:
    }
  | UNSET '(' rtadot dynamic_attr ')' ';' {
      $$ = $4;
-     $$->aux = T_VOID;
+     $$->aux = EAF_TYPE_UNDEF | EAF_INLINE;
      $$->code = P('e','S');
      $$->a1.p = NULL;
    }
index 2bc78737c3d09029769e7496ab8f8cd59b668b18..6a42b9d3ce3c602c3e75d28746c3959e6d218aec 100644 (file)
@@ -36,7 +36,7 @@ struct f_inst *
 f_new_dynamic_attr(int code)
 {
   struct f_inst *f = f_new_inst();
-  f->aux = T_INT;
+  f->aux = EAF_TYPE_INT | EAF_INLINE;
   f->a2.i = code;
   return f;
 }
index cbbd1b5803fc9967612ad92694f8325d560a42c1..f0de20d7a7750e134d36f6d980323566fe1f2acd 100644 (file)
@@ -142,6 +142,7 @@ val_print(struct f_val v)
 
 static struct rte **f_rte, *f_rte_old;
 static struct linpool *f_pool;
+static struct ea_list **f_tmp_attrs;
 
 #define runtime(x) do { \
     log( L_ERR x ); \
@@ -319,7 +320,8 @@ interpret(struct f_inst *what)
   case P('e','a'):     /* Access to extended attributes */
     {
       eattr *e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i );
-      /* FIXME: should I search in tmp_attrs, too, or what ? */
+      if (!e) 
+       e = ea_find( (*f_tmp_attrs), what->a2.i );
       if (!e) {
        res.type = T_VOID;
        break;
@@ -345,19 +347,28 @@ interpret(struct f_inst *what)
       l->count = 1;
       l->attrs[0].id = what->a2.i;
       l->attrs[0].flags = 0;
-      switch (what->aux) {
-      case T_INT:
-       l->attrs[0].type = EAF_TYPE_INT | EAF_INLINE;
+      l->attrs[0].type = what->aux;
+      switch (what->aux & EAF_TYPE_MASK) {
+      case EAF_TYPE_INT:
+       if (v1.type != T_INT)
+         runtime( "Setting int attribute to non-int value" );
        l->attrs[0].u.data = v1.val.i;
        break;
-      case T_VOID:
-       l->attrs[0].type = EAF_TYPE_UNDEF | EAF_INLINE;
+      case EAF_TYPE_UNDEF:
+       if (v1.type != T_VOID)
+         runtime( "Setting void attribute to non-void value" );
        l->attrs[0].u.data = 0;
        break;
       }
-      *f_rte = rte_do_cow(*f_rte);
-      l->next = (*f_rte)->attrs->eattrs;
-      (*f_rte)->attrs->eattrs = l;
+
+      if (what->aux & EAF_INLINE) {
+       *f_rte = rte_do_cow(*f_rte);
+       l->next = (*f_rte)->attrs->eattrs;
+       (*f_rte)->attrs->eattrs = l;
+      } else {
+       l->next = (*f_tmp_attrs);
+       (*f_tmp_attrs) = l;
+      }
     }
     break;
 
@@ -494,8 +505,6 @@ i_same(struct f_inst *f1, struct f_inst *f2)
   return i_same(f1->next, f2->next);
 }
 
-/* FIXME: tmp_attrs is unreferenced. That can't be right.
-   Strange. look at eS how dynamic attrs are set. */
 int
 f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool)
 {
@@ -503,6 +512,7 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc
   struct f_val res;
   debug( "Running filter `%s'...", filter->name );
 
+  f_tmp_attrs = tmp_attrs;
   f_rte = rte;
   f_rte_old = *rte;
   f_pool = tmp_pool;