Subject: [IPV6] MIP6: Fix to update IP6CB when cloned skbuff is received at HAO. (Re: [PATCH 23/44] [IPV6]: Allow to replace skbuff by TLV parser.)

From: Masahide NAKAMURA <[email-masked]>
Date: Thu, 31 Aug 2006 21:05:41 +0900

> From: YOSHIFUJI Hideaki <[email-masked]>
> Date: Thu, 24 Aug 2006 00:02:24 +0900
> 
> > In receiving Mobile IPv6 home address option which is a TLV carried
> > by destination options header, kernel will try to mangle source adderss
> > of packet. Think of cloned skbuff it is required to replace it by
> > the parser just like routing header case.
> > This is a framework to achieve that to allow TLV parser to replace
> > inbound skbuff pointer.
> > 
> > Signed-off-by: Masahide NAKAMURA <[email-masked]>
> > Signed-off-by: YOSHIFUJI Hideaki <[email-masked]>
> 
> Applied to net-2.6.19, thanks a lot.
> 

I've found issue about the patch above.
This is a fix for it, to update IP6CB when cloned skbuff is received at HAO.

Signed-off-by: Masahide NAKAMURA <[email-masked]>
---
 net/ipv6/exthdrs.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index f4c7629..ec93a1d 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -233,9 +233,14 @@ static int ipv6_dest_hao(struct sk_buff 
 
 	if (skb_cloned(skb)) {
 		struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC);
+		struct inet6_skb_parm *opt2;
+
 		if (skb2 == NULL)
 			goto discard;
 
+		opt2 = IP6CB(skb2);
+		memcpy(opt2, opt, sizeof(*opt2));
+
 		kfree_skb(skb);
 
 		/* update all variable using below by copied skbuff */
@@ -296,6 +301,7 @@ #endif
 	if (ip6_parse_tlv(tlvprocdestopt_lst, skbp)) {
 		skb = *skbp;
 		skb->h.raw += ((skb->h.raw[1]+1)<<3);
+		opt = IP6CB(skb);
 #ifdef CONFIG_IPV6_MIP6
 		opt->nhoff = dstbuf;
 #else
@@ -690,6 +696,7 @@ int ipv6_parse_hopopts(struct sk_buff **
 	if (ip6_parse_tlv(tlvprochopopt_lst, skbp)) {
 		skb = *skbp;
 		skb->h.raw += (skb->h.raw[1]+1)<<3;
+		opt = IP6CB(skb);
 		opt->nhoff = sizeof(struct ipv6hdr);
 		return 1;
 	}
-- 
1.4.2