aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ah6.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:50:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:59 -0400
commitd56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch)
tree3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /net/ipv6/ah6.c
parentbbe735e4247dba32568a305553b010081c8dea99 (diff)
[SK_BUFF]: Introduce skb_network_header()
For the places where we need a pointer to the network header, it is still legal to touch skb->nh.raw directly if just adding to, subtracting from or setting it to another layer header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ah6.c')
-rw-r--r--net/ipv6/ah6.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index dc68b7269c3c..1c914386982f 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -238,8 +238,8 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
238 top_iph = (struct ipv6hdr *)skb->data; 238 top_iph = (struct ipv6hdr *)skb->data;
239 top_iph->payload_len = htons(skb->len - sizeof(*top_iph)); 239 top_iph->payload_len = htons(skb->len - sizeof(*top_iph));
240 240
241 nexthdr = *skb->nh.raw; 241 nexthdr = *skb_network_header(skb);
242 *skb->nh.raw = IPPROTO_AH; 242 *skb_network_header(skb) = IPPROTO_AH;
243 243
244 /* When there are no extension headers, we only need to save the first 244 /* When there are no extension headers, we only need to save the first
245 * 8 bytes of the base IP header. 245 * 8 bytes of the base IP header.
@@ -341,7 +341,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
341 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 341 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
342 goto out; 342 goto out;
343 343
344 hdr_len = skb->data - skb->nh.raw; 344 hdr_len = skb->data - skb_network_header(skb);
345 ah = (struct ipv6_auth_hdr*)skb->data; 345 ah = (struct ipv6_auth_hdr*)skb->data;
346 ahp = x->data; 346 ahp = x->data;
347 nexthdr = ah->nexthdr; 347 nexthdr = ah->nexthdr;
@@ -354,7 +354,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
354 if (!pskb_may_pull(skb, ah_hlen)) 354 if (!pskb_may_pull(skb, ah_hlen))
355 goto out; 355 goto out;
356 356
357 tmp_hdr = kmemdup(skb->nh.raw, hdr_len, GFP_ATOMIC); 357 tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC);
358 if (!tmp_hdr) 358 if (!tmp_hdr)
359 goto out; 359 goto out;
360 if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len, XFRM_POLICY_IN)) 360 if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len, XFRM_POLICY_IN))
@@ -382,7 +382,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
382 } 382 }
383 } 383 }
384 384
385 skb->h.raw = memcpy(skb->nh.raw += ah_hlen, tmp_hdr, hdr_len); 385 skb->nh.raw += ah_hlen;
386 memcpy(skb_network_header(skb), tmp_hdr, hdr_len);
387 skb->h.raw = skb->nh.raw;
386 __skb_pull(skb, ah_hlen + hdr_len); 388 __skb_pull(skb, ah_hlen + hdr_len);
387 389
388 kfree(tmp_hdr); 390 kfree(tmp_hdr);