aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorSergey Popovich <popovich_sergei@mail.ua>2015-06-12 15:11:54 -0400
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2015-06-14 04:40:12 -0400
commitedda0791743eafc36382fb893d91547f36edaf7d (patch)
treee9f9bdf655f623bdd2914b39b734c5e7a5acdfa8 /net/netfilter
parentaaeb6e24f5b6cb6a664fbdec6e08b65c3173c1b3 (diff)
netfilter: ipset: Use SET_WITH_*() helpers to test set extensions
Signed-off-by: Sergey Popovich <popovich_sergei@mail.ua> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/ipset/ip_set_core.c12
-rw-r--r--net/netfilter/ipset/ip_set_hash_gen.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 475e4960a164..347d97afc887 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -390,12 +390,12 @@ ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
390{ 390{
391 u64 fullmark; 391 u64 fullmark;
392 if (tb[IPSET_ATTR_TIMEOUT]) { 392 if (tb[IPSET_ATTR_TIMEOUT]) {
393 if (!(set->extensions & IPSET_EXT_TIMEOUT)) 393 if (!SET_WITH_TIMEOUT(set))
394 return -IPSET_ERR_TIMEOUT; 394 return -IPSET_ERR_TIMEOUT;
395 ext->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); 395 ext->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
396 } 396 }
397 if (tb[IPSET_ATTR_BYTES] || tb[IPSET_ATTR_PACKETS]) { 397 if (tb[IPSET_ATTR_BYTES] || tb[IPSET_ATTR_PACKETS]) {
398 if (!(set->extensions & IPSET_EXT_COUNTER)) 398 if (!SET_WITH_COUNTER(set))
399 return -IPSET_ERR_COUNTER; 399 return -IPSET_ERR_COUNTER;
400 if (tb[IPSET_ATTR_BYTES]) 400 if (tb[IPSET_ATTR_BYTES])
401 ext->bytes = be64_to_cpu(nla_get_be64( 401 ext->bytes = be64_to_cpu(nla_get_be64(
@@ -405,25 +405,25 @@ ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
405 tb[IPSET_ATTR_PACKETS])); 405 tb[IPSET_ATTR_PACKETS]));
406 } 406 }
407 if (tb[IPSET_ATTR_COMMENT]) { 407 if (tb[IPSET_ATTR_COMMENT]) {
408 if (!(set->extensions & IPSET_EXT_COMMENT)) 408 if (!SET_WITH_COMMENT(set))
409 return -IPSET_ERR_COMMENT; 409 return -IPSET_ERR_COMMENT;
410 ext->comment = ip_set_comment_uget(tb[IPSET_ATTR_COMMENT]); 410 ext->comment = ip_set_comment_uget(tb[IPSET_ATTR_COMMENT]);
411 } 411 }
412 if (tb[IPSET_ATTR_SKBMARK]) { 412 if (tb[IPSET_ATTR_SKBMARK]) {
413 if (!(set->extensions & IPSET_EXT_SKBINFO)) 413 if (!SET_WITH_SKBINFO(set))
414 return -IPSET_ERR_SKBINFO; 414 return -IPSET_ERR_SKBINFO;
415 fullmark = be64_to_cpu(nla_get_be64(tb[IPSET_ATTR_SKBMARK])); 415 fullmark = be64_to_cpu(nla_get_be64(tb[IPSET_ATTR_SKBMARK]));
416 ext->skbmark = fullmark >> 32; 416 ext->skbmark = fullmark >> 32;
417 ext->skbmarkmask = fullmark & 0xffffffff; 417 ext->skbmarkmask = fullmark & 0xffffffff;
418 } 418 }
419 if (tb[IPSET_ATTR_SKBPRIO]) { 419 if (tb[IPSET_ATTR_SKBPRIO]) {
420 if (!(set->extensions & IPSET_EXT_SKBINFO)) 420 if (!SET_WITH_SKBINFO(set))
421 return -IPSET_ERR_SKBINFO; 421 return -IPSET_ERR_SKBINFO;
422 ext->skbprio = be32_to_cpu(nla_get_be32( 422 ext->skbprio = be32_to_cpu(nla_get_be32(
423 tb[IPSET_ATTR_SKBPRIO])); 423 tb[IPSET_ATTR_SKBPRIO]));
424 } 424 }
425 if (tb[IPSET_ATTR_SKBQUEUE]) { 425 if (tb[IPSET_ATTR_SKBQUEUE]) {
426 if (!(set->extensions & IPSET_EXT_SKBINFO)) 426 if (!SET_WITH_SKBINFO(set))
427 return -IPSET_ERR_SKBINFO; 427 return -IPSET_ERR_SKBINFO;
428 ext->skbqueue = be16_to_cpu(nla_get_be16( 428 ext->skbqueue = be16_to_cpu(nla_get_be16(
429 tb[IPSET_ATTR_SKBQUEUE])); 429 tb[IPSET_ATTR_SKBQUEUE]));
diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 7952869c8023..8dd82db05ed0 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -431,7 +431,7 @@ mtype_destroy(struct ip_set *set)
431{ 431{
432 struct htype *h = set->data; 432 struct htype *h = set->data;
433 433
434 if (set->extensions & IPSET_EXT_TIMEOUT) 434 if (SET_WITH_TIMEOUT(set))
435 del_timer_sync(&h->gc); 435 del_timer_sync(&h->gc);
436 436
437 mtype_ahash_destroy(set, rcu_dereference_bh_nfnl(h->table), true); 437 mtype_ahash_destroy(set, rcu_dereference_bh_nfnl(h->table), true);