1 // SPDX-License-Identifier: GPL-2.0
6 * YOSHIFUJI Hideaki @USAGI
7 * Split up af-specific portion
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
));
34 static struct xfrm_state_afinfo xfrm4_state_afinfo
= {
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
);