aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ah6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ah6.c')
-rw-r--r--net/ipv6/ah6.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index ac6bae17a13b..f9f689162692 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -270,7 +270,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
270 goto error_free_iph; 270 goto error_free_iph;
271 } 271 }
272 272
273 ah = (struct ip_auth_hdr *)skb_transport_header(skb); 273 ah = ip_auth_hdr(skb);
274 ah->nexthdr = nexthdr; 274 ah->nexthdr = nexthdr;
275 275
276 top_iph->priority = 0; 276 top_iph->priority = 0;
@@ -280,8 +280,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
280 top_iph->hop_limit = 0; 280 top_iph->hop_limit = 0;
281 281
282 ahp = x->data; 282 ahp = x->data;
283 ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + 283 ah->hdrlen = (XFRM_ALIGN8(sizeof(*ah) + ahp->icv_trunc_len) >> 2) - 2;
284 ahp->icv_trunc_len) >> 2) - 2;
285 284
286 ah->reserved = 0; 285 ah->reserved = 0;
287 ah->spi = x->id.spi; 286 ah->spi = x->id.spi;
@@ -327,7 +326,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
327 * There is offset of AH before IPv6 header after the process. 326 * There is offset of AH before IPv6 header after the process.
328 */ 327 */
329 328
330 struct ipv6_auth_hdr *ah; 329 struct ip_auth_hdr *ah;
331 struct ipv6hdr *ip6h; 330 struct ipv6hdr *ip6h;
332 struct ah_data *ahp; 331 struct ah_data *ahp;
333 unsigned char *tmp_hdr = NULL; 332 unsigned char *tmp_hdr = NULL;
@@ -346,13 +345,13 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
346 goto out; 345 goto out;
347 346
348 hdr_len = skb->data - skb_network_header(skb); 347 hdr_len = skb->data - skb_network_header(skb);
349 ah = (struct ipv6_auth_hdr*)skb->data; 348 ah = (struct ip_auth_hdr *)skb->data;
350 ahp = x->data; 349 ahp = x->data;
351 nexthdr = ah->nexthdr; 350 nexthdr = ah->nexthdr;
352 ah_hlen = (ah->hdrlen + 2) << 2; 351 ah_hlen = (ah->hdrlen + 2) << 2;
353 352
354 if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && 353 if (ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_full_len) &&
355 ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) 354 ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_trunc_len))
356 goto out; 355 goto out;
357 356
358 if (!pskb_may_pull(skb, ah_hlen)) 357 if (!pskb_may_pull(skb, ah_hlen))
@@ -474,7 +473,8 @@ static int ah6_init_state(struct xfrm_state *x)
474 if (!ahp->work_icv) 473 if (!ahp->work_icv)
475 goto error; 474 goto error;
476 475
477 x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); 476 x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) +
477 ahp->icv_trunc_len);
478 if (x->props.mode == XFRM_MODE_TUNNEL) 478 if (x->props.mode == XFRM_MODE_TUNNEL)
479 x->props.header_len += sizeof(struct ipv6hdr); 479 x->props.header_len += sizeof(struct ipv6hdr);
480 x->data = ahp; 480 x->data = ahp;