diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-25 20:55:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:16 -0400 |
commit | ea2ae17d6443abddc79480dc9f7af8feacabddc4 (patch) | |
tree | 2d6f48a5e4a40f761b5b510af9aac1fca55004cb /net/ipv6/exthdrs.c | |
parent | badff6d01a8589a1c828b0bf118903ca38627f4e (diff) |
[SK_BUFF]: Introduce skb_transport_offset()
For the quite common 'skb->h.raw - skb->data' sequence.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r-- | net/ipv6/exthdrs.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index dab069b0b3f..1bda0299890 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -146,7 +146,7 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp) | |||
146 | int off = skb->h.raw - skb->nh.raw; | 146 | int off = skb->h.raw - skb->nh.raw; |
147 | int len = ((skb->h.raw[1]+1)<<3); | 147 | int len = ((skb->h.raw[1]+1)<<3); |
148 | 148 | ||
149 | if ((skb->h.raw + len) - skb->data > skb_headlen(skb)) | 149 | if (skb_transport_offset(skb) + len > skb_headlen(skb)) |
150 | goto bad; | 150 | goto bad; |
151 | 151 | ||
152 | off += 2; | 152 | off += 2; |
@@ -288,8 +288,9 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp) | |||
288 | #endif | 288 | #endif |
289 | struct dst_entry *dst; | 289 | struct dst_entry *dst; |
290 | 290 | ||
291 | if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || | 291 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
292 | !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { | 292 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
293 | ((skb->h.raw[1] + 1) << 3)))) { | ||
293 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 294 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), |
294 | IPSTATS_MIB_INHDRERRORS); | 295 | IPSTATS_MIB_INHDRERRORS); |
295 | kfree_skb(skb); | 296 | kfree_skb(skb); |
@@ -387,8 +388,9 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp) | |||
387 | 388 | ||
388 | in6_dev_put(idev); | 389 | in6_dev_put(idev); |
389 | 390 | ||
390 | if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || | 391 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
391 | !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { | 392 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
393 | ((skb->h.raw[1] + 1) << 3)))) { | ||
392 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 394 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), |
393 | IPSTATS_MIB_INHDRERRORS); | 395 | IPSTATS_MIB_INHDRERRORS); |
394 | kfree_skb(skb); | 396 | kfree_skb(skb); |