Filter refactoring: Drop the roa check specific f_inst
This commit is contained in:
parent
ca2ee91a80
commit
8436040735
4 changed files with 10 additions and 16 deletions
|
@ -890,7 +890,7 @@
|
||||||
as_path_get_last(e->u.ptr, &as);
|
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)
|
if (!table)
|
||||||
runtime("Missing ROA table");
|
runtime("Missing ROA table");
|
||||||
|
|
||||||
|
|
|
@ -66,18 +66,16 @@ f_generate_complex(int operation, int operation_aux, struct f_dynamic_attr da, s
|
||||||
struct f_inst *
|
struct f_inst *
|
||||||
f_generate_roa_check(struct rtable_config *table, struct f_inst *prefix, struct f_inst *asn)
|
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));
|
struct f_inst *ret = f_new_inst(FI_ROA_CHECK);
|
||||||
ret->i.fi_code = FI_ROA_CHECK;
|
ret->arg1 = prefix;
|
||||||
ret->i.lineno = ifs->lino;
|
ret->arg2 = asn;
|
||||||
ret->i.arg1 = prefix;
|
|
||||||
ret->i.arg2 = asn;
|
|
||||||
/* prefix == NULL <-> asn == NULL */
|
/* prefix == NULL <-> asn == NULL */
|
||||||
|
|
||||||
if (table->addr_type != NET_ROA4 && table->addr_type != NET_ROA6)
|
if (table->addr_type != NET_ROA4 && table->addr_type != NET_ROA6)
|
||||||
cf_error("%s is not a ROA table", table->name);
|
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[] = {
|
static const char * const f_instruction_name_str[] = {
|
||||||
|
|
|
@ -826,9 +826,9 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
||||||
case FI_AS_PATH_LAST_NAG: ONEARG; break;
|
case FI_AS_PATH_LAST_NAG: ONEARG; break;
|
||||||
case FI_ROA_CHECK:
|
case FI_ROA_CHECK:
|
||||||
TWOARGS;
|
TWOARGS;
|
||||||
/* Does not really make sense - ROA check results may change anyway */
|
/* FIXME: ROA check results may change anyway */
|
||||||
if (strcmp(((struct f_inst_roa_check *) f1)->rtc->name,
|
if (strcmp(f1->a[2].rtc->name,
|
||||||
((struct f_inst_roa_check *) f2)->rtc->name))
|
f2->a[2].rtc->name))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case FI_FORMAT: ONEARG; break;
|
case FI_FORMAT: ONEARG; break;
|
||||||
|
|
|
@ -124,6 +124,7 @@ struct f_inst { /* Instruction */
|
||||||
union {
|
union {
|
||||||
uint i;
|
uint i;
|
||||||
void *p;
|
void *p;
|
||||||
|
struct rtable_config *rtc;
|
||||||
} a[3]; /* The three arguments */
|
} a[3]; /* The three arguments */
|
||||||
struct f_val val; /* The value if FI_CONSTANT */
|
struct f_val val; /* The value if FI_CONSTANT */
|
||||||
};
|
};
|
||||||
|
@ -134,11 +135,6 @@ struct f_inst { /* Instruction */
|
||||||
#define arg2 a[1].p
|
#define arg2 a[1].p
|
||||||
#define arg3 a[2].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 {
|
struct filter {
|
||||||
char *name;
|
char *name;
|
||||||
struct f_inst *root;
|
struct f_inst *root;
|
||||||
|
|
Loading…
Reference in a new issue