fix next header offset in decode_session
Subsystems (2)
PATCH 1/1 fix next header offset in decode_session
The way to get the next protocol number of an IPv6 tunnel changes after introducing IP6CB, but I think we should go back to the previous version here.
In our case I think there was a confusion between the pointer on the first byte of the next header and the value of the next header field.
xfrm6_policy.c 2006-11-07 09:46:19.000000000 +0100 renamed from xfrm6_policy.c.org 2006-11-07 09:45:47.000000000 +0100 +1 -1
@@ -255,7 +255,7 @@ _decode_session6(struct sk_buff *skb, st u16 offset = skb->h.raw - skb->nh.raw; struct ipv6hdr *hdr = skb->nh.ipv6h; struct ipv6_opt_hdr *exthdr; - u8 nexthdr = skb->nh.raw[IP6CB(skb)->nhoff]; + u8 nexthdr = skb->nh.ipv6h->nexthdr; memset(fl, 0, sizeof(struct flowi)); ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr);
In article <[email protected]> (at Tue, 7 Nov 2006 10:30:02 +0100), Jean-Philippe Andriot <[email protected]> says:
Quoted 3 lines
The way to get the next protocol number of an IPv6 tunnel changes after introducing IP6CB, but I think we should go back to the previous version here.
:
xfrm6_policy.c 2006-11-07 09:46:19.000000000 +0100 _decode_session6(struct sk_buff *skb, st · line 260
Quoted 5 lines
struct ipv6_opt_hdr *exthdr;xfrm6_policy.c 2006-11-07 09:46:19.000000000 +0100 renamed from xfrm6_policy.c.org 2006-11-07 09:45:47.000000000 +0100 +1
-1- u8 nexthdr = skb->nh.raw[IP6CB(skb)->nhoff]; + u8 nexthdr = skb->nh.ipv6h->nexthdr; memset(fl, 0, sizeof(struct flowi));
I disagree.
If you do this, you refer to the first extension headers only. We need to skip preceding extension headers using IP6CB(skb)->nhoff, which holds the offset to the current nexthdr.
--yoshfuji