]> granicus.if.org Git - ipset/commitdiff
netfilter: ipset: Use SET_WITH_*() helpers to test set extensions
authorSergey Popovich <popovich_sergei@mail.ua>
Mon, 17 Nov 2014 11:06:26 +0000 (13:06 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 20 Mar 2015 17:35:55 +0000 (18:35 +0100)
Signed-off-by: Sergey Popovich <popovich_sergei@mail.ua>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
kernel/net/netfilter/ipset/ip_set_core.c
kernel/net/netfilter/ipset/ip_set_hash_gen.h

index 421da797dd645e52742e2fe4f28cfe9ba08e3821..9801bbad43b3af0a61a767ccbfa48ce9e98f02e7 100644 (file)
@@ -398,12 +398,12 @@ ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
        u64 fullmark;
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
-               if (!(set->extensions & IPSET_EXT_TIMEOUT))
+               if (!SET_WITH_TIMEOUT(set))
                        return -IPSET_ERR_TIMEOUT;
                ext->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
        if (tb[IPSET_ATTR_BYTES] || tb[IPSET_ATTR_PACKETS]) {
-               if (!(set->extensions & IPSET_EXT_COUNTER))
+               if (!SET_WITH_COUNTER(set))
                        return -IPSET_ERR_COUNTER;
                if (tb[IPSET_ATTR_BYTES])
                        ext->bytes = be64_to_cpu(nla_get_be64(
@@ -413,25 +413,25 @@ ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
                                                   tb[IPSET_ATTR_PACKETS]));
        }
        if (tb[IPSET_ATTR_COMMENT]) {
-               if (!(set->extensions & IPSET_EXT_COMMENT))
+               if (!SET_WITH_COMMENT(set))
                        return -IPSET_ERR_COMMENT;
                ext->comment = ip_set_comment_uget(tb[IPSET_ATTR_COMMENT]);
        }
        if (tb[IPSET_ATTR_SKBMARK]) {
-               if (!(set->extensions & IPSET_EXT_SKBINFO))
+               if (!SET_WITH_SKBINFO(set))
                        return -IPSET_ERR_SKBINFO;
                fullmark = be64_to_cpu(nla_get_be64(tb[IPSET_ATTR_SKBMARK]));
                ext->skbmark = fullmark >> 32;
                ext->skbmarkmask = fullmark & 0xffffffff;
        }
        if (tb[IPSET_ATTR_SKBPRIO]) {
-               if (!(set->extensions & IPSET_EXT_SKBINFO))
+               if (!SET_WITH_SKBINFO(set))
                        return -IPSET_ERR_SKBINFO;
                ext->skbprio = be32_to_cpu(nla_get_be32(
                                            tb[IPSET_ATTR_SKBPRIO]));
        }
        if (tb[IPSET_ATTR_SKBQUEUE]) {
-               if (!(set->extensions & IPSET_EXT_SKBINFO))
+               if (!SET_WITH_SKBINFO(set))
                        return -IPSET_ERR_SKBINFO;
                ext->skbqueue = be16_to_cpu(nla_get_be16(
                                            tb[IPSET_ATTR_SKBQUEUE]));
index c25c10addf8b6117e61943634911738b91f5b3b3..d9b4a2a3a7d37d66fb3aede1b82b67bd85af623d 100644 (file)
@@ -413,7 +413,7 @@ mtype_destroy(struct ip_set *set)
 {
        struct htype *h = set->data;
 
-       if (set->extensions & IPSET_EXT_TIMEOUT)
+       if (SET_WITH_TIMEOUT(set))
                del_timer_sync(&h->gc);
 
        mtype_ahash_destroy(set,