8 #include <linux/module.h>
9 #include <linux/netfilter/x_tables.h>
10 #include <linux/netfilter_arp/arp_tables.h>
11 #include <linux/slab.h>
17 #define FILTER_VALID_HOOKS ((1 << NF_ARP_IN) | (1 << NF_ARP_OUT) | \
18 (1 << NF_ARP_FORWARD))
20 static const struct xt_table packet_filter = {
34 const struct net *
net = dev_net((in !=
NULL) ? in : out);
41 static int __net_init arptable_filter_net_init(
struct net *net)
48 net->
ipv4.arptable_filter =
51 if (IS_ERR(net->
ipv4.arptable_filter))
52 return PTR_ERR(net->
ipv4.arptable_filter);
56 static void __net_exit arptable_filter_net_exit(
struct net *net)
62 .init = arptable_filter_net_init,
63 .exit = arptable_filter_net_exit,
66 static int __init arptable_filter_init(
void)
74 arpfilter_ops =
xt_hook_link(&packet_filter, arptable_filter_hook);
75 if (IS_ERR(arpfilter_ops)) {
76 ret = PTR_ERR(arpfilter_ops);
86 static void __exit arptable_filter_fini(
void)