diff options
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index d8a585bd2cb4..1faa2ea80afc 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -240,7 +240,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
240 | if (!afinfo) { | 240 | if (!afinfo) { |
241 | dst = *dst_p; | 241 | dst = *dst_p; |
242 | goto error; | 242 | goto error; |
243 | }; | 243 | } |
244 | |||
244 | dst_prev->output = afinfo->output; | 245 | dst_prev->output = afinfo->output; |
245 | xfrm_state_put_afinfo(afinfo); | 246 | xfrm_state_put_afinfo(afinfo); |
246 | /* Sheit... I remember I did this right. Apparently, | 247 | /* Sheit... I remember I did this right. Apparently, |
@@ -270,17 +271,19 @@ error: | |||
270 | static inline void | 271 | static inline void |
271 | _decode_session6(struct sk_buff *skb, struct flowi *fl) | 272 | _decode_session6(struct sk_buff *skb, struct flowi *fl) |
272 | { | 273 | { |
273 | u16 offset = skb->h.raw - skb->nh.raw; | 274 | u16 offset = skb_network_header_len(skb); |
274 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 275 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
275 | struct ipv6_opt_hdr *exthdr; | 276 | struct ipv6_opt_hdr *exthdr; |
276 | u8 nexthdr = skb->nh.raw[IP6CB(skb)->nhoff]; | 277 | const unsigned char *nh = skb_network_header(skb); |
278 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; | ||
277 | 279 | ||
278 | memset(fl, 0, sizeof(struct flowi)); | 280 | memset(fl, 0, sizeof(struct flowi)); |
279 | ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); | 281 | ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); |
280 | ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); | 282 | ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); |
281 | 283 | ||
282 | while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) { | 284 | while (pskb_may_pull(skb, nh + offset + 1 - skb->data)) { |
283 | exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); | 285 | nh = skb_network_header(skb); |
286 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); | ||
284 | 287 | ||
285 | switch (nexthdr) { | 288 | switch (nexthdr) { |
286 | case NEXTHDR_ROUTING: | 289 | case NEXTHDR_ROUTING: |
@@ -288,7 +291,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) | |||
288 | case NEXTHDR_DEST: | 291 | case NEXTHDR_DEST: |
289 | offset += ipv6_optlen(exthdr); | 292 | offset += ipv6_optlen(exthdr); |
290 | nexthdr = exthdr->nexthdr; | 293 | nexthdr = exthdr->nexthdr; |
291 | exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); | 294 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); |
292 | break; | 295 | break; |
293 | 296 | ||
294 | case IPPROTO_UDP: | 297 | case IPPROTO_UDP: |
@@ -296,7 +299,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) | |||
296 | case IPPROTO_TCP: | 299 | case IPPROTO_TCP: |
297 | case IPPROTO_SCTP: | 300 | case IPPROTO_SCTP: |
298 | case IPPROTO_DCCP: | 301 | case IPPROTO_DCCP: |
299 | if (pskb_may_pull(skb, skb->nh.raw + offset + 4 - skb->data)) { | 302 | if (pskb_may_pull(skb, nh + offset + 4 - skb->data)) { |
300 | __be16 *ports = (__be16 *)exthdr; | 303 | __be16 *ports = (__be16 *)exthdr; |
301 | 304 | ||
302 | fl->fl_ip_sport = ports[0]; | 305 | fl->fl_ip_sport = ports[0]; |
@@ -306,7 +309,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) | |||
306 | return; | 309 | return; |
307 | 310 | ||
308 | case IPPROTO_ICMPV6: | 311 | case IPPROTO_ICMPV6: |
309 | if (pskb_may_pull(skb, skb->nh.raw + offset + 2 - skb->data)) { | 312 | if (pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
310 | u8 *icmp = (u8 *)exthdr; | 313 | u8 *icmp = (u8 *)exthdr; |
311 | 314 | ||
312 | fl->fl_icmp_type = icmp[0]; | 315 | fl->fl_icmp_type = icmp[0]; |
@@ -317,7 +320,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) | |||
317 | 320 | ||
318 | #ifdef CONFIG_IPV6_MIP6 | 321 | #ifdef CONFIG_IPV6_MIP6 |
319 | case IPPROTO_MH: | 322 | case IPPROTO_MH: |
320 | if (pskb_may_pull(skb, skb->nh.raw + offset + 3 - skb->data)) { | 323 | if (pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
321 | struct ip6_mh *mh; | 324 | struct ip6_mh *mh; |
322 | mh = (struct ip6_mh *)exthdr; | 325 | mh = (struct ip6_mh *)exthdr; |
323 | 326 | ||
@@ -335,7 +338,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) | |||
335 | fl->fl_ipsec_spi = 0; | 338 | fl->fl_ipsec_spi = 0; |
336 | fl->proto = nexthdr; | 339 | fl->proto = nexthdr; |
337 | return; | 340 | return; |
338 | }; | 341 | } |
339 | } | 342 | } |
340 | } | 343 | } |
341 | 344 | ||