0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

Filter refactoring: Drop the roa check specific f_inst

This commit is contained in:
Maria Matejka 2018-12-20 16:07:59 +01:00
parent ca2ee91a80
commit 8436040735
4 changed files with 10 additions and 16 deletions

View File

@ -890,7 +890,7 @@
as_path_get_last(e->u.ptr, &as);
}
struct rtable *table = ((struct f_inst_roa_check *) what)->rtc->table;
struct rtable *table = what->a[2].rtc->table;
if (!table)
runtime("Missing ROA table");

View File

@ -66,18 +66,16 @@ f_generate_complex(int operation, int operation_aux, struct f_dynamic_attr da, s
struct f_inst *
f_generate_roa_check(struct rtable_config *table, struct f_inst *prefix, struct f_inst *asn)
{
struct f_inst_roa_check *ret = cfg_allocz(sizeof(struct f_inst_roa_check));
ret->i.fi_code = FI_ROA_CHECK;
ret->i.lineno = ifs->lino;
ret->i.arg1 = prefix;
ret->i.arg2 = asn;
struct f_inst *ret = f_new_inst(FI_ROA_CHECK);
ret->arg1 = prefix;
ret->arg2 = asn;
/* prefix == NULL <-> asn == NULL */
if (table->addr_type != NET_ROA4 && table->addr_type != NET_ROA6)
cf_error("%s is not a ROA table", table->name);
ret->rtc = table;
ret->arg3 = table;
return &ret->i;
return ret;
}
static const char * const f_instruction_name_str[] = {

View File

@ -826,9 +826,9 @@ i_same(struct f_inst *f1, struct f_inst *f2)
case FI_AS_PATH_LAST_NAG: ONEARG; break;
case FI_ROA_CHECK:
TWOARGS;
/* Does not really make sense - ROA check results may change anyway */
if (strcmp(((struct f_inst_roa_check *) f1)->rtc->name,
((struct f_inst_roa_check *) f2)->rtc->name))
/* FIXME: ROA check results may change anyway */
if (strcmp(f1->a[2].rtc->name,
f2->a[2].rtc->name))
return 0;
break;
case FI_FORMAT: ONEARG; break;

View File

@ -124,6 +124,7 @@ struct f_inst { /* Instruction */
union {
uint i;
void *p;
struct rtable_config *rtc;
} a[3]; /* The three arguments */
struct f_val val; /* The value if FI_CONSTANT */
};
@ -134,11 +135,6 @@ struct f_inst { /* Instruction */
#define arg2 a[1].p
#define arg3 a[2].p
/* Not enough fields in f_inst for three args used by roa_check() */
struct f_inst_roa_check {
struct f_inst i;
struct rtable_config *rtc;
};
struct filter {
char *name;
struct f_inst *root;