2 * IPv6 raw table, a port of the IPv4 raw table to IPv6
4 * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
6 #include <linux/module.h>
7 #include <linux/netfilter_ipv6/ip6_tables.h>
9 #define RAW_VALID_HOOKS ((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_OUT))
12 #define DEBUGP(x, args...) printk(KERN_DEBUG x, ## args)
14 #define DEBUGP(x, args...)
19 struct ip6t_replace repl
;
20 struct ip6t_standard entries
[2];
21 struct ip6t_error term
;
22 } initial_table __initdata
= {
25 .valid_hooks
= RAW_VALID_HOOKS
,
27 .size
= sizeof(struct ip6t_standard
) * 2 + sizeof(struct ip6t_error
),
29 [NF_IP6_PRE_ROUTING
] = 0,
30 [NF_IP6_LOCAL_OUT
] = sizeof(struct ip6t_standard
)
33 [NF_IP6_PRE_ROUTING
] = 0,
34 [NF_IP6_LOCAL_OUT
] = sizeof(struct ip6t_standard
)
41 .target_offset
= sizeof(struct ip6t_entry
),
42 .next_offset
= sizeof(struct ip6t_standard
),
47 .target_size
= IP6T_ALIGN(sizeof(struct ip6t_standard_target
)),
50 .verdict
= -NF_ACCEPT
- 1,
57 .target_offset
= sizeof(struct ip6t_entry
),
58 .next_offset
= sizeof(struct ip6t_standard
),
63 .target_size
= IP6T_ALIGN(sizeof(struct ip6t_standard_target
)),
66 .verdict
= -NF_ACCEPT
- 1,
73 .target_offset
= sizeof(struct ip6t_entry
),
74 .next_offset
= sizeof(struct ip6t_error
),
80 .target_size
= IP6T_ALIGN(sizeof(struct ip6t_error_target
)),
81 .name
= IP6T_ERROR_TARGET
,
90 static struct xt_table packet_raw
= {
92 .valid_hooks
= RAW_VALID_HOOKS
,
93 .lock
= RW_LOCK_UNLOCKED
,
98 /* The work comes in here from netfilter.c. */
100 ip6t_hook(unsigned int hook
,
101 struct sk_buff
**pskb
,
102 const struct net_device
*in
,
103 const struct net_device
*out
,
104 int (*okfn
)(struct sk_buff
*))
106 return ip6t_do_table(pskb
, hook
, in
, out
, &packet_raw
);
109 static struct nf_hook_ops ip6t_ops
[] = {
113 .hooknum
= NF_IP6_PRE_ROUTING
,
114 .priority
= NF_IP6_PRI_FIRST
,
115 .owner
= THIS_MODULE
,
120 .hooknum
= NF_IP6_LOCAL_OUT
,
121 .priority
= NF_IP6_PRI_FIRST
,
122 .owner
= THIS_MODULE
,
126 static int __init
ip6table_raw_init(void)
131 ret
= ip6t_register_table(&packet_raw
, &initial_table
.repl
);
136 ret
= nf_register_hooks(ip6t_ops
, ARRAY_SIZE(ip6t_ops
));
143 ip6t_unregister_table(&packet_raw
);
147 static void __exit
ip6table_raw_fini(void)
149 nf_unregister_hooks(ip6t_ops
, ARRAY_SIZE(ip6t_ops
));
150 ip6t_unregister_table(&packet_raw
);
153 module_init(ip6table_raw_init
);
154 module_exit(ip6table_raw_fini
);
155 MODULE_LICENSE("GPL");