diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-10 23:50:43 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:59 -0400 |
commit | d56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch) | |
tree | 3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /net/bridge | |
parent | bbe735e4247dba32568a305553b010081c8dea99 (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/bridge')
-rw-r--r-- | net/bridge/br_netfilter.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 1163c4f69899..8a56d8963025 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -374,7 +374,8 @@ static int check_hbh_len(struct sk_buff *skb) | |||
374 | { | 374 | { |
375 | unsigned char *raw = (u8 *) (skb->nh.ipv6h + 1); | 375 | unsigned char *raw = (u8 *) (skb->nh.ipv6h + 1); |
376 | u32 pkt_len; | 376 | u32 pkt_len; |
377 | int off = raw - skb->nh.raw; | 377 | const unsigned char *nh = skb_network_header(skb); |
378 | int off = raw - nh; | ||
378 | int len = (raw[1] + 1) << 3; | 379 | int len = (raw[1] + 1) << 3; |
379 | 380 | ||
380 | if ((raw + len) - skb->data > skb_headlen(skb)) | 381 | if ((raw + len) - skb->data > skb_headlen(skb)) |
@@ -384,9 +385,9 @@ static int check_hbh_len(struct sk_buff *skb) | |||
384 | len -= 2; | 385 | len -= 2; |
385 | 386 | ||
386 | while (len > 0) { | 387 | while (len > 0) { |
387 | int optlen = skb->nh.raw[off + 1] + 2; | 388 | int optlen = nh[off + 1] + 2; |
388 | 389 | ||
389 | switch (skb->nh.raw[off]) { | 390 | switch (nh[off]) { |
390 | case IPV6_TLV_PAD0: | 391 | case IPV6_TLV_PAD0: |
391 | optlen = 1; | 392 | optlen = 1; |
392 | break; | 393 | break; |
@@ -395,9 +396,9 @@ static int check_hbh_len(struct sk_buff *skb) | |||
395 | break; | 396 | break; |
396 | 397 | ||
397 | case IPV6_TLV_JUMBO: | 398 | case IPV6_TLV_JUMBO: |
398 | if (skb->nh.raw[off + 1] != 4 || (off & 3) != 2) | 399 | if (nh[off + 1] != 4 || (off & 3) != 2) |
399 | goto bad; | 400 | goto bad; |
400 | pkt_len = ntohl(*(__be32 *) (skb->nh.raw + off + 2)); | 401 | pkt_len = ntohl(*(__be32 *) (nh + off + 2)); |
401 | if (pkt_len <= IPV6_MAXPLEN || | 402 | if (pkt_len <= IPV6_MAXPLEN || |
402 | skb->nh.ipv6h->payload_len) | 403 | skb->nh.ipv6h->payload_len) |
403 | goto bad; | 404 | goto bad; |
@@ -406,6 +407,7 @@ static int check_hbh_len(struct sk_buff *skb) | |||
406 | if (pskb_trim_rcsum(skb, | 407 | if (pskb_trim_rcsum(skb, |
407 | pkt_len + sizeof(struct ipv6hdr))) | 408 | pkt_len + sizeof(struct ipv6hdr))) |
408 | goto bad; | 409 | goto bad; |
410 | nh = skb_network_header(skb); | ||
409 | break; | 411 | break; |
410 | default: | 412 | default: |
411 | if (optlen > len) | 413 | if (optlen > len) |