diff options
Diffstat (limited to 'net/ipv4/xfrm4_input.c')
-rw-r--r-- | net/ipv4/xfrm4_input.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 850d919591d1..e1b8f4b90d80 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -68,7 +68,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
68 | { | 68 | { |
69 | int err; | 69 | int err; |
70 | u32 spi, seq; | 70 | u32 spi, seq; |
71 | struct sec_decap_state xfrm_vec[XFRM_MAX_DEPTH]; | 71 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; |
72 | struct xfrm_state *x; | 72 | struct xfrm_state *x; |
73 | int xfrm_nr = 0; | 73 | int xfrm_nr = 0; |
74 | int decaps = 0; | 74 | int decaps = 0; |
@@ -90,14 +90,16 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
90 | if (unlikely(x->km.state != XFRM_STATE_VALID)) | 90 | if (unlikely(x->km.state != XFRM_STATE_VALID)) |
91 | goto drop_unlock; | 91 | goto drop_unlock; |
92 | 92 | ||
93 | if (x->encap->encap_type != encap_type) | ||
94 | goto drop_unlock; | ||
95 | |||
93 | if (x->props.replay_window && xfrm_replay_check(x, seq)) | 96 | if (x->props.replay_window && xfrm_replay_check(x, seq)) |
94 | goto drop_unlock; | 97 | goto drop_unlock; |
95 | 98 | ||
96 | if (xfrm_state_check_expire(x)) | 99 | if (xfrm_state_check_expire(x)) |
97 | goto drop_unlock; | 100 | goto drop_unlock; |
98 | 101 | ||
99 | xfrm_vec[xfrm_nr].decap.decap_type = encap_type; | 102 | if (x->type->input(x, skb)) |
100 | if (x->type->input(x, &(xfrm_vec[xfrm_nr].decap), skb)) | ||
101 | goto drop_unlock; | 103 | goto drop_unlock; |
102 | 104 | ||
103 | /* only the first xfrm gets the encap type */ | 105 | /* only the first xfrm gets the encap type */ |
@@ -111,7 +113,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
111 | 113 | ||
112 | spin_unlock(&x->lock); | 114 | spin_unlock(&x->lock); |
113 | 115 | ||
114 | xfrm_vec[xfrm_nr++].xvec = x; | 116 | xfrm_vec[xfrm_nr++] = x; |
115 | 117 | ||
116 | iph = skb->nh.iph; | 118 | iph = skb->nh.iph; |
117 | 119 | ||
@@ -153,7 +155,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
153 | if (xfrm_nr + skb->sp->len > XFRM_MAX_DEPTH) | 155 | if (xfrm_nr + skb->sp->len > XFRM_MAX_DEPTH) |
154 | goto drop; | 156 | goto drop; |
155 | 157 | ||
156 | memcpy(skb->sp->x+skb->sp->len, xfrm_vec, xfrm_nr*sizeof(struct sec_decap_state)); | 158 | memcpy(skb->sp->xvec + skb->sp->len, xfrm_vec, |
159 | xfrm_nr * sizeof(xfrm_vec[0])); | ||
157 | skb->sp->len += xfrm_nr; | 160 | skb->sp->len += xfrm_nr; |
158 | 161 | ||
159 | nf_reset(skb); | 162 | nf_reset(skb); |
@@ -184,7 +187,7 @@ drop_unlock: | |||
184 | xfrm_state_put(x); | 187 | xfrm_state_put(x); |
185 | drop: | 188 | drop: |
186 | while (--xfrm_nr >= 0) | 189 | while (--xfrm_nr >= 0) |
187 | xfrm_state_put(xfrm_vec[xfrm_nr].xvec); | 190 | xfrm_state_put(xfrm_vec[xfrm_nr]); |
188 | 191 | ||
189 | kfree_skb(skb); | 192 | kfree_skb(skb); |
190 | return 0; | 193 | return 0; |