summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/f-inst.c2
-rw-r--r--filter/f-util.c12
-rw-r--r--filter/filter.c6
-rw-r--r--filter/filter.h6
4 files changed, 10 insertions, 16 deletions
diff --git a/filter/f-inst.c b/filter/f-inst.c
index fb2f043c..37de2a1e 100644
--- a/filter/f-inst.c
+++ b/filter/f-inst.c
@@ -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");
diff --git a/filter/f-util.c b/filter/f-util.c
index d7678fa1..11a5e97e 100644
--- a/filter/f-util.c
+++ b/filter/f-util.c
@@ -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[] = {
diff --git a/filter/filter.c b/filter/filter.c
index c54bedea..c2184f0b 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -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;
diff --git a/filter/filter.h b/filter/filter.h
index e483d223..06e87a8f 100644
--- a/filter/filter.h
+++ b/filter/filter.h
@@ -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;