9 #include <linux/kernel.h>
10 #include <linux/module.h>
31 for (pprev = &rcv_notify_handlers;
33 lockdep_is_held(&xfrm4_mode_tunnel_input_mutex))) !=
NULL;
42 handler->
next = *pprev;
60 for (pprev = &rcv_notify_handlers;
62 lockdep_is_held(&xfrm4_mode_tunnel_input_mutex))) !=
NULL;
65 *pprev = handler->
next;
77 static inline void ipip_ecn_decapsulate(
struct sk_buff *
skb)
79 struct iphdr *inner_iph = ipip_hdr(skb);
82 IP_ECN_set_ce(inner_iph);
92 struct iphdr *top_iph;
95 skb_set_network_header(skb, -x->
props.header_len);
99 top_iph = ip_hdr(skb);
102 top_iph->version = 4;
104 top_iph->
protocol = xfrm_af2proto(skb_dst(skb)->
ops->family);
110 flags = x->
props.flags;
112 IP_ECN_clear(top_iph);
116 ip_select_ident(top_iph, dst->
child,
NULL);
118 top_iph->
ttl = ip4_dst_hoplimit(dst->
child);
121 top_iph->
daddr = x->
id.daddr.a4;
126 #define for_each_input_rcu(head, handler) \
127 for (handler = rcu_dereference(head); \
129 handler = rcu_dereference(handler->next))
139 if (!pskb_may_pull(skb,
sizeof(
struct iphdr)))
145 if (skb_cloned(skb) &&
151 if (!(x->
props.flags & XFRM_STATE_NOECN))
152 ipip_ecn_decapsulate(skb);
154 skb_reset_network_header(skb);
155 skb_mac_header_rebuild(skb);
163 static struct xfrm_mode xfrm4_tunnel_mode = {
164 .input2 = xfrm4_mode_tunnel_input,
166 .output2 = xfrm4_mode_tunnel_output,
173 static int __init xfrm4_mode_tunnel_init(
void)
178 static void __exit xfrm4_mode_tunnel_exit(
void)