netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
@ 2013-03-07 20:13 Alexander Aring
  2013-03-07 20:41 ` Alexander Aring
  2013-03-07 22:41 ` Ben Hutchings
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Aring @ 2013-03-07 20:13 UTC (permalink / raw)
  To: davem
  Cc: kuznet, jmorris, yoshfuji, linux-zigbee-devel, netdev,
	Alexander Aring

The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
We need first to manipulate eui[0] before we call memcpy afterwards.

Broken since commit:
5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f

Since this commit I got many trouble with the ieee802154 stack.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ipv6/addrconf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index fa36a67..4460237 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1731,8 +1731,8 @@ static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)
 {
 	if (dev->addr_len != IEEE802154_ADDR_LEN)
 		return -1;
-	memcpy(eui, dev->dev_addr, 8);
 	eui[0] ^= 2;
+	memcpy(eui, dev->dev_addr, 8);
 	return 0;
 }
 
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 20:13 [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices Alexander Aring
@ 2013-03-07 20:41 ` Alexander Aring
  2013-03-08  2:21   ` YOSHIFUJI Hideaki
  2013-03-07 22:41 ` Ben Hutchings
  1 sibling, 1 reply; 12+ messages in thread
From: Alexander Aring @ 2013-03-07 20:41 UTC (permalink / raw)
  To: davem; +Cc: kuznet, jmorris, yoshfuji, linux-zigbee-devel, netdev

Hi,

I don't know if this is a right solution for that, because other
functions like addrconf_ifid_infiniband to manipulate eui after memcpy,
too.

But this patch solves my problems with ieee802154 stack.

Any other ideas?

Regards
Alex

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 20:13 [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices Alexander Aring
  2013-03-07 20:41 ` Alexander Aring
@ 2013-03-07 22:41 ` Ben Hutchings
  2013-03-07 22:57   ` Eric Dumazet
       [not found]   ` <1362696088.2936.47.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
  1 sibling, 2 replies; 12+ messages in thread
From: Ben Hutchings @ 2013-03-07 22:41 UTC (permalink / raw)
  To: Alexander Aring
  Cc: davem, kuznet, jmorris, yoshfuji, linux-zigbee-devel, netdev

On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
> The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
> We need first to manipulate eui[0] before we call memcpy afterwards.

memcpy() does not work that way.

> Broken since commit:
> 5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f
> 
> Since this commit I got many trouble with the ieee802154 stack.

Your change is effectively reverting that commit.

Ben.

> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  net/ipv6/addrconf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index fa36a67..4460237 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1731,8 +1731,8 @@ static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)
>  {
>  	if (dev->addr_len != IEEE802154_ADDR_LEN)
>  		return -1;
> -	memcpy(eui, dev->dev_addr, 8);
>  	eui[0] ^= 2;
> +	memcpy(eui, dev->dev_addr, 8);
>  	return 0;
>  }
>  

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 22:41 ` Ben Hutchings
@ 2013-03-07 22:57   ` Eric Dumazet
  2013-03-07 23:17     ` David Miller
       [not found]   ` <1362696088.2936.47.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2013-03-07 22:57 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Alexander Aring, davem, kuznet, jmorris, yoshfuji,
	linux-zigbee-devel, netdev

On Thu, 2013-03-07 at 22:41 +0000, Ben Hutchings wrote:
> On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
> > The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
> > We need first to manipulate eui[0] before we call memcpy afterwards.
> 
> memcpy() does not work that way.
> 
> > Broken since commit:
> > 5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f
> > 
> > Since this commit I got many trouble with the ieee802154 stack.
> 
> Your change is effectively reverting that commit.


Reverting the commit seems the solution ;)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 22:57   ` Eric Dumazet
@ 2013-03-07 23:17     ` David Miller
  2013-03-08  8:53       ` Alexander Aring
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2013-03-07 23:17 UTC (permalink / raw)
  To: eric.dumazet
  Cc: bhutchings, alex.aring, kuznet, jmorris, yoshfuji,
	linux-zigbee-devel, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Mar 2013 14:57:05 -0800

> On Thu, 2013-03-07 at 22:41 +0000, Ben Hutchings wrote:
>> On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
>> > The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
>> > We need first to manipulate eui[0] before we call memcpy afterwards.
>> 
>> memcpy() does not work that way.
>> 
>> > Broken since commit:
>> > 5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f
>> > 
>> > Since this commit I got many trouble with the ieee802154 stack.
>> 
>> Your change is effectively reverting that commit.
> 
> Reverting the commit seems the solution ;)

So Yoshifuji HIDEAKI and Alexander need to work out what is happening
here.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 20:41 ` Alexander Aring
@ 2013-03-08  2:21   ` YOSHIFUJI Hideaki
  2013-03-08  9:37     ` Alexander Aring
  0 siblings, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-03-08  2:21 UTC (permalink / raw)
  To: Alexander Aring; +Cc: davem, kuznet, jmorris, linux-zigbee-devel, netdev

Hi,

Alexander Aring wrote:
> Hi,
> 
> I don't know if this is a right solution for that, because other
> functions like addrconf_ifid_infiniband to manipulate eui after memcpy,
> too.
> 
> But this patch solves my problems with ieee802154 stack.

What kind of problems do you have?

--yoshfuji

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-07 23:17     ` David Miller
@ 2013-03-08  8:53       ` Alexander Aring
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-03-08  8:53 UTC (permalink / raw)
  To: David Miller
  Cc: eric.dumazet, bhutchings, kuznet, jmorris, yoshfuji,
	linux-zigbee-devel, netdev

On Thu, Mar 07, 2013 at 06:17:51PM -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 07 Mar 2013 14:57:05 -0800
> 
> > On Thu, 2013-03-07 at 22:41 +0000, Ben Hutchings wrote:
> >> On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
> >> > The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
> >> > We need first to manipulate eui[0] before we call memcpy afterwards.
> >> 
> >> memcpy() does not work that way.
> >> 
> >> > Broken since commit:
> >> > 5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f
> >> > 
> >> > Since this commit I got many trouble with the ieee802154 stack.
> >> 
> >> Your change is effectively reverting that commit.
> > 
> > Reverting the commit seems the solution ;)
> 
> So Yoshifuji HIDEAKI and Alexander need to work out what is happening
> here.

Ok, I will try that. Maybe somebody with a another 802.15.4 device with
6lowpan on linux-zigbee-devel mailinglist can confirm that?

I have a at86rf231 device.

Alex

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
       [not found]   ` <1362696088.2936.47.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
@ 2013-03-08  9:04     ` Alexander Aring
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-03-08  9:04 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: yoshfuji-VfPWfsRibaP+Ru+s062T9g, netdev-u79uwXL29TY76Z2rM5mHXA,
	jmorris-gx6/JNMH7DfYtjvyW6yDsg,
	linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kuznet-v/Mj1YrvjDBInbfyfbPRSQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Thu, Mar 07, 2013 at 10:41:28PM +0000, Ben Hutchings wrote:
> On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
> > The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
> > We need first to manipulate eui[0] before we call memcpy afterwards.
> 
> memcpy() does not work that way.
> 
oh yeah, sry. It was too late yesterday. Change dest and src address of a common
function, sry. :-)

Alex

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-08  2:21   ` YOSHIFUJI Hideaki
@ 2013-03-08  9:37     ` Alexander Aring
  2013-03-08 17:30       ` YOSHIFUJI Hideaki
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Aring @ 2013-03-08  9:37 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: davem, kuznet, jmorris, linux-zigbee-devel, netdev

Hi,

On Fri, Mar 08, 2013 at 11:21:38AM +0900, YOSHIFUJI Hideaki wrote:
> Hi,
> 
> Alexander Aring wrote:
> > Hi,
> > 
> > I don't know if this is a right solution for that, because other
> > functions like addrconf_ifid_infiniband to manipulate eui after memcpy,
> > too.
> > 
> > But this patch solves my problems with ieee802154 stack.
> 
> What kind of problems do you have?
>

I compile with #define DEBUG enabled in net/ieee802154/6lowpan.c

The problem is the address compression in 6lowpan.

First device has address fe80::a000:0:0:1/64. Second device has address
fe80::a000:0:0:2/64. I use only a ping6 to check connection.

Debug Information on the receiving side:
Without your patch which is working.

iphc0 = 7a, iphc1 = 11
NH flag is set, next header carried inline: 3a
source address stateless compression
(lowpan_uncompress_addr) linklocal address: 
a0 00 00 00 00 00 00 02
uncompressing 2 + 8 => 
fe 80 00 00 00 00 00 00 a0 00 00 00 00 00 00 02
dest: stateless compression
(lowpan_uncompress_addr) linklocal address: 
a0 00 00 00 00 00 00 01
uncompressing 2 + 8 => 
fe 80 00 00 00 00 00 00 a0 00 00 00 00 00 00 01
skb headroom size = 40, data length = 64
IPv6 header dump:
	version = 6
	length  = 64
	nexthdr = 0x3a
	hop_lim = 64


With your patch, which isn't working anymore:

iphc0 = 7b, iphc1 = 3b
NH flag is set, next header carried inline: 3a
source address stateless compression
(lowpan_uncompress_addr) linklocal address: 
02 85 00 3a 20 00 00 00
uncompressing 2 + 0 => 
fe 80 00 00 00 00 00 00 00 85 00 3a 20 00 00 00
dest: non context-based mcast compression
uncompressing 2 + 1 => 
ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
skb headroom size = 25, data length = 24
IPv6 header dump:
	version = 6
	length  = 24
	nexthdr = 0x3a
	hop_lim = 255

And for every ipv6 packet I got:
ICMPv6 checksum failed [fe80:0000:0000:0000:0001:ff00:0001:8700 > ff02:0000:0000:0000:0000:0001:ff00:0001]

I seems that the reconstructed destination address and header length are
not right.

I will try to figure out this problem. Hope this information helps you to
know more about my problems.

Regards
Alex

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-08  9:37     ` Alexander Aring
@ 2013-03-08 17:30       ` YOSHIFUJI Hideaki
  2013-03-09  4:34         ` YOSHIFUJI Hideaki
  0 siblings, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-03-08 17:30 UTC (permalink / raw)
  To: Alexander Aring
  Cc: davem, kuznet, jmorris, linux-zigbee-devel, netdev,
	YOSHIFUJI Hideaki

Alexander Aring wrote:
> Hi,
> 
> On Fri, Mar 08, 2013 at 11:21:38AM +0900, YOSHIFUJI Hideaki wrote:
>> Hi,
>>
>> Alexander Aring wrote:
>>> Hi,
>>>
>>> I don't know if this is a right solution for that, because other
>>> functions like addrconf_ifid_infiniband to manipulate eui after memcpy,
>>> too.
>>>
>>> But this patch solves my problems with ieee802154 stack.
>>
>> What kind of problems do you have?
>>
> 
> I compile with #define DEBUG enabled in net/ieee802154/6lowpan.c
> 
> The problem is the address compression in 6lowpan.
> 
> First device has address fe80::a000:0:0:1/64. Second device has address
> fe80::a000:0:0:2/64. I use only a ping6 to check connection.
> 
> Debug Information on the receiving side:
> Without your patch which is working.
> 
> iphc0 = 7a, iphc1 = 11
> NH flag is set, next header carried inline: 3a
> source address stateless compression
> (lowpan_uncompress_addr) linklocal address: 
> a0 00 00 00 00 00 00 02
> uncompressing 2 + 8 => 
> fe 80 00 00 00 00 00 00 a0 00 00 00 00 00 00 02
> dest: stateless compression
> (lowpan_uncompress_addr) linklocal address: 
> a0 00 00 00 00 00 00 01
> uncompressing 2 + 8 => 
> fe 80 00 00 00 00 00 00 a0 00 00 00 00 00 00 01
> skb headroom size = 40, data length = 64
> IPv6 header dump:
> 	version = 6
> 	length  = 64
> 	nexthdr = 0x3a
> 	hop_lim = 64
> 
> 
> With your patch, which isn't working anymore:
> 
> iphc0 = 7b, iphc1 = 3b
> NH flag is set, next header carried inline: 3a
> source address stateless compression
> (lowpan_uncompress_addr) linklocal address: 
> 02 85 00 3a 20 00 00 00
> uncompressing 2 + 0 => 
> fe 80 00 00 00 00 00 00 00 85 00 3a 20 00 00 00
> dest: non context-based mcast compression
> uncompressing 2 + 1 => 
> ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
> skb headroom size = 25, data length = 24
> IPv6 header dump:
> 	version = 6
> 	length  = 24
> 	nexthdr = 0x3a
> 	hop_lim = 255
> 
> And for every ipv6 packet I got:
> ICMPv6 checksum failed [fe80:0000:0000:0000:0001:ff00:0001:8700 > ff02:0000:0000:0000:0000:0001:ff00:0001]
> 
> I seems that the reconstructed destination address and header length are
> not right.

That's wired.  It is expected to work whatever valid source/destination
addresses are used, right?

--yoshfuji

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-08 17:30       ` YOSHIFUJI Hideaki
@ 2013-03-09  4:34         ` YOSHIFUJI Hideaki
  2013-03-09 20:08           ` Alexander Aring
  0 siblings, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-03-09  4:34 UTC (permalink / raw)
  To: Alexander Aring
  Cc: YOSHIFUJI Hideaki, davem, kuznet, jmorris, linux-zigbee-devel,
	netdev

YOSHIFUJI Hideaki wrote:
> Alexander Aring wrote:
:
>> With your patch, which isn't working anymore:
>>
>> iphc0 = 7b, iphc1 = 3b
>> NH flag is set, next header carried inline: 3a
>> source address stateless compression
>> (lowpan_uncompress_addr) linklocal address: 
>> 02 85 00 3a 20 00 00 00
>> uncompressing 2 + 0 => 
>> fe 80 00 00 00 00 00 00 00 85 00 3a 20 00 00 00
>> dest: non context-based mcast compression
>> uncompressing 2 + 1 => 
>> ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
>> skb headroom size = 25, data length = 24
>> IPv6 header dump:
>> 	version = 6
>> 	length  = 24
>> 	nexthdr = 0x3a
>> 	hop_lim = 255
>>
>> And for every ipv6 packet I got:
>> ICMPv6 checksum failed [fe80:0000:0000:0000:0001:ff00:0001:8700 > ff02:0000:0000:0000:0000:0001:ff00:0001]
>>
>> I seems that the reconstructed destination address and header length are
>> not right.
> 
> That's wired.  It is expected to work whatever valid source/destination
> addesses are used, right?

It seems the last argument for lowpan_uncompress_address() (lladdr,
show as "linklocal address") is incorrect.
Note that it should say link-"layer" address, BTW.

--yoshfuji

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
  2013-03-09  4:34         ` YOSHIFUJI Hideaki
@ 2013-03-09 20:08           ` Alexander Aring
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-03-09 20:08 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: davem, kuznet, jmorris, linux-zigbee-devel, netdev

Hi,

I try to figure out this problem but I think it will take some days.
I will send a fix then.

Thanks for your help.

Alex

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-09 20:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-07 20:13 [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices Alexander Aring
2013-03-07 20:41 ` Alexander Aring
2013-03-08  2:21   ` YOSHIFUJI Hideaki
2013-03-08  9:37     ` Alexander Aring
2013-03-08 17:30       ` YOSHIFUJI Hideaki
2013-03-09  4:34         ` YOSHIFUJI Hideaki
2013-03-09 20:08           ` Alexander Aring
2013-03-07 22:41 ` Ben Hutchings
2013-03-07 22:57   ` Eric Dumazet
2013-03-07 23:17     ` David Miller
2013-03-08  8:53       ` Alexander Aring
     [not found]   ` <1362696088.2936.47.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
2013-03-08  9:04     ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).