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");
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[] = {
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;
union {
uint i;
void *p;
+ struct rtable_config *rtc;
} a[3]; /* The three arguments */
struct f_val val; /* The value if FI_CONSTANT */
};
#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;