[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.)

2006-08-31 Thread Masahide NAKAMURA
 From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 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 PROTECTED]
  Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 
 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 PROTECTED]
---
 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

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/44] [IPV6]: Allow to replace skbuff by TLV parser.

2006-08-23 Thread YOSHIFUJI Hideaki
From: Masahide NAKAMURA [EMAIL PROTECTED]

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 PROTECTED]
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 include/net/ipv6.h   |2 +-
 net/ipv6/exthdrs.c   |   29 +++--
 net/ipv6/ip6_input.c |2 +-
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c4ea127..8e6ec60 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -229,7 +229,7 @@ extern int  ip6_ra_control(struct sock
   void (*destructor)(struct sock 
*));
 
 
-extern int ipv6_parse_hopopts(struct sk_buff *skb);
+extern int ipv6_parse_hopopts(struct sk_buff **skbp);
 
 extern struct ipv6_txoptions *  ipv6_dup_options(struct sock *sk, struct 
ipv6_txoptions *opt);
 extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct 
ipv6_txoptions *opt,
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 72e8175..fc972c1 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -102,7 +102,7 @@ int ipv6_find_tlv(struct sk_buff *skb, i
 
 struct tlvtype_proc {
int type;
-   int (*func)(struct sk_buff *skb, int offset);
+   int (*func)(struct sk_buff **skbp, int offset);
 };
 
 /*
@@ -111,8 +111,10 @@ struct tlvtype_proc {
 
 /* An unknown option is detected, decide what to do */
 
-static int ip6_tlvopt_unknown(struct sk_buff *skb, int optoff)
+static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
 {
+   struct sk_buff *skb = *skbp;
+
switch ((skb-nh.raw[optoff]  0xC0)  6) {
case 0: /* ignore */
return 1;
@@ -137,8 +139,9 @@ static int ip6_tlvopt_unknown(struct sk_
 
 /* Parse tlv encoded option header (hop-by-hop or destination) */
 
-static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff *skb)
+static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
 {
+   struct sk_buff *skb = *skbp;
struct tlvtype_proc *curr;
int off = skb-h.raw - skb-nh.raw;
int len = ((skb-h.raw[1]+1)3);
@@ -168,13 +171,13 @@ static int ip6_parse_tlv(struct tlvtype_
/* type specific length/alignment 
   checks will be performed in the 
   func(). */
-   if (curr-func(skb, off) == 0)
+   if (curr-func(skbp, off) == 0)
return 0;
break;
}
}
if (curr-type  0) {
-   if (ip6_tlvopt_unknown(skb, off) == 0)
+   if (ip6_tlvopt_unknown(skbp, off) == 0)
return 0;
}
break;
@@ -213,7 +216,8 @@ static int ipv6_destopt_rcv(struct sk_bu
opt-lastopt = skb-h.raw - skb-nh.raw;
opt-dst1 = skb-h.raw - skb-nh.raw;
 
-   if (ip6_parse_tlv(tlvprocdestopt_lst, skb)) {
+   if (ip6_parse_tlv(tlvprocdestopt_lst, skbp)) {
+   skb = *skbp;
skb-h.raw += ((skb-h.raw[1]+1)3);
opt-nhoff = opt-dst1;
return 1;
@@ -517,8 +521,10 @@ EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
 
 /* Router Alert as of RFC 2711 */
 
-static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
+static int ipv6_hop_ra(struct sk_buff **skbp, int optoff)
 {
+   struct sk_buff *skb = *skbp;
+
if (skb-nh.raw[optoff+1] == 2) {
IP6CB(skb)-ra = optoff;
return 1;
@@ -531,8 +537,9 @@ static int ipv6_hop_ra(struct sk_buff *s
 
 /* Jumbo payload */
 
-static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
+static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
 {
+   struct sk_buff *skb = *skbp;
u32 pkt_len;
 
if (skb-nh.raw[optoff+1] != 4 || (optoff3) != 2) {
@@ -581,8 +588,9 @@ static struct tlvtype_proc tlvprochopopt
{ -1, }
 };
 
-int ipv6_parse_hopopts(struct sk_buff *skb)
+int ipv6_parse_hopopts(struct sk_buff **skbp)
 {
+   struct sk_buff *skb = *skbp;
struct inet6_skb_parm *opt = IP6CB(skb);
 
/*
@@ -598,7 +606,8 @@ int ipv6_parse_hopopts(struct sk_buff *s
}
 
opt-hop = sizeof(struct ipv6hdr);
-   if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
+   if (ip6_parse_tlv(tlvprochopopt_lst, skbp)) {
+   skb = 

Re: [PATCH 23/44] [IPV6]: Allow to replace skbuff by TLV parser.

2006-08-23 Thread David Miller
From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
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 PROTECTED]
 Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

Applied to net-2.6.19, thanks a lot.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html