return chain_error(ctx, ft, "invalid hook %s", ft->hookstr);
if (!evaluate_priority(&ft->priority, NFPROTO_NETDEV, ft->hooknum))
- return chain_error(ctx, ft, "'%s' is invalid priority.",
- ft->priority.str);
+ return __stmt_binary_error(ctx, &ft->priority.loc, NULL,
+ "'%s' is invalid priority.",
+ ft->priority.str);
if (!ft->dev_expr)
return chain_error(ctx, ft, "Unbound flowtable not allowed (must specify devices)");
if (!evaluate_priority(&chain->priority, chain->handle.family,
chain->hooknum))
- return chain_error(ctx, chain,
- "'%s' is invalid priority in this context.",
- chain->priority.str);
+ return __stmt_binary_error(ctx, &chain->priority.loc, NULL,
+ "'%s' is invalid priority in this context.",
+ chain->priority.str);
}
list_for_each_entry(rule, &chain->rules, list) {
%destructor { handle_free(&$$); } table_spec tableid_spec chain_spec chainid_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec index_spec
%type <handle> set_spec setid_spec set_identifier flowtable_identifier obj_spec objid_spec obj_identifier
%destructor { handle_free(&$$); } set_spec setid_spec set_identifier obj_spec objid_spec obj_identifier
-%type <val> family_spec family_spec_explicit chain_policy prio_spec
-%type <prio_spec> extended_prio_spec
+%type <val> family_spec family_spec_explicit chain_policy int_num
+%type <prio_spec> extended_prio_spec prio_spec
%type <string> dev_spec quota_unit
%destructor { xfree($$); } dev_spec quota_unit
flowtable_block : /* empty */ { $$ = $<flowtable>-1; }
| flowtable_block common_block
| flowtable_block stmt_separator
- | flowtable_block HOOK STRING PRIORITY extended_prio_spec stmt_separator
+ | flowtable_block HOOK STRING prio_spec stmt_separator
{
$$->hookstr = chain_hookname_lookup($3);
if ($$->hookstr == NULL) {
}
xfree($3);
- $$->priority = $5;
+ $$->priority = $4;
}
| flowtable_block DEVICES '=' flowtable_expr stmt_separator
{
| CLASSID { $$ = xstrdup("classid"); }
;
-hook_spec : TYPE STRING HOOK STRING dev_spec PRIORITY extended_prio_spec
+hook_spec : TYPE STRING HOOK STRING dev_spec prio_spec
{
const char *chain_type = chain_type_name_lookup($2);
xfree($4);
$<chain>0->dev = $5;
- $<chain>0->priority = $7;
+ $<chain>0->priority = $6;
$<chain>0->flags |= CHAIN_F_BASECHAIN;
}
;
-extended_prio_spec : prio_spec
+prio_spec : PRIORITY extended_prio_spec
+ {
+ $$ = $2;
+ $$.loc = @$;
+ }
+ ;
+
+extended_prio_spec : int_num
{
struct prio_spec spec = {0};
spec.num = $1;
}
;
-prio_spec : NUM { $$ = $1; }
+int_num : NUM { $$ = $1; }
| DASH NUM { $$ = -$2; }
;