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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 2fa108245413..e9bbfde19ac3 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -54,12 +54,14 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
54 int xfrm_nr = 0; 54 int xfrm_nr = 0;
55 int decaps = 0; 55 int decaps = 0;
56 int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq); 56 int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq);
57 unsigned int nhoff = offsetof(struct iphdr, protocol);
57 58
58 if (err != 0) 59 if (err != 0)
59 goto drop; 60 goto drop;
60 61
61 do { 62 do {
62 const struct iphdr *iph = ip_hdr(skb); 63 const struct iphdr *iph = ip_hdr(skb);
64 int nexthdr;
63 65
64 if (xfrm_nr == XFRM_MAX_DEPTH) 66 if (xfrm_nr == XFRM_MAX_DEPTH)
65 goto drop; 67 goto drop;
@@ -82,9 +84,12 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
82 if (xfrm_state_check_expire(x)) 84 if (xfrm_state_check_expire(x))
83 goto drop_unlock; 85 goto drop_unlock;
84 86
85 if (x->type->input(x, skb)) 87 nexthdr = x->type->input(x, skb);
88 if (nexthdr <= 0)
86 goto drop_unlock; 89 goto drop_unlock;
87 90
91 skb_network_header(skb)[nhoff] = nexthdr;
92
88 /* only the first xfrm gets the encap type */ 93 /* only the first xfrm gets the encap type */
89 encap_type = 0; 94 encap_type = 0;
90 95