6 #define pr_fmt(fmt) "IPsec: " fmt
9 #include <linux/module.h>
17 skb_push(skb, -skb_network_offset(skb));
23 return ip_hdr(skb)->protocol;
43 static const struct xfrm_type ipip_type = {
44 .description =
"IPIP",
47 .init_state = ipip_init_state,
48 .destructor = ipip_destroy,
49 .input = ipip_xfrm_rcv,
53 static int xfrm_tunnel_rcv(
struct sk_buff *
skb)
64 .handler = xfrm_tunnel_rcv,
65 .err_handler = xfrm_tunnel_err,
69 #if IS_ENABLED(CONFIG_IPV6)
70 static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
72 .err_handler = xfrm_tunnel_err,
77 static int __init ipip_init(
void)
80 pr_info(
"%s: can't add xfrm type\n", __func__);
85 pr_info(
"%s: can't add xfrm handler for AF_INET\n", __func__);
89 #if IS_ENABLED(CONFIG_IPV6)
91 pr_info(
"%s: can't add xfrm handler for AF_INET6\n", __func__);
100 static void __exit ipip_fini(
void)
102 #if IS_ENABLED(CONFIG_IPV6)
104 pr_info(
"%s: can't remove xfrm handler for AF_INET6\n",
108 pr_info(
"%s: can't remove xfrm handler for AF_INET\n",
111 pr_info(
"%s: can't remove xfrm type\n", __func__);