[Linux-zigbee-devel] [PATCH 01/12] 6lowpan: fix small comment issue

2013-07-18 Thread Alexander Aring
Fix a little comment issue.
Number 2 is 10 in bits and 1 is 01.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 55e1fd5..1ec14ef 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -862,7 +862,7 @@ lowpan_process_data(struct sk_buff *skb)
 * Traffic class carried in-line
 * ECN + DSCP (1 byte), Flow Label is elided
 */
-   case 1: /* 10b */
+   case 1: /* 01b */
if (lowpan_fetch_skb_u8(skb, &tmp))
goto drop;
 
@@ -875,7 +875,7 @@ lowpan_process_data(struct sk_buff *skb)
 * Flow Label carried in-line
 * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided
 */
-   case 2: /* 01b */
+   case 2: /* 10b */
if (lowpan_fetch_skb_u8(skb, &tmp))
goto drop;
 
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 05/12] 6lowpan: Fix fragmentation with link-local compressed addresses

2013-07-18 Thread Alexander Aring
From: David Hauweele 

When a new 6lowpan fragment is received, a skbuff is allocated for
the reassembled packet. However when a 6lowpan packet compresses
link-local addresses based on link-layer addresses, the processing
function relies on the skb mac control block to find the related
link-layer address.

This patch copies the control block from the first fragment into
the newly allocated skb to keep a trace of the link-layer addresses
in case of a link-local compressed address.

Signed-off-by: David Hauweele 
Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index f3406dac..d503c61 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -698,6 +698,13 @@ lowpan_alloc_new_frame(struct sk_buff *skb, u16 len, u16 
tag)
skb_reserve(frame->skb, sizeof(struct ipv6hdr));
skb_put(frame->skb, frame->length);
 
+   /*
+* copy the first control block to keep a
+* trace of the link-layer addresses in case
+* of a link-local compressed address
+*/
+   memcpy(frame->skb->cb, skb->cb, sizeof(skb->cb));
+
init_timer(&frame->timer);
/* time out is the same as for ipv6 - 60 sec */
frame->timer.expires = jiffies + LOWPAN_FRAG_TIMEOUT;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCHv5 00/12] minor fixes

2013-07-18 Thread Alexander Aring
Version 5 of my patch series for the 6lowpan patch. It doesn't fix all known 
bugs yet.
But it should fix the bug for uncompression of link_layer addresses and some 
other addresses.

If this patch series looks OK, I will send it to the netdev mailinglist.



I got some issues with checkpatch in patch "6lowpan: handle context based 
source address", but
this looks like a bug in checkpatch. Some comment issue.

v5:
 - fix handle of uncompress_context_based_addr if SAC Bit is set. We handle 
currently the
   case if SAC = 1 and SAM = 00, otherwise we print a warning and drop the 
package.

v4:
 - Got a "Mail delivery failed" - I resend this patch series

v3:
 - add David Hauweele patch to fix fragmentation with link-local compressed
   addresses
 - add warnings for CID and DAC bit
 - handle SAC bit to :: address
 - rename layer_addr to lladdr in function lowpan_uncompress_addr

v2:
 - add patch to add uncompress multicast addresses
 - add patch for new uncompress address function

Alexander Aring (11):
  6lowpan: fix small comment issue
  6lowpan: fix return value with comment operator
  6lowpan: init 6lowpan header and ipv6hdr to zero
  6lowpan: remove setting some memory regions to zero
  6lowpan: use _saddr and _daddr instead of skb data
  6lowpan: add function to uncompress multicast addr
  6lowpan: lowpan_uncompress_addr with address_mode
  6lowpan: add warning for CID bit
  6lowpan: add warning for DAC bit
  6lowpan: add comment for unspec address
  6lowpan: handle context based source address

David Hauweele (1):
  6lowpan: Fix fragmentation with link-local compressed addresses

 net/ieee802154/6lowpan.c | 308 +--
 net/ieee802154/6lowpan.h |   8 +-
 2 files changed, 199 insertions(+), 117 deletions(-)

-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 09/12] 6lowpan: add warning for CID bit

2013-07-18 Thread Alexander Aring
We don't handle the CID bit currently, so I add a warning and drop the
package.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 51fb55c..7062dad 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -772,7 +772,7 @@ static int
 lowpan_process_data(struct sk_buff *skb)
 {
struct ipv6hdr hdr = {};
-   u8 tmp, iphc0, iphc1, num_context = 0;
+   u8 tmp, iphc0, iphc1;
u8 *_saddr, *_daddr;
int err;
 
@@ -884,9 +884,9 @@ lowpan_process_data(struct sk_buff *skb)
 
/* another if the CID flag is set */
if (iphc1 & LOWPAN_IPHC_CID) {
-   pr_debug("CID flag is set, increase header with one\n");
-   if (lowpan_fetch_skb_u8(skb, &num_context))
-   goto drop;
+   /* TODO: implement this */
+   netdev_warn(skb->dev, "CID bit is set. Context-based not 
implemented. Drop packet.\n");
+   goto drop;
}
 
hdr.version = 6;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 11/12] 6lowpan: add comment for unspec address

2013-07-18 Thread Alexander Aring
Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 80f6f7b..edd4cfa 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -543,9 +543,10 @@ static int lowpan_header_create(struct sk_buff *skb,
 
/* source address compression */
if (is_addr_unspecified(&hdr->saddr)) {
+   /* Case SAM = 0 and SAC = 1 */
pr_debug("source address is unspecified, setting SAC\n");
iphc1 |= LOWPAN_IPHC_SAC;
-   /* TODO: context lookup */
+   /* TODO: context lookup */
} else if (is_addr_link_local(&hdr->saddr)) {
pr_debug("source address is link-local\n");
iphc1 |= lowpan_compress_addr_64(&hc06_ptr,
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 03/12] 6lowpan: init 6lowpan header and ipv6hdr to zero

2013-07-18 Thread Alexander Aring
When we set it to zero, we can assume that the memory is already zero
while parsing.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 8e0fbb8..fd0a5bc 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -387,7 +387,7 @@ static int lowpan_header_create(struct sk_buff *skb,
struct ipv6hdr *hdr;
const u8 *saddr = _saddr;
const u8 *daddr = _daddr;
-   u8 head[100];
+   u8 head[100] = {};
struct ieee802154_addr sa, da;
 
/* TODO:
@@ -723,7 +723,7 @@ frame_err:
 static int
 lowpan_process_data(struct sk_buff *skb)
 {
-   struct ipv6hdr hdr;
+   struct ipv6hdr hdr = {};
u8 tmp, iphc0, iphc1, num_context = 0;
u8 *_saddr, *_daddr;
int err;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 06/12] 6lowpan: use _saddr and _daddr instead of skb data

2013-07-18 Thread Alexander Aring
Pointers _saddr and _daddr points to source and destination address.
Use this for a link-layer compression to get these addresses.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index d503c61..fad517a 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -916,7 +916,7 @@ lowpan_process_data(struct sk_buff *skb)
/* Source address uncompression */
pr_debug("source address stateless compression\n");
err = lowpan_uncompress_addr(skb, &hdr.saddr, lowpan_llprefix,
-   lowpan_unc_llconf[tmp], skb->data);
+   lowpan_unc_llconf[tmp], _saddr);
if (err)
goto drop;
 
@@ -945,7 +945,7 @@ lowpan_process_data(struct sk_buff *skb)
} else {
pr_debug("dest: stateless compression\n");
err = lowpan_uncompress_addr(skb, &hdr.daddr, lowpan_llprefix,
-   lowpan_unc_llconf[tmp], skb->data);
+   lowpan_unc_llconf[tmp], _daddr);
if (err)
goto drop;
}
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 02/12] 6lowpan: fix return value with comment operator

2013-07-18 Thread Alexander Aring
Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 1ec14ef..8e0fbb8 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -819,7 +819,8 @@ lowpan_process_data(struct sk_buff *skb)
}
spin_unlock_bh(&flist_lock);
 
-   return kfree_skb(skb), 0;
+   kfree_skb(skb);
+   return 0;
}
default:
break;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 08/12] 6lowpan: lowpan_uncompress_addr with address_mode

2013-07-18 Thread Alexander Aring
This patch drop the pre and postcount calculation from the
lowpan_uncompress_addr function.

We use instead a switch case over address_mode value, it's easier
to understand what's going on there.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 123 ++-
 net/ieee802154/6lowpan.h |   8 +--
 2 files changed, 62 insertions(+), 69 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index f46c2fb..51fb55c 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -67,30 +67,6 @@ static const u8 lowpan_ttl_values[] = {0, 1, 64, 255};
 
 static LIST_HEAD(lowpan_devices);
 
-/*
- * Uncompression of linklocal:
- *   0 -> 16 bytes from packet
- *   1 -> 2  bytes from prefix - bunch of zeroes and 8 from packet
- *   2 -> 2  bytes from prefix - zeroes + 2 from packet
- *   3 -> 2  bytes from prefix - infer 8 bytes from lladdr
- *
- *  NOTE: => the uncompress function does change 0xf to 0x10
- *  NOTE: 0x00 => no-autoconfig => unspecified
- */
-static const u8 lowpan_unc_llconf[] = {0x0f, 0x28, 0x22, 0x20};
-
-/*
- * Uncompression of ctx-based:
- *   0 -> 0 bits  from packet [unspecified / reserved]
- *   1 -> 8 bytes from prefix - bunch of zeroes and 8 from packet
- *   2 -> 8 bytes from prefix - zeroes + 2 from packet
- *   3 -> 8 bytes from prefix - infer 8 bytes from lladdr
- */
-static const u8 lowpan_unc_ctxconf[] = {0x00, 0x88, 0x82, 0x80};
-
-/* Link local prefix */
-static const u8 lowpan_llprefix[] = {0xfe, 0x80};
-
 /* private device info */
 struct lowpan_dev_info {
struct net_device   *real_dev; /* real WPAN device ptr */
@@ -182,50 +158,67 @@ lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift, const 
struct in6_addr *ipaddr,
return rol8(val, shift);
 }
 
-static void
-lowpan_uip_ds6_set_addr_iid(struct in6_addr *ipaddr, unsigned char *lladdr)
-{
-   memcpy(&ipaddr->s6_addr[8], lladdr, IEEE802154_ADDR_LEN);
-   /* second bit-flip (Universe/Local) is done according RFC2464 */
-   ipaddr->s6_addr[8] ^= 0x02;
-}
-
 /*
- * Uncompress addresses based on a prefix and a postfix with zeroes in
- * between. If the postfix is zero in length it will use the link address
- * to configure the IP address (autoconf style).
- * pref_post_count takes a byte where the first nibble specify prefix count
- * and the second postfix count (NOTE: 15/0xf => 16 bytes copy).
+ * Uncompress address function for source and
+ * destination address(non-multicast).
+ *
+ * address_mode is sam value or dam value.
  */
 static int
-lowpan_uncompress_addr(struct sk_buff *skb, struct in6_addr *ipaddr,
-   u8 const *prefix, u8 pref_post_count, unsigned char *lladdr)
+lowpan_uncompress_addr(struct sk_buff *skb,
+   struct in6_addr *ipaddr,
+   const u8 address_mode,
+   const u8 *lladdr)
 {
-   u8 prefcount = pref_post_count >> 4;
-   u8 postcount = pref_post_count & 0x0f;
-
-   /* full nibble 15 => 16 */
-   prefcount = (prefcount == 15 ? 16 : prefcount);
-   postcount = (postcount == 15 ? 16 : postcount);
-
-   if (lladdr)
-   lowpan_raw_dump_inline(__func__, "linklocal address",
-   lladdr, IEEE802154_ADDR_LEN);
-   if (prefcount > 0)
-   memcpy(ipaddr, prefix, prefcount);
-
-   if (postcount > 0) {
-   memcpy(&ipaddr->s6_addr[16 - postcount], skb->data, postcount);
-   skb_pull(skb, postcount);
-   } else if (prefcount > 0) {
-   if (lladdr == NULL)
-   return -EINVAL;
-
-   /* no IID based configuration if no prefix and no data */
-   lowpan_uip_ds6_set_addr_iid(ipaddr, lladdr);
+   switch (address_mode) {
+   case LOWPAN_IPHC_ADDR_00:
+   /*
+* for global link addresses
+*/
+   memcpy(ipaddr->s6_addr, skb->data, 16);
+   skb_pull(skb, 16);
+   break;
+   case LOWPAN_IPHC_ADDR_01:
+   /*
+* fe:80:::::
+*/
+   memset(&ipaddr->s6_addr[0], 0xFE, 1);
+   memset(&ipaddr->s6_addr[1], 0x80, 1);
+   memcpy(&ipaddr->s6_addr[8], skb->data, 8);
+   skb_pull(skb, 8);
+   break;
+   case LOWPAN_IPHC_ADDR_02:
+   /*
+* fe:80::ff:fe00:
+*/
+   memset(&ipaddr->s6_addr[0], 0xFE, 1);
+   memset(&ipaddr->s6_addr[1], 0x80, 1);
+   memset(&ipaddr->s6_addr[11], 0xFF, 1);
+   memset(&ipaddr->s6_addr[12], 0xFE, 1);
+   memcpy(&ipaddr->s6_addr[14], skb->data, 2);
+   skb_pull(skb, 2);
+   break;
+   case LOWPAN_IPHC_ADDR_03:
+   /*
+* fe:80:::::
+*\_/
+* lladdr
+

[Linux-zigbee-devel] [PATCH 12/12] 6lowpan: handle context based source address

2013-07-18 Thread Alexander Aring
Handle context based address when a unspecific address is specified.
For other context based address we print a warning and drop the package
currently because we don't support it right now.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 54 +++-
 1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index edd4cfa..bea1ed3 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -225,6 +225,41 @@ lowpan_uncompress_addr(struct sk_buff *skb,
 }
 
 /*
+ * Uncompress address function for source context
+ * based address(non-multicast).
+ */
+static int
+lowpan_uncompress_context_based_src_addr(struct sk_buff *skb,
+   struct in6_addr *ipaddr,
+   const u8 sam)
+{
+   switch (sam) {
+   case LOWPAN_IPHC_ADDR_00:
+   /*
+* unspec address ::
+* Do nothing, address is already ::
+*/
+   break;
+   case LOWPAN_IPHC_ADDR_01:
+   /* TODO */
+   case LOWPAN_IPHC_ADDR_02:
+   /* TODO */
+   case LOWPAN_IPHC_ADDR_03:
+   /* TODO */
+   netdev_warn(skb->dev, "SAM value 0x%x not supported\n", sam);
+   return -EINVAL;
+   default:
+   pr_debug("Invalid sam value: 0x%x\n", sam);
+   return -EINVAL;
+   }
+
+   pr_debug("Reconstructed context based ipv6 addr is:\n");
+   lowpan_raw_dump_inline(NULL, NULL, ipaddr->s6_addr, 16);
+
+   return 0;
+}
+
+/*
  * Uncompress function for multicast destination address,
  * when M bit is set.
  */
@@ -959,11 +994,20 @@ lowpan_process_data(struct sk_buff *skb)
/* Extract SAM to the tmp variable */
tmp = ((iphc1 & LOWPAN_IPHC_SAM) >> LOWPAN_IPHC_SAM_BIT) & 0x03;
 
-   /* Source address uncompression */
-   pr_debug("source address stateless compression\n");
-   err = lowpan_uncompress_addr(skb, &hdr.saddr, tmp, _saddr);
-   if (err)
-   goto drop;
+   if (iphc1 & LOWPAN_IPHC_SAC) {
+   /* Source address context based uncompression */
+   pr_debug("SAC bit is set. Handle context based source 
address.\n");
+   err = lowpan_uncompress_context_based_src_addr(
+   skb, &hdr.saddr, tmp);
+   if (err)
+   goto drop;
+   } else {
+   /* Source address uncompression */
+   pr_debug("source address stateless compression\n");
+   err = lowpan_uncompress_addr(skb, &hdr.saddr, tmp, _saddr);
+   if (err)
+   goto drop;
+   }
 
/* Extract DAM to the tmp variable */
tmp = ((iphc1 & LOWPAN_IPHC_DAM_11) >> LOWPAN_IPHC_DAM_BIT) & 0x03;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 10/12] 6lowpan: add warning for DAC bit

2013-07-18 Thread Alexander Aring
We don't handle the DAC bit currently, so I add a warning and drop the
package.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 7062dad..80f6f7b 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -967,22 +967,24 @@ lowpan_process_data(struct sk_buff *skb)
/* Extract DAM to the tmp variable */
tmp = ((iphc1 & LOWPAN_IPHC_DAM_11) >> LOWPAN_IPHC_DAM_BIT) & 0x03;
 
-   /* check for Multicast Compression */
-   if (iphc1 & LOWPAN_IPHC_M) {
-   if (iphc1 & LOWPAN_IPHC_DAC) {
-   pr_debug("dest: context-based mcast compression\n");
-   /* TODO: implement this */
-   } else {
+   if (iphc1 & LOWPAN_IPHC_DAC) {
+   /* TODO: implement this */
+   netdev_warn(skb->dev, "DAC bit is set. Context-based not 
implemented. Drop packet.\n");
+   goto drop;
+   } else {
+   /* check for Multicast Compression */
+   if (iphc1 & LOWPAN_IPHC_M) {
err = lowpan_uncompress_multicast_daddr(
skb, &hdr.daddr, tmp);
if (err)
goto drop;
+   } else {
+   pr_debug("dest: stateless compression\n");
+   err = lowpan_uncompress_addr(
+   skb, &hdr.daddr, tmp, _daddr);
+   if (err)
+   goto drop;
}
-   } else {
-   pr_debug("dest: stateless compression\n");
-   err = lowpan_uncompress_addr(skb, &hdr.daddr, tmp, _daddr);
-   if (err)
-   goto drop;
}
 
/* UDP data uncompression */
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 07/12] 6lowpan: add function to uncompress multicast addr

2013-07-18 Thread Alexander Aring
Add function to uncompress multicast address.
This function split the uncompress function for a multicast address
in a seperate function.

To uncompress a multicast address is different than a other
non-multicasts addresses according to rfc6282.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 82 +---
 1 file changed, 63 insertions(+), 19 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index fad517a..f46c2fb 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -88,15 +88,6 @@ static const u8 lowpan_unc_llconf[] = {0x0f, 0x28, 0x22, 
0x20};
  */
 static const u8 lowpan_unc_ctxconf[] = {0x00, 0x88, 0x82, 0x80};
 
-/*
- * Uncompression of ctx-base
- *   0 -> 0 bits from packet
- *   1 -> 2 bytes from prefix - bunch of zeroes 5 from packet
- *   2 -> 2 bytes from prefix - zeroes + 3 from packet
- *   3 -> 2 bytes from prefix - infer 1 bytes from lladdr
- */
-static const u8 lowpan_unc_mxconf[] = {0x0f, 0x25, 0x23, 0x21};
-
 /* Link local prefix */
 static const u8 lowpan_llprefix[] = {0xfe, 0x80};
 
@@ -240,6 +231,67 @@ lowpan_uncompress_addr(struct sk_buff *skb, struct 
in6_addr *ipaddr,
return 0;
 }
 
+/*
+ * Uncompress function for multicast destination address,
+ * when M bit is set.
+ */
+static int
+lowpan_uncompress_multicast_daddr(struct sk_buff *skb,
+   struct in6_addr *ipaddr,
+   const u8 dam)
+{
+   switch (dam) {
+   case LOWPAN_IPHC_DAM_00:
+   /*
+* 00:  128 bits.  The full address
+* is carried in-line.
+*/
+   memcpy(ipaddr->s6_addr, skb->data, 16);
+   skb_pull(skb, 16);
+   break;
+   case LOWPAN_IPHC_DAM_01:
+   /*
+* 01:  48 bits.  The address takes
+* the form ffXX::00XX::.
+*/
+   memset(&ipaddr->s6_addr[0], 0xFF, 1);
+   memcpy(&ipaddr->s6_addr[1], skb->data, 1);
+   skb_pull(skb, 1);
+   memcpy(&ipaddr->s6_addr[11], skb->data, 5);
+   skb_pull(skb, 5);
+   break;
+   case LOWPAN_IPHC_DAM_10:
+   /*
+* 10:  32 bits.  The address takes
+* the form ffXX::00XX:.
+*/
+   memset(&ipaddr->s6_addr[0], 0xFF, 1);
+   memcpy(&ipaddr->s6_addr[1], skb->data, 1);
+   skb_pull(skb, 1);
+   memcpy(&ipaddr->s6_addr[13], skb->data, 3);
+   skb_pull(skb, 3);
+   break;
+   case LOWPAN_IPHC_DAM_11:
+   /*
+* 11:  8 bits.  The address takes
+* the form ff02::00XX.
+*/
+   memset(&ipaddr->s6_addr[0], 0xFF, 1);
+   memset(&ipaddr->s6_addr[1], 0x02, 1);
+   memcpy(&ipaddr->s6_addr[15], skb->data, 1);
+   skb_pull(skb, 1);
+   break;
+   default:
+   pr_debug("DAM value has a wrong value: 0x%x\n", dam);
+   return -EINVAL;
+   }
+
+   pr_debug("Reconstructed ipv6 multicast addr is:\n");
+   lowpan_raw_dump_inline(NULL, NULL, ipaddr->s6_addr, 16);
+
+   return 0;
+}
+
 static void
 lowpan_compress_udp_header(u8 **hc06_ptr, struct sk_buff *skb)
 {
@@ -929,16 +981,8 @@ lowpan_process_data(struct sk_buff *skb)
pr_debug("dest: context-based mcast compression\n");
/* TODO: implement this */
} else {
-   u8 prefix[] = {0xff, 0x02};
-
-   pr_debug("dest: non context-based mcast compression\n");
-   if (0 < tmp && tmp < 3) {
-   if (lowpan_fetch_skb_u8(skb, &prefix[1]))
-   goto drop;
-   }
-
-   err = lowpan_uncompress_addr(skb, &hdr.daddr, prefix,
-   lowpan_unc_mxconf[tmp], NULL);
+   err = lowpan_uncompress_multicast_daddr(
+   skb, &hdr.daddr, tmp);
if (err)
goto drop;
}
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH 04/12] 6lowpan: remove setting some memory regions to zero

2013-07-18 Thread Alexander Aring
While we can assume that the memory is already be zero, we can drop some
memsets while parsing.

Signed-off-by: Alexander Aring 
---
 net/ieee802154/6lowpan.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index fd0a5bc..f3406dac 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -223,10 +223,6 @@ lowpan_uncompress_addr(struct sk_buff *skb, struct 
in6_addr *ipaddr,
if (prefcount > 0)
memcpy(ipaddr, prefix, prefcount);
 
-   if (prefcount + postcount < 16)
-   memset(&ipaddr->s6_addr[prefcount], 0,
-   16 - (prefcount + postcount));
-
if (postcount > 0) {
memcpy(&ipaddr->s6_addr[16 - postcount], skb->data, postcount);
skb_pull(skb, postcount);
@@ -869,8 +865,6 @@ lowpan_process_data(struct sk_buff *skb)
 
hdr.priority = ((tmp >> 2) & 0x0f);
hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30);
-   hdr.flow_lbl[1] = 0;
-   hdr.flow_lbl[2] = 0;
break;
/*
 * Flow Label carried in-line
@@ -886,10 +880,6 @@ lowpan_process_data(struct sk_buff *skb)
break;
/* Traffic Class and Flow Label are elided */
case 3: /* 11b */
-   hdr.priority = 0;
-   hdr.flow_lbl[0] = 0;
-   hdr.flow_lbl[1] = 0;
-   hdr.flow_lbl[2] = 0;
break;
default:
break;
-- 
1.8.3.3


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] known problems of the 6lowpan stack

2013-07-18 Thread Alexander Aring
Hi all,

I decide to send this mail to summary all problems/bugs of the current
6lowpan implementation. This mail is not to send "Missing support of
..." or something else. Only bugs of current supported things.

I have these problems in my mind:

- Payload length on fragmented packets

- Some Traffic Class problems (not important, is normaly zero which
  works correct)


If anybody knows other problems, we can collect it in this mail.

Alex

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] Which 6lowpan SOCs can the Linux stack interoperate with?

2013-07-18 Thread jonsm...@gmail.com
I'm interested in knowing what SOC 802.15.4 devices  you are using
this stack with. Also, which 6lowpan implementation on the SOC.

Has Contiki to linux-zigbee been sorted out yet?

--
Jon Smirl
jonsm...@gmail.com

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] Which 6lowpan SOCs can the Linux stack interoperate with?

2013-07-18 Thread Alexander Aring
Hi,

On Thu, Jul 18, 2013 at 01:59:56PM -0400, jonsm...@gmail.com wrote:
> I'm interested in knowing what SOC 802.15.4 devices  you are using
> this stack with. Also, which 6lowpan implementation on the SOC.
> 
what do you mean with SOC, System on Chip? Currently there are some spi
device and virtual devices.

http://sourceforge.net/apps/trac/linux-zigbee/wiki/HardwareSupport

The mainline drivers for these devices are located in:
drivers/net/ieee802154

For a good virtual device, Tony Cheneau write something:
https://github.com/tcheneau/linux802154-serialdev
which is for testing the serial protocol:
http://sourceforge.net/apps/trac/linux-zigbee/wiki/SerialV1

> Has Contiki to linux-zigbee been sorted out yet?
> 

With my experience it doesn't work yet. I need some time to get this
working...

There are also a wrong payload length for fragmented packets, I will try
to fix it...
This is a really big problem, because Contiki will calculate a wrong
checksum and drop the packet.

Alex

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] Which 6lowpan SOCs can the Linux stack interoperate with?

2013-07-18 Thread jonsm...@gmail.com
On Thu, Jul 18, 2013 at 2:17 PM, Alexander Aring  wrote:
> Hi,
>
> On Thu, Jul 18, 2013 at 01:59:56PM -0400, jonsm...@gmail.com wrote:
>> I'm interested in knowing what SOC 802.15.4 devices  you are using
>> this stack with. Also, which 6lowpan implementation on the SOC.
>>
> what do you mean with SOC, System on Chip? Currently there are some spi
> device and virtual devices.

I mean which external 802.15.4 devices are you using your Linux box to talk to?

For example can the Linux stack talk the the Jennic 6lowpan
implementation on the JN51xx series?


>
> http://sourceforge.net/apps/trac/linux-zigbee/wiki/HardwareSupport
>
> The mainline drivers for these devices are located in:
> drivers/net/ieee802154
>
> For a good virtual device, Tony Cheneau write something:
> https://github.com/tcheneau/linux802154-serialdev
> which is for testing the serial protocol:
> http://sourceforge.net/apps/trac/linux-zigbee/wiki/SerialV1
>
>> Has Contiki to linux-zigbee been sorted out yet?
>>
>
> With my experience it doesn't work yet. I need some time to get this
> working...
>
> There are also a wrong payload length for fragmented packets, I will try
> to fix it...
> This is a really big problem, because Contiki will calculate a wrong
> checksum and drop the packet.
>
> Alex



--
Jon Smirl
jonsm...@gmail.com

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] Which 6lowpan SOCs can the Linux stack interoperate with?

2013-07-18 Thread Tony Cheneau
Hi Jon,

I think Alexander highlighted the various issues in his previous mail
named "known problems of the 6lowpan stack". Currently, I don't think a
vanilla Linux kernel would be able to talk with anything else than an
other vanilla Linux kernel. There is some patches floating around, that
fix some issues in the way the address compression is currently
handled. With these patches, pinging Contiki-enabled device became
possible. However, as Alexander pointed out, the fragmentation code
would need some work, so interop with other stacks is not there yet
(but it's close!).

Regards,
Tony


Le Thu, 18 Jul 2013 14:16:31 -0400,
"jonsm...@gmail.com"  a écrit :

> On Thu, Jul 18, 2013 at 2:17 PM, Alexander Aring
>  wrote:
> > Hi,
> >
> > On Thu, Jul 18, 2013 at 01:59:56PM -0400, jonsm...@gmail.com wrote:
> >> I'm interested in knowing what SOC 802.15.4 devices  you are using
> >> this stack with. Also, which 6lowpan implementation on the SOC.
> >>
> > what do you mean with SOC, System on Chip? Currently there are some
> > spi device and virtual devices.
> 
> I mean which external 802.15.4 devices are you using your Linux box
> to talk to?
> 
> For example can the Linux stack talk the the Jennic 6lowpan
> implementation on the JN51xx series?
> 
> 
> >
> > http://sourceforge.net/apps/trac/linux-zigbee/wiki/HardwareSupport
> >
> > The mainline drivers for these devices are located in:
> > drivers/net/ieee802154
> >
> > For a good virtual device, Tony Cheneau write something:
> > https://github.com/tcheneau/linux802154-serialdev
> > which is for testing the serial protocol:
> > http://sourceforge.net/apps/trac/linux-zigbee/wiki/SerialV1
> >
> >> Has Contiki to linux-zigbee been sorted out yet?
> >>
> >
> > With my experience it doesn't work yet. I need some time to get this
> > working...
> >
> > There are also a wrong payload length for fragmented packets, I
> > will try to fix it...
> > This is a really big problem, because Contiki will calculate a wrong
> > checksum and drop the packet.
> >
> > Alex
> 
> 
> 
> --
> Jon Smirl
> jonsm...@gmail.com
> 
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Linux-zigbee-devel mailing list
> Linux-zigbee-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel