1 /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
8 /* Kernel module implementing an IP set type: the hash:ip,port,net type */
10 #include <linux/jhash.h>
11 #include <linux/module.h>
13 #include <linux/skbuff.h>
14 #include <linux/errno.h>
15 #include <linux/random.h>
18 #include <net/netlink.h>
21 #include <linux/netfilter.h>
22 #include <linux/netfilter/ipset/pfxlen.h>
23 #include <linux/netfilter/ipset/ip_set.h>
24 #include <linux/netfilter/ipset/ip_set_timeout.h>
25 #include <linux/netfilter/ipset/ip_set_getport.h>
26 #include <linux/netfilter/ipset/ip_set_hash.h>
28 #define REVISION_MIN 0
29 /* 1 SCTP and UDPLITE support added */
30 /* 2 Range as input support for IPv4 added */
31 #define REVISION_MAX 3 /* nomatch flag support added */
33 MODULE_LICENSE("GPL");
34 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
35 IP_SET_MODULE_DESC("hash:ip,port,net", REVISION_MIN, REVISION_MAX);
36 MODULE_ALIAS("ip_set_hash:ip,port,net");
38 /* Type specific function prefix */
39 #define TYPE hash_ipportnet
42 hash_ipportnet_same_set(const struct ip_set *a, const struct ip_set *b);
44 #define hash_ipportnet4_same_set hash_ipportnet_same_set
45 #define hash_ipportnet6_same_set hash_ipportnet_same_set
47 /* The type variant functions: IPv4 */
49 /* We squeeze the "nomatch" flag into cidr: we don't support cidr == 0
50 * However this way we have to store internally cidr - 1,
51 * dancing back and forth.
53 #define IP_SET_HASH_WITH_NETS_PACKED
55 /* Member elements without timeout */
56 struct hash_ipportnet4_elem {
65 /* Member elements with timeout support */
66 struct hash_ipportnet4_telem {
73 unsigned long timeout;
77 hash_ipportnet4_data_equal(const struct hash_ipportnet4_elem *ip1,
78 const struct hash_ipportnet4_elem *ip2,
81 return ip1->ip == ip2->ip &&
82 ip1->ip2 == ip2->ip2 &&
83 ip1->cidr == ip2->cidr &&
84 ip1->port == ip2->port &&
85 ip1->proto == ip2->proto;
89 hash_ipportnet4_data_isnull(const struct hash_ipportnet4_elem *elem)
91 return elem->proto == 0;
95 hash_ipportnet4_data_copy(struct hash_ipportnet4_elem *dst,
96 const struct hash_ipportnet4_elem *src)
98 memcpy(dst, src, sizeof(*dst));
102 hash_ipportnet4_data_flags(struct hash_ipportnet4_elem *dst, u32 flags)
104 dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH);
108 hash_ipportnet4_data_match(const struct hash_ipportnet4_elem *elem)
110 return elem->nomatch ? -ENOTEMPTY : 1;
114 hash_ipportnet4_data_netmask(struct hash_ipportnet4_elem *elem, u8 cidr)
116 elem->ip2 &= ip_set_netmask(cidr);
117 elem->cidr = cidr - 1;
121 hash_ipportnet4_data_zero_out(struct hash_ipportnet4_elem *elem)
127 hash_ipportnet4_data_list(struct sk_buff *skb,
128 const struct hash_ipportnet4_elem *data)
130 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
132 if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip) ||
133 nla_put_ipaddr4(skb, IPSET_ATTR_IP2, data->ip2) ||
134 nla_put_net16(skb, IPSET_ATTR_PORT, data->port) ||
135 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
136 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
138 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
139 goto nla_put_failure;
147 hash_ipportnet4_data_tlist(struct sk_buff *skb,
148 const struct hash_ipportnet4_elem *data)
150 const struct hash_ipportnet4_telem *tdata =
151 (const struct hash_ipportnet4_telem *)data;
152 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
154 if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, tdata->ip) ||
155 nla_put_ipaddr4(skb, IPSET_ATTR_IP2, tdata->ip2) ||
156 nla_put_net16(skb, IPSET_ATTR_PORT, tdata->port) ||
157 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
158 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
159 nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
160 htonl(ip_set_timeout_get(tdata->timeout))) ||
162 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
163 goto nla_put_failure;
170 #define IP_SET_HASH_WITH_PROTO
171 #define IP_SET_HASH_WITH_NETS
175 #include <linux/netfilter/ipset/ip_set_ahash.h>
178 hash_ipportnet4_data_next(struct ip_set_hash *h,
179 const struct hash_ipportnet4_elem *d)
182 h->next.port = d->port;
183 h->next.ip2 = d->ip2;
187 hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb,
188 const struct xt_action_param *par,
189 enum ipset_adt adt, const struct ip_set_adt_opt *opt)
191 const struct ip_set_hash *h = set->data;
192 ipset_adtfn adtfn = set->variant->adt[adt];
193 struct hash_ipportnet4_elem data = {
194 .cidr = h->nets[0].cidr ? h->nets[0].cidr - 1 : HOST_MASK - 1
197 if (adt == IPSET_TEST)
198 data.cidr = HOST_MASK - 1;
200 if (!ip_set_get_ip4_port(skb, opt->flags & IPSET_DIM_TWO_SRC,
201 &data.port, &data.proto))
204 ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip);
205 ip4addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2);
206 data.ip2 &= ip_set_netmask(data.cidr + 1);
208 return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags);
212 hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
213 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
215 const struct ip_set_hash *h = set->data;
216 ipset_adtfn adtfn = set->variant->adt[adt];
217 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK - 1 };
218 u32 ip, ip_to, p = 0, port, port_to;
219 u32 ip2_from, ip2_to, ip2_last, ip2;
220 u32 timeout = h->timeout;
221 bool with_ports = false;
225 if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
226 !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) ||
227 !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) ||
228 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
229 !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS)))
230 return -IPSET_ERR_PROTOCOL;
232 if (tb[IPSET_ATTR_LINENO])
233 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
235 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip);
239 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2], &ip2_from);
243 if (tb[IPSET_ATTR_CIDR2]) {
244 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR2]);
245 if (!cidr || cidr > HOST_MASK)
246 return -IPSET_ERR_INVALID_CIDR;
247 data.cidr = cidr - 1;
250 if (tb[IPSET_ATTR_PORT])
251 data.port = nla_get_be16(tb[IPSET_ATTR_PORT]);
253 return -IPSET_ERR_PROTOCOL;
255 if (tb[IPSET_ATTR_PROTO]) {
256 data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
257 with_ports = ip_set_proto_with_ports(data.proto);
260 return -IPSET_ERR_INVALID_PROTO;
262 return -IPSET_ERR_MISSING_PROTO;
264 if (!(with_ports || data.proto == IPPROTO_ICMP))
267 if (tb[IPSET_ATTR_TIMEOUT]) {
268 if (!with_timeout(h->timeout))
269 return -IPSET_ERR_TIMEOUT;
270 timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
273 if (tb[IPSET_ATTR_CADT_FLAGS] && adt == IPSET_ADD) {
274 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
275 if (cadt_flags & IPSET_FLAG_NOMATCH)
276 flags |= (cadt_flags << 16);
279 with_ports = with_ports && tb[IPSET_ATTR_PORT_TO];
280 if (adt == IPSET_TEST ||
281 !(tb[IPSET_ATTR_CIDR] || tb[IPSET_ATTR_IP_TO] || with_ports ||
282 tb[IPSET_ATTR_IP2_TO])) {
284 data.ip2 = htonl(ip2_from & ip_set_hostmask(data.cidr + 1));
285 ret = adtfn(set, &data, timeout, flags);
286 return ip_set_eexist(ret, flags) ? 0 : ret;
290 if (tb[IPSET_ATTR_IP_TO]) {
291 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
296 } else if (tb[IPSET_ATTR_CIDR]) {
297 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);
299 if (!cidr || cidr > 32)
300 return -IPSET_ERR_INVALID_CIDR;
301 ip_set_mask_from_to(ip, ip_to, cidr);
304 port_to = port = ntohs(data.port);
305 if (tb[IPSET_ATTR_PORT_TO]) {
306 port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
312 if (tb[IPSET_ATTR_IP2_TO]) {
313 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);
316 if (ip2_from > ip2_to)
317 swap(ip2_from, ip2_to);
318 if (ip2_from + UINT_MAX == ip2_to)
319 return -IPSET_ERR_HASH_RANGE;
321 ip_set_mask_from_to(ip2_from, ip2_to, data.cidr + 1);
325 ip = ntohl(h->next.ip);
326 for (; !before(ip_to, ip); ip++) {
328 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
330 for (; p <= port_to; p++) {
331 data.port = htons(p);
333 && ip == ntohl(h->next.ip)
334 && p == ntohs(h->next.port)
335 ? ntohl(h->next.ip2) : ip2_from;
336 while (!after(ip2, ip2_to)) {
337 data.ip2 = htonl(ip2);
338 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
340 data.cidr = cidr - 1;
341 ret = adtfn(set, &data, timeout, flags);
343 if (ret && !ip_set_eexist(ret, flags))
355 hash_ipportnet_same_set(const struct ip_set *a, const struct ip_set *b)
357 const struct ip_set_hash *x = a->data;
358 const struct ip_set_hash *y = b->data;
360 /* Resizing changes htable_bits, so we ignore it */
361 return x->maxelem == y->maxelem &&
362 x->timeout == y->timeout;
365 /* The type variant functions: IPv6 */
367 struct hash_ipportnet6_elem {
368 union nf_inet_addr ip;
369 union nf_inet_addr ip2;
376 struct hash_ipportnet6_telem {
377 union nf_inet_addr ip;
378 union nf_inet_addr ip2;
383 unsigned long timeout;
387 hash_ipportnet6_data_equal(const struct hash_ipportnet6_elem *ip1,
388 const struct hash_ipportnet6_elem *ip2,
391 return ipv6_addr_equal(&ip1->ip.in6, &ip2->ip.in6) &&
392 ipv6_addr_equal(&ip1->ip2.in6, &ip2->ip2.in6) &&
393 ip1->cidr == ip2->cidr &&
394 ip1->port == ip2->port &&
395 ip1->proto == ip2->proto;
399 hash_ipportnet6_data_isnull(const struct hash_ipportnet6_elem *elem)
401 return elem->proto == 0;
405 hash_ipportnet6_data_copy(struct hash_ipportnet6_elem *dst,
406 const struct hash_ipportnet6_elem *src)
408 memcpy(dst, src, sizeof(*dst));
412 hash_ipportnet6_data_flags(struct hash_ipportnet6_elem *dst, u32 flags)
414 dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH);
418 hash_ipportnet6_data_match(const struct hash_ipportnet6_elem *elem)
420 return elem->nomatch ? -ENOTEMPTY : 1;
424 hash_ipportnet6_data_zero_out(struct hash_ipportnet6_elem *elem)
430 ip6_netmask(union nf_inet_addr *ip, u8 prefix)
432 ip->ip6[0] &= ip_set_netmask6(prefix)[0];
433 ip->ip6[1] &= ip_set_netmask6(prefix)[1];
434 ip->ip6[2] &= ip_set_netmask6(prefix)[2];
435 ip->ip6[3] &= ip_set_netmask6(prefix)[3];
439 hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr)
441 ip6_netmask(&elem->ip2, cidr);
442 elem->cidr = cidr - 1;
446 hash_ipportnet6_data_list(struct sk_buff *skb,
447 const struct hash_ipportnet6_elem *data)
449 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
451 if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &data->ip.in6) ||
452 nla_put_ipaddr6(skb, IPSET_ATTR_IP2, &data->ip2.in6) ||
453 nla_put_net16(skb, IPSET_ATTR_PORT, data->port) ||
454 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
455 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
457 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
458 goto nla_put_failure;
466 hash_ipportnet6_data_tlist(struct sk_buff *skb,
467 const struct hash_ipportnet6_elem *data)
469 const struct hash_ipportnet6_telem *e =
470 (const struct hash_ipportnet6_telem *)data;
471 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
473 if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &e->ip.in6) ||
474 nla_put_ipaddr6(skb, IPSET_ATTR_IP2, &data->ip2.in6) ||
475 nla_put_net16(skb, IPSET_ATTR_PORT, data->port) ||
476 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
477 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
478 nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
479 htonl(ip_set_timeout_get(e->timeout))) ||
481 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
482 goto nla_put_failure;
493 #define HOST_MASK 128
494 #include <linux/netfilter/ipset/ip_set_ahash.h>
497 hash_ipportnet6_data_next(struct ip_set_hash *h,
498 const struct hash_ipportnet6_elem *d)
500 h->next.port = d->port;
504 hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb,
505 const struct xt_action_param *par,
506 enum ipset_adt adt, const struct ip_set_adt_opt *opt)
508 const struct ip_set_hash *h = set->data;
509 ipset_adtfn adtfn = set->variant->adt[adt];
510 struct hash_ipportnet6_elem data = {
511 .cidr = h->nets[0].cidr ? h->nets[0].cidr - 1 : HOST_MASK - 1
514 if (adt == IPSET_TEST)
515 data.cidr = HOST_MASK - 1;
517 if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC,
518 &data.port, &data.proto))
521 ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
522 ip6addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);
523 ip6_netmask(&data.ip2, data.cidr + 1);
525 return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags);
529 hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
530 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
532 const struct ip_set_hash *h = set->data;
533 ipset_adtfn adtfn = set->variant->adt[adt];
534 struct hash_ipportnet6_elem data = { .cidr = HOST_MASK - 1 };
536 u32 timeout = h->timeout;
537 bool with_ports = false;
541 if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
542 !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) ||
543 !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) ||
544 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
545 !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) ||
546 tb[IPSET_ATTR_IP_TO] ||
547 tb[IPSET_ATTR_CIDR]))
548 return -IPSET_ERR_PROTOCOL;
549 if (unlikely(tb[IPSET_ATTR_IP_TO]))
550 return -IPSET_ERR_HASH_RANGE_UNSUPPORTED;
552 if (tb[IPSET_ATTR_LINENO])
553 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
555 ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &data.ip);
559 ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP2], &data.ip2);
563 if (tb[IPSET_ATTR_CIDR2]) {
564 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR2]);
565 if (!cidr || cidr > HOST_MASK)
566 return -IPSET_ERR_INVALID_CIDR;
567 data.cidr = cidr - 1;
570 ip6_netmask(&data.ip2, data.cidr + 1);
572 if (tb[IPSET_ATTR_PORT])
573 data.port = nla_get_be16(tb[IPSET_ATTR_PORT]);
575 return -IPSET_ERR_PROTOCOL;
577 if (tb[IPSET_ATTR_PROTO]) {
578 data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
579 with_ports = ip_set_proto_with_ports(data.proto);
582 return -IPSET_ERR_INVALID_PROTO;
584 return -IPSET_ERR_MISSING_PROTO;
586 if (!(with_ports || data.proto == IPPROTO_ICMPV6))
589 if (tb[IPSET_ATTR_TIMEOUT]) {
590 if (!with_timeout(h->timeout))
591 return -IPSET_ERR_TIMEOUT;
592 timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
595 if (tb[IPSET_ATTR_CADT_FLAGS] && adt == IPSET_ADD) {
596 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
597 if (cadt_flags & IPSET_FLAG_NOMATCH)
598 flags |= (cadt_flags << 16);
601 if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
602 ret = adtfn(set, &data, timeout, flags);
603 return ip_set_eexist(ret, flags) ? 0 : ret;
606 port = ntohs(data.port);
607 port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
612 port = ntohs(h->next.port);
613 for (; port <= port_to; port++) {
614 data.port = htons(port);
615 ret = adtfn(set, &data, timeout, flags);
617 if (ret && !ip_set_eexist(ret, flags))
625 /* Create hash:ip type of sets */
628 hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
630 struct ip_set_hash *h;
631 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
635 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
636 return -IPSET_ERR_INVALID_FAMILY;
638 if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) ||
639 !ip_set_optattr_netorder(tb, IPSET_ATTR_MAXELEM) ||
640 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT)))
641 return -IPSET_ERR_PROTOCOL;
643 if (tb[IPSET_ATTR_HASHSIZE]) {
644 hashsize = ip_set_get_h32(tb[IPSET_ATTR_HASHSIZE]);
645 if (hashsize < IPSET_MIMINAL_HASHSIZE)
646 hashsize = IPSET_MIMINAL_HASHSIZE;
649 if (tb[IPSET_ATTR_MAXELEM])
650 maxelem = ip_set_get_h32(tb[IPSET_ATTR_MAXELEM]);
652 h = kzalloc(sizeof(*h)
653 + sizeof(struct ip_set_hash_nets)
654 * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL);
658 h->maxelem = maxelem;
659 get_random_bytes(&h->initval, sizeof(h->initval));
660 h->timeout = IPSET_NO_TIMEOUT;
662 hbits = htable_bits(hashsize);
663 hsize = htable_size(hbits);
668 h->table = ip_set_alloc(hsize);
673 h->table->htable_bits = hbits;
677 if (tb[IPSET_ATTR_TIMEOUT]) {
678 h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
680 set->variant = set->family == NFPROTO_IPV4
681 ? &hash_ipportnet4_tvariant
682 : &hash_ipportnet6_tvariant;
684 if (set->family == NFPROTO_IPV4)
685 hash_ipportnet4_gc_init(set);
687 hash_ipportnet6_gc_init(set);
689 set->variant = set->family == NFPROTO_IPV4
690 ? &hash_ipportnet4_variant : &hash_ipportnet6_variant;
693 pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
694 set->name, jhash_size(h->table->htable_bits),
695 h->table->htable_bits, h->maxelem, set->data, h->table);
700 static struct ip_set_type hash_ipportnet_type __read_mostly = {
701 .name = "hash:ip,port,net",
702 .protocol = IPSET_PROTOCOL,
703 .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2 |
705 .dimension = IPSET_DIM_THREE,
706 .family = NFPROTO_UNSPEC,
707 .revision_min = REVISION_MIN,
708 .revision_max = REVISION_MAX,
709 .create = hash_ipportnet_create,
711 [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 },
712 [IPSET_ATTR_MAXELEM] = { .type = NLA_U32 },
713 [IPSET_ATTR_PROBES] = { .type = NLA_U8 },
714 [IPSET_ATTR_RESIZE] = { .type = NLA_U8 },
715 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
718 [IPSET_ATTR_IP] = { .type = NLA_NESTED },
719 [IPSET_ATTR_IP_TO] = { .type = NLA_NESTED },
720 [IPSET_ATTR_IP2] = { .type = NLA_NESTED },
721 [IPSET_ATTR_IP2_TO] = { .type = NLA_NESTED },
722 [IPSET_ATTR_PORT] = { .type = NLA_U16 },
723 [IPSET_ATTR_PORT_TO] = { .type = NLA_U16 },
724 [IPSET_ATTR_CIDR] = { .type = NLA_U8 },
725 [IPSET_ATTR_CIDR2] = { .type = NLA_U8 },
726 [IPSET_ATTR_PROTO] = { .type = NLA_U8 },
727 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
728 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
729 [IPSET_ATTR_LINENO] = { .type = NLA_U32 },
735 hash_ipportnet_init(void)
737 return ip_set_type_register(&hash_ipportnet_type);
741 hash_ipportnet_fini(void)
743 ip_set_type_unregister(&hash_ipportnet_type);
746 module_init(hash_ipportnet_init);
747 module_exit(hash_ipportnet_fini);