mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Filters: first parts of extended attributes being read-write. It can
not actually work since I do not do rta/rte cow, yet.
This commit is contained in:
parent
c7b43f33ae
commit
f31156ca21
@ -27,7 +27,7 @@ CF_HDR
|
|||||||
|
|
||||||
CF_DECLS
|
CF_DECLS
|
||||||
|
|
||||||
CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST,
|
CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST, UNSET,
|
||||||
ACCEPT, REJECT, ERROR, QUITBIRD,
|
ACCEPT, REJECT, ERROR, QUITBIRD,
|
||||||
INT, BOOL, IP, PREFIX, PAIR, SET, STRING,
|
INT, BOOL, IP, PREFIX, PAIR, SET, STRING,
|
||||||
IF, THEN, ELSE, CASE,
|
IF, THEN, ELSE, CASE,
|
||||||
@ -360,7 +360,11 @@ cmd:
|
|||||||
| RTA '.' any_dynamic '=' term ';' {
|
| RTA '.' any_dynamic '=' term ';' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
$$->code = 'eS';
|
$$->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; }
|
| break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
|
||||||
| SYM '(' var_list ')' ';' {
|
| SYM '(' var_list ')' ';' {
|
||||||
|
@ -159,6 +159,7 @@ val_print(struct f_val v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct rte **f_rte;
|
static struct rte **f_rte;
|
||||||
|
static struct linpool *f_pool;
|
||||||
|
|
||||||
static struct f_val interpret(struct f_inst *what);
|
static struct f_val interpret(struct f_inst *what);
|
||||||
|
|
||||||
@ -332,6 +333,32 @@ interpret(struct f_inst *what)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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 ... */
|
case 'cp': /* Convert prefix to ... */
|
||||||
ONEARG;
|
ONEARG;
|
||||||
if (v1.type != T_PREFIX)
|
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 );
|
debug( "Running filter `%s'...", filter->name );
|
||||||
|
|
||||||
f_rte = rte;
|
f_rte = rte;
|
||||||
|
f_pool = tmp_pool;
|
||||||
inst = filter->root;
|
inst = filter->root;
|
||||||
res = interpret(inst);
|
res = interpret(inst);
|
||||||
if (res.type != T_RETURN)
|
if (res.type != T_RETURN)
|
||||||
|
Loading…
Reference in New Issue
Block a user