diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2012-02-13 18:24:10 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-03-07 11:40:29 -0500 |
commit | c15f1c83251049182b1771da004d14f29683ab97 (patch) | |
tree | 3545bc015ba3a7691816c065e08e2752b3110253 | |
parent | ae5d33723e325392c48bc0ff481d9ec8d646a0ed (diff) |
netfilter: ipset: use NFPROTO_ constants
ipset is actually using NFPROTO values rather than AF (xt_set passes
that along).
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/linux/netfilter/ipset/ip_set.h | 5 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_bitmap_ip.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_bitmap_ipmac.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_bitmap_port.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_core.c | 16 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_getport.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ip.c | 18 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipport.c | 10 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportip.c | 10 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportnet.c | 12 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_net.c | 12 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netiface.c | 12 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netport.c | 12 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_list_set.c | 2 |
14 files changed, 64 insertions, 61 deletions
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 3540c6e262f7..e7b06f52be84 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
@@ -288,7 +288,10 @@ struct ip_set_type { | |||
288 | u8 features; | 288 | u8 features; |
289 | /* Set type dimension */ | 289 | /* Set type dimension */ |
290 | u8 dimension; | 290 | u8 dimension; |
291 | /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ | 291 | /* |
292 | * Supported family: may be NFPROTO_UNSPEC for both | ||
293 | * NFPROTO_IPV4/NFPROTO_IPV6. | ||
294 | */ | ||
292 | u8 family; | 295 | u8 family; |
293 | /* Type revisions */ | 296 | /* Type revisions */ |
294 | u8 revision_min, revision_max; | 297 | u8 revision_min, revision_max; |
diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c index e3e73997c3be..a72a4dff0031 100644 --- a/net/netfilter/ipset/ip_set_bitmap_ip.c +++ b/net/netfilter/ipset/ip_set_bitmap_ip.c | |||
@@ -442,7 +442,7 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map, | |||
442 | map->timeout = IPSET_NO_TIMEOUT; | 442 | map->timeout = IPSET_NO_TIMEOUT; |
443 | 443 | ||
444 | set->data = map; | 444 | set->data = map; |
445 | set->family = AF_INET; | 445 | set->family = NFPROTO_IPV4; |
446 | 446 | ||
447 | return true; | 447 | return true; |
448 | } | 448 | } |
@@ -550,7 +550,7 @@ static struct ip_set_type bitmap_ip_type __read_mostly = { | |||
550 | .protocol = IPSET_PROTOCOL, | 550 | .protocol = IPSET_PROTOCOL, |
551 | .features = IPSET_TYPE_IP, | 551 | .features = IPSET_TYPE_IP, |
552 | .dimension = IPSET_DIM_ONE, | 552 | .dimension = IPSET_DIM_ONE, |
553 | .family = AF_INET, | 553 | .family = NFPROTO_IPV4, |
554 | .revision_min = 0, | 554 | .revision_min = 0, |
555 | .revision_max = 0, | 555 | .revision_max = 0, |
556 | .create = bitmap_ip_create, | 556 | .create = bitmap_ip_create, |
diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c index 56096f544978..81324c12c5be 100644 --- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c +++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c | |||
@@ -543,7 +543,7 @@ init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map, | |||
543 | map->timeout = IPSET_NO_TIMEOUT; | 543 | map->timeout = IPSET_NO_TIMEOUT; |
544 | 544 | ||
545 | set->data = map; | 545 | set->data = map; |
546 | set->family = AF_INET; | 546 | set->family = NFPROTO_IPV4; |
547 | 547 | ||
548 | return true; | 548 | return true; |
549 | } | 549 | } |
@@ -623,7 +623,7 @@ static struct ip_set_type bitmap_ipmac_type = { | |||
623 | .protocol = IPSET_PROTOCOL, | 623 | .protocol = IPSET_PROTOCOL, |
624 | .features = IPSET_TYPE_IP | IPSET_TYPE_MAC, | 624 | .features = IPSET_TYPE_IP | IPSET_TYPE_MAC, |
625 | .dimension = IPSET_DIM_TWO, | 625 | .dimension = IPSET_DIM_TWO, |
626 | .family = AF_INET, | 626 | .family = NFPROTO_IPV4, |
627 | .revision_min = 0, | 627 | .revision_min = 0, |
628 | .revision_max = 0, | 628 | .revision_max = 0, |
629 | .create = bitmap_ipmac_create, | 629 | .create = bitmap_ipmac_create, |
diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c index 29ba93bb94be..382ec28ba72e 100644 --- a/net/netfilter/ipset/ip_set_bitmap_port.c +++ b/net/netfilter/ipset/ip_set_bitmap_port.c | |||
@@ -422,7 +422,7 @@ init_map_port(struct ip_set *set, struct bitmap_port *map, | |||
422 | map->timeout = IPSET_NO_TIMEOUT; | 422 | map->timeout = IPSET_NO_TIMEOUT; |
423 | 423 | ||
424 | set->data = map; | 424 | set->data = map; |
425 | set->family = AF_UNSPEC; | 425 | set->family = NFPROTO_UNSPEC; |
426 | 426 | ||
427 | return true; | 427 | return true; |
428 | } | 428 | } |
@@ -483,7 +483,7 @@ static struct ip_set_type bitmap_port_type = { | |||
483 | .protocol = IPSET_PROTOCOL, | 483 | .protocol = IPSET_PROTOCOL, |
484 | .features = IPSET_TYPE_PORT, | 484 | .features = IPSET_TYPE_PORT, |
485 | .dimension = IPSET_DIM_ONE, | 485 | .dimension = IPSET_DIM_ONE, |
486 | .family = AF_UNSPEC, | 486 | .family = NFPROTO_UNSPEC, |
487 | .revision_min = 0, | 487 | .revision_min = 0, |
488 | .revision_max = 0, | 488 | .revision_max = 0, |
489 | .create = bitmap_port_create, | 489 | .create = bitmap_port_create, |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index e7f90e7082b4..e6c1c9605a58 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -69,7 +69,7 @@ find_set_type(const char *name, u8 family, u8 revision) | |||
69 | 69 | ||
70 | list_for_each_entry_rcu(type, &ip_set_type_list, list) | 70 | list_for_each_entry_rcu(type, &ip_set_type_list, list) |
71 | if (STREQ(type->name, name) && | 71 | if (STREQ(type->name, name) && |
72 | (type->family == family || type->family == AF_UNSPEC) && | 72 | (type->family == family || type->family == NFPROTO_UNSPEC) && |
73 | revision >= type->revision_min && | 73 | revision >= type->revision_min && |
74 | revision <= type->revision_max) | 74 | revision <= type->revision_max) |
75 | return type; | 75 | return type; |
@@ -149,7 +149,7 @@ __find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max, | |||
149 | rcu_read_lock(); | 149 | rcu_read_lock(); |
150 | list_for_each_entry_rcu(type, &ip_set_type_list, list) | 150 | list_for_each_entry_rcu(type, &ip_set_type_list, list) |
151 | if (STREQ(type->name, name) && | 151 | if (STREQ(type->name, name) && |
152 | (type->family == family || type->family == AF_UNSPEC)) { | 152 | (type->family == family || type->family == NFPROTO_UNSPEC)) { |
153 | found = true; | 153 | found = true; |
154 | if (type->revision_min < *min) | 154 | if (type->revision_min < *min) |
155 | *min = type->revision_min; | 155 | *min = type->revision_min; |
@@ -164,8 +164,8 @@ __find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max, | |||
164 | __find_set_type_minmax(name, family, min, max, true); | 164 | __find_set_type_minmax(name, family, min, max, true); |
165 | } | 165 | } |
166 | 166 | ||
167 | #define family_name(f) ((f) == AF_INET ? "inet" : \ | 167 | #define family_name(f) ((f) == NFPROTO_IPV4 ? "inet" : \ |
168 | (f) == AF_INET6 ? "inet6" : "any") | 168 | (f) == NFPROTO_IPV6 ? "inet6" : "any") |
169 | 169 | ||
170 | /* Register a set type structure. The type is identified by | 170 | /* Register a set type structure. The type is identified by |
171 | * the unique triple of name, family and revision. | 171 | * the unique triple of name, family and revision. |
@@ -354,7 +354,7 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb, | |||
354 | pr_debug("set %s, index %u\n", set->name, index); | 354 | pr_debug("set %s, index %u\n", set->name, index); |
355 | 355 | ||
356 | if (opt->dim < set->type->dimension || | 356 | if (opt->dim < set->type->dimension || |
357 | !(opt->family == set->family || set->family == AF_UNSPEC)) | 357 | !(opt->family == set->family || set->family == NFPROTO_UNSPEC)) |
358 | return 0; | 358 | return 0; |
359 | 359 | ||
360 | read_lock_bh(&set->lock); | 360 | read_lock_bh(&set->lock); |
@@ -387,7 +387,7 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb, | |||
387 | pr_debug("set %s, index %u\n", set->name, index); | 387 | pr_debug("set %s, index %u\n", set->name, index); |
388 | 388 | ||
389 | if (opt->dim < set->type->dimension || | 389 | if (opt->dim < set->type->dimension || |
390 | !(opt->family == set->family || set->family == AF_UNSPEC)) | 390 | !(opt->family == set->family || set->family == NFPROTO_UNSPEC)) |
391 | return 0; | 391 | return 0; |
392 | 392 | ||
393 | write_lock_bh(&set->lock); | 393 | write_lock_bh(&set->lock); |
@@ -410,7 +410,7 @@ ip_set_del(ip_set_id_t index, const struct sk_buff *skb, | |||
410 | pr_debug("set %s, index %u\n", set->name, index); | 410 | pr_debug("set %s, index %u\n", set->name, index); |
411 | 411 | ||
412 | if (opt->dim < set->type->dimension || | 412 | if (opt->dim < set->type->dimension || |
413 | !(opt->family == set->family || set->family == AF_UNSPEC)) | 413 | !(opt->family == set->family || set->family == NFPROTO_UNSPEC)) |
414 | return 0; | 414 | return 0; |
415 | 415 | ||
416 | write_lock_bh(&set->lock); | 416 | write_lock_bh(&set->lock); |
@@ -575,7 +575,7 @@ start_msg(struct sk_buff *skb, u32 pid, u32 seq, unsigned int flags, | |||
575 | return NULL; | 575 | return NULL; |
576 | 576 | ||
577 | nfmsg = nlmsg_data(nlh); | 577 | nfmsg = nlmsg_data(nlh); |
578 | nfmsg->nfgen_family = AF_INET; | 578 | nfmsg->nfgen_family = NFPROTO_IPV4; |
579 | nfmsg->version = NFNETLINK_V0; | 579 | nfmsg->version = NFNETLINK_V0; |
580 | nfmsg->res_id = 0; | 580 | nfmsg->res_id = 0; |
581 | 581 | ||
diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c index 1f03556666f4..6fdf88ae2353 100644 --- a/net/netfilter/ipset/ip_set_getport.c +++ b/net/netfilter/ipset/ip_set_getport.c | |||
@@ -136,10 +136,10 @@ ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port) | |||
136 | u8 proto; | 136 | u8 proto; |
137 | 137 | ||
138 | switch (pf) { | 138 | switch (pf) { |
139 | case AF_INET: | 139 | case NFPROTO_IPV4: |
140 | ret = ip_set_get_ip4_port(skb, src, port, &proto); | 140 | ret = ip_set_get_ip4_port(skb, src, port, &proto); |
141 | break; | 141 | break; |
142 | case AF_INET6: | 142 | case NFPROTO_IPV6: |
143 | ret = ip_set_get_ip6_port(skb, src, port, &proto); | 143 | ret = ip_set_get_ip6_port(skb, src, port, &proto); |
144 | break; | 144 | break; |
145 | default: | 145 | default: |
diff --git a/net/netfilter/ipset/ip_set_hash_ip.c b/net/netfilter/ipset/ip_set_hash_ip.c index 4015fcaf87bc..5139dea6019e 100644 --- a/net/netfilter/ipset/ip_set_hash_ip.c +++ b/net/netfilter/ipset/ip_set_hash_ip.c | |||
@@ -366,11 +366,11 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
366 | u8 netmask, hbits; | 366 | u8 netmask, hbits; |
367 | struct ip_set_hash *h; | 367 | struct ip_set_hash *h; |
368 | 368 | ||
369 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 369 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
370 | return -IPSET_ERR_INVALID_FAMILY; | 370 | return -IPSET_ERR_INVALID_FAMILY; |
371 | netmask = set->family == AF_INET ? 32 : 128; | 371 | netmask = set->family == NFPROTO_IPV4 ? 32 : 128; |
372 | pr_debug("Create set %s with family %s\n", | 372 | pr_debug("Create set %s with family %s\n", |
373 | set->name, set->family == AF_INET ? "inet" : "inet6"); | 373 | set->name, set->family == NFPROTO_IPV4 ? "inet" : "inet6"); |
374 | 374 | ||
375 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 375 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
376 | !ip_set_optattr_netorder(tb, IPSET_ATTR_MAXELEM) || | 376 | !ip_set_optattr_netorder(tb, IPSET_ATTR_MAXELEM) || |
@@ -389,8 +389,8 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
389 | if (tb[IPSET_ATTR_NETMASK]) { | 389 | if (tb[IPSET_ATTR_NETMASK]) { |
390 | netmask = nla_get_u8(tb[IPSET_ATTR_NETMASK]); | 390 | netmask = nla_get_u8(tb[IPSET_ATTR_NETMASK]); |
391 | 391 | ||
392 | if ((set->family == AF_INET && netmask > 32) || | 392 | if ((set->family == NFPROTO_IPV4 && netmask > 32) || |
393 | (set->family == AF_INET6 && netmask > 128) || | 393 | (set->family == NFPROTO_IPV6 && netmask > 128) || |
394 | netmask == 0) | 394 | netmask == 0) |
395 | return -IPSET_ERR_INVALID_NETMASK; | 395 | return -IPSET_ERR_INVALID_NETMASK; |
396 | } | 396 | } |
@@ -419,15 +419,15 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
419 | if (tb[IPSET_ATTR_TIMEOUT]) { | 419 | if (tb[IPSET_ATTR_TIMEOUT]) { |
420 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 420 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
421 | 421 | ||
422 | set->variant = set->family == AF_INET | 422 | set->variant = set->family == NFPROTO_IPV4 |
423 | ? &hash_ip4_tvariant : &hash_ip6_tvariant; | 423 | ? &hash_ip4_tvariant : &hash_ip6_tvariant; |
424 | 424 | ||
425 | if (set->family == AF_INET) | 425 | if (set->family == NFPROTO_IPV4) |
426 | hash_ip4_gc_init(set); | 426 | hash_ip4_gc_init(set); |
427 | else | 427 | else |
428 | hash_ip6_gc_init(set); | 428 | hash_ip6_gc_init(set); |
429 | } else { | 429 | } else { |
430 | set->variant = set->family == AF_INET | 430 | set->variant = set->family == NFPROTO_IPV4 |
431 | ? &hash_ip4_variant : &hash_ip6_variant; | 431 | ? &hash_ip4_variant : &hash_ip6_variant; |
432 | } | 432 | } |
433 | 433 | ||
@@ -443,7 +443,7 @@ static struct ip_set_type hash_ip_type __read_mostly = { | |||
443 | .protocol = IPSET_PROTOCOL, | 443 | .protocol = IPSET_PROTOCOL, |
444 | .features = IPSET_TYPE_IP, | 444 | .features = IPSET_TYPE_IP, |
445 | .dimension = IPSET_DIM_ONE, | 445 | .dimension = IPSET_DIM_ONE, |
446 | .family = AF_UNSPEC, | 446 | .family = NFPROTO_UNSPEC, |
447 | .revision_min = 0, | 447 | .revision_min = 0, |
448 | .revision_max = 0, | 448 | .revision_max = 0, |
449 | .create = hash_ip_create, | 449 | .create = hash_ip_create, |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 37d667e3f6f8..9c27e249c171 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
@@ -450,7 +450,7 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
450 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 450 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
451 | u8 hbits; | 451 | u8 hbits; |
452 | 452 | ||
453 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 453 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
454 | return -IPSET_ERR_INVALID_FAMILY; | 454 | return -IPSET_ERR_INVALID_FAMILY; |
455 | 455 | ||
456 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 456 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -490,15 +490,15 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
490 | if (tb[IPSET_ATTR_TIMEOUT]) { | 490 | if (tb[IPSET_ATTR_TIMEOUT]) { |
491 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 491 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
492 | 492 | ||
493 | set->variant = set->family == AF_INET | 493 | set->variant = set->family == NFPROTO_IPV4 |
494 | ? &hash_ipport4_tvariant : &hash_ipport6_tvariant; | 494 | ? &hash_ipport4_tvariant : &hash_ipport6_tvariant; |
495 | 495 | ||
496 | if (set->family == AF_INET) | 496 | if (set->family == NFPROTO_IPV4) |
497 | hash_ipport4_gc_init(set); | 497 | hash_ipport4_gc_init(set); |
498 | else | 498 | else |
499 | hash_ipport6_gc_init(set); | 499 | hash_ipport6_gc_init(set); |
500 | } else { | 500 | } else { |
501 | set->variant = set->family == AF_INET | 501 | set->variant = set->family == NFPROTO_IPV4 |
502 | ? &hash_ipport4_variant : &hash_ipport6_variant; | 502 | ? &hash_ipport4_variant : &hash_ipport6_variant; |
503 | } | 503 | } |
504 | 504 | ||
@@ -514,7 +514,7 @@ static struct ip_set_type hash_ipport_type __read_mostly = { | |||
514 | .protocol = IPSET_PROTOCOL, | 514 | .protocol = IPSET_PROTOCOL, |
515 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, | 515 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, |
516 | .dimension = IPSET_DIM_TWO, | 516 | .dimension = IPSET_DIM_TWO, |
517 | .family = AF_UNSPEC, | 517 | .family = NFPROTO_UNSPEC, |
518 | .revision_min = 0, | 518 | .revision_min = 0, |
519 | .revision_max = 1, /* SCTP and UDPLITE support added */ | 519 | .revision_max = 1, /* SCTP and UDPLITE support added */ |
520 | .create = hash_ipport_create, | 520 | .create = hash_ipport_create, |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index e69e2718fbe1..9134057c0728 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
@@ -468,7 +468,7 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
468 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 468 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
469 | u8 hbits; | 469 | u8 hbits; |
470 | 470 | ||
471 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 471 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
472 | return -IPSET_ERR_INVALID_FAMILY; | 472 | return -IPSET_ERR_INVALID_FAMILY; |
473 | 473 | ||
474 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 474 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -508,15 +508,15 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
508 | if (tb[IPSET_ATTR_TIMEOUT]) { | 508 | if (tb[IPSET_ATTR_TIMEOUT]) { |
509 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 509 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
510 | 510 | ||
511 | set->variant = set->family == AF_INET | 511 | set->variant = set->family == NFPROTO_IPV4 |
512 | ? &hash_ipportip4_tvariant : &hash_ipportip6_tvariant; | 512 | ? &hash_ipportip4_tvariant : &hash_ipportip6_tvariant; |
513 | 513 | ||
514 | if (set->family == AF_INET) | 514 | if (set->family == NFPROTO_IPV4) |
515 | hash_ipportip4_gc_init(set); | 515 | hash_ipportip4_gc_init(set); |
516 | else | 516 | else |
517 | hash_ipportip6_gc_init(set); | 517 | hash_ipportip6_gc_init(set); |
518 | } else { | 518 | } else { |
519 | set->variant = set->family == AF_INET | 519 | set->variant = set->family == NFPROTO_IPV4 |
520 | ? &hash_ipportip4_variant : &hash_ipportip6_variant; | 520 | ? &hash_ipportip4_variant : &hash_ipportip6_variant; |
521 | } | 521 | } |
522 | 522 | ||
@@ -532,7 +532,7 @@ static struct ip_set_type hash_ipportip_type __read_mostly = { | |||
532 | .protocol = IPSET_PROTOCOL, | 532 | .protocol = IPSET_PROTOCOL, |
533 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, | 533 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, |
534 | .dimension = IPSET_DIM_THREE, | 534 | .dimension = IPSET_DIM_THREE, |
535 | .family = AF_UNSPEC, | 535 | .family = NFPROTO_UNSPEC, |
536 | .revision_min = 0, | 536 | .revision_min = 0, |
537 | .revision_max = 1, /* SCTP and UDPLITE support added */ | 537 | .revision_max = 1, /* SCTP and UDPLITE support added */ |
538 | .create = hash_ipportip_create, | 538 | .create = hash_ipportip_create, |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index 64199b4e93c9..0edb35b81e36 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -554,7 +554,7 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
554 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 554 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
555 | u8 hbits; | 555 | u8 hbits; |
556 | 556 | ||
557 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 557 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
558 | return -IPSET_ERR_INVALID_FAMILY; | 558 | return -IPSET_ERR_INVALID_FAMILY; |
559 | 559 | ||
560 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 560 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -573,7 +573,7 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
573 | 573 | ||
574 | h = kzalloc(sizeof(*h) | 574 | h = kzalloc(sizeof(*h) |
575 | + sizeof(struct ip_set_hash_nets) | 575 | + sizeof(struct ip_set_hash_nets) |
576 | * (set->family == AF_INET ? 32 : 128), GFP_KERNEL); | 576 | * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL); |
577 | if (!h) | 577 | if (!h) |
578 | return -ENOMEM; | 578 | return -ENOMEM; |
579 | 579 | ||
@@ -596,16 +596,16 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
596 | if (tb[IPSET_ATTR_TIMEOUT]) { | 596 | if (tb[IPSET_ATTR_TIMEOUT]) { |
597 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 597 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
598 | 598 | ||
599 | set->variant = set->family == AF_INET | 599 | set->variant = set->family == NFPROTO_IPV4 |
600 | ? &hash_ipportnet4_tvariant | 600 | ? &hash_ipportnet4_tvariant |
601 | : &hash_ipportnet6_tvariant; | 601 | : &hash_ipportnet6_tvariant; |
602 | 602 | ||
603 | if (set->family == AF_INET) | 603 | if (set->family == NFPROTO_IPV4) |
604 | hash_ipportnet4_gc_init(set); | 604 | hash_ipportnet4_gc_init(set); |
605 | else | 605 | else |
606 | hash_ipportnet6_gc_init(set); | 606 | hash_ipportnet6_gc_init(set); |
607 | } else { | 607 | } else { |
608 | set->variant = set->family == AF_INET | 608 | set->variant = set->family == NFPROTO_IPV4 |
609 | ? &hash_ipportnet4_variant : &hash_ipportnet6_variant; | 609 | ? &hash_ipportnet4_variant : &hash_ipportnet6_variant; |
610 | } | 610 | } |
611 | 611 | ||
@@ -621,7 +621,7 @@ static struct ip_set_type hash_ipportnet_type __read_mostly = { | |||
621 | .protocol = IPSET_PROTOCOL, | 621 | .protocol = IPSET_PROTOCOL, |
622 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, | 622 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, |
623 | .dimension = IPSET_DIM_THREE, | 623 | .dimension = IPSET_DIM_THREE, |
624 | .family = AF_UNSPEC, | 624 | .family = NFPROTO_UNSPEC, |
625 | .revision_min = 0, | 625 | .revision_min = 0, |
626 | /* 1 SCTP and UDPLITE support added */ | 626 | /* 1 SCTP and UDPLITE support added */ |
627 | .revision_max = 2, /* Range as input support for IPv4 added */ | 627 | .revision_max = 2, /* Range as input support for IPv4 added */ |
diff --git a/net/netfilter/ipset/ip_set_hash_net.c b/net/netfilter/ipset/ip_set_hash_net.c index 28988196775e..5a4457adaf85 100644 --- a/net/netfilter/ipset/ip_set_hash_net.c +++ b/net/netfilter/ipset/ip_set_hash_net.c | |||
@@ -406,7 +406,7 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
406 | struct ip_set_hash *h; | 406 | struct ip_set_hash *h; |
407 | u8 hbits; | 407 | u8 hbits; |
408 | 408 | ||
409 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 409 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
410 | return -IPSET_ERR_INVALID_FAMILY; | 410 | return -IPSET_ERR_INVALID_FAMILY; |
411 | 411 | ||
412 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 412 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -425,7 +425,7 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
425 | 425 | ||
426 | h = kzalloc(sizeof(*h) | 426 | h = kzalloc(sizeof(*h) |
427 | + sizeof(struct ip_set_hash_nets) | 427 | + sizeof(struct ip_set_hash_nets) |
428 | * (set->family == AF_INET ? 32 : 128), GFP_KERNEL); | 428 | * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL); |
429 | if (!h) | 429 | if (!h) |
430 | return -ENOMEM; | 430 | return -ENOMEM; |
431 | 431 | ||
@@ -448,15 +448,15 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
448 | if (tb[IPSET_ATTR_TIMEOUT]) { | 448 | if (tb[IPSET_ATTR_TIMEOUT]) { |
449 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 449 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
450 | 450 | ||
451 | set->variant = set->family == AF_INET | 451 | set->variant = set->family == NFPROTO_IPV4 |
452 | ? &hash_net4_tvariant : &hash_net6_tvariant; | 452 | ? &hash_net4_tvariant : &hash_net6_tvariant; |
453 | 453 | ||
454 | if (set->family == AF_INET) | 454 | if (set->family == NFPROTO_IPV4) |
455 | hash_net4_gc_init(set); | 455 | hash_net4_gc_init(set); |
456 | else | 456 | else |
457 | hash_net6_gc_init(set); | 457 | hash_net6_gc_init(set); |
458 | } else { | 458 | } else { |
459 | set->variant = set->family == AF_INET | 459 | set->variant = set->family == NFPROTO_IPV4 |
460 | ? &hash_net4_variant : &hash_net6_variant; | 460 | ? &hash_net4_variant : &hash_net6_variant; |
461 | } | 461 | } |
462 | 462 | ||
@@ -472,7 +472,7 @@ static struct ip_set_type hash_net_type __read_mostly = { | |||
472 | .protocol = IPSET_PROTOCOL, | 472 | .protocol = IPSET_PROTOCOL, |
473 | .features = IPSET_TYPE_IP, | 473 | .features = IPSET_TYPE_IP, |
474 | .dimension = IPSET_DIM_ONE, | 474 | .dimension = IPSET_DIM_ONE, |
475 | .family = AF_UNSPEC, | 475 | .family = NFPROTO_UNSPEC, |
476 | .revision_min = 0, | 476 | .revision_min = 0, |
477 | .revision_max = 1, /* Range as input support for IPv4 added */ | 477 | .revision_max = 1, /* Range as input support for IPv4 added */ |
478 | .create = hash_net_create, | 478 | .create = hash_net_create, |
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c index e13095deb50d..a9fb4afafa8b 100644 --- a/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/net/netfilter/ipset/ip_set_hash_netiface.c | |||
@@ -678,7 +678,7 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
678 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 678 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
679 | u8 hbits; | 679 | u8 hbits; |
680 | 680 | ||
681 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 681 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
682 | return -IPSET_ERR_INVALID_FAMILY; | 682 | return -IPSET_ERR_INVALID_FAMILY; |
683 | 683 | ||
684 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 684 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -697,7 +697,7 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
697 | 697 | ||
698 | h = kzalloc(sizeof(*h) | 698 | h = kzalloc(sizeof(*h) |
699 | + sizeof(struct ip_set_hash_nets) | 699 | + sizeof(struct ip_set_hash_nets) |
700 | * (set->family == AF_INET ? 32 : 128), GFP_KERNEL); | 700 | * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL); |
701 | if (!h) | 701 | if (!h) |
702 | return -ENOMEM; | 702 | return -ENOMEM; |
703 | 703 | ||
@@ -722,15 +722,15 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
722 | if (tb[IPSET_ATTR_TIMEOUT]) { | 722 | if (tb[IPSET_ATTR_TIMEOUT]) { |
723 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 723 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
724 | 724 | ||
725 | set->variant = set->family == AF_INET | 725 | set->variant = set->family == NFPROTO_IPV4 |
726 | ? &hash_netiface4_tvariant : &hash_netiface6_tvariant; | 726 | ? &hash_netiface4_tvariant : &hash_netiface6_tvariant; |
727 | 727 | ||
728 | if (set->family == AF_INET) | 728 | if (set->family == NFPROTO_IPV4) |
729 | hash_netiface4_gc_init(set); | 729 | hash_netiface4_gc_init(set); |
730 | else | 730 | else |
731 | hash_netiface6_gc_init(set); | 731 | hash_netiface6_gc_init(set); |
732 | } else { | 732 | } else { |
733 | set->variant = set->family == AF_INET | 733 | set->variant = set->family == NFPROTO_IPV4 |
734 | ? &hash_netiface4_variant : &hash_netiface6_variant; | 734 | ? &hash_netiface4_variant : &hash_netiface6_variant; |
735 | } | 735 | } |
736 | 736 | ||
@@ -746,7 +746,7 @@ static struct ip_set_type hash_netiface_type __read_mostly = { | |||
746 | .protocol = IPSET_PROTOCOL, | 746 | .protocol = IPSET_PROTOCOL, |
747 | .features = IPSET_TYPE_IP | IPSET_TYPE_IFACE, | 747 | .features = IPSET_TYPE_IP | IPSET_TYPE_IFACE, |
748 | .dimension = IPSET_DIM_TWO, | 748 | .dimension = IPSET_DIM_TWO, |
749 | .family = AF_UNSPEC, | 749 | .family = NFPROTO_UNSPEC, |
750 | .revision_min = 0, | 750 | .revision_min = 0, |
751 | .create = hash_netiface_create, | 751 | .create = hash_netiface_create, |
752 | .create_policy = { | 752 | .create_policy = { |
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c index 8f9de7207ec9..1fcc1020eaae 100644 --- a/net/netfilter/ipset/ip_set_hash_netport.c +++ b/net/netfilter/ipset/ip_set_hash_netport.c | |||
@@ -507,7 +507,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
507 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 507 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
508 | u8 hbits; | 508 | u8 hbits; |
509 | 509 | ||
510 | if (!(set->family == AF_INET || set->family == AF_INET6)) | 510 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
511 | return -IPSET_ERR_INVALID_FAMILY; | 511 | return -IPSET_ERR_INVALID_FAMILY; |
512 | 512 | ||
513 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || | 513 | if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) || |
@@ -526,7 +526,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
526 | 526 | ||
527 | h = kzalloc(sizeof(*h) | 527 | h = kzalloc(sizeof(*h) |
528 | + sizeof(struct ip_set_hash_nets) | 528 | + sizeof(struct ip_set_hash_nets) |
529 | * (set->family == AF_INET ? 32 : 128), GFP_KERNEL); | 529 | * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL); |
530 | if (!h) | 530 | if (!h) |
531 | return -ENOMEM; | 531 | return -ENOMEM; |
532 | 532 | ||
@@ -549,15 +549,15 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
549 | if (tb[IPSET_ATTR_TIMEOUT]) { | 549 | if (tb[IPSET_ATTR_TIMEOUT]) { |
550 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); | 550 | h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); |
551 | 551 | ||
552 | set->variant = set->family == AF_INET | 552 | set->variant = set->family == NFPROTO_IPV4 |
553 | ? &hash_netport4_tvariant : &hash_netport6_tvariant; | 553 | ? &hash_netport4_tvariant : &hash_netport6_tvariant; |
554 | 554 | ||
555 | if (set->family == AF_INET) | 555 | if (set->family == NFPROTO_IPV4) |
556 | hash_netport4_gc_init(set); | 556 | hash_netport4_gc_init(set); |
557 | else | 557 | else |
558 | hash_netport6_gc_init(set); | 558 | hash_netport6_gc_init(set); |
559 | } else { | 559 | } else { |
560 | set->variant = set->family == AF_INET | 560 | set->variant = set->family == NFPROTO_IPV4 |
561 | ? &hash_netport4_variant : &hash_netport6_variant; | 561 | ? &hash_netport4_variant : &hash_netport6_variant; |
562 | } | 562 | } |
563 | 563 | ||
@@ -573,7 +573,7 @@ static struct ip_set_type hash_netport_type __read_mostly = { | |||
573 | .protocol = IPSET_PROTOCOL, | 573 | .protocol = IPSET_PROTOCOL, |
574 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, | 574 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, |
575 | .dimension = IPSET_DIM_TWO, | 575 | .dimension = IPSET_DIM_TWO, |
576 | .family = AF_UNSPEC, | 576 | .family = NFPROTO_UNSPEC, |
577 | .revision_min = 0, | 577 | .revision_min = 0, |
578 | /* 1 SCTP and UDPLITE support added */ | 578 | /* 1 SCTP and UDPLITE support added */ |
579 | .revision_max = 2, /* Range as input support for IPv4 added */ | 579 | .revision_max = 2, /* Range as input support for IPv4 added */ |
diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c index 4d10819d462e..7e095f9005f0 100644 --- a/net/netfilter/ipset/ip_set_list_set.c +++ b/net/netfilter/ipset/ip_set_list_set.c | |||
@@ -575,7 +575,7 @@ static struct ip_set_type list_set_type __read_mostly = { | |||
575 | .protocol = IPSET_PROTOCOL, | 575 | .protocol = IPSET_PROTOCOL, |
576 | .features = IPSET_TYPE_NAME | IPSET_DUMP_LAST, | 576 | .features = IPSET_TYPE_NAME | IPSET_DUMP_LAST, |
577 | .dimension = IPSET_DIM_ONE, | 577 | .dimension = IPSET_DIM_ONE, |
578 | .family = AF_UNSPEC, | 578 | .family = NFPROTO_UNSPEC, |
579 | .revision_min = 0, | 579 | .revision_min = 0, |
580 | .revision_max = 0, | 580 | .revision_max = 0, |
581 | .create = list_set_create, | 581 | .create = list_set_create, |