]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: nf_tables: set element extended ACK reporting support
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 19 May 2022 22:02:06 +0000 (00:02 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 27 May 2022 09:16:38 +0000 (11:16 +0200)
Report the element that causes problems via netlink extended ACK for set
element commands.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index f296dfe86b6225849f55fc6b51e58ed91d14a65b..f4f1d0a2da43c0bbbacd8d8552be10b8c07faf87 100644 (file)
@@ -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;
@@ -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)
@@ -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;
 }