Hello,

Last week, I was analyzing some 6lowpan packet with Wireshark and got notified by the tool that the checksum (TCP, UDP or ICMPv6) was wrong. Some investigations showed me that this issue has been discussed and solved in Contiki, as pointed out in the following thread:
http://comments.gmane.org/gmane.os.contiki.devel/7053

In my case, the issue was triggered by the format of the address I assigned to my nodes. They were assigned with addresses fe80::1 and fe80::2 and the 6lowpan code wrongly interpreted them as being 16-bit short address mapped an EUI-64 address (although the ff:fe part was missing).

It turns out that the lowpan_is_iid_16_bit_compressable macro in net/ieee802154/6lowpan.h is not correct and does not behave according to RFC6282. I attached a patch that intend to correct this behavior.

Regards,
Tony
From 84a884346b175d2c2890249d122e2f34735d433a Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.chen...@amnesiak.org>
Date: Thu, 17 May 2012 17:13:06 -0400
Subject: [PATCH 1/1] lowpan_is_iid_16_bit_compressable() would not detect
 compressable address correctly (at least, not in a
 RFC6282 compliant way). This issue has been witnessed
 and solved in the past in Contiki. This patch is
 basicaly a port of their fix.

---
 net/ieee802154/6lowpan.h |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
index 8c2251f..9aa3c41 100644
--- a/net/ieee802154/6lowpan.h
+++ b/net/ieee802154/6lowpan.h
@@ -87,14 +87,16 @@
 #define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE)
 
 /*
- * check whether we can compress the IID to 16 bits,
- * it's possible for unicast adresses with first 49 bits are zero only.
- */
+* check whether we can compress the IID to 16 bits,
+* it's possible for unicast adresses with first 49 bits are zero only.
+*/
 #define lowpan_is_iid_16_bit_compressable(a)   \
-       ((((a)->s6_addr16[4]) == 0) &&          \
-        (((a)->s6_addr16[5]) == 0) &&          \
-        (((a)->s6_addr16[6]) == 0) &&          \
-        ((((a)->s6_addr[14]) & 0x80) == 0))
+((((a)->s6_addr16[4]) == 0) &&                       \
+ (((a)->s6_addr[10]) == 0)&&               \
+ (((a)->s6_addr[11]) == 0xff)&&                \
+ (((a)->s6_addr[12]) == 0xfe)&&                \
+ (((a)->s6_addr[13]) == 0))
+
 
 /* multicast address */
 #define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
-- 
1.7.6.5

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to