aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv6/netfilter/ip6_tables.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index caf9e375a0f1..b97aedce62ae 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1448,7 +1448,7 @@ static void __exit ip6_tables_fini(void)
1448int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 1448int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
1449 int target, unsigned short *fragoff) 1449 int target, unsigned short *fragoff)
1450{ 1450{
1451 unsigned int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; 1451 unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
1452 u8 nexthdr = ipv6_hdr(skb)->nexthdr; 1452 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
1453 unsigned int len = skb->len - start; 1453 unsigned int len = skb->len - start;
1454 1454
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index b7889ceef556..721f02d7b7f6 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -707,8 +707,9 @@ static int
707find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) 707find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
708{ 708{
709 u8 nexthdr = ipv6_hdr(skb)->nexthdr; 709 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
710 u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data; 710 const int netoff = skb_network_offset(skb);
711 int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; 711 u8 prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
712 int start = netoff + sizeof(struct ipv6hdr);
712 int len = skb->len - start; 713 int len = skb->len - start;
713 u8 prevhdr = NEXTHDR_IPV6; 714 u8 prevhdr = NEXTHDR_IPV6;
714 715