Re: [IPV6] RAW: Add checksum default defines for MH.
From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> Date: Wed, 07 Feb 2007 15:43:34 +0900 (JST) > AFAIK, we have not heard objectsions and I finally agree on this. > Please apply. > > Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> Yes, thank you for reminding me, I will apply this to net-2.6.21 right now. - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
Dave, AFAIK, we have not heard objectsions and I finally agree on this. Please apply. Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> --yoshfuji In article <[EMAIL PROTECTED]> (at Wed, 3 Jan 2007 18:57:48 +0900), Masahide NAKAMURA <[EMAIL PROTECTED]> says: > Add checksum default defines for mobility header(MH) which > goes through raw socket. As the result kernel's behavior is > to handle MH checksum as default. > > This patch also removes verifying inbound MH checksum at > mip6_mh_filter() since it did not consider user specified > checksum offset and was redundant check with raw socket code. > > Signed-off-by: Masahide NAKAMURA <[EMAIL PROTECTED]> > --- > net/ipv6/mip6.c | 26 -- > net/ipv6/raw.c | 13 +++-- > 2 files changed, 11 insertions(+), 28 deletions(-) > > diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c > index be7dd7d..681bb07 100644 > --- a/net/ipv6/mip6.c > +++ b/net/ipv6/mip6.c > @@ -89,7 +89,6 @@ static int mip6_mh_len(int type) > int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) > { > struct ip6_mh *mh; > - int mhlen; > > if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || > !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) > << 3))) > @@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, stru > mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw); > return -1; > } > - mhlen = (mh->ip6mh_hdrlen + 1) << 3; > - > - if (skb->ip_summed == CHECKSUM_COMPLETE) { > - skb->ip_summed = CHECKSUM_UNNECESSARY; > - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, > - &skb->nh.ipv6h->daddr, > - mhlen, IPPROTO_MH, > - skb->csum)) { > - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum > failed\n"); > - skb->ip_summed = CHECKSUM_NONE; > - } > - } > - if (skb->ip_summed == CHECKSUM_NONE) { > - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, > - &skb->nh.ipv6h->daddr, > - mhlen, IPPROTO_MH, > - skb_checksum(skb, 0, mhlen, 0))) { > - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed " > -"[" NIP6_FMT " > " NIP6_FMT "]\n", > -NIP6(skb->nh.ipv6h->saddr), > -NIP6(skb->nh.ipv6h->daddr)); > - return -1; > - } > - skb->ip_summed = CHECKSUM_UNNECESSARY; > - } > > if (mh->ip6mh_proto != IPPROTO_NONE) { > LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = > %d\n", > diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c > index 4ae1b19..4b83e69 100644 > --- a/net/ipv6/raw.c > +++ b/net/ipv6/raw.c > @@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk, > > static int rawv6_init_sk(struct sock *sk) > { > - if (inet_sk(sk)->num == IPPROTO_ICMPV6) { > - struct raw6_sock *rp = raw6_sk(sk); > + struct raw6_sock *rp = raw6_sk(sk); > + > + switch (inet_sk(sk)->num) { > + case IPPROTO_ICMPV6: > rp->checksum = 1; > rp->offset = 2; > + break; > + case IPPROTO_MH: > + rp->checksum = 1; > + rp->offset = 4; > + break; > + default: > + break; > } > return(0); > } > -- > 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 - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
David Miller wrote: From: Herbert Xu <[EMAIL PROTECTED]> Date: Wed, 24 Jan 2007 17:56:23 +1100 David Miller <[EMAIL PROTECTED]> wrote: Did a complete agreement occur that this patch is ok? My only concern is that we're putting an arbitrary list of protocols in the generic raw.c. What's the justification for including these protocols in particular but not others? Is there any reason why the application can't just use the existing IPV6_CHECKSUM socket option to set the same fields? My understanding in the MH case is that the kernel is going to make changes to the header that the user can't predict and thus it's impossible for them to set the correct checksum. Yes, kernel will change the IPv6 header address, however, actually it is possible to compute MH checksum by user-space since final address (=home address) is seen by application on both sending and receiving case and the checksum is calculated by the address. It is true user can use IPV6_CHECKSUM option to set the same fields. (FYI, it is failed to validate MH checksum with IPv6 header address on wire (or before parsing extension headers) for such Mobile IPv6 routing optimized packet). So this fix is not mandatory feature for kernel. This patch just relaxes user application like ICMPv6 case then we can cancel this if it is too much. Thanks for taking care of this again, guys. -- Masahide NAKAMURA - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
On Wed, Jan 24, 2007 at 04:05:41PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote: > > The only reason they (not myself :-)) want to put this in is > because the RFC says that MIP6 implementation MUST compute > checksum by default when it passes the MH to userspace. On > the other hand, it also states that user space application SHOULD > set IPV6_CHECKSUM to 4. OK if the RFC says so then it's fine by me :) -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
In article <[EMAIL PROTECTED]> (at Wed, 24 Jan 2007 17:56:23 +1100), Herbert Xu <[EMAIL PROTECTED]> says: > David Miller <[EMAIL PROTECTED]> wrote: > > > > Did a complete agreement occur that this patch is ok? > > My only concern is that we're putting an arbitrary list of > protocols in the generic raw.c. What's the justification > for including these protocols in particular but not others? > > Is there any reason why the application can't just use the > existing IPV6_CHECKSUM socket option to set the same fields? Yes, it can. The only reason they (not myself :-)) want to put this in is because the RFC says that MIP6 implementation MUST compute checksum by default when it passes the MH to userspace. On the other hand, it also states that user space application SHOULD set IPV6_CHECKSUM to 4. --yoshfuji - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
From: Herbert Xu <[EMAIL PROTECTED]> Date: Wed, 24 Jan 2007 17:56:23 +1100 > David Miller <[EMAIL PROTECTED]> wrote: > > > > Did a complete agreement occur that this patch is ok? > > My only concern is that we're putting an arbitrary list of > protocols in the generic raw.c. What's the justification > for including these protocols in particular but not others? > > Is there any reason why the application can't just use the > existing IPV6_CHECKSUM socket option to set the same fields? My understanding in the MH case is that the kernel is going to make changes to the header that the user can't predict and thus it's impossible for them to set the correct checksum. I don't know what the justification is for ICMP6 though :-) - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
David Miller <[EMAIL PROTECTED]> wrote: > > Did a complete agreement occur that this patch is ok? My only concern is that we're putting an arbitrary list of protocols in the generic raw.c. What's the justification for including these protocols in particular but not others? Is there any reason why the application can't just use the existing IPV6_CHECKSUM socket option to set the same fields? Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - 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
Re: [IPV6] RAW: Add checksum default defines for MH.
From: Masahide NAKAMURA <[EMAIL PROTECTED]> Date: Wed, 3 Jan 2007 18:32:22 +0900 > Add checksum default defines for mobility header(MH) which > goes through raw socket. As the result kernel's behavior is > to handle MH checksum as default. > > This patch also removes verifying inbound MH checksum at > mip6_mh_filter() since it did not consider user specified > checksum offset and was redundant check with raw socket code. > > Signed-off-by: Masahide NAKAMURA <[EMAIL PROTECTED]> Did a complete agreement occur that this patch is ok? Thank you. - 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
[IPV6] RAW: Add checksum default defines for MH.
Add checksum default defines for mobility header(MH) which goes through raw socket. As the result kernel's behavior is to handle MH checksum as default. This patch also removes verifying inbound MH checksum at mip6_mh_filter() since it did not consider user specified checksum offset and was redundant check with raw socket code. Signed-off-by: Masahide NAKAMURA <[EMAIL PROTECTED]> --- net/ipv6/mip6.c | 26 -- net/ipv6/raw.c | 13 +++-- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index be7dd7d..681bb07 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c @@ -89,7 +89,6 @@ static int mip6_mh_len(int type) int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) { struct ip6_mh *mh; - int mhlen; if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3))) @@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, stru mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw); return -1; } - mhlen = (mh->ip6mh_hdrlen + 1) << 3; - - if (skb->ip_summed == CHECKSUM_COMPLETE) { - skb->ip_summed = CHECKSUM_UNNECESSARY; - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, - &skb->nh.ipv6h->daddr, - mhlen, IPPROTO_MH, - skb->csum)) { - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum failed\n"); - skb->ip_summed = CHECKSUM_NONE; - } - } - if (skb->ip_summed == CHECKSUM_NONE) { - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, - &skb->nh.ipv6h->daddr, - mhlen, IPPROTO_MH, - skb_checksum(skb, 0, mhlen, 0))) { - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed " - "[" NIP6_FMT " > " NIP6_FMT "]\n", - NIP6(skb->nh.ipv6h->saddr), - NIP6(skb->nh.ipv6h->daddr)); - return -1; - } - skb->ip_summed = CHECKSUM_UNNECESSARY; - } if (mh->ip6mh_proto != IPPROTO_NONE) { LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 4ae1b19..4b83e69 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk, static int rawv6_init_sk(struct sock *sk) { - if (inet_sk(sk)->num == IPPROTO_ICMPV6) { - struct raw6_sock *rp = raw6_sk(sk); + struct raw6_sock *rp = raw6_sk(sk); + + switch (inet_sk(sk)->num) { + case IPPROTO_ICMPV6: rp->checksum = 1; rp->offset = 2; + break; + case IPPROTO_MH: + rp->checksum = 1; + rp->offset = 4; + break; + default: + break; } return(0); } -- 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
[IPV6] RAW: Add checksum default defines for MH.
Add checksum default defines for mobility header(MH) which goes through raw socket. As the result kernel's behavior is to handle MH checksum as default. This patch also removes verifying inbound MH checksum at mip6_mh_filter() since it did not consider user specified checksum offset and was redundant check with raw socket code. Signed-off-by: Masahide NAKAMURA <[EMAIL PROTECTED]> --- net/ipv6/mip6.c | 26 -- net/ipv6/raw.c | 13 +++-- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index be7dd7d..681bb07 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c @@ -89,7 +89,6 @@ static int mip6_mh_len(int type) int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) { struct ip6_mh *mh; - int mhlen; if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3))) @@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, stru mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw); return -1; } - mhlen = (mh->ip6mh_hdrlen + 1) << 3; - - if (skb->ip_summed == CHECKSUM_COMPLETE) { - skb->ip_summed = CHECKSUM_UNNECESSARY; - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, - &skb->nh.ipv6h->daddr, - mhlen, IPPROTO_MH, - skb->csum)) { - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum failed\n"); - skb->ip_summed = CHECKSUM_NONE; - } - } - if (skb->ip_summed == CHECKSUM_NONE) { - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, - &skb->nh.ipv6h->daddr, - mhlen, IPPROTO_MH, - skb_checksum(skb, 0, mhlen, 0))) { - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed " - "[" NIP6_FMT " > " NIP6_FMT "]\n", - NIP6(skb->nh.ipv6h->saddr), - NIP6(skb->nh.ipv6h->daddr)); - return -1; - } - skb->ip_summed = CHECKSUM_UNNECESSARY; - } if (mh->ip6mh_proto != IPPROTO_NONE) { LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 4ae1b19..4b83e69 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk, static int rawv6_init_sk(struct sock *sk) { - if (inet_sk(sk)->num == IPPROTO_ICMPV6) { - struct raw6_sock *rp = raw6_sk(sk); + struct raw6_sock *rp = raw6_sk(sk); + + switch (inet_sk(sk)->num) { + case IPPROTO_ICMPV6: rp->checksum = 1; rp->offset = 2; + break; + case IPPROTO_MH: + rp->checksum = 1; + rp->offset = 4; + break; + default: + break; } return(0); } -- 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