RAW: Add checksum default defines for mobility header.
Subsystems (2)
PATCH 2/2 RAW: Add checksum default defines for mobility header.
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
--- net/ipv6/raw.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
net/ipv6/raw.c +13 -2
@@ -1095,10 +1095,21 @@ 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 ; +#ifdef CONFIG_IPV6_MIP6 +case IPPROTO_MH : + rp->checksum =1 ; + rp->offset =4 ; +break ; +#endif +default : +break ; }return (0 ); }
Signature · 1 line
1.4.2
In article <[email protected]> (at Tue, 5 Dec 2006 19:03:27 +0900), Masahide NAKAMURA <[email protected]> says:
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
--yoshfuji
Quoted 5 lines · YOSHIFUJI Hideaki / ????
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
That looks correct according to 3775.
-Brian
In article <[email protected]> (at Tue, 05 Dec 2006 10:04:14 -0500), Brian Haley <[email protected]> says:
Quoted 8 lines
Quoted 5 lines · YOSHIFUJI Hideaki
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
That looks correct according to 3775.
I'm thinking about difference RFC.
--yoshfuji
David Miller
maintainerFrom: YOSHIFUJI Hideaki <[email protected]>
Date: Tue, 05 Dec 2006 20:02:42 +0900 (JST)
Quoted 7 lines
In article <[email protected]> (at Tue, 5 Dec 2006 19:03:27 +0900), Masahide NAKAMURA <[email protected]> says:
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
Ok.
David Miller
maintainerFrom: YOSHIFUJI Hideaki <[email protected]>
Date: Tue, 05 Dec 2006 20:02:42 +0900 (JST)
Quoted 7 lines
In article <[email protected]> (at Tue, 5 Dec 2006 19:03:27 +0900), Masahide NAKAMURA <[email protected]> says:
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
Is there any resolution about this?
Thanks.
Happy Holidays!
In article <[email protected]> (at Sun, 10 Dec 2006 22:50:55 -0800 (PST)), David Miller <[email protected]> says:
Quoted 5 lines
From: YOSHIFUJI Hideaki <[email protected]>
Date: Tue, 05 Dec 2006 20:02:42 +0900 (JST)Quoted 2 lines
In article <[email protected]> (at Tue, 5 Dec 2006 19:03:27 +0900), Masahide NAKAMURA <[email protected]> says:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Add checksum default defines for mobility header(MH). As the result kernel's behavior is to handle MH checksum as default.
I'd like to hold this on. I need to check RFC.
Is there any resolution about this?
Sorry to have kept you waiting.
According to RFC4584 (Extension to Sockets API for Mobile IPv6) Section 6.1 (Receiving and Sending Mobility Header Messages), an implementation that supports the Mobile IPv6 API must implement Mobility Header API checksum calculations by default at the kernel. This is true in our kernel so far because we always performs it in net/ipv6/raw.c:mip6_mh_filter(). However, the default value for IPV6_CHECKSUM socket option was not 4 but -1, which is inconsistent.
So, the proposed patch tried changing the default for IPV6_CHECKSUM.
But, wait... currently, we cannot disable checksumming by IPV6_CHECKSUM for IPPROTO_MH sockets while we can do it for IPPROTO_ICMPV6 sockets. This is still not good.
RFC3775 Section 9.2 (Processing Mobility Headers) says that Mobile IPv6 implementation must observe the following items:
- Checksum (-> silently discard)
Note: calculated by the common IPv6 checksum algorithm and its offset in MH is 4.
- MH Type (-> Binding Error)
- Payload protocol (-> ICMPv6 Parameter Problem)
- Length (-> ICMPv6 Parameter Problem)
Note: The order of these checks is not specified.
In Linux, mip6_mh_filter() performs basic checks for Mobile Header, which corresponds to RFC3775 Section 9.2:
- Length (depends on MH type)
- Checksum
- Payload protocol
Note: MH is checked in user-space daemon, to send BE.
If it is okay to defer the checksumming after checking the next header protocol, we can omit the checksumming in mip6_mh_filter(), and leave it to rawv6_rcv() and rawv6_recvmsg().
Anyway, we have 4 options.
1. IPV6_CHECKSUM default for IPPROTO_MH == 4 omit checksumming in mip6_mh_filter()
2. IPV6_CHECKSUM default for IPPROTO_MH == -1 omit checksumming in mip6_mh_filter()
3. IPV6_CHECKSUM for IPPROTO_MH == 4 always perform checksumming in mip6_mh_filter()
4. IPV6_CHECKSUM default for IPPROTO_MH == -1 always perform checksumming in mip6_mh_filter()
Current behavior is 4, but it is not appropriate.
I guess 1 is the way to go.
Another question may arise; is it okay to change the default if the raw socket for Mobility Header is NOT for user-space daemon? or, is it okay to have two different default value depending on CONFIG_IPV6_MIP6? If we take these question seriously, we should take 2.
Note: in any case, all IPPROTO_MH raw socket users should explicitly set IPV6_CHECKSUM socket option.
Opinions? Objections?
Signature · 2 lines
YOSHIFUJI Hideaki @ USAGI Project <[email protected]> GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Quoted 16 lines · YOSHIFUJI Hideaki / ????
If it is okay to defer the checksumming after checking the next header protocol, we can omit the checksumming in
mip6_mh_filter(), and leave it torawv6_rcv()andrawv6_recvmsg().Anyway, we have 4 options.
1.
IPV6_CHECKSUMdefault forIPPROTO_MH== 4 omit checksumming inmip6_mh_filter()
2.IPV6_CHECKSUMdefault forIPPROTO_MH== -1 omit checksumming inmip6_mh_filter()
3.IPV6_CHECKSUMforIPPROTO_MH== 4 always perform checksumming inmip6_mh_filter()
4.IPV6_CHECKSUMdefault forIPPROTO_MH== -1 always perform checksumming inmip6_mh_filter()
Quoted 2 lines
Current behavior is 4, but it is not appropriate.
I guess 1 is the way to go.
I would like to have 1, too.
Quoted 2 lines
Another question may arise; is it okay to change the default if the raw socket for Mobility Header is NOT for user-space daemon? or,
For such application (if any), it has used setsockopt = 4 or hasn't used it for inbound checksum. Those code should work with the kernel change then I can not find any issue here. Do you have anything else to be discussed?
Quoted 2 lines
is it okay to have two different default value depending on
CONFIG_IPV6_MIP6? If we take these question seriously, we should take 2.
We have a solution here, to remove "ifdef CONFIG_IPV6_MIP6" from rawv6_init_sk() to have the same default value = 4 for IPPROTO_MH regardless user config.
BTW ICMPv6 default is on and offset = 2. It is better idea for me to have the similar design for both MH and ICMPv6 as raw socket stuff than you pointed.
Regards,
Signature · 1 line
Masahide NAKAMURA
Hi,
Quoted 15 lines
Quoted 15 lines
Wed, 27 Dec 2006 13:57:23 +0900
[Subject: Re: [PATCH 2/2] [IPV6] RAW: Add checksum default defines for mobility header.] Masahide NAKAMURA <[email protected]> wrote....Anyway, we have 4 options.
1.
IPV6_CHECKSUMdefault forIPPROTO_MH== 4 omit checksumming inmip6_mh_filter()
2.IPV6_CHECKSUMdefault forIPPROTO_MH== -1 omit checksumming inmip6_mh_filter()
3.IPV6_CHECKSUMforIPPROTO_MH== 4 always perform checksumming inmip6_mh_filter()
4.IPV6_CHECKSUMdefault forIPPROTO_MH== -1 always perform checksumming inmip6_mh_filter()
Quoted 4 lines
Quoted 2 lines
Current behavior is 4, but it is not appropriate.
I guess 1 is the way to go.I would like to have 1, too.
I think 1. is suitable.
--
Noriaki TAKAMIYA
[IPV6] RAW: Add checksum default defines for MH.
In reply to Masahide NAKAMURAAdd 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.
--- net/ipv6/mip6.c | 26 -------------------------- net/ipv6/raw.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 28 deletions(-)
net/ipv6/mip6.c +0 -26
@@ -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, strumip6_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",
net/ipv6/raw.c +11 -2
@@ -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 ); }
Signature · 1 line
1.4.2
Re: [IPV6] RAW: Add checksum default defines for MH.
Dave,
AFAIK, we have not heard objectsions and I finally agree on this. Please apply.
--yoshfuji
In article <[email protected]> (at Wed, 3 Jan 2007 18:57:48 +0900), Masahide NAKAMURA <[email protected]> says:
Quoted 91 lines
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(-)net/ipv6/mip6.c +0
-26@@ -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, strumip6_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",net/ipv6/raw.c +11
-2@@ -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 ); }Signature · 6 lines
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
David Miller
maintainerRe: [IPV6] RAW: Add checksum default defines for MH.
From: YOSHIFUJI Hideaki <[email protected]>
Date: Wed, 07 Feb 2007 15:43:34 +0900 (JST)
Quoted 4 lines
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.
[IPV6] RAW: Add checksum default defines for MH.
In reply to Masahide NAKAMURAAdd 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.
--- net/ipv6/mip6.c | 26 -------------------------- net/ipv6/raw.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 28 deletions(-)
net/ipv6/mip6.c +0 -26
@@ -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, strumip6_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",
net/ipv6/raw.c +11 -2
@@ -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 ); }
Signature · 1 line
1.4.2
David Miller
maintainerRe: [IPV6] RAW: Add checksum default defines for MH.
From: Masahide NAKAMURA <[email protected]>
Date: Wed, 3 Jan 2007 18:32:22 +0900
Quoted 9 lines
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.
Re: [IPV6] RAW: Add checksum default defines for MH.
Quoted 2 lines · David Miller
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,
Signature · 4 lines
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.txtDavid Miller
maintainerRe: [IPV6] RAW: Add checksum default defines for MH.
From: Herbert Xu <[email protected]>
Date: Wed, 24 Jan 2007 17:56:23 +1100
Quoted 10 lines
Quoted 2 lines · David Miller
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_CHECKSUMsocket 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 :-)
Re: [IPV6] RAW: Add checksum default defines for MH.
Quoted 9 lines · David Miller
From: Herbert Xu <[email protected]>
Date: Wed, 24 Jan 2007 17:56:23 +1100Quoted 6 lines
Quoted 1 line · David Miller
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?
Quoted 6 lines
Quoted 2 lines
Is there any reason why the application can't just use the existing
IPV6_CHECKSUMsocket 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.
Signature · 1 line
Masahide NAKAMURA
Re: [IPV6] RAW: Add checksum default defines for MH.
In reply to Herbert XuIn article <[email protected]> (at Wed, 24 Jan 2007 17:56:23 +1100), Herbert Xu <[email protected]> says:
Quoted 10 lines
Quoted 2 lines · David Miller
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_CHECKSUMsocket 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
Re: [IPV6] RAW: Add checksum default defines for MH.
Quoted 6 lines · 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_CHECKSUMto 4.
OK if the RFC says so then it's fine by me :)
Signature · 4 lines
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