Merge branch 'upstream' of git://git.infradead.org/users/pcmoore/audit
[cascardo/linux.git] / net / netfilter / ipset / ip_set_hash_netiface.c
1 /* Copyright (C) 2011-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 hash:net,iface type */
9
10 #include <linux/jhash.h>
11 #include <linux/module.h>
12 #include <linux/ip.h>
13 #include <linux/skbuff.h>
14 #include <linux/errno.h>
15 #include <linux/random.h>
16 #include <linux/rbtree.h>
17 #include <net/ip.h>
18 #include <net/ipv6.h>
19 #include <net/netlink.h>
20
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_hash.h>
25
26 #define IPSET_TYPE_REV_MIN      0
27 /*                              1    nomatch flag support added */
28 /*                              2    /0 support added */
29 /*                              3    Counters support added */
30 /*                              4    Comments support added */
31 /*                              5    Forceadd support added */
32 #define IPSET_TYPE_REV_MAX      6 /* skbinfo support added */
33
34 MODULE_LICENSE("GPL");
35 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
36 IP_SET_MODULE_DESC("hash:net,iface", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
37 MODULE_ALIAS("ip_set_hash:net,iface");
38
39 /* Interface name rbtree */
40
41 struct iface_node {
42         struct rb_node node;
43         char iface[IFNAMSIZ];
44 };
45
46 #define iface_data(n)   (rb_entry(n, struct iface_node, node)->iface)
47
48 static void
49 rbtree_destroy(struct rb_root *root)
50 {
51         struct iface_node *node, *next;
52
53         rbtree_postorder_for_each_entry_safe(node, next, root, node)
54                 kfree(node);
55
56         *root = RB_ROOT;
57 }
58
59 static int
60 iface_test(struct rb_root *root, const char **iface)
61 {
62         struct rb_node *n = root->rb_node;
63
64         while (n) {
65                 const char *d = iface_data(n);
66                 int res = strcmp(*iface, d);
67
68                 if (res < 0)
69                         n = n->rb_left;
70                 else if (res > 0)
71                         n = n->rb_right;
72                 else {
73                         *iface = d;
74                         return 1;
75                 }
76         }
77         return 0;
78 }
79
80 static int
81 iface_add(struct rb_root *root, const char **iface)
82 {
83         struct rb_node **n = &(root->rb_node), *p = NULL;
84         struct iface_node *d;
85
86         while (*n) {
87                 char *ifname = iface_data(*n);
88                 int res = strcmp(*iface, ifname);
89
90                 p = *n;
91                 if (res < 0)
92                         n = &((*n)->rb_left);
93                 else if (res > 0)
94                         n = &((*n)->rb_right);
95                 else {
96                         *iface = ifname;
97                         return 0;
98                 }
99         }
100
101         d = kzalloc(sizeof(*d), GFP_ATOMIC);
102         if (!d)
103                 return -ENOMEM;
104         strcpy(d->iface, *iface);
105
106         rb_link_node(&d->node, p, n);
107         rb_insert_color(&d->node, root);
108
109         *iface = d->iface;
110         return 0;
111 }
112
113 /* Type specific function prefix */
114 #define HTYPE           hash_netiface
115 #define IP_SET_HASH_WITH_NETS
116 #define IP_SET_HASH_WITH_RBTREE
117 #define IP_SET_HASH_WITH_MULTI
118 #define IP_SET_HASH_WITH_NET0
119
120 #define STREQ(a, b)     (strcmp(a, b) == 0)
121
122 /* IPv4 variant */
123
124 struct hash_netiface4_elem_hashed {
125         __be32 ip;
126         u8 physdev;
127         u8 cidr;
128         u8 nomatch;
129         u8 elem;
130 };
131
132 /* Member elements */
133 struct hash_netiface4_elem {
134         __be32 ip;
135         u8 physdev;
136         u8 cidr;
137         u8 nomatch;
138         u8 elem;
139         const char *iface;
140 };
141
142 /* Common functions */
143
144 static inline bool
145 hash_netiface4_data_equal(const struct hash_netiface4_elem *ip1,
146                           const struct hash_netiface4_elem *ip2,
147                           u32 *multi)
148 {
149         return ip1->ip == ip2->ip &&
150                ip1->cidr == ip2->cidr &&
151                (++*multi) &&
152                ip1->physdev == ip2->physdev &&
153                ip1->iface == ip2->iface;
154 }
155
156 static inline int
157 hash_netiface4_do_data_match(const struct hash_netiface4_elem *elem)
158 {
159         return elem->nomatch ? -ENOTEMPTY : 1;
160 }
161
162 static inline void
163 hash_netiface4_data_set_flags(struct hash_netiface4_elem *elem, u32 flags)
164 {
165         elem->nomatch = (flags >> 16) & IPSET_FLAG_NOMATCH;
166 }
167
168 static inline void
169 hash_netiface4_data_reset_flags(struct hash_netiface4_elem *elem, u8 *flags)
170 {
171         swap(*flags, elem->nomatch);
172 }
173
174 static inline void
175 hash_netiface4_data_netmask(struct hash_netiface4_elem *elem, u8 cidr)
176 {
177         elem->ip &= ip_set_netmask(cidr);
178         elem->cidr = cidr;
179 }
180
181 static bool
182 hash_netiface4_data_list(struct sk_buff *skb,
183                          const struct hash_netiface4_elem *data)
184 {
185         u32 flags = data->physdev ? IPSET_FLAG_PHYSDEV : 0;
186
187         if (data->nomatch)
188                 flags |= IPSET_FLAG_NOMATCH;
189         if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip) ||
190             nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr) ||
191             nla_put_string(skb, IPSET_ATTR_IFACE, data->iface) ||
192             (flags &&
193              nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
194                 goto nla_put_failure;
195         return 0;
196
197 nla_put_failure:
198         return 1;
199 }
200
201 static inline void
202 hash_netiface4_data_next(struct hash_netiface4_elem *next,
203                          const struct hash_netiface4_elem *d)
204 {
205         next->ip = d->ip;
206 }
207
208 #define MTYPE           hash_netiface4
209 #define PF              4
210 #define HOST_MASK       32
211 #define HKEY_DATALEN    sizeof(struct hash_netiface4_elem_hashed)
212 #include "ip_set_hash_gen.h"
213
214 static int
215 hash_netiface4_kadt(struct ip_set *set, const struct sk_buff *skb,
216                     const struct xt_action_param *par,
217                     enum ipset_adt adt, struct ip_set_adt_opt *opt)
218 {
219         struct hash_netiface *h = set->data;
220         ipset_adtfn adtfn = set->variant->adt[adt];
221         struct hash_netiface4_elem e = {
222                 .cidr = IP_SET_INIT_CIDR(h->nets[0].cidr[0], HOST_MASK),
223                 .elem = 1,
224         };
225         struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set);
226         int ret;
227
228         if (e.cidr == 0)
229                 return -EINVAL;
230         if (adt == IPSET_TEST)
231                 e.cidr = HOST_MASK;
232
233         ip4addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &e.ip);
234         e.ip &= ip_set_netmask(e.cidr);
235
236 #define IFACE(dir)      (par->dir ? par->dir->name : NULL)
237 #define PHYSDEV(dir)    (nf_bridge->dir ? nf_bridge->dir->name : NULL)
238 #define SRCDIR          (opt->flags & IPSET_DIM_TWO_SRC)
239
240         if (opt->cmdflags & IPSET_FLAG_PHYSDEV) {
241 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
242                 const struct nf_bridge_info *nf_bridge = skb->nf_bridge;
243
244                 if (!nf_bridge)
245                         return -EINVAL;
246                 e.iface = SRCDIR ? PHYSDEV(physindev) : PHYSDEV(physoutdev);
247                 e.physdev = 1;
248 #else
249                 e.iface = NULL;
250 #endif
251         } else
252                 e.iface = SRCDIR ? IFACE(in) : IFACE(out);
253
254         if (!e.iface)
255                 return -EINVAL;
256         ret = iface_test(&h->rbtree, &e.iface);
257         if (adt == IPSET_ADD) {
258                 if (!ret) {
259                         ret = iface_add(&h->rbtree, &e.iface);
260                         if (ret)
261                                 return ret;
262                 }
263         } else if (!ret)
264                 return ret;
265
266         return adtfn(set, &e, &ext, &opt->ext, opt->cmdflags);
267 }
268
269 static int
270 hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[],
271                     enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
272 {
273         struct hash_netiface *h = set->data;
274         ipset_adtfn adtfn = set->variant->adt[adt];
275         struct hash_netiface4_elem e = { .cidr = HOST_MASK, .elem = 1 };
276         struct ip_set_ext ext = IP_SET_INIT_UEXT(set);
277         u32 ip = 0, ip_to = 0, last;
278         char iface[IFNAMSIZ];
279         int ret;
280
281         if (unlikely(!tb[IPSET_ATTR_IP] ||
282                      !tb[IPSET_ATTR_IFACE] ||
283                      !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
284                      !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) ||
285                      !ip_set_optattr_netorder(tb, IPSET_ATTR_PACKETS) ||
286                      !ip_set_optattr_netorder(tb, IPSET_ATTR_BYTES) ||
287                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBMARK) ||
288                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBPRIO) ||
289                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBQUEUE)))
290                 return -IPSET_ERR_PROTOCOL;
291
292         if (tb[IPSET_ATTR_LINENO])
293                 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
294
295         ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip) ||
296               ip_set_get_extensions(set, tb, &ext);
297         if (ret)
298                 return ret;
299
300         if (tb[IPSET_ATTR_CIDR]) {
301                 e.cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);
302                 if (e.cidr > HOST_MASK)
303                         return -IPSET_ERR_INVALID_CIDR;
304         }
305
306         strcpy(iface, nla_data(tb[IPSET_ATTR_IFACE]));
307         e.iface = iface;
308         ret = iface_test(&h->rbtree, &e.iface);
309         if (adt == IPSET_ADD) {
310                 if (!ret) {
311                         ret = iface_add(&h->rbtree, &e.iface);
312                         if (ret)
313                                 return ret;
314                 }
315         } else if (!ret)
316                 return ret;
317
318         if (tb[IPSET_ATTR_CADT_FLAGS]) {
319                 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
320                 if (cadt_flags & IPSET_FLAG_PHYSDEV)
321                         e.physdev = 1;
322                 if (cadt_flags & IPSET_FLAG_NOMATCH)
323                         flags |= (IPSET_FLAG_NOMATCH << 16);
324         }
325         if (adt == IPSET_TEST || !tb[IPSET_ATTR_IP_TO]) {
326                 e.ip = htonl(ip & ip_set_hostmask(e.cidr));
327                 ret = adtfn(set, &e, &ext, &ext, flags);
328                 return ip_set_enomatch(ret, flags, adt, set) ? -ret :
329                        ip_set_eexist(ret, flags) ? 0 : ret;
330         }
331
332         if (tb[IPSET_ATTR_IP_TO]) {
333                 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
334                 if (ret)
335                         return ret;
336                 if (ip_to < ip)
337                         swap(ip, ip_to);
338                 if (ip + UINT_MAX == ip_to)
339                         return -IPSET_ERR_HASH_RANGE;
340         } else
341                 ip_set_mask_from_to(ip, ip_to, e.cidr);
342
343         if (retried)
344                 ip = ntohl(h->next.ip);
345         while (!after(ip, ip_to)) {
346                 e.ip = htonl(ip);
347                 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);
348                 ret = adtfn(set, &e, &ext, &ext, flags);
349
350                 if (ret && !ip_set_eexist(ret, flags))
351                         return ret;
352                 else
353                         ret = 0;
354                 ip = last + 1;
355         }
356         return ret;
357 }
358
359 /* IPv6 variant */
360
361 struct hash_netiface6_elem_hashed {
362         union nf_inet_addr ip;
363         u8 physdev;
364         u8 cidr;
365         u8 nomatch;
366         u8 elem;
367 };
368
369 struct hash_netiface6_elem {
370         union nf_inet_addr ip;
371         u8 physdev;
372         u8 cidr;
373         u8 nomatch;
374         u8 elem;
375         const char *iface;
376 };
377
378 /* Common functions */
379
380 static inline bool
381 hash_netiface6_data_equal(const struct hash_netiface6_elem *ip1,
382                           const struct hash_netiface6_elem *ip2,
383                           u32 *multi)
384 {
385         return ipv6_addr_equal(&ip1->ip.in6, &ip2->ip.in6) &&
386                ip1->cidr == ip2->cidr &&
387                (++*multi) &&
388                ip1->physdev == ip2->physdev &&
389                ip1->iface == ip2->iface;
390 }
391
392 static inline int
393 hash_netiface6_do_data_match(const struct hash_netiface6_elem *elem)
394 {
395         return elem->nomatch ? -ENOTEMPTY : 1;
396 }
397
398 static inline void
399 hash_netiface6_data_set_flags(struct hash_netiface6_elem *elem, u32 flags)
400 {
401         elem->nomatch = (flags >> 16) & IPSET_FLAG_NOMATCH;
402 }
403
404 static inline void
405 hash_netiface6_data_reset_flags(struct hash_netiface6_elem *elem, u8 *flags)
406 {
407         swap(*flags, elem->nomatch);
408 }
409
410 static inline void
411 hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr)
412 {
413         ip6_netmask(&elem->ip, cidr);
414         elem->cidr = cidr;
415 }
416
417 static bool
418 hash_netiface6_data_list(struct sk_buff *skb,
419                          const struct hash_netiface6_elem *data)
420 {
421         u32 flags = data->physdev ? IPSET_FLAG_PHYSDEV : 0;
422
423         if (data->nomatch)
424                 flags |= IPSET_FLAG_NOMATCH;
425         if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &data->ip.in6) ||
426             nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr) ||
427             nla_put_string(skb, IPSET_ATTR_IFACE, data->iface) ||
428             (flags &&
429              nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(flags))))
430                 goto nla_put_failure;
431         return 0;
432
433 nla_put_failure:
434         return 1;
435 }
436
437 static inline void
438 hash_netiface6_data_next(struct hash_netiface4_elem *next,
439                          const struct hash_netiface6_elem *d)
440 {
441 }
442
443 #undef MTYPE
444 #undef PF
445 #undef HOST_MASK
446 #undef HKEY_DATALEN
447
448 #define MTYPE           hash_netiface6
449 #define PF              6
450 #define HOST_MASK       128
451 #define HKEY_DATALEN    sizeof(struct hash_netiface6_elem_hashed)
452 #define IP_SET_EMIT_CREATE
453 #include "ip_set_hash_gen.h"
454
455 static int
456 hash_netiface6_kadt(struct ip_set *set, const struct sk_buff *skb,
457                     const struct xt_action_param *par,
458                     enum ipset_adt adt, struct ip_set_adt_opt *opt)
459 {
460         struct hash_netiface *h = set->data;
461         ipset_adtfn adtfn = set->variant->adt[adt];
462         struct hash_netiface6_elem e = {
463                 .cidr = IP_SET_INIT_CIDR(h->nets[0].cidr[0], HOST_MASK),
464                 .elem = 1,
465         };
466         struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set);
467         int ret;
468
469         if (e.cidr == 0)
470                 return -EINVAL;
471         if (adt == IPSET_TEST)
472                 e.cidr = HOST_MASK;
473
474         ip6addrptr(skb, opt->flags & IPSET_DIM_ONE_SRC, &e.ip.in6);
475         ip6_netmask(&e.ip, e.cidr);
476
477         if (opt->cmdflags & IPSET_FLAG_PHYSDEV) {
478 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
479                 const struct nf_bridge_info *nf_bridge = skb->nf_bridge;
480
481                 if (!nf_bridge)
482                         return -EINVAL;
483                 e.iface = SRCDIR ? PHYSDEV(physindev) : PHYSDEV(physoutdev);
484                 e.physdev = 1;
485 #else
486                 e.iface = NULL;
487 #endif
488         } else
489                 e.iface = SRCDIR ? IFACE(in) : IFACE(out);
490
491         if (!e.iface)
492                 return -EINVAL;
493         ret = iface_test(&h->rbtree, &e.iface);
494         if (adt == IPSET_ADD) {
495                 if (!ret) {
496                         ret = iface_add(&h->rbtree, &e.iface);
497                         if (ret)
498                                 return ret;
499                 }
500         } else if (!ret)
501                 return ret;
502
503         return adtfn(set, &e, &ext, &opt->ext, opt->cmdflags);
504 }
505
506 static int
507 hash_netiface6_uadt(struct ip_set *set, struct nlattr *tb[],
508                    enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
509 {
510         struct hash_netiface *h = set->data;
511         ipset_adtfn adtfn = set->variant->adt[adt];
512         struct hash_netiface6_elem e = { .cidr = HOST_MASK, .elem = 1 };
513         struct ip_set_ext ext = IP_SET_INIT_UEXT(set);
514         char iface[IFNAMSIZ];
515         int ret;
516
517         if (unlikely(!tb[IPSET_ATTR_IP] ||
518                      !tb[IPSET_ATTR_IFACE] ||
519                      !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) ||
520                      !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS) ||
521                      !ip_set_optattr_netorder(tb, IPSET_ATTR_PACKETS) ||
522                      !ip_set_optattr_netorder(tb, IPSET_ATTR_BYTES) ||
523                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBMARK) ||
524                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBPRIO) ||
525                      !ip_set_optattr_netorder(tb, IPSET_ATTR_SKBQUEUE)))
526                 return -IPSET_ERR_PROTOCOL;
527         if (unlikely(tb[IPSET_ATTR_IP_TO]))
528                 return -IPSET_ERR_HASH_RANGE_UNSUPPORTED;
529
530         if (tb[IPSET_ATTR_LINENO])
531                 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
532
533         ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip) ||
534               ip_set_get_extensions(set, tb, &ext);
535         if (ret)
536                 return ret;
537
538         if (tb[IPSET_ATTR_CIDR])
539                 e.cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);
540         if (e.cidr > HOST_MASK)
541                 return -IPSET_ERR_INVALID_CIDR;
542         ip6_netmask(&e.ip, e.cidr);
543
544         strcpy(iface, nla_data(tb[IPSET_ATTR_IFACE]));
545         e.iface = iface;
546         ret = iface_test(&h->rbtree, &e.iface);
547         if (adt == IPSET_ADD) {
548                 if (!ret) {
549                         ret = iface_add(&h->rbtree, &e.iface);
550                         if (ret)
551                                 return ret;
552                 }
553         } else if (!ret)
554                 return ret;
555
556         if (tb[IPSET_ATTR_CADT_FLAGS]) {
557                 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
558                 if (cadt_flags & IPSET_FLAG_PHYSDEV)
559                         e.physdev = 1;
560                 if (cadt_flags & IPSET_FLAG_NOMATCH)
561                         flags |= (IPSET_FLAG_NOMATCH << 16);
562         }
563
564         ret = adtfn(set, &e, &ext, &ext, flags);
565
566         return ip_set_enomatch(ret, flags, adt, set) ? -ret :
567                ip_set_eexist(ret, flags) ? 0 : ret;
568 }
569
570 static struct ip_set_type hash_netiface_type __read_mostly = {
571         .name           = "hash:net,iface",
572         .protocol       = IPSET_PROTOCOL,
573         .features       = IPSET_TYPE_IP | IPSET_TYPE_IFACE |
574                           IPSET_TYPE_NOMATCH,
575         .dimension      = IPSET_DIM_TWO,
576         .family         = NFPROTO_UNSPEC,
577         .revision_min   = IPSET_TYPE_REV_MIN,
578         .revision_max   = IPSET_TYPE_REV_MAX,
579         .create         = hash_netiface_create,
580         .create_policy  = {
581                 [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
582                 [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
583                 [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
584                 [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
585                 [IPSET_ATTR_PROTO]      = { .type = NLA_U8 },
586                 [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
587                 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
588         },
589         .adt_policy     = {
590                 [IPSET_ATTR_IP]         = { .type = NLA_NESTED },
591                 [IPSET_ATTR_IP_TO]      = { .type = NLA_NESTED },
592                 [IPSET_ATTR_IFACE]      = { .type = NLA_NUL_STRING,
593                                             .len  = IFNAMSIZ - 1 },
594                 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
595                 [IPSET_ATTR_CIDR]       = { .type = NLA_U8 },
596                 [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
597                 [IPSET_ATTR_LINENO]     = { .type = NLA_U32 },
598                 [IPSET_ATTR_BYTES]      = { .type = NLA_U64 },
599                 [IPSET_ATTR_PACKETS]    = { .type = NLA_U64 },
600                 [IPSET_ATTR_COMMENT]    = { .type = NLA_NUL_STRING },
601                 [IPSET_ATTR_SKBMARK]    = { .type = NLA_U64 },
602                 [IPSET_ATTR_SKBPRIO]    = { .type = NLA_U32 },
603                 [IPSET_ATTR_SKBQUEUE]   = { .type = NLA_U16 },
604         },
605         .me             = THIS_MODULE,
606 };
607
608 static int __init
609 hash_netiface_init(void)
610 {
611         return ip_set_type_register(&hash_netiface_type);
612 }
613
614 static void __exit
615 hash_netiface_fini(void)
616 {
617         ip_set_type_unregister(&hash_netiface_type);
618 }
619
620 module_init(hash_netiface_init);
621 module_exit(hash_netiface_fini);