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 = 0, p = 0, port, port_to;
219 u32 ip2_from = 0, 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;
289 if (tb[IPSET_ATTR_IP_TO]) {
290 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
295 } else if (tb[IPSET_ATTR_CIDR]) {
296 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);
298 if (!cidr || cidr > 32)
299 return -IPSET_ERR_INVALID_CIDR;
300 ip_set_mask_from_to(ip, ip_to, cidr);
303 port_to = port = ntohs(data.port);
304 if (tb[IPSET_ATTR_PORT_TO]) {
305 port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
309 if (tb[IPSET_ATTR_IP2_TO]) {
310 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);
313 if (ip2_from > ip2_to)
314 swap(ip2_from, ip2_to);
315 if (ip2_from + UINT_MAX == ip2_to)
316 return -IPSET_ERR_HASH_RANGE;
318 ip_set_mask_from_to(ip2_from, ip2_to, data.cidr + 1);
322 ip = ntohl(h->next.ip);
323 for (; !before(ip_to, ip); ip++) {
325 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
327 for (; p <= port_to; p++) {
328 data.port = htons(p);
330 && ip == ntohl(h->next.ip)
331 && p == ntohs(h->next.port)
332 ? ntohl(h->next.ip2) : ip2_from;
333 while (!after(ip2, ip2_to)) {
334 data.ip2 = htonl(ip2);
335 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
337 data.cidr = cidr - 1;
338 ret = adtfn(set, &data, timeout, flags);
340 if (ret && !ip_set_eexist(ret, flags))
352 hash_ipportnet_same_set(const struct ip_set *a, const struct ip_set *b)
354 const struct ip_set_hash *x = a->data;
355 const struct ip_set_hash *y = b->data;
357 /* Resizing changes htable_bits, so we ignore it */
358 return x->maxelem == y->maxelem &&
359 x->timeout == y->timeout;
362 /* The type variant functions: IPv6 */
364 struct hash_ipportnet6_elem {
365 union nf_inet_addr ip;
366 union nf_inet_addr ip2;
373 struct hash_ipportnet6_telem {
374 union nf_inet_addr ip;
375 union nf_inet_addr ip2;
380 unsigned long timeout;
384 hash_ipportnet6_data_equal(const struct hash_ipportnet6_elem *ip1,
385 const struct hash_ipportnet6_elem *ip2,
388 return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 &&
389 ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 &&
390 ip1->cidr == ip2->cidr &&
391 ip1->port == ip2->port &&
392 ip1->proto == ip2->proto;
396 hash_ipportnet6_data_isnull(const struct hash_ipportnet6_elem *elem)
398 return elem->proto == 0;
402 hash_ipportnet6_data_copy(struct hash_ipportnet6_elem *dst,
403 const struct hash_ipportnet6_elem *src)
405 memcpy(dst, src, sizeof(*dst));
409 hash_ipportnet6_data_flags(struct hash_ipportnet6_elem *dst, u32 flags)
411 dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH);
415 hash_ipportnet6_data_match(const struct hash_ipportnet6_elem *elem)
417 return elem->nomatch ? -ENOTEMPTY : 1;
421 hash_ipportnet6_data_zero_out(struct hash_ipportnet6_elem *elem)
427 ip6_netmask(union nf_inet_addr *ip, u8 prefix)
429 ip->ip6[0] &= ip_set_netmask6(prefix)[0];
430 ip->ip6[1] &= ip_set_netmask6(prefix)[1];
431 ip->ip6[2] &= ip_set_netmask6(prefix)[2];
432 ip->ip6[3] &= ip_set_netmask6(prefix)[3];
436 hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr)
438 ip6_netmask(&elem->ip2, cidr);
439 elem->cidr = cidr - 1;
443 hash_ipportnet6_data_list(struct sk_buff *skb,
444 const struct hash_ipportnet6_elem *data)
446 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
448 if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &data->ip.in6) ||
449 nla_put_ipaddr6(skb, IPSET_ATTR_IP2, &data->ip2.in6) ||
450 nla_put_net16(skb, IPSET_ATTR_PORT, data->port) ||
451 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
452 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
454 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
455 goto nla_put_failure;
463 hash_ipportnet6_data_tlist(struct sk_buff *skb,
464 const struct hash_ipportnet6_elem *data)
466 const struct hash_ipportnet6_telem *e =
467 (const struct hash_ipportnet6_telem *)data;
468 u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0;
470 if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &e->ip.in6) ||
471 nla_put_ipaddr6(skb, IPSET_ATTR_IP2, &data->ip2.in6) ||
472 nla_put_net16(skb, IPSET_ATTR_PORT, data->port) ||
473 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) ||
474 nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto) ||
475 nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
476 htonl(ip_set_timeout_get(e->timeout))) ||
478 nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
479 goto nla_put_failure;
490 #define HOST_MASK 128
491 #include <linux/netfilter/ipset/ip_set_ahash.h>
494 hash_ipportnet6_data_next(struct ip_set_hash *h,
495 const struct hash_ipportnet6_elem *d)
497 h->next.port = d->port;
501 hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb,
502 const struct xt_action_param *par,
503 enum ipset_adt adt, const struct ip_set_adt_opt *opt)
505 const struct ip_set_hash *h = set->data;
506 ipset_adtfn adtfn = set->variant->adt[adt];
507 struct hash_ipportnet6_elem data = {
508 .cidr = h->nets[0].cidr ? h->nets[0].cidr - 1 : HOST_MASK - 1
511 if (adt == IPSET_TEST)
512 data.cidr = HOST_MASK - 1;
514 if (!ip_set_get_ip6_port(skb, opt->flags & IPSET_DIM_TWO_SRC,
515 &data.port, &data.proto))
518 ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
519 ip6addrptr(skb, opt->flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);
520 ip6_netmask(&data.ip2, data.cidr + 1);
522 return adtfn(set, &data, opt_timeout(opt, h), opt->cmdflags);
526 hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
527 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
529 const struct ip_set_hash *h = set->data;
530 ipset_adtfn adtfn = set->variant->adt[adt];
531 struct hash_ipportnet6_elem data = { .cidr = HOST_MASK - 1 };
533 u32 timeout = h->timeout;
534 bool with_ports = false;
538 if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
539 !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) ||
540 !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) ||
541 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
542 !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) ||
543 tb[IPSET_ATTR_IP_TO] ||
544 tb[IPSET_ATTR_CIDR]))
545 return -IPSET_ERR_PROTOCOL;
546 if (unlikely(tb[IPSET_ATTR_IP_TO]))
547 return -IPSET_ERR_HASH_RANGE_UNSUPPORTED;
549 if (tb[IPSET_ATTR_LINENO])
550 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
552 ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &data.ip);
556 ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP2], &data.ip2);
560 if (tb[IPSET_ATTR_CIDR2]) {
561 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR2]);
562 if (!cidr || cidr > HOST_MASK)
563 return -IPSET_ERR_INVALID_CIDR;
564 data.cidr = cidr - 1;
567 ip6_netmask(&data.ip2, data.cidr + 1);
569 if (tb[IPSET_ATTR_PORT])
570 data.port = nla_get_be16(tb[IPSET_ATTR_PORT]);
572 return -IPSET_ERR_PROTOCOL;
574 if (tb[IPSET_ATTR_PROTO]) {
575 data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
576 with_ports = ip_set_proto_with_ports(data.proto);
579 return -IPSET_ERR_INVALID_PROTO;
581 return -IPSET_ERR_MISSING_PROTO;
583 if (!(with_ports || data.proto == IPPROTO_ICMPV6))
586 if (tb[IPSET_ATTR_TIMEOUT]) {
587 if (!with_timeout(h->timeout))
588 return -IPSET_ERR_TIMEOUT;
589 timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
592 if (tb[IPSET_ATTR_CADT_FLAGS] && adt == IPSET_ADD) {
593 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
594 if (cadt_flags & IPSET_FLAG_NOMATCH)
595 flags |= (cadt_flags << 16);
598 if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
599 ret = adtfn(set, &data, timeout, flags);
600 return ip_set_eexist(ret, flags) ? 0 : ret;
603 port = ntohs(data.port);
604 port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
609 port = ntohs(h->next.port);
610 for (; port <= port_to; port++) {
611 data.port = htons(port);
612 ret = adtfn(set, &data, timeout, flags);
614 if (ret && !ip_set_eexist(ret, flags))
622 /* Create hash:ip type of sets */
625 hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
627 struct ip_set_hash *h;
628 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
632 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
633 return -IPSET_ERR_INVALID_FAMILY;
635 if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_HASHSIZE) ||
636 !ip_set_optattr_netorder(tb, IPSET_ATTR_MAXELEM) ||
637 !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT)))
638 return -IPSET_ERR_PROTOCOL;
640 if (tb[IPSET_ATTR_HASHSIZE]) {
641 hashsize = ip_set_get_h32(tb[IPSET_ATTR_HASHSIZE]);
642 if (hashsize < IPSET_MIMINAL_HASHSIZE)
643 hashsize = IPSET_MIMINAL_HASHSIZE;
646 if (tb[IPSET_ATTR_MAXELEM])
647 maxelem = ip_set_get_h32(tb[IPSET_ATTR_MAXELEM]);
649 h = kzalloc(sizeof(*h)
650 + sizeof(struct ip_set_hash_nets)
651 * (set->family == NFPROTO_IPV4 ? 32 : 128), GFP_KERNEL);
655 h->maxelem = maxelem;
656 get_random_bytes(&h->initval, sizeof(h->initval));
657 h->timeout = IPSET_NO_TIMEOUT;
659 hbits = htable_bits(hashsize);
660 hsize = htable_size(hbits);
665 h->table = ip_set_alloc(hsize);
670 h->table->htable_bits = hbits;
674 if (tb[IPSET_ATTR_TIMEOUT]) {
675 h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
677 set->variant = set->family == NFPROTO_IPV4
678 ? &hash_ipportnet4_tvariant
679 : &hash_ipportnet6_tvariant;
681 if (set->family == NFPROTO_IPV4)
682 hash_ipportnet4_gc_init(set);
684 hash_ipportnet6_gc_init(set);
686 set->variant = set->family == NFPROTO_IPV4
687 ? &hash_ipportnet4_variant : &hash_ipportnet6_variant;
690 pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
691 set->name, jhash_size(h->table->htable_bits),
692 h->table->htable_bits, h->maxelem, set->data, h->table);
697 static struct ip_set_type hash_ipportnet_type __read_mostly = {
698 .name = "hash:ip,port,net",
699 .protocol = IPSET_PROTOCOL,
700 .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2 |
702 .dimension = IPSET_DIM_THREE,
703 .family = NFPROTO_UNSPEC,
704 .revision_min = REVISION_MIN,
705 .revision_max = REVISION_MAX,
706 .create = hash_ipportnet_create,
708 [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 },
709 [IPSET_ATTR_MAXELEM] = { .type = NLA_U32 },
710 [IPSET_ATTR_PROBES] = { .type = NLA_U8 },
711 [IPSET_ATTR_RESIZE] = { .type = NLA_U8 },
712 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
715 [IPSET_ATTR_IP] = { .type = NLA_NESTED },
716 [IPSET_ATTR_IP_TO] = { .type = NLA_NESTED },
717 [IPSET_ATTR_IP2] = { .type = NLA_NESTED },
718 [IPSET_ATTR_IP2_TO] = { .type = NLA_NESTED },
719 [IPSET_ATTR_PORT] = { .type = NLA_U16 },
720 [IPSET_ATTR_PORT_TO] = { .type = NLA_U16 },
721 [IPSET_ATTR_CIDR] = { .type = NLA_U8 },
722 [IPSET_ATTR_CIDR2] = { .type = NLA_U8 },
723 [IPSET_ATTR_PROTO] = { .type = NLA_U8 },
724 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
725 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
726 [IPSET_ATTR_LINENO] = { .type = NLA_U32 },
732 hash_ipportnet_init(void)
734 return ip_set_type_register(&hash_ipportnet_type);
738 hash_ipportnet_fini(void)
740 ip_set_type_unregister(&hash_ipportnet_type);
743 module_init(hash_ipportnet_init);
744 module_exit(hash_ipportnet_fini);