]>
git.ipfire.org Git - thirdparty/bird.git/blob - filter/f-util.c
2 * Filters: utility functions
4 * Copyright 1998 Pavel Machek <pavel@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
10 #include "conf/conf.h"
11 #include "filter/filter.h"
13 #define P(a,b) ((a<<8) | b)
19 ret
= cfg_alloc(sizeof(struct f_inst
));
20 ret
->code
= ret
->aux
= 0;
21 ret
->arg1
= ret
->arg2
= ret
->next
= NULL
;
22 ret
->lineno
= ifs
->lino
;
27 f_new_dynamic_attr(int type
, int f_type UNUSED
, int code
)
29 /* FIXME: Remove the f_type parameter? */
30 struct f_inst
*f
= f_new_inst();
37 * Generate set_dynamic( operation( get_dynamic(), argument ) )
40 f_generate_complex(int operation
, int operation_aux
, struct f_inst
*dyn
, struct f_inst
*argument
)
42 struct f_inst
*set_dyn
= f_new_inst(),
47 get_dyn
->code
= P('e','a');
48 oper
->code
= operation
;
49 oper
->aux
= operation_aux
;
51 oper
->a2
.p
= argument
;
52 set_dyn
->code
= P('e','S');
58 f_generate_roa_check(struct rtable_config
*table
, struct f_inst
*prefix
, struct f_inst
*asn
)
60 struct f_inst_roa_check
*ret
= cfg_allocz(sizeof(struct f_inst_roa_check
));
61 ret
->i
.code
= P('R','C');
62 ret
->i
.lineno
= ifs
->lino
;
65 /* prefix == NULL <-> asn == NULL */
67 if (table
->addr_type
!= NET_ROA4
&& table
->addr_type
!= NET_ROA6
)
68 cf_error("%s is not a ROA table", table
->name
);
75 filter_name(struct filter
*filter
)
79 else if (filter
== FILTER_REJECT
)
81 else if (!filter
->name
)