Skip to content

Commit c781471

Browse files
committed
netfilter: nf_tables: missing error reporting for not selected expressions
Sometimes users forget to turn on nftables extensions from Kconfig that they need. In such case, the error reporting from userspace is misleading: $ sudo nft add rule x y counter Error: Could not process rule: No such file or directory add rule x y counter ^^^^^^^^^^^^^^^^^^^^ Add missing NL_SET_BAD_ATTR() to provide a hint: $ nft add rule x y counter Error: Could not process rule: No such file or directory add rule x y counter ^^^^^^^ Fixes: 83d9dcb ("netfilter: nf_tables: extended netlink error reporting for expressions") Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 22cbdbc commit c781471

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3328,8 +3328,10 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
33283328
if (n == NFT_RULE_MAXEXPRS)
33293329
goto err1;
33303330
err = nf_tables_expr_parse(&ctx, tmp, &expr_info[n]);
3331-
if (err < 0)
3331+
if (err < 0) {
3332+
NL_SET_BAD_ATTR(extack, tmp);
33323333
goto err1;
3334+
}
33333335
size += expr_info[n].ops->size;
33343336
n++;
33353337
}

0 commit comments

Comments
 (0)