2 * (C) 2012-2013 by Pablo Neira Ayuso <pablo@netfilter.org>
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.
8 * This software has been sponsored by Sophos Astaro <http://www.sophos.com>
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 <linux/netfilter_bridge/ebtables.h>
23 #include <linux/netfilter_arp/arp_tables.h>
24 #include <net/netfilter/nf_tables.h>
26 static int nft_compat_chain_validate_dependency(const char *tablename
,
27 const struct nft_chain
*chain
)
29 const struct nft_base_chain
*basechain
;
31 if (!tablename
|| !(chain
->flags
& NFT_BASE_CHAIN
))
34 basechain
= nft_base_chain(chain
);
35 if (strcmp(tablename
, "nat") == 0 &&
36 basechain
->type
->type
!= NFT_CHAIN_T_NAT
)
46 struct arpt_entry arp
;
50 nft_compat_set_par(struct xt_action_param
*par
, void *xt
, const void *xt_info
)
53 par
->targinfo
= xt_info
;
57 static void nft_target_eval_xt(const struct nft_expr
*expr
,
58 struct nft_regs
*regs
,
59 const struct nft_pktinfo
*pkt
)
61 void *info
= nft_expr_priv(expr
);
62 struct xt_target
*target
= expr
->ops
->data
;
63 struct sk_buff
*skb
= pkt
->skb
;
66 nft_compat_set_par((struct xt_action_param
*)&pkt
->xt
, target
, info
);
68 ret
= target
->target(skb
, &pkt
->xt
);
75 regs
->verdict
.code
= NFT_CONTINUE
;
78 regs
->verdict
.code
= ret
;
83 static void nft_target_eval_bridge(const struct nft_expr
*expr
,
84 struct nft_regs
*regs
,
85 const struct nft_pktinfo
*pkt
)
87 void *info
= nft_expr_priv(expr
);
88 struct xt_target
*target
= expr
->ops
->data
;
89 struct sk_buff
*skb
= pkt
->skb
;
92 nft_compat_set_par((struct xt_action_param
*)&pkt
->xt
, target
, info
);
94 ret
= target
->target(skb
, &pkt
->xt
);
101 regs
->verdict
.code
= NF_ACCEPT
;
104 regs
->verdict
.code
= NF_DROP
;
107 regs
->verdict
.code
= NFT_CONTINUE
;
110 regs
->verdict
.code
= NFT_RETURN
;
113 regs
->verdict
.code
= ret
;
118 static const struct nla_policy nft_target_policy
[NFTA_TARGET_MAX
+ 1] = {
119 [NFTA_TARGET_NAME
] = { .type
= NLA_NUL_STRING
},
120 [NFTA_TARGET_REV
] = { .type
= NLA_U32
},
121 [NFTA_TARGET_INFO
] = { .type
= NLA_BINARY
},
125 nft_target_set_tgchk_param(struct xt_tgchk_param
*par
,
126 const struct nft_ctx
*ctx
,
127 struct xt_target
*target
, void *info
,
128 union nft_entry
*entry
, u16 proto
, bool inv
)
131 par
->table
= ctx
->table
->name
;
132 switch (ctx
->afi
->family
) {
134 entry
->e4
.ip
.proto
= proto
;
135 entry
->e4
.ip
.invflags
= inv
? IPT_INV_PROTO
: 0;
139 entry
->e6
.ipv6
.flags
|= IP6T_F_PROTO
;
141 entry
->e6
.ipv6
.proto
= proto
;
142 entry
->e6
.ipv6
.invflags
= inv
? IP6T_INV_PROTO
: 0;
145 entry
->ebt
.ethproto
= (__force __be16
)proto
;
146 entry
->ebt
.invflags
= inv
? EBT_IPROTO
: 0;
151 par
->entryinfo
= entry
;
152 par
->target
= target
;
153 par
->targinfo
= info
;
154 if (ctx
->chain
->flags
& NFT_BASE_CHAIN
) {
155 const struct nft_base_chain
*basechain
=
156 nft_base_chain(ctx
->chain
);
157 const struct nf_hook_ops
*ops
= &basechain
->ops
[0];
159 par
->hook_mask
= 1 << ops
->hooknum
;
163 par
->family
= ctx
->afi
->family
;
164 par
->nft_compat
= true;
167 static void target_compat_from_user(struct xt_target
*t
, void *in
, void *out
)
171 memcpy(out
, in
, t
->targetsize
);
172 pad
= XT_ALIGN(t
->targetsize
) - t
->targetsize
;
174 memset(out
+ t
->targetsize
, 0, pad
);
177 static const struct nla_policy nft_rule_compat_policy
[NFTA_RULE_COMPAT_MAX
+ 1] = {
178 [NFTA_RULE_COMPAT_PROTO
] = { .type
= NLA_U32
},
179 [NFTA_RULE_COMPAT_FLAGS
] = { .type
= NLA_U32
},
182 static int nft_parse_compat(const struct nlattr
*attr
, u16
*proto
, bool *inv
)
184 struct nlattr
*tb
[NFTA_RULE_COMPAT_MAX
+1];
188 err
= nla_parse_nested(tb
, NFTA_RULE_COMPAT_MAX
, attr
,
189 nft_rule_compat_policy
);
193 if (!tb
[NFTA_RULE_COMPAT_PROTO
] || !tb
[NFTA_RULE_COMPAT_FLAGS
])
196 flags
= ntohl(nla_get_be32(tb
[NFTA_RULE_COMPAT_FLAGS
]));
197 if (flags
& ~NFT_RULE_COMPAT_F_MASK
)
199 if (flags
& NFT_RULE_COMPAT_F_INV
)
202 *proto
= ntohl(nla_get_be32(tb
[NFTA_RULE_COMPAT_PROTO
]));
207 nft_target_init(const struct nft_ctx
*ctx
, const struct nft_expr
*expr
,
208 const struct nlattr
* const tb
[])
210 void *info
= nft_expr_priv(expr
);
211 struct xt_target
*target
= expr
->ops
->data
;
212 struct xt_tgchk_param par
;
213 size_t size
= XT_ALIGN(nla_len(tb
[NFTA_TARGET_INFO
]));
216 union nft_entry e
= {};
219 ret
= nft_compat_chain_validate_dependency(target
->table
, ctx
->chain
);
223 target_compat_from_user(target
, nla_data(tb
[NFTA_TARGET_INFO
]), info
);
225 if (ctx
->nla
[NFTA_RULE_COMPAT
]) {
226 ret
= nft_parse_compat(ctx
->nla
[NFTA_RULE_COMPAT
], &proto
, &inv
);
231 nft_target_set_tgchk_param(&par
, ctx
, target
, info
, &e
, proto
, inv
);
233 ret
= xt_check_target(&par
, size
, proto
, inv
);
237 /* The standard target cannot be used */
238 if (target
->target
== NULL
) {
245 module_put(target
->me
);
250 nft_target_destroy(const struct nft_ctx
*ctx
, const struct nft_expr
*expr
)
252 struct xt_target
*target
= expr
->ops
->data
;
253 void *info
= nft_expr_priv(expr
);
254 struct xt_tgdtor_param par
;
259 par
.family
= ctx
->afi
->family
;
260 if (par
.target
->destroy
!= NULL
)
261 par
.target
->destroy(&par
);
263 module_put(target
->me
);
266 static int nft_target_dump(struct sk_buff
*skb
, const struct nft_expr
*expr
)
268 const struct xt_target
*target
= expr
->ops
->data
;
269 void *info
= nft_expr_priv(expr
);
271 if (nla_put_string(skb
, NFTA_TARGET_NAME
, target
->name
) ||
272 nla_put_be32(skb
, NFTA_TARGET_REV
, htonl(target
->revision
)) ||
273 nla_put(skb
, NFTA_TARGET_INFO
, XT_ALIGN(target
->targetsize
), info
))
274 goto nla_put_failure
;
282 static int nft_target_validate(const struct nft_ctx
*ctx
,
283 const struct nft_expr
*expr
,
284 const struct nft_data
**data
)
286 struct xt_target
*target
= expr
->ops
->data
;
287 unsigned int hook_mask
= 0;
290 if (ctx
->chain
->flags
& NFT_BASE_CHAIN
) {
291 const struct nft_base_chain
*basechain
=
292 nft_base_chain(ctx
->chain
);
293 const struct nf_hook_ops
*ops
= &basechain
->ops
[0];
295 hook_mask
= 1 << ops
->hooknum
;
296 if (!(hook_mask
& target
->hooks
))
299 ret
= nft_compat_chain_validate_dependency(target
->table
,
307 static void nft_match_eval(const struct nft_expr
*expr
,
308 struct nft_regs
*regs
,
309 const struct nft_pktinfo
*pkt
)
311 void *info
= nft_expr_priv(expr
);
312 struct xt_match
*match
= expr
->ops
->data
;
313 struct sk_buff
*skb
= pkt
->skb
;
316 nft_compat_set_par((struct xt_action_param
*)&pkt
->xt
, match
, info
);
318 ret
= match
->match(skb
, (struct xt_action_param
*)&pkt
->xt
);
320 if (pkt
->xt
.hotdrop
) {
321 regs
->verdict
.code
= NF_DROP
;
325 switch (ret
? 1 : 0) {
327 regs
->verdict
.code
= NFT_CONTINUE
;
330 regs
->verdict
.code
= NFT_BREAK
;
335 static const struct nla_policy nft_match_policy
[NFTA_MATCH_MAX
+ 1] = {
336 [NFTA_MATCH_NAME
] = { .type
= NLA_NUL_STRING
},
337 [NFTA_MATCH_REV
] = { .type
= NLA_U32
},
338 [NFTA_MATCH_INFO
] = { .type
= NLA_BINARY
},
341 /* struct xt_mtchk_param and xt_tgchk_param look very similar */
343 nft_match_set_mtchk_param(struct xt_mtchk_param
*par
, const struct nft_ctx
*ctx
,
344 struct xt_match
*match
, void *info
,
345 union nft_entry
*entry
, u16 proto
, bool inv
)
348 par
->table
= ctx
->table
->name
;
349 switch (ctx
->afi
->family
) {
351 entry
->e4
.ip
.proto
= proto
;
352 entry
->e4
.ip
.invflags
= inv
? IPT_INV_PROTO
: 0;
356 entry
->e6
.ipv6
.flags
|= IP6T_F_PROTO
;
358 entry
->e6
.ipv6
.proto
= proto
;
359 entry
->e6
.ipv6
.invflags
= inv
? IP6T_INV_PROTO
: 0;
362 entry
->ebt
.ethproto
= (__force __be16
)proto
;
363 entry
->ebt
.invflags
= inv
? EBT_IPROTO
: 0;
368 par
->entryinfo
= entry
;
370 par
->matchinfo
= info
;
371 if (ctx
->chain
->flags
& NFT_BASE_CHAIN
) {
372 const struct nft_base_chain
*basechain
=
373 nft_base_chain(ctx
->chain
);
374 const struct nf_hook_ops
*ops
= &basechain
->ops
[0];
376 par
->hook_mask
= 1 << ops
->hooknum
;
380 par
->family
= ctx
->afi
->family
;
381 par
->nft_compat
= true;
384 static void match_compat_from_user(struct xt_match
*m
, void *in
, void *out
)
388 memcpy(out
, in
, m
->matchsize
);
389 pad
= XT_ALIGN(m
->matchsize
) - m
->matchsize
;
391 memset(out
+ m
->matchsize
, 0, pad
);
395 nft_match_init(const struct nft_ctx
*ctx
, const struct nft_expr
*expr
,
396 const struct nlattr
* const tb
[])
398 void *info
= nft_expr_priv(expr
);
399 struct xt_match
*match
= expr
->ops
->data
;
400 struct xt_mtchk_param par
;
401 size_t size
= XT_ALIGN(nla_len(tb
[NFTA_MATCH_INFO
]));
404 union nft_entry e
= {};
407 ret
= nft_compat_chain_validate_dependency(match
->table
, ctx
->chain
);
411 match_compat_from_user(match
, nla_data(tb
[NFTA_MATCH_INFO
]), info
);
413 if (ctx
->nla
[NFTA_RULE_COMPAT
]) {
414 ret
= nft_parse_compat(ctx
->nla
[NFTA_RULE_COMPAT
], &proto
, &inv
);
419 nft_match_set_mtchk_param(&par
, ctx
, match
, info
, &e
, proto
, inv
);
421 ret
= xt_check_match(&par
, size
, proto
, inv
);
427 module_put(match
->me
);
432 nft_match_destroy(const struct nft_ctx
*ctx
, const struct nft_expr
*expr
)
434 struct xt_match
*match
= expr
->ops
->data
;
435 void *info
= nft_expr_priv(expr
);
436 struct xt_mtdtor_param par
;
440 par
.matchinfo
= info
;
441 par
.family
= ctx
->afi
->family
;
442 if (par
.match
->destroy
!= NULL
)
443 par
.match
->destroy(&par
);
445 module_put(match
->me
);
448 static int nft_match_dump(struct sk_buff
*skb
, const struct nft_expr
*expr
)
450 void *info
= nft_expr_priv(expr
);
451 struct xt_match
*match
= expr
->ops
->data
;
453 if (nla_put_string(skb
, NFTA_MATCH_NAME
, match
->name
) ||
454 nla_put_be32(skb
, NFTA_MATCH_REV
, htonl(match
->revision
)) ||
455 nla_put(skb
, NFTA_MATCH_INFO
, XT_ALIGN(match
->matchsize
), info
))
456 goto nla_put_failure
;
464 static int nft_match_validate(const struct nft_ctx
*ctx
,
465 const struct nft_expr
*expr
,
466 const struct nft_data
**data
)
468 struct xt_match
*match
= expr
->ops
->data
;
469 unsigned int hook_mask
= 0;
472 if (ctx
->chain
->flags
& NFT_BASE_CHAIN
) {
473 const struct nft_base_chain
*basechain
=
474 nft_base_chain(ctx
->chain
);
475 const struct nf_hook_ops
*ops
= &basechain
->ops
[0];
477 hook_mask
= 1 << ops
->hooknum
;
478 if (!(hook_mask
& match
->hooks
))
481 ret
= nft_compat_chain_validate_dependency(match
->table
,
490 nfnl_compat_fill_info(struct sk_buff
*skb
, u32 portid
, u32 seq
, u32 type
,
491 int event
, u16 family
, const char *name
,
494 struct nlmsghdr
*nlh
;
495 struct nfgenmsg
*nfmsg
;
496 unsigned int flags
= portid
? NLM_F_MULTI
: 0;
498 event
|= NFNL_SUBSYS_NFT_COMPAT
<< 8;
499 nlh
= nlmsg_put(skb
, portid
, seq
, event
, sizeof(*nfmsg
), flags
);
503 nfmsg
= nlmsg_data(nlh
);
504 nfmsg
->nfgen_family
= family
;
505 nfmsg
->version
= NFNETLINK_V0
;
508 if (nla_put_string(skb
, NFTA_COMPAT_NAME
, name
) ||
509 nla_put_be32(skb
, NFTA_COMPAT_REV
, htonl(rev
)) ||
510 nla_put_be32(skb
, NFTA_COMPAT_TYPE
, htonl(target
)))
511 goto nla_put_failure
;
518 nlmsg_cancel(skb
, nlh
);
523 nfnl_compat_get(struct sock
*nfnl
, struct sk_buff
*skb
,
524 const struct nlmsghdr
*nlh
, const struct nlattr
* const tb
[])
527 struct nfgenmsg
*nfmsg
;
531 struct sk_buff
*skb2
;
533 if (tb
[NFTA_COMPAT_NAME
] == NULL
||
534 tb
[NFTA_COMPAT_REV
] == NULL
||
535 tb
[NFTA_COMPAT_TYPE
] == NULL
)
538 name
= nla_data(tb
[NFTA_COMPAT_NAME
]);
539 rev
= ntohl(nla_get_be32(tb
[NFTA_COMPAT_REV
]));
540 target
= ntohl(nla_get_be32(tb
[NFTA_COMPAT_TYPE
]));
542 nfmsg
= nlmsg_data(nlh
);
544 switch(nfmsg
->nfgen_family
) {
558 pr_err("nft_compat: unsupported protocol %d\n",
559 nfmsg
->nfgen_family
);
563 try_then_request_module(xt_find_revision(nfmsg
->nfgen_family
, name
,
570 skb2
= nlmsg_new(NLMSG_DEFAULT_SIZE
, GFP_KERNEL
);
574 /* include the best revision for this extension in the message */
575 if (nfnl_compat_fill_info(skb2
, NETLINK_CB(skb
).portid
,
577 NFNL_MSG_TYPE(nlh
->nlmsg_type
),
580 name
, ret
, target
) <= 0) {
585 ret
= netlink_unicast(nfnl
, skb2
, NETLINK_CB(skb
).portid
,
590 return ret
== -EAGAIN
? -ENOBUFS
: ret
;
593 static const struct nla_policy nfnl_compat_policy_get
[NFTA_COMPAT_MAX
+1] = {
594 [NFTA_COMPAT_NAME
] = { .type
= NLA_NUL_STRING
,
595 .len
= NFT_COMPAT_NAME_MAX
-1 },
596 [NFTA_COMPAT_REV
] = { .type
= NLA_U32
},
597 [NFTA_COMPAT_TYPE
] = { .type
= NLA_U32
},
600 static const struct nfnl_callback nfnl_nft_compat_cb
[NFNL_MSG_COMPAT_MAX
] = {
601 [NFNL_MSG_COMPAT_GET
] = { .call
= nfnl_compat_get
,
602 .attr_count
= NFTA_COMPAT_MAX
,
603 .policy
= nfnl_compat_policy_get
},
606 static const struct nfnetlink_subsystem nfnl_compat_subsys
= {
607 .name
= "nft-compat",
608 .subsys_id
= NFNL_SUBSYS_NFT_COMPAT
,
609 .cb_count
= NFNL_MSG_COMPAT_MAX
,
610 .cb
= nfnl_nft_compat_cb
,
613 static LIST_HEAD(nft_match_list
);
616 struct list_head head
;
617 struct nft_expr_ops ops
;
620 static struct nft_expr_type nft_match_type
;
622 static bool nft_match_cmp(const struct xt_match
*match
,
623 const char *name
, u32 rev
, u32 family
)
625 return strcmp(match
->name
, name
) == 0 && match
->revision
== rev
&&
626 (match
->family
== NFPROTO_UNSPEC
|| match
->family
== family
);
629 static const struct nft_expr_ops
*
630 nft_match_select_ops(const struct nft_ctx
*ctx
,
631 const struct nlattr
* const tb
[])
633 struct nft_xt
*nft_match
;
634 struct xt_match
*match
;
638 if (tb
[NFTA_MATCH_NAME
] == NULL
||
639 tb
[NFTA_MATCH_REV
] == NULL
||
640 tb
[NFTA_MATCH_INFO
] == NULL
)
641 return ERR_PTR(-EINVAL
);
643 mt_name
= nla_data(tb
[NFTA_MATCH_NAME
]);
644 rev
= ntohl(nla_get_be32(tb
[NFTA_MATCH_REV
]));
645 family
= ctx
->afi
->family
;
647 /* Re-use the existing match if it's already loaded. */
648 list_for_each_entry(nft_match
, &nft_match_list
, head
) {
649 struct xt_match
*match
= nft_match
->ops
.data
;
651 if (nft_match_cmp(match
, mt_name
, rev
, family
)) {
652 if (!try_module_get(match
->me
))
653 return ERR_PTR(-ENOENT
);
655 return &nft_match
->ops
;
659 match
= xt_request_find_match(family
, mt_name
, rev
);
661 return ERR_PTR(-ENOENT
);
663 /* This is the first time we use this match, allocate operations */
664 nft_match
= kzalloc(sizeof(struct nft_xt
), GFP_KERNEL
);
665 if (nft_match
== NULL
)
666 return ERR_PTR(-ENOMEM
);
668 nft_match
->ops
.type
= &nft_match_type
;
669 nft_match
->ops
.size
= NFT_EXPR_SIZE(XT_ALIGN(match
->matchsize
));
670 nft_match
->ops
.eval
= nft_match_eval
;
671 nft_match
->ops
.init
= nft_match_init
;
672 nft_match
->ops
.destroy
= nft_match_destroy
;
673 nft_match
->ops
.dump
= nft_match_dump
;
674 nft_match
->ops
.validate
= nft_match_validate
;
675 nft_match
->ops
.data
= match
;
677 list_add(&nft_match
->head
, &nft_match_list
);
679 return &nft_match
->ops
;
682 static void nft_match_release(void)
684 struct nft_xt
*nft_match
, *tmp
;
686 list_for_each_entry_safe(nft_match
, tmp
, &nft_match_list
, head
)
690 static struct nft_expr_type nft_match_type __read_mostly
= {
692 .select_ops
= nft_match_select_ops
,
693 .policy
= nft_match_policy
,
694 .maxattr
= NFTA_MATCH_MAX
,
695 .owner
= THIS_MODULE
,
698 static LIST_HEAD(nft_target_list
);
700 static struct nft_expr_type nft_target_type
;
702 static bool nft_target_cmp(const struct xt_target
*tg
,
703 const char *name
, u32 rev
, u32 family
)
705 return strcmp(tg
->name
, name
) == 0 && tg
->revision
== rev
&&
706 (tg
->family
== NFPROTO_UNSPEC
|| tg
->family
== family
);
709 static const struct nft_expr_ops
*
710 nft_target_select_ops(const struct nft_ctx
*ctx
,
711 const struct nlattr
* const tb
[])
713 struct nft_xt
*nft_target
;
714 struct xt_target
*target
;
718 if (tb
[NFTA_TARGET_NAME
] == NULL
||
719 tb
[NFTA_TARGET_REV
] == NULL
||
720 tb
[NFTA_TARGET_INFO
] == NULL
)
721 return ERR_PTR(-EINVAL
);
723 tg_name
= nla_data(tb
[NFTA_TARGET_NAME
]);
724 rev
= ntohl(nla_get_be32(tb
[NFTA_TARGET_REV
]));
725 family
= ctx
->afi
->family
;
727 /* Re-use the existing target if it's already loaded. */
728 list_for_each_entry(nft_target
, &nft_target_list
, head
) {
729 struct xt_target
*target
= nft_target
->ops
.data
;
731 if (nft_target_cmp(target
, tg_name
, rev
, family
)) {
732 if (!try_module_get(target
->me
))
733 return ERR_PTR(-ENOENT
);
735 return &nft_target
->ops
;
739 target
= xt_request_find_target(family
, tg_name
, rev
);
741 return ERR_PTR(-ENOENT
);
743 /* This is the first time we use this target, allocate operations */
744 nft_target
= kzalloc(sizeof(struct nft_xt
), GFP_KERNEL
);
745 if (nft_target
== NULL
)
746 return ERR_PTR(-ENOMEM
);
748 nft_target
->ops
.type
= &nft_target_type
;
749 nft_target
->ops
.size
= NFT_EXPR_SIZE(XT_ALIGN(target
->targetsize
));
750 nft_target
->ops
.init
= nft_target_init
;
751 nft_target
->ops
.destroy
= nft_target_destroy
;
752 nft_target
->ops
.dump
= nft_target_dump
;
753 nft_target
->ops
.validate
= nft_target_validate
;
754 nft_target
->ops
.data
= target
;
756 if (family
== NFPROTO_BRIDGE
)
757 nft_target
->ops
.eval
= nft_target_eval_bridge
;
759 nft_target
->ops
.eval
= nft_target_eval_xt
;
761 list_add(&nft_target
->head
, &nft_target_list
);
763 return &nft_target
->ops
;
766 static void nft_target_release(void)
768 struct nft_xt
*nft_target
, *tmp
;
770 list_for_each_entry_safe(nft_target
, tmp
, &nft_target_list
, head
)
774 static struct nft_expr_type nft_target_type __read_mostly
= {
776 .select_ops
= nft_target_select_ops
,
777 .policy
= nft_target_policy
,
778 .maxattr
= NFTA_TARGET_MAX
,
779 .owner
= THIS_MODULE
,
782 static int __init
nft_compat_module_init(void)
786 ret
= nft_register_expr(&nft_match_type
);
790 ret
= nft_register_expr(&nft_target_type
);
794 ret
= nfnetlink_subsys_register(&nfnl_compat_subsys
);
796 pr_err("nft_compat: cannot register with nfnetlink.\n");
800 pr_info("nf_tables_compat: (c) 2012 Pablo Neira Ayuso <pablo@netfilter.org>\n");
805 nft_unregister_expr(&nft_target_type
);
807 nft_unregister_expr(&nft_match_type
);
811 static void __exit
nft_compat_module_exit(void)
813 nfnetlink_subsys_unregister(&nfnl_compat_subsys
);
814 nft_unregister_expr(&nft_target_type
);
815 nft_unregister_expr(&nft_match_type
);
817 nft_target_release();
820 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT
);
822 module_init(nft_compat_module_init
);
823 module_exit(nft_compat_module_exit
);
825 MODULE_LICENSE("GPL");
826 MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
827 MODULE_ALIAS_NFT_EXPR("match");
828 MODULE_ALIAS_NFT_EXPR("target");