]> git.karo-electronics.de Git - karo-tx-linux.git/blob - net/netfilter/ipset/ip_set_list_set.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek...
[karo-tx-linux.git] / net / netfilter / ipset / ip_set_list_set.c
1 /* Copyright (C) 2008-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
2  *
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.
6  */
7
8 /* Kernel module implementing an IP set type: the list:set type */
9
10 #include <linux/module.h>
11 #include <linux/ip.h>
12 #include <linux/rculist.h>
13 #include <linux/skbuff.h>
14 #include <linux/errno.h>
15
16 #include <linux/netfilter/ipset/ip_set.h>
17 #include <linux/netfilter/ipset/ip_set_list.h>
18
19 #define IPSET_TYPE_REV_MIN      0
20 /*                              1    Counters support added */
21 /*                              2    Comments support added */
22 #define IPSET_TYPE_REV_MAX      3 /* skbinfo support added */
23
24 MODULE_LICENSE("GPL");
25 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
26 IP_SET_MODULE_DESC("list:set", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
27 MODULE_ALIAS("ip_set_list:set");
28
29 /* Member elements  */
30 struct set_elem {
31         struct rcu_head rcu;
32         struct list_head list;
33         struct ip_set *set;     /* Sigh, in order to cleanup reference */
34         ip_set_id_t id;
35 } __aligned(__alignof__(u64));
36
37 struct set_adt_elem {
38         ip_set_id_t id;
39         ip_set_id_t refid;
40         int before;
41 };
42
43 /* Type structure */
44 struct list_set {
45         u32 size;               /* size of set list array */
46         struct timer_list gc;   /* garbage collection */
47         struct net *net;        /* namespace */
48         struct list_head members; /* the set members */
49 };
50
51 static int
52 list_set_ktest(struct ip_set *set, const struct sk_buff *skb,
53                const struct xt_action_param *par,
54                struct ip_set_adt_opt *opt, const struct ip_set_ext *ext)
55 {
56         struct list_set *map = set->data;
57         struct set_elem *e;
58         u32 cmdflags = opt->cmdflags;
59         int ret;
60
61         /* Don't lookup sub-counters at all */
62         opt->cmdflags &= ~IPSET_FLAG_MATCH_COUNTERS;
63         if (opt->cmdflags & IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE)
64                 opt->cmdflags &= ~IPSET_FLAG_SKIP_COUNTER_UPDATE;
65         list_for_each_entry_rcu(e, &map->members, list) {
66                 if (SET_WITH_TIMEOUT(set) &&
67                     ip_set_timeout_expired(ext_timeout(e, set)))
68                         continue;
69                 ret = ip_set_test(e->id, skb, par, opt);
70                 if (ret > 0) {
71                         if (SET_WITH_COUNTER(set))
72                                 ip_set_update_counter(ext_counter(e, set),
73                                                       ext, &opt->ext,
74                                                       cmdflags);
75                         if (SET_WITH_SKBINFO(set))
76                                 ip_set_get_skbinfo(ext_skbinfo(e, set),
77                                                    ext, &opt->ext,
78                                                    cmdflags);
79                         return ret;
80                 }
81         }
82         return 0;
83 }
84
85 static int
86 list_set_kadd(struct ip_set *set, const struct sk_buff *skb,
87               const struct xt_action_param *par,
88               struct ip_set_adt_opt *opt, const struct ip_set_ext *ext)
89 {
90         struct list_set *map = set->data;
91         struct set_elem *e;
92         int ret;
93
94         list_for_each_entry(e, &map->members, list) {
95                 if (SET_WITH_TIMEOUT(set) &&
96                     ip_set_timeout_expired(ext_timeout(e, set)))
97                         continue;
98                 ret = ip_set_add(e->id, skb, par, opt);
99                 if (ret == 0)
100                         return ret;
101         }
102         return 0;
103 }
104
105 static int
106 list_set_kdel(struct ip_set *set, const struct sk_buff *skb,
107               const struct xt_action_param *par,
108               struct ip_set_adt_opt *opt, const struct ip_set_ext *ext)
109 {
110         struct list_set *map = set->data;
111         struct set_elem *e;
112         int ret;
113
114         list_for_each_entry(e, &map->members, list) {
115                 if (SET_WITH_TIMEOUT(set) &&
116                     ip_set_timeout_expired(ext_timeout(e, set)))
117                         continue;
118                 ret = ip_set_del(e->id, skb, par, opt);
119                 if (ret == 0)
120                         return ret;
121         }
122         return 0;
123 }
124
125 static int
126 list_set_kadt(struct ip_set *set, const struct sk_buff *skb,
127               const struct xt_action_param *par,
128               enum ipset_adt adt, struct ip_set_adt_opt *opt)
129 {
130         struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set);
131         int ret = -EINVAL;
132
133         rcu_read_lock();
134         switch (adt) {
135         case IPSET_TEST:
136                 ret = list_set_ktest(set, skb, par, opt, &ext);
137                 break;
138         case IPSET_ADD:
139                 ret = list_set_kadd(set, skb, par, opt, &ext);
140                 break;
141         case IPSET_DEL:
142                 ret = list_set_kdel(set, skb, par, opt, &ext);
143                 break;
144         default:
145                 break;
146         }
147         rcu_read_unlock();
148
149         return ret;
150 }
151
152 /* Userspace interfaces: we are protected by the nfnl mutex */
153
154 static void
155 __list_set_del_rcu(struct rcu_head * rcu)
156 {
157         struct set_elem *e = container_of(rcu, struct set_elem, rcu);
158         struct ip_set *set = e->set;
159         struct list_set *map = set->data;
160
161         ip_set_put_byindex(map->net, e->id);
162         ip_set_ext_destroy(set, e);
163         kfree(e);
164 }
165
166 static inline void
167 list_set_del(struct ip_set *set, struct set_elem *e)
168 {
169         set->elements--;
170         list_del_rcu(&e->list);
171         call_rcu(&e->rcu, __list_set_del_rcu);
172 }
173
174 static inline void
175 list_set_replace(struct set_elem *e, struct set_elem *old)
176 {
177         list_replace_rcu(&old->list, &e->list);
178         call_rcu(&old->rcu, __list_set_del_rcu);
179 }
180
181 static void
182 set_cleanup_entries(struct ip_set *set)
183 {
184         struct list_set *map = set->data;
185         struct set_elem *e, *n;
186
187         list_for_each_entry_safe(e, n, &map->members, list)
188                 if (ip_set_timeout_expired(ext_timeout(e, set)))
189                         list_set_del(set, e);
190 }
191
192 static int
193 list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext,
194                struct ip_set_ext *mext, u32 flags)
195 {
196         struct list_set *map = set->data;
197         struct set_adt_elem *d = value;
198         struct set_elem *e, *next, *prev = NULL;
199         int ret;
200
201         list_for_each_entry(e, &map->members, list) {
202                 if (SET_WITH_TIMEOUT(set) &&
203                     ip_set_timeout_expired(ext_timeout(e, set)))
204                         continue;
205                 else if (e->id != d->id) {
206                         prev = e;
207                         continue;
208                 }
209
210                 if (d->before == 0) {
211                         ret = 1;
212                 } else if (d->before > 0) {
213                         next = list_next_entry(e, list);
214                         ret = !list_is_last(&e->list, &map->members) &&
215                               next->id == d->refid;
216                 } else {
217                         ret = prev && prev->id == d->refid;
218                 }
219                 return ret;
220         }
221         return 0;
222 }
223
224 static void
225 list_set_init_extensions(struct ip_set *set, const struct ip_set_ext *ext,
226                          struct set_elem *e)
227 {
228         if (SET_WITH_COUNTER(set))
229                 ip_set_init_counter(ext_counter(e, set), ext);
230         if (SET_WITH_COMMENT(set))
231                 ip_set_init_comment(set, ext_comment(e, set), ext);
232         if (SET_WITH_SKBINFO(set))
233                 ip_set_init_skbinfo(ext_skbinfo(e, set), ext);
234         /* Update timeout last */
235         if (SET_WITH_TIMEOUT(set))
236                 ip_set_timeout_set(ext_timeout(e, set), ext->timeout);
237 }
238
239 static int
240 list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext,
241               struct ip_set_ext *mext, u32 flags)
242 {
243         struct list_set *map = set->data;
244         struct set_adt_elem *d = value;
245         struct set_elem *e, *n, *prev, *next;
246         bool flag_exist = flags & IPSET_FLAG_EXIST;
247
248         /* Find where to add the new entry */
249         n = prev = next = NULL;
250         list_for_each_entry(e, &map->members, list) {
251                 if (SET_WITH_TIMEOUT(set) &&
252                     ip_set_timeout_expired(ext_timeout(e, set)))
253                         continue;
254                 else if (d->id == e->id)
255                         n = e;
256                 else if (d->before == 0 || e->id != d->refid)
257                         continue;
258                 else if (d->before > 0)
259                         next = e;
260                 else
261                         prev = e;
262         }
263
264         /* If before/after is used on an empty set */
265         if ((d->before > 0 && !next) ||
266             (d->before < 0 && !prev))
267                 return -IPSET_ERR_REF_EXIST;
268
269         /* Re-add already existing element */
270         if (n) {
271                 if (!flag_exist)
272                         return -IPSET_ERR_EXIST;
273                 /* Update extensions */
274                 ip_set_ext_destroy(set, n);
275                 list_set_init_extensions(set, ext, n);
276
277                 /* Set is already added to the list */
278                 ip_set_put_byindex(map->net, d->id);
279                 return 0;
280         }
281         /* Add new entry */
282         if (d->before == 0) {
283                 /* Append  */
284                 n = list_empty(&map->members) ? NULL :
285                     list_last_entry(&map->members, struct set_elem, list);
286         } else if (d->before > 0) {
287                 /* Insert after next element */
288                 if (!list_is_last(&next->list, &map->members))
289                         n = list_next_entry(next, list);
290         } else {
291                 /* Insert before prev element */
292                 if (prev->list.prev != &map->members)
293                         n = list_prev_entry(prev, list);
294         }
295         /* Can we replace a timed out entry? */
296         if (n &&
297             !(SET_WITH_TIMEOUT(set) &&
298               ip_set_timeout_expired(ext_timeout(n, set))))
299                 n =  NULL;
300
301         e = kzalloc(set->dsize, GFP_ATOMIC);
302         if (!e)
303                 return -ENOMEM;
304         e->id = d->id;
305         e->set = set;
306         INIT_LIST_HEAD(&e->list);
307         list_set_init_extensions(set, ext, e);
308         if (n)
309                 list_set_replace(e, n);
310         else if (next)
311                 list_add_tail_rcu(&e->list, &next->list);
312         else if (prev)
313                 list_add_rcu(&e->list, &prev->list);
314         else
315                 list_add_tail_rcu(&e->list, &map->members);
316         set->elements++;
317
318         return 0;
319 }
320
321 static int
322 list_set_udel(struct ip_set *set, void *value, const struct ip_set_ext *ext,
323               struct ip_set_ext *mext, u32 flags)
324 {
325         struct list_set *map = set->data;
326         struct set_adt_elem *d = value;
327         struct set_elem *e, *next, *prev = NULL;
328
329         list_for_each_entry(e, &map->members, list) {
330                 if (SET_WITH_TIMEOUT(set) &&
331                     ip_set_timeout_expired(ext_timeout(e, set)))
332                         continue;
333                 else if (e->id != d->id) {
334                         prev = e;
335                         continue;
336                 }
337
338                 if (d->before > 0) {
339                         next = list_next_entry(e, list);
340                         if (list_is_last(&e->list, &map->members) ||
341                             next->id != d->refid)
342                                 return -IPSET_ERR_REF_EXIST;
343                 } else if (d->before < 0) {
344                         if (!prev || prev->id != d->refid)
345                                 return -IPSET_ERR_REF_EXIST;
346                 }
347                 list_set_del(set, e);
348                 return 0;
349         }
350         return d->before != 0 ? -IPSET_ERR_REF_EXIST : -IPSET_ERR_EXIST;
351 }
352
353 static int
354 list_set_uadt(struct ip_set *set, struct nlattr *tb[],
355               enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
356 {
357         struct list_set *map = set->data;
358         ipset_adtfn adtfn = set->variant->adt[adt];
359         struct set_adt_elem e = { .refid = IPSET_INVALID_ID };
360         struct ip_set_ext ext = IP_SET_INIT_UEXT(set);
361         struct ip_set *s;
362         int ret = 0;
363
364         if (tb[IPSET_ATTR_LINENO])
365                 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
366
367         if (unlikely(!tb[IPSET_ATTR_NAME] ||
368                      !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS)))
369                 return -IPSET_ERR_PROTOCOL;
370
371         ret = ip_set_get_extensions(set, tb, &ext);
372         if (ret)
373                 return ret;
374         e.id = ip_set_get_byname(map->net, nla_data(tb[IPSET_ATTR_NAME]), &s);
375         if (e.id == IPSET_INVALID_ID)
376                 return -IPSET_ERR_NAME;
377         /* "Loop detection" */
378         if (s->type->features & IPSET_TYPE_NAME) {
379                 ret = -IPSET_ERR_LOOP;
380                 goto finish;
381         }
382
383         if (tb[IPSET_ATTR_CADT_FLAGS]) {
384                 u32 f = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
385
386                 e.before = f & IPSET_FLAG_BEFORE;
387         }
388
389         if (e.before && !tb[IPSET_ATTR_NAMEREF]) {
390                 ret = -IPSET_ERR_BEFORE;
391                 goto finish;
392         }
393
394         if (tb[IPSET_ATTR_NAMEREF]) {
395                 e.refid = ip_set_get_byname(map->net,
396                                             nla_data(tb[IPSET_ATTR_NAMEREF]),
397                                             &s);
398                 if (e.refid == IPSET_INVALID_ID) {
399                         ret = -IPSET_ERR_NAMEREF;
400                         goto finish;
401                 }
402                 if (!e.before)
403                         e.before = -1;
404         }
405         if (adt != IPSET_TEST && SET_WITH_TIMEOUT(set))
406                 set_cleanup_entries(set);
407
408         ret = adtfn(set, &e, &ext, &ext, flags);
409
410 finish:
411         if (e.refid != IPSET_INVALID_ID)
412                 ip_set_put_byindex(map->net, e.refid);
413         if (adt != IPSET_ADD || ret)
414                 ip_set_put_byindex(map->net, e.id);
415
416         return ip_set_eexist(ret, flags) ? 0 : ret;
417 }
418
419 static void
420 list_set_flush(struct ip_set *set)
421 {
422         struct list_set *map = set->data;
423         struct set_elem *e, *n;
424
425         list_for_each_entry_safe(e, n, &map->members, list)
426                 list_set_del(set, e);
427         set->elements = 0;
428         set->ext_size = 0;
429 }
430
431 static void
432 list_set_destroy(struct ip_set *set)
433 {
434         struct list_set *map = set->data;
435         struct set_elem *e, *n;
436
437         if (SET_WITH_TIMEOUT(set))
438                 del_timer_sync(&map->gc);
439
440         list_for_each_entry_safe(e, n, &map->members, list) {
441                 list_del(&e->list);
442                 ip_set_put_byindex(map->net, e->id);
443                 ip_set_ext_destroy(set, e);
444                 kfree(e);
445         }
446         kfree(map);
447
448         set->data = NULL;
449 }
450
451 /* Calculate the actual memory size of the set data */
452 static size_t
453 list_set_memsize(const struct list_set *map, size_t dsize)
454 {
455         struct set_elem *e;
456         size_t memsize;
457         u32 n = 0;
458
459         rcu_read_lock();
460         list_for_each_entry_rcu(e, &map->members, list)
461                 n++;
462         rcu_read_unlock();
463
464         memsize = sizeof(*map) + n * dsize;
465
466         return memsize;
467 }
468
469 static int
470 list_set_head(struct ip_set *set, struct sk_buff *skb)
471 {
472         const struct list_set *map = set->data;
473         struct nlattr *nested;
474         size_t memsize = list_set_memsize(map, set->dsize) + set->ext_size;
475
476         nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
477         if (!nested)
478                 goto nla_put_failure;
479         if (nla_put_net32(skb, IPSET_ATTR_SIZE, htonl(map->size)) ||
480             nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref)) ||
481             nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
482             nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(set->elements)))
483                 goto nla_put_failure;
484         if (unlikely(ip_set_put_flags(skb, set)))
485                 goto nla_put_failure;
486         ipset_nest_end(skb, nested);
487
488         return 0;
489 nla_put_failure:
490         return -EMSGSIZE;
491 }
492
493 static int
494 list_set_list(const struct ip_set *set,
495               struct sk_buff *skb, struct netlink_callback *cb)
496 {
497         const struct list_set *map = set->data;
498         struct nlattr *atd, *nested;
499         u32 i = 0, first = cb->args[IPSET_CB_ARG0];
500         struct set_elem *e;
501         int ret = 0;
502
503         atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
504         if (!atd)
505                 return -EMSGSIZE;
506
507         rcu_read_lock();
508         list_for_each_entry_rcu(e, &map->members, list) {
509                 if (i < first ||
510                     (SET_WITH_TIMEOUT(set) &&
511                      ip_set_timeout_expired(ext_timeout(e, set)))) {
512                         i++;
513                         continue;
514                 }
515                 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
516                 if (!nested)
517                         goto nla_put_failure;
518                 if (nla_put_string(skb, IPSET_ATTR_NAME,
519                                    ip_set_name_byindex(map->net, e->id)))
520                         goto nla_put_failure;
521                 if (ip_set_put_extensions(skb, set, e, true))
522                         goto nla_put_failure;
523                 ipset_nest_end(skb, nested);
524                 i++;
525         }
526
527         ipset_nest_end(skb, atd);
528         /* Set listing finished */
529         cb->args[IPSET_CB_ARG0] = 0;
530         goto out;
531
532 nla_put_failure:
533         nla_nest_cancel(skb, nested);
534         if (unlikely(i == first)) {
535                 nla_nest_cancel(skb, atd);
536                 cb->args[IPSET_CB_ARG0] = 0;
537                 ret = -EMSGSIZE;
538         } else {
539                 cb->args[IPSET_CB_ARG0] = i;
540         }
541         ipset_nest_end(skb, atd);
542 out:
543         rcu_read_unlock();
544         return ret;
545 }
546
547 static bool
548 list_set_same_set(const struct ip_set *a, const struct ip_set *b)
549 {
550         const struct list_set *x = a->data;
551         const struct list_set *y = b->data;
552
553         return x->size == y->size &&
554                a->timeout == b->timeout &&
555                a->extensions == b->extensions;
556 }
557
558 static const struct ip_set_type_variant set_variant = {
559         .kadt   = list_set_kadt,
560         .uadt   = list_set_uadt,
561         .adt    = {
562                 [IPSET_ADD] = list_set_uadd,
563                 [IPSET_DEL] = list_set_udel,
564                 [IPSET_TEST] = list_set_utest,
565         },
566         .destroy = list_set_destroy,
567         .flush  = list_set_flush,
568         .head   = list_set_head,
569         .list   = list_set_list,
570         .same_set = list_set_same_set,
571 };
572
573 static void
574 list_set_gc(unsigned long ul_set)
575 {
576         struct ip_set *set = (struct ip_set *)ul_set;
577         struct list_set *map = set->data;
578
579         spin_lock_bh(&set->lock);
580         set_cleanup_entries(set);
581         spin_unlock_bh(&set->lock);
582
583         map->gc.expires = jiffies + IPSET_GC_PERIOD(set->timeout) * HZ;
584         add_timer(&map->gc);
585 }
586
587 static void
588 list_set_gc_init(struct ip_set *set, void (*gc)(unsigned long ul_set))
589 {
590         struct list_set *map = set->data;
591
592         setup_timer(&map->gc, gc, (unsigned long)set);
593         mod_timer(&map->gc, jiffies + IPSET_GC_PERIOD(set->timeout) * HZ);
594 }
595
596 /* Create list:set type of sets */
597
598 static bool
599 init_list_set(struct net *net, struct ip_set *set, u32 size)
600 {
601         struct list_set *map;
602
603         map = kzalloc(sizeof(*map), GFP_KERNEL);
604         if (!map)
605                 return false;
606
607         map->size = size;
608         map->net = net;
609         INIT_LIST_HEAD(&map->members);
610         set->data = map;
611
612         return true;
613 }
614
615 static int
616 list_set_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
617                 u32 flags)
618 {
619         u32 size = IP_SET_LIST_DEFAULT_SIZE;
620
621         if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_SIZE) ||
622                      !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
623                      !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS)))
624                 return -IPSET_ERR_PROTOCOL;
625
626         if (tb[IPSET_ATTR_SIZE])
627                 size = ip_set_get_h32(tb[IPSET_ATTR_SIZE]);
628         if (size < IP_SET_LIST_MIN_SIZE)
629                 size = IP_SET_LIST_MIN_SIZE;
630
631         set->variant = &set_variant;
632         set->dsize = ip_set_elem_len(set, tb, sizeof(struct set_elem),
633                                      __alignof__(struct set_elem));
634         if (!init_list_set(net, set, size))
635                 return -ENOMEM;
636         if (tb[IPSET_ATTR_TIMEOUT]) {
637                 set->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
638                 list_set_gc_init(set, list_set_gc);
639         }
640         return 0;
641 }
642
643 static struct ip_set_type list_set_type __read_mostly = {
644         .name           = "list:set",
645         .protocol       = IPSET_PROTOCOL,
646         .features       = IPSET_TYPE_NAME | IPSET_DUMP_LAST,
647         .dimension      = IPSET_DIM_ONE,
648         .family         = NFPROTO_UNSPEC,
649         .revision_min   = IPSET_TYPE_REV_MIN,
650         .revision_max   = IPSET_TYPE_REV_MAX,
651         .create         = list_set_create,
652         .create_policy  = {
653                 [IPSET_ATTR_SIZE]       = { .type = NLA_U32 },
654                 [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
655                 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
656         },
657         .adt_policy     = {
658                 [IPSET_ATTR_NAME]       = { .type = NLA_STRING,
659                                             .len = IPSET_MAXNAMELEN },
660                 [IPSET_ATTR_NAMEREF]    = { .type = NLA_STRING,
661                                             .len = IPSET_MAXNAMELEN },
662                 [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
663                 [IPSET_ATTR_LINENO]     = { .type = NLA_U32 },
664                 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
665                 [IPSET_ATTR_BYTES]      = { .type = NLA_U64 },
666                 [IPSET_ATTR_PACKETS]    = { .type = NLA_U64 },
667                 [IPSET_ATTR_COMMENT]    = { .type = NLA_NUL_STRING,
668                                             .len  = IPSET_MAX_COMMENT_SIZE },
669                 [IPSET_ATTR_SKBMARK]    = { .type = NLA_U64 },
670                 [IPSET_ATTR_SKBPRIO]    = { .type = NLA_U32 },
671                 [IPSET_ATTR_SKBQUEUE]   = { .type = NLA_U16 },
672         },
673         .me             = THIS_MODULE,
674 };
675
676 static int __init
677 list_set_init(void)
678 {
679         return ip_set_type_register(&list_set_type);
680 }
681
682 static void __exit
683 list_set_fini(void)
684 {
685         rcu_barrier();
686         ip_set_type_unregister(&list_set_type);
687 }
688
689 module_init(list_set_init);
690 module_exit(list_set_fini);