12 #include <linux/module.h>
14 #include <linux/netfilter_ipv6/ip6_tables.h>
15 #include <linux/slab.h>
21 #define FILTER_VALID_HOOKS ((1 << NF_INET_LOCAL_IN) | \
22 (1 << NF_INET_FORWARD) | \
23 (1 << NF_INET_LOCAL_OUT))
25 static const struct xt_table packet_filter = {
39 const struct net *
net = dev_net((in !=
NULL) ? in : out);
41 return ip6t_do_table(skb, hook, in, out, net->ipv6.ip6table_filter);
47 static bool forward =
true;
50 static int __net_init ip6table_filter_net_init(
struct net *net)
61 net->ipv6.ip6table_filter =
64 return PTR_RET(net->ipv6.ip6table_filter);
67 static void __net_exit ip6table_filter_net_exit(
struct net *net)
73 .init = ip6table_filter_net_init,
74 .exit = ip6table_filter_net_exit,
77 static int __init ip6table_filter_init(
void)
86 filter_ops =
xt_hook_link(&packet_filter, ip6table_filter_hook);
87 if (IS_ERR(filter_ops)) {
88 ret = PTR_ERR(filter_ops);
99 static void __exit ip6table_filter_fini(
void)