[SK_BUFF] ipv6: Use skb_network_offset in some more places
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Mar 2007 01:29:03 +0000 (22:29 -0300)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:26:38 +0000 (22:26 -0700)
So that we reduce the number of direct accesses to skb->data.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/nf_conntrack_reasm.c

index caf9e375a0f112bb27d5923c522865be9b252069..b97aedce62aed1e343d63f3114191d82b38c59e4 100644 (file)
@@ -1448,7 +1448,7 @@ static void __exit ip6_tables_fini(void)
 int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
                  int target, unsigned short *fragoff)
 {
-       unsigned int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
+       unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
        u8 nexthdr = ipv6_hdr(skb)->nexthdr;
        unsigned int len = skb->len - start;
 
index b7889ceef5560a245c51fb707b1d2e7f7af1f8a2..721f02d7b7f6bd41007bfc57d40e6e983da64da6 100644 (file)
@@ -707,8 +707,9 @@ static int
 find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
 {
        u8 nexthdr = ipv6_hdr(skb)->nexthdr;
-       u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data;
-       int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
+       const int netoff = skb_network_offset(skb);
+       u8 prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
+       int start = netoff + sizeof(struct ipv6hdr);
        int len = skb->len - start;
        u8 prevhdr = NEXTHDR_IPV6;