]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filters: first parts of extended attributes being read-write. It can
authorPavel Machek <pavel@ucw.cz>
Thu, 18 Nov 1999 14:29:10 +0000 (14:29 +0000)
committerPavel Machek <pavel@ucw.cz>
Thu, 18 Nov 1999 14:29:10 +0000 (14:29 +0000)
not actually work since I do not do rta/rte cow, yet.

filter/config.Y
filter/filter.c

index 0a14856008453c02a918318bfe45674e9b460b9b..a24b15752140e4554e0727fbc595106d12b1ffe9 100644 (file)
@@ -27,7 +27,7 @@ CF_HDR
 
 CF_DECLS
 
-CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST,
+CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST, UNSET,
        ACCEPT, REJECT, ERROR, QUITBIRD,
        INT, BOOL, IP, PREFIX, PAIR, SET, STRING,
        IF, THEN, ELSE, CASE,
@@ -360,7 +360,11 @@ cmd:
  | RTA '.' any_dynamic '=' term ';' {
      $$ = $3;
      $$->code  = 'eS';
-
+     $$->a1.p = $5;
+   }
+ | UNSET '(' RTA '.' any_dynamic ')' ';' {
+     $$ = $5;
+     $$->code = 'eD';
    }
  | break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
  | SYM '(' var_list ')' ';' {
index 458b8760967f8e7e06fea5b6fd5cdfe9ff5b7b2e..36830bd156c6b7082955b098a176836ab347307e 100644 (file)
@@ -159,6 +159,7 @@ val_print(struct f_val v)
 }
 
 static struct rte **f_rte;
+static struct linpool *f_pool;
 
 static struct f_val interpret(struct f_inst *what);
 
@@ -332,6 +333,32 @@ interpret(struct f_inst *what)
       }
     }
     break;
+  case 'eS':
+    ONEARG;
+    if (v1.type != what->aux)
+      runtime("Wrong type when setting dynamic attribute\n");
+
+    /* This willl only work if it is not already there! */
+    {
+      struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr));
+
+      l->next = NULL;
+      l->flags = EALF_SORTED;
+      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].u.data = v1.val.i;
+       break;
+      }
+      /* FIXME: need to do copy on write of rte + rta + insert at the beggining */
+    }
+
+  case 'eD':    /*FIXME: unset:  implement me */
+    die("Implement me!!!" );
+    break;
   case 'cp':   /* Convert prefix to ... */
     ONEARG;
     if (v1.type != T_PREFIX)
@@ -392,6 +419,7 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc
   debug( "Running filter `%s'...", filter->name );
 
   f_rte = rte;
+  f_pool = tmp_pool;
   inst = filter->root;
   res = interpret(inst);
   if (res.type != T_RETURN)