Skip to content

Commit

Permalink
netfilter: nf_tables: set element extended ACK reporting support
Browse files Browse the repository at this point in the history
Report the element that causes problems via netlink extended ACK for set
element commands.

Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
ummakynes committed May 27, 2022
1 parent aeed55a commit b53c116
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -5348,8 +5348,10 @@ static int nf_tables_getsetelem(struct sk_buff *skb,

nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
err = nft_get_set_elem(&ctx, set, attr);
if (err < 0)
if (err < 0) {
NL_SET_BAD_ATTR(extack, attr);
break;
}
}

return err;
Expand Down Expand Up @@ -6126,8 +6128,10 @@ static int nf_tables_newsetelem(struct sk_buff *skb,

nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
err = nft_add_set_elem(&ctx, set, attr, info->nlh->nlmsg_flags);
if (err < 0)
if (err < 0) {
NL_SET_BAD_ATTR(extack, attr);
return err;
}
}

if (nft_net->validate_state == NFT_VALIDATE_DO)
Expand Down Expand Up @@ -6397,8 +6401,10 @@ static int nf_tables_delsetelem(struct sk_buff *skb,

nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
err = nft_del_setelem(&ctx, set, attr);
if (err < 0)
if (err < 0) {
NL_SET_BAD_ATTR(extack, attr);
break;
}
}
return err;
}
Expand Down

0 comments on commit b53c116

Please sign in to comment.