7 #include <linux/module.h>
9 #include <linux/netdevice.h>
11 #include <linux/slab.h>
23 return (family ==
AF_INET) ? &tunnel4_handlers : &tunnel64_handlers;
36 for (pprev = fam_handlers(family);
38 lockdep_is_held(&tunnel4_mutex))) !=
NULL;
46 handler->
next = *pprev;
66 for (pprev = fam_handlers(family);
68 lockdep_is_held(&tunnel4_mutex))) !=
NULL;
71 *pprev = handler->
next;
85 #define for_each_tunnel_rcu(head, handler) \
86 for (handler = rcu_dereference(head); \
88 handler = rcu_dereference(handler->next)) \
94 if (!pskb_may_pull(skb,
sizeof(
struct iphdr)))
108 #if IS_ENABLED(CONFIG_IPV6)
113 if (!pskb_may_pull(skb,
sizeof(
struct ipv6hdr)))
117 if (!handler->handler(skb))
137 #if IS_ENABLED(CONFIG_IPV6)
138 static void tunnel64_err(
struct sk_buff *skb,
u32 info)
149 .handler = tunnel4_rcv,
150 .err_handler = tunnel4_err,
155 #if IS_ENABLED(CONFIG_IPV6)
158 .err_handler = tunnel64_err,
164 static int __init tunnel4_init(
void)
167 pr_err(
"%s: can't add protocol\n", __func__);
170 #if IS_ENABLED(CONFIG_IPV6)
172 pr_err(
"tunnel64 init: can't add protocol\n");
180 static void __exit tunnel4_fini(
void)
182 #if IS_ENABLED(CONFIG_IPV6)
184 pr_err(
"tunnel64 close: can't remove protocol\n");
187 pr_err(
"tunnel4 close: can't remove protocol\n");