]> granicus.if.org Git - ipset/commitdiff
Send (N)ACK at dumping only when NLM_F_ACK is set
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 26 Jan 2011 21:37:11 +0000 (22:37 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 26 Jan 2011 21:37:11 +0000 (22:37 +0100)
Missing check of the flag NLM_F_ACK is added to the kernel -
and userspace does set it too (Patrick McHardy's review)

kernel/ip_set_core.c
lib/mnl.c

index 023813b973a357af64d67f310d6aa8fc45ceeffe..3071d3fc59eba56661b7cb9fd58eec3723718966 100644 (file)
@@ -973,9 +973,11 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
        if (cb->args[0] == DUMP_INIT) {
                ret = dump_init(cb);
                if (ret < 0) {
+                       struct nlmsghdr *nlh = nlmsg_hdr(cb->skb);
                        /* We have to create and send the error message
                         * manually :-( */
-                       netlink_ack(cb->skb, nlmsg_hdr(cb->skb), ret);
+                       if (nlh->nlmsg_flags & NLM_F_ACK)
+                               netlink_ack(cb->skb, nlh, ret);
                        return ret;
                }
        }
index 77e4faa88c5b9c86b5ae82c64f84f834f77bbe2a..a1c70fdbd9797bff6a88c83aa1714fdc992cf2f4 100644 (file)
--- a/lib/mnl.c
+++ b/lib/mnl.c
@@ -37,8 +37,8 @@ static const uint16_t cmdflags[] = {
        [IPSET_CMD_FLUSH-1]     = NLM_F_REQUEST|NLM_F_ACK,
        [IPSET_CMD_RENAME-1]    = NLM_F_REQUEST|NLM_F_ACK,
        [IPSET_CMD_SWAP-1]      = NLM_F_REQUEST|NLM_F_ACK,
-       [IPSET_CMD_LIST-1]      = NLM_F_REQUEST|NLM_F_ROOT|NLM_F_MATCH|NLM_F_DUMP,
-       [IPSET_CMD_SAVE-1]      = NLM_F_REQUEST|NLM_F_ROOT|NLM_F_MATCH|NLM_F_DUMP,
+       [IPSET_CMD_LIST-1]      = NLM_F_REQUEST|NLM_F_ACK|NLM_F_ROOT|NLM_F_MATCH|NLM_F_DUMP,
+       [IPSET_CMD_SAVE-1]      = NLM_F_REQUEST|NLM_F_ACK|NLM_F_ROOT|NLM_F_MATCH|NLM_F_DUMP,
        [IPSET_CMD_ADD-1]       = NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL,
        [IPSET_CMD_DEL-1]       = NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL,
        [IPSET_CMD_TEST-1]      = NLM_F_REQUEST|NLM_F_ACK,