dm writecache: fix incorrect flush sequence when doing SSD mode commit
[linux/fpc-iii.git] / net / ipv4 / xfrm4_state.c
blobf8ed3c3bb928f1b3a083a9b904111eb91eb70894
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * xfrm4_state.c
5 * Changes:
6 * YOSHIFUJI Hideaki @USAGI
7 * Split up af-specific portion
9 */
11 #include <net/ip.h>
12 #include <net/xfrm.h>
13 #include <linux/pfkeyv2.h>
14 #include <linux/ipsec.h>
15 #include <linux/netfilter_ipv4.h>
16 #include <linux/export.h>
18 int xfrm4_extract_header(struct sk_buff *skb)
20 const struct iphdr *iph = ip_hdr(skb);
22 XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph);
23 XFRM_MODE_SKB_CB(skb)->id = iph->id;
24 XFRM_MODE_SKB_CB(skb)->frag_off = iph->frag_off;
25 XFRM_MODE_SKB_CB(skb)->tos = iph->tos;
26 XFRM_MODE_SKB_CB(skb)->ttl = iph->ttl;
27 XFRM_MODE_SKB_CB(skb)->optlen = iph->ihl * 4 - sizeof(*iph);
28 memset(XFRM_MODE_SKB_CB(skb)->flow_lbl, 0,
29 sizeof(XFRM_MODE_SKB_CB(skb)->flow_lbl));
31 return 0;
34 static struct xfrm_state_afinfo xfrm4_state_afinfo = {
35 .family = AF_INET,
36 .proto = IPPROTO_IPIP,
37 .output = xfrm4_output,
38 .output_finish = xfrm4_output_finish,
39 .extract_input = xfrm4_extract_input,
40 .extract_output = xfrm4_extract_output,
41 .transport_finish = xfrm4_transport_finish,
42 .local_error = xfrm4_local_error,
45 void __init xfrm4_state_init(void)
47 xfrm_state_register_afinfo(&xfrm4_state_afinfo);