44ae273b43917cfdc2b510ee5828f3695fd82833
[deliverable/linux.git] / net / netfilter / nft_compat.c
1 /*
2 * (C) 2012-2013 by Pablo Neira Ayuso <pablo@netfilter.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This software has been sponsored by Sophos Astaro <http://www.sophos.com>
9 */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/module.h>
14 #include <linux/netlink.h>
15 #include <linux/netfilter.h>
16 #include <linux/netfilter/nfnetlink.h>
17 #include <linux/netfilter/nf_tables.h>
18 #include <linux/netfilter/nf_tables_compat.h>
19 #include <linux/netfilter/x_tables.h>
20 #include <linux/netfilter_ipv4/ip_tables.h>
21 #include <linux/netfilter_ipv6/ip6_tables.h>
22 #include <asm/uaccess.h> /* for set_fs */
23 #include <net/netfilter/nf_tables.h>
24
25 union nft_entry {
26 struct ipt_entry e4;
27 struct ip6t_entry e6;
28 };
29
30 static inline void
31 nft_compat_set_par(struct xt_action_param *par, void *xt, const void *xt_info)
32 {
33 par->target = xt;
34 par->targinfo = xt_info;
35 par->hotdrop = false;
36 }
37
38 static void nft_target_eval(const struct nft_expr *expr,
39 struct nft_data data[NFT_REG_MAX + 1],
40 const struct nft_pktinfo *pkt)
41 {
42 void *info = nft_expr_priv(expr);
43 struct xt_target *target = expr->ops->data;
44 struct sk_buff *skb = pkt->skb;
45 int ret;
46
47 nft_compat_set_par((struct xt_action_param *)&pkt->xt, target, info);
48
49 ret = target->target(skb, &pkt->xt);
50
51 if (pkt->xt.hotdrop)
52 ret = NF_DROP;
53
54 switch(ret) {
55 case XT_CONTINUE:
56 data[NFT_REG_VERDICT].verdict = NFT_CONTINUE;
57 break;
58 default:
59 data[NFT_REG_VERDICT].verdict = ret;
60 break;
61 }
62 return;
63 }
64
65 static const struct nla_policy nft_target_policy[NFTA_TARGET_MAX + 1] = {
66 [NFTA_TARGET_NAME] = { .type = NLA_NUL_STRING },
67 [NFTA_TARGET_REV] = { .type = NLA_U32 },
68 [NFTA_TARGET_INFO] = { .type = NLA_BINARY },
69 };
70
71 static void
72 nft_target_set_tgchk_param(struct xt_tgchk_param *par,
73 const struct nft_ctx *ctx,
74 struct xt_target *target, void *info,
75 union nft_entry *entry, u8 proto, bool inv)
76 {
77 par->net = &init_net;
78 par->table = ctx->table->name;
79 switch (ctx->afi->family) {
80 case AF_INET:
81 entry->e4.ip.proto = proto;
82 entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0;
83 break;
84 case AF_INET6:
85 entry->e6.ipv6.proto = proto;
86 entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0;
87 break;
88 }
89 par->entryinfo = entry;
90 par->target = target;
91 par->targinfo = info;
92 if (ctx->chain->flags & NFT_BASE_CHAIN) {
93 const struct nft_base_chain *basechain =
94 nft_base_chain(ctx->chain);
95 const struct nf_hook_ops *ops = &basechain->ops[0];
96
97 par->hook_mask = 1 << ops->hooknum;
98 } else {
99 par->hook_mask = 0;
100 }
101 par->family = ctx->afi->family;
102 }
103
104 static void target_compat_from_user(struct xt_target *t, void *in, void *out)
105 {
106 int pad;
107
108 memcpy(out, in, t->targetsize);
109 pad = XT_ALIGN(t->targetsize) - t->targetsize;
110 if (pad > 0)
111 memset(out + t->targetsize, 0, pad);
112 }
113
114 static const struct nla_policy nft_rule_compat_policy[NFTA_RULE_COMPAT_MAX + 1] = {
115 [NFTA_RULE_COMPAT_PROTO] = { .type = NLA_U32 },
116 [NFTA_RULE_COMPAT_FLAGS] = { .type = NLA_U32 },
117 };
118
119 static int nft_parse_compat(const struct nlattr *attr, u8 *proto, bool *inv)
120 {
121 struct nlattr *tb[NFTA_RULE_COMPAT_MAX+1];
122 u32 flags;
123 int err;
124
125 err = nla_parse_nested(tb, NFTA_RULE_COMPAT_MAX, attr,
126 nft_rule_compat_policy);
127 if (err < 0)
128 return err;
129
130 if (!tb[NFTA_RULE_COMPAT_PROTO] || !tb[NFTA_RULE_COMPAT_FLAGS])
131 return -EINVAL;
132
133 flags = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_FLAGS]));
134 if (flags & ~NFT_RULE_COMPAT_F_MASK)
135 return -EINVAL;
136 if (flags & NFT_RULE_COMPAT_F_INV)
137 *inv = true;
138
139 *proto = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_PROTO]));
140 return 0;
141 }
142
143 static int
144 nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
145 const struct nlattr * const tb[])
146 {
147 void *info = nft_expr_priv(expr);
148 struct xt_target *target = expr->ops->data;
149 struct xt_tgchk_param par;
150 size_t size = XT_ALIGN(nla_len(tb[NFTA_TARGET_INFO]));
151 u8 proto = 0;
152 bool inv = false;
153 union nft_entry e = {};
154 int ret;
155
156 target_compat_from_user(target, nla_data(tb[NFTA_TARGET_INFO]), info);
157
158 if (ctx->nla[NFTA_RULE_COMPAT]) {
159 ret = nft_parse_compat(ctx->nla[NFTA_RULE_COMPAT], &proto, &inv);
160 if (ret < 0)
161 goto err;
162 }
163
164 nft_target_set_tgchk_param(&par, ctx, target, info, &e, proto, inv);
165
166 ret = xt_check_target(&par, size, proto, inv);
167 if (ret < 0)
168 goto err;
169
170 /* The standard target cannot be used */
171 if (target->target == NULL) {
172 ret = -EINVAL;
173 goto err;
174 }
175
176 return 0;
177 err:
178 module_put(target->me);
179 return ret;
180 }
181
182 static void
183 nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr)
184 {
185 struct xt_target *target = expr->ops->data;
186 void *info = nft_expr_priv(expr);
187 struct xt_tgdtor_param par;
188
189 par.net = ctx->net;
190 par.target = target;
191 par.targinfo = info;
192 par.family = ctx->afi->family;
193 if (par.target->destroy != NULL)
194 par.target->destroy(&par);
195
196 module_put(target->me);
197 }
198
199 static int nft_target_dump(struct sk_buff *skb, const struct nft_expr *expr)
200 {
201 const struct xt_target *target = expr->ops->data;
202 void *info = nft_expr_priv(expr);
203
204 if (nla_put_string(skb, NFTA_TARGET_NAME, target->name) ||
205 nla_put_be32(skb, NFTA_TARGET_REV, htonl(target->revision)) ||
206 nla_put(skb, NFTA_TARGET_INFO, XT_ALIGN(target->targetsize), info))
207 goto nla_put_failure;
208
209 return 0;
210
211 nla_put_failure:
212 return -1;
213 }
214
215 static int nft_target_validate(const struct nft_ctx *ctx,
216 const struct nft_expr *expr,
217 const struct nft_data **data)
218 {
219 struct xt_target *target = expr->ops->data;
220 unsigned int hook_mask = 0;
221
222 if (ctx->chain->flags & NFT_BASE_CHAIN) {
223 const struct nft_base_chain *basechain =
224 nft_base_chain(ctx->chain);
225 const struct nf_hook_ops *ops = &basechain->ops[0];
226
227 hook_mask = 1 << ops->hooknum;
228 if (hook_mask & target->hooks)
229 return 0;
230
231 /* This target is being called from an invalid chain */
232 return -EINVAL;
233 }
234 return 0;
235 }
236
237 static void nft_match_eval(const struct nft_expr *expr,
238 struct nft_data data[NFT_REG_MAX + 1],
239 const struct nft_pktinfo *pkt)
240 {
241 void *info = nft_expr_priv(expr);
242 struct xt_match *match = expr->ops->data;
243 struct sk_buff *skb = pkt->skb;
244 bool ret;
245
246 nft_compat_set_par((struct xt_action_param *)&pkt->xt, match, info);
247
248 ret = match->match(skb, (struct xt_action_param *)&pkt->xt);
249
250 if (pkt->xt.hotdrop) {
251 data[NFT_REG_VERDICT].verdict = NF_DROP;
252 return;
253 }
254
255 switch(ret) {
256 case true:
257 data[NFT_REG_VERDICT].verdict = NFT_CONTINUE;
258 break;
259 case false:
260 data[NFT_REG_VERDICT].verdict = NFT_BREAK;
261 break;
262 }
263 }
264
265 static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = {
266 [NFTA_MATCH_NAME] = { .type = NLA_NUL_STRING },
267 [NFTA_MATCH_REV] = { .type = NLA_U32 },
268 [NFTA_MATCH_INFO] = { .type = NLA_BINARY },
269 };
270
271 /* struct xt_mtchk_param and xt_tgchk_param look very similar */
272 static void
273 nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx,
274 struct xt_match *match, void *info,
275 union nft_entry *entry, u8 proto, bool inv)
276 {
277 par->net = &init_net;
278 par->table = ctx->table->name;
279 switch (ctx->afi->family) {
280 case AF_INET:
281 entry->e4.ip.proto = proto;
282 entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0;
283 break;
284 case AF_INET6:
285 entry->e6.ipv6.proto = proto;
286 entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0;
287 break;
288 }
289 par->entryinfo = entry;
290 par->match = match;
291 par->matchinfo = info;
292 if (ctx->chain->flags & NFT_BASE_CHAIN) {
293 const struct nft_base_chain *basechain =
294 nft_base_chain(ctx->chain);
295 const struct nf_hook_ops *ops = &basechain->ops[0];
296
297 par->hook_mask = 1 << ops->hooknum;
298 } else {
299 par->hook_mask = 0;
300 }
301 par->family = ctx->afi->family;
302 }
303
304 static void match_compat_from_user(struct xt_match *m, void *in, void *out)
305 {
306 int pad;
307
308 memcpy(out, in, m->matchsize);
309 pad = XT_ALIGN(m->matchsize) - m->matchsize;
310 if (pad > 0)
311 memset(out + m->matchsize, 0, pad);
312 }
313
314 static int
315 nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
316 const struct nlattr * const tb[])
317 {
318 void *info = nft_expr_priv(expr);
319 struct xt_match *match = expr->ops->data;
320 struct xt_mtchk_param par;
321 size_t size = XT_ALIGN(nla_len(tb[NFTA_MATCH_INFO]));
322 u8 proto = 0;
323 bool inv = false;
324 union nft_entry e = {};
325 int ret;
326
327 match_compat_from_user(match, nla_data(tb[NFTA_MATCH_INFO]), info);
328
329 if (ctx->nla[NFTA_RULE_COMPAT]) {
330 ret = nft_parse_compat(ctx->nla[NFTA_RULE_COMPAT], &proto, &inv);
331 if (ret < 0)
332 goto err;
333 }
334
335 nft_match_set_mtchk_param(&par, ctx, match, info, &e, proto, inv);
336
337 ret = xt_check_match(&par, size, proto, inv);
338 if (ret < 0)
339 goto err;
340
341 return 0;
342 err:
343 module_put(match->me);
344 return ret;
345 }
346
347 static void
348 nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr)
349 {
350 struct xt_match *match = expr->ops->data;
351 void *info = nft_expr_priv(expr);
352 struct xt_mtdtor_param par;
353
354 par.net = ctx->net;
355 par.match = match;
356 par.matchinfo = info;
357 par.family = ctx->afi->family;
358 if (par.match->destroy != NULL)
359 par.match->destroy(&par);
360
361 module_put(match->me);
362 }
363
364 static int nft_match_dump(struct sk_buff *skb, const struct nft_expr *expr)
365 {
366 void *info = nft_expr_priv(expr);
367 struct xt_match *match = expr->ops->data;
368
369 if (nla_put_string(skb, NFTA_MATCH_NAME, match->name) ||
370 nla_put_be32(skb, NFTA_MATCH_REV, htonl(match->revision)) ||
371 nla_put(skb, NFTA_MATCH_INFO, XT_ALIGN(match->matchsize), info))
372 goto nla_put_failure;
373
374 return 0;
375
376 nla_put_failure:
377 return -1;
378 }
379
380 static int nft_match_validate(const struct nft_ctx *ctx,
381 const struct nft_expr *expr,
382 const struct nft_data **data)
383 {
384 struct xt_match *match = expr->ops->data;
385 unsigned int hook_mask = 0;
386
387 if (ctx->chain->flags & NFT_BASE_CHAIN) {
388 const struct nft_base_chain *basechain =
389 nft_base_chain(ctx->chain);
390 const struct nf_hook_ops *ops = &basechain->ops[0];
391
392 hook_mask = 1 << ops->hooknum;
393 if (hook_mask & match->hooks)
394 return 0;
395
396 /* This match is being called from an invalid chain */
397 return -EINVAL;
398 }
399 return 0;
400 }
401
402 static int
403 nfnl_compat_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
404 int event, u16 family, const char *name,
405 int rev, int target)
406 {
407 struct nlmsghdr *nlh;
408 struct nfgenmsg *nfmsg;
409 unsigned int flags = portid ? NLM_F_MULTI : 0;
410
411 event |= NFNL_SUBSYS_NFT_COMPAT << 8;
412 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*nfmsg), flags);
413 if (nlh == NULL)
414 goto nlmsg_failure;
415
416 nfmsg = nlmsg_data(nlh);
417 nfmsg->nfgen_family = family;
418 nfmsg->version = NFNETLINK_V0;
419 nfmsg->res_id = 0;
420
421 if (nla_put_string(skb, NFTA_COMPAT_NAME, name) ||
422 nla_put_be32(skb, NFTA_COMPAT_REV, htonl(rev)) ||
423 nla_put_be32(skb, NFTA_COMPAT_TYPE, htonl(target)))
424 goto nla_put_failure;
425
426 nlmsg_end(skb, nlh);
427 return skb->len;
428
429 nlmsg_failure:
430 nla_put_failure:
431 nlmsg_cancel(skb, nlh);
432 return -1;
433 }
434
435 static int
436 nfnl_compat_get(struct sock *nfnl, struct sk_buff *skb,
437 const struct nlmsghdr *nlh, const struct nlattr * const tb[])
438 {
439 int ret = 0, target;
440 struct nfgenmsg *nfmsg;
441 const char *fmt;
442 const char *name;
443 u32 rev;
444 struct sk_buff *skb2;
445
446 if (tb[NFTA_COMPAT_NAME] == NULL ||
447 tb[NFTA_COMPAT_REV] == NULL ||
448 tb[NFTA_COMPAT_TYPE] == NULL)
449 return -EINVAL;
450
451 name = nla_data(tb[NFTA_COMPAT_NAME]);
452 rev = ntohl(nla_get_be32(tb[NFTA_COMPAT_REV]));
453 target = ntohl(nla_get_be32(tb[NFTA_COMPAT_TYPE]));
454
455 nfmsg = nlmsg_data(nlh);
456
457 switch(nfmsg->nfgen_family) {
458 case AF_INET:
459 fmt = "ipt_%s";
460 break;
461 case AF_INET6:
462 fmt = "ip6t_%s";
463 break;
464 default:
465 pr_err("nft_compat: unsupported protocol %d\n",
466 nfmsg->nfgen_family);
467 return -EINVAL;
468 }
469
470 try_then_request_module(xt_find_revision(nfmsg->nfgen_family, name,
471 rev, target, &ret),
472 fmt, name);
473
474 if (ret < 0)
475 return ret;
476
477 skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
478 if (skb2 == NULL)
479 return -ENOMEM;
480
481 /* include the best revision for this extension in the message */
482 if (nfnl_compat_fill_info(skb2, NETLINK_CB(skb).portid,
483 nlh->nlmsg_seq,
484 NFNL_MSG_TYPE(nlh->nlmsg_type),
485 NFNL_MSG_COMPAT_GET,
486 nfmsg->nfgen_family,
487 name, ret, target) <= 0) {
488 kfree_skb(skb2);
489 return -ENOSPC;
490 }
491
492 ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,
493 MSG_DONTWAIT);
494 if (ret > 0)
495 ret = 0;
496
497 return ret == -EAGAIN ? -ENOBUFS : ret;
498 }
499
500 static const struct nla_policy nfnl_compat_policy_get[NFTA_COMPAT_MAX+1] = {
501 [NFTA_COMPAT_NAME] = { .type = NLA_NUL_STRING,
502 .len = NFT_COMPAT_NAME_MAX-1 },
503 [NFTA_COMPAT_REV] = { .type = NLA_U32 },
504 [NFTA_COMPAT_TYPE] = { .type = NLA_U32 },
505 };
506
507 static const struct nfnl_callback nfnl_nft_compat_cb[NFNL_MSG_COMPAT_MAX] = {
508 [NFNL_MSG_COMPAT_GET] = { .call = nfnl_compat_get,
509 .attr_count = NFTA_COMPAT_MAX,
510 .policy = nfnl_compat_policy_get },
511 };
512
513 static const struct nfnetlink_subsystem nfnl_compat_subsys = {
514 .name = "nft-compat",
515 .subsys_id = NFNL_SUBSYS_NFT_COMPAT,
516 .cb_count = NFNL_MSG_COMPAT_MAX,
517 .cb = nfnl_nft_compat_cb,
518 };
519
520 static LIST_HEAD(nft_match_list);
521
522 struct nft_xt {
523 struct list_head head;
524 struct nft_expr_ops ops;
525 };
526
527 static struct nft_expr_type nft_match_type;
528
529 static const struct nft_expr_ops *
530 nft_match_select_ops(const struct nft_ctx *ctx,
531 const struct nlattr * const tb[])
532 {
533 struct nft_xt *nft_match;
534 struct xt_match *match;
535 char *mt_name;
536 __u32 rev, family;
537
538 if (tb[NFTA_MATCH_NAME] == NULL ||
539 tb[NFTA_MATCH_REV] == NULL ||
540 tb[NFTA_MATCH_INFO] == NULL)
541 return ERR_PTR(-EINVAL);
542
543 mt_name = nla_data(tb[NFTA_MATCH_NAME]);
544 rev = ntohl(nla_get_be32(tb[NFTA_MATCH_REV]));
545 family = ctx->afi->family;
546
547 /* Re-use the existing match if it's already loaded. */
548 list_for_each_entry(nft_match, &nft_match_list, head) {
549 struct xt_match *match = nft_match->ops.data;
550
551 if (strcmp(match->name, mt_name) == 0 &&
552 match->revision == rev && match->family == family)
553 return &nft_match->ops;
554 }
555
556 match = xt_request_find_match(family, mt_name, rev);
557 if (IS_ERR(match))
558 return ERR_PTR(-ENOENT);
559
560 /* This is the first time we use this match, allocate operations */
561 nft_match = kzalloc(sizeof(struct nft_xt), GFP_KERNEL);
562 if (nft_match == NULL)
563 return ERR_PTR(-ENOMEM);
564
565 nft_match->ops.type = &nft_match_type;
566 nft_match->ops.size = NFT_EXPR_SIZE(XT_ALIGN(match->matchsize));
567 nft_match->ops.eval = nft_match_eval;
568 nft_match->ops.init = nft_match_init;
569 nft_match->ops.destroy = nft_match_destroy;
570 nft_match->ops.dump = nft_match_dump;
571 nft_match->ops.validate = nft_match_validate;
572 nft_match->ops.data = match;
573
574 list_add(&nft_match->head, &nft_match_list);
575
576 return &nft_match->ops;
577 }
578
579 static void nft_match_release(void)
580 {
581 struct nft_xt *nft_match, *tmp;
582
583 list_for_each_entry_safe(nft_match, tmp, &nft_match_list, head)
584 kfree(nft_match);
585 }
586
587 static struct nft_expr_type nft_match_type __read_mostly = {
588 .name = "match",
589 .select_ops = nft_match_select_ops,
590 .policy = nft_match_policy,
591 .maxattr = NFTA_MATCH_MAX,
592 .owner = THIS_MODULE,
593 };
594
595 static LIST_HEAD(nft_target_list);
596
597 static struct nft_expr_type nft_target_type;
598
599 static const struct nft_expr_ops *
600 nft_target_select_ops(const struct nft_ctx *ctx,
601 const struct nlattr * const tb[])
602 {
603 struct nft_xt *nft_target;
604 struct xt_target *target;
605 char *tg_name;
606 __u32 rev, family;
607
608 if (tb[NFTA_TARGET_NAME] == NULL ||
609 tb[NFTA_TARGET_REV] == NULL ||
610 tb[NFTA_TARGET_INFO] == NULL)
611 return ERR_PTR(-EINVAL);
612
613 tg_name = nla_data(tb[NFTA_TARGET_NAME]);
614 rev = ntohl(nla_get_be32(tb[NFTA_TARGET_REV]));
615 family = ctx->afi->family;
616
617 /* Re-use the existing target if it's already loaded. */
618 list_for_each_entry(nft_target, &nft_match_list, head) {
619 struct xt_target *target = nft_target->ops.data;
620
621 if (strcmp(target->name, tg_name) == 0 &&
622 target->revision == rev && target->family == family)
623 return &nft_target->ops;
624 }
625
626 target = xt_request_find_target(family, tg_name, rev);
627 if (IS_ERR(target))
628 return ERR_PTR(-ENOENT);
629
630 /* This is the first time we use this target, allocate operations */
631 nft_target = kzalloc(sizeof(struct nft_xt), GFP_KERNEL);
632 if (nft_target == NULL)
633 return ERR_PTR(-ENOMEM);
634
635 nft_target->ops.type = &nft_target_type;
636 nft_target->ops.size = NFT_EXPR_SIZE(XT_ALIGN(target->targetsize));
637 nft_target->ops.eval = nft_target_eval;
638 nft_target->ops.init = nft_target_init;
639 nft_target->ops.destroy = nft_target_destroy;
640 nft_target->ops.dump = nft_target_dump;
641 nft_target->ops.validate = nft_target_validate;
642 nft_target->ops.data = target;
643
644 list_add(&nft_target->head, &nft_target_list);
645
646 return &nft_target->ops;
647 }
648
649 static void nft_target_release(void)
650 {
651 struct nft_xt *nft_target, *tmp;
652
653 list_for_each_entry_safe(nft_target, tmp, &nft_target_list, head)
654 kfree(nft_target);
655 }
656
657 static struct nft_expr_type nft_target_type __read_mostly = {
658 .name = "target",
659 .select_ops = nft_target_select_ops,
660 .policy = nft_target_policy,
661 .maxattr = NFTA_TARGET_MAX,
662 .owner = THIS_MODULE,
663 };
664
665 static int __init nft_compat_module_init(void)
666 {
667 int ret;
668
669 ret = nft_register_expr(&nft_match_type);
670 if (ret < 0)
671 return ret;
672
673 ret = nft_register_expr(&nft_target_type);
674 if (ret < 0)
675 goto err_match;
676
677 ret = nfnetlink_subsys_register(&nfnl_compat_subsys);
678 if (ret < 0) {
679 pr_err("nft_compat: cannot register with nfnetlink.\n");
680 goto err_target;
681 }
682
683 pr_info("nf_tables_compat: (c) 2012 Pablo Neira Ayuso <pablo@netfilter.org>\n");
684
685 return ret;
686
687 err_target:
688 nft_unregister_expr(&nft_target_type);
689 err_match:
690 nft_unregister_expr(&nft_match_type);
691 return ret;
692 }
693
694 static void __exit nft_compat_module_exit(void)
695 {
696 nfnetlink_subsys_unregister(&nfnl_compat_subsys);
697 nft_unregister_expr(&nft_target_type);
698 nft_unregister_expr(&nft_match_type);
699 nft_match_release();
700 nft_target_release();
701 }
702
703 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT);
704
705 module_init(nft_compat_module_init);
706 module_exit(nft_compat_module_exit);
707
708 MODULE_LICENSE("GPL");
709 MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
710 MODULE_ALIAS_NFT_EXPR("match");
711 MODULE_ALIAS_NFT_EXPR("target");
This page took 0.046353 seconds and 4 git commands to generate.