Filters: write access to dynamic attributes should actually work. It
would be nice to find method of testing such beasts.
This commit is contained in:
parent
99bbd23b22
commit
48f9e01954
3 changed files with 15 additions and 7 deletions
|
@ -364,7 +364,9 @@ cmd:
|
||||||
}
|
}
|
||||||
| UNSET '(' RTA '.' any_dynamic ')' ';' {
|
| UNSET '(' RTA '.' any_dynamic ')' ';' {
|
||||||
$$ = $5;
|
$$ = $5;
|
||||||
$$->code = 'eD';
|
$$->aux = T_VOID;
|
||||||
|
$$->code = 'eS';
|
||||||
|
$$->a1.p = NULL;
|
||||||
}
|
}
|
||||||
| break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
|
| break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
|
||||||
| SYM '(' var_list ')' ';' {
|
| SYM '(' var_list ')' ';' {
|
||||||
|
|
|
@ -158,7 +158,7 @@ val_print(struct f_val v)
|
||||||
printf( buf );
|
printf( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rte **f_rte;
|
static struct rte **f_rte, *f_rte_old;
|
||||||
static struct linpool *f_pool;
|
static struct linpool *f_pool;
|
||||||
|
|
||||||
static struct f_val interpret(struct f_inst *what);
|
static struct f_val interpret(struct f_inst *what);
|
||||||
|
@ -338,7 +338,6 @@ interpret(struct f_inst *what)
|
||||||
if (v1.type != what->aux)
|
if (v1.type != what->aux)
|
||||||
runtime("Wrong type when setting dynamic attribute\n");
|
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));
|
struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr));
|
||||||
|
|
||||||
|
@ -352,13 +351,17 @@ interpret(struct f_inst *what)
|
||||||
l->attrs[0].type = EAF_TYPE_INT | EAF_INLINE;
|
l->attrs[0].type = EAF_TYPE_INT | EAF_INLINE;
|
||||||
l->attrs[0].u.data = v1.val.i;
|
l->attrs[0].u.data = v1.val.i;
|
||||||
break;
|
break;
|
||||||
}
|
case T_VOID:
|
||||||
/* FIXME: need to do copy on write of rte + rta + insert at the beggining */
|
l->attrs[0].type = EAF_TYPE_UNDEF | EAF_INLINE;
|
||||||
}
|
l->attrs[0].u.data = 0;
|
||||||
|
|
||||||
case 'eD': /*FIXME: unset: implement me */
|
|
||||||
die("Implement me!!!" );
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
*f_rte = rte_do_cow(*f_rte);
|
||||||
|
l->next = *f_rte->attrs->eattrs;
|
||||||
|
*f_rte->attrs->eattrs = l;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'cp': /* Convert prefix to ... */
|
case 'cp': /* Convert prefix to ... */
|
||||||
ONEARG;
|
ONEARG;
|
||||||
if (v1.type != T_PREFIX)
|
if (v1.type != T_PREFIX)
|
||||||
|
@ -419,6 +422,7 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc
|
||||||
debug( "Running filter `%s'...", filter->name );
|
debug( "Running filter `%s'...", filter->name );
|
||||||
|
|
||||||
f_rte = rte;
|
f_rte = rte;
|
||||||
|
f_rte_old = *rte;
|
||||||
f_pool = tmp_pool;
|
f_pool = tmp_pool;
|
||||||
inst = filter->root;
|
inst = filter->root;
|
||||||
res = interpret(inst);
|
res = interpret(inst);
|
||||||
|
|
|
@ -73,6 +73,8 @@ int j;
|
||||||
if rta.rip_metric > 15 then {
|
if rta.rip_metric > 15 then {
|
||||||
reject "RIP Metric is more than infinity";
|
reject "RIP Metric is more than infinity";
|
||||||
}
|
}
|
||||||
|
rta.rip_metric = 14;
|
||||||
|
unset(rta.rip_metric);
|
||||||
|
|
||||||
accept "ok I take that";
|
accept "ok I take that";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue