Commit 6b88dd96 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[SK_BUFF] ipv6: Use skb_network_offset in some more places

So that we reduce the number of direct accesses to skb->data.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dc5fc579
...@@ -1448,7 +1448,7 @@ static void __exit ip6_tables_fini(void) ...@@ -1448,7 +1448,7 @@ static void __exit ip6_tables_fini(void)
int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
int target, unsigned short *fragoff) 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; u8 nexthdr = ipv6_hdr(skb)->nexthdr;
unsigned int len = skb->len - start; unsigned int len = skb->len - start;
......
...@@ -707,8 +707,9 @@ static int ...@@ -707,8 +707,9 @@ static int
find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
{ {
u8 nexthdr = ipv6_hdr(skb)->nexthdr; u8 nexthdr = ipv6_hdr(skb)->nexthdr;
u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data; const int netoff = skb_network_offset(skb);
int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; u8 prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
int start = netoff + sizeof(struct ipv6hdr);
int len = skb->len - start; int len = skb->len - start;
u8 prevhdr = NEXTHDR_IPV6; u8 prevhdr = NEXTHDR_IPV6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment