aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/xfrm4_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/xfrm4_input.c')
-rw-r--r--net/ipv4/xfrm4_input.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index e374903dacdf..662d1e86cfbf 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -21,7 +21,6 @@ int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb)
21 return xfrm4_extract_header(skb); 21 return xfrm4_extract_header(skb);
22} 22}
23 23
24#ifdef CONFIG_NETFILTER
25static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) 24static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
26{ 25{
27 if (skb->dst == NULL) { 26 if (skb->dst == NULL) {
@@ -36,12 +35,10 @@ drop:
36 kfree_skb(skb); 35 kfree_skb(skb);
37 return NET_RX_DROP; 36 return NET_RX_DROP;
38} 37}
39#endif
40 38
41int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, 39int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
42 int encap_type) 40 int encap_type)
43{ 41{
44 XFRM_SPI_SKB_CB(skb)->nhoff = offsetof(struct iphdr, protocol);
45 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); 42 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
46 return xfrm_input(skb, nexthdr, spi, encap_type); 43 return xfrm_input(skb, nexthdr, spi, encap_type);
47} 44}
@@ -49,16 +46,20 @@ EXPORT_SYMBOL(xfrm4_rcv_encap);
49 46
50int xfrm4_transport_finish(struct sk_buff *skb, int async) 47int xfrm4_transport_finish(struct sk_buff *skb, int async)
51{ 48{
49 struct iphdr *iph = ip_hdr(skb);
50
51 iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol;
52
52#ifdef CONFIG_NETFILTER 53#ifdef CONFIG_NETFILTER
53 __skb_push(skb, skb->data - skb_network_header(skb)); 54 __skb_push(skb, skb->data - skb_network_header(skb));
54 ip_hdr(skb)->tot_len = htons(skb->len); 55 iph->tot_len = htons(skb->len);
55 ip_send_check(ip_hdr(skb)); 56 ip_send_check(iph);
56 57
57 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, 58 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL,
58 xfrm4_rcv_encap_finish); 59 xfrm4_rcv_encap_finish);
59 return 0; 60 return 0;
60#else 61#else
61 return -ip_hdr(skb)->protocol; 62 return -iph->protocol;
62#endif 63#endif
63} 64}
64 65