Hi,

Here is the patch. I am not too familiar with git, so I do not know if the patch is formatted correctly or not, if not, you can produce your own patch and cc me. The patch was created against the latest version of the net-next (82981930125abfd39d7c8378a9cfdf5e1be2002b at the moment I write these lines).

Hope it helps.

Regards,
Tony


Le 27.04.2012 09:18, Alexander Smirnov a écrit :
Hi Tony,

27 апреля 2012 г. 1:46 пользователь Tony Cheneau
<tony.cheneau+zigbee...@amnesiak.org> написал:
Hello,

I'm reading the 6lowpan.c file and I find the following code very odd.
I believe a bug lies in it. I cannot test at the moment because the
serial driver I plan on using does not work with the 6lowpan stack.

In lowpan_header_create(), there is the following switch (around line
495):
      switch (hdr->hop_limit) {
      case 1:
              iphc0 |= LOWPAN_IPHC_TTL_1;
              break;
      case 64:
              iphc0 |= LOWPAN_IPHC_TTL_64;
              break;
      case 255:
              iphc0 |= LOWPAN_IPHC_TTL_255;
              break;
      default:
              *hc06_ptr = hdr->hop_limit;
              break;
      }

I believe the code in the default block should be:
      default:
              *hc06_ptr = hdr->hop_limit;
              hc06_ptr += 1;
              break;
      }

Can you confirm this is indeed a bug?

yeah, it seems you are right! thanks for the finding..
BTW: are you going to make a patch? Or I can do it (with you in cc)
and sent with my next set.

With best regards,
Alex


Regards,
Tony



------------------------------------------------------------------------------
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
From 40b6fa4495a1775fa1825b37fc19cf51e991cc13 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.chen...@amnesiak.org>
Date: Fri, 27 Apr 2012 10:26:08 -0400
Subject: [PATCH] 6lowpan: fixes a bug in lowpan_header_create(). If the hop
 limit value was not 1, 64 or 255, the value would not have
 been set correctly.

---
 net/ieee802154/6lowpan.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 4b5701c..9f6d6d7 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -490,6 +490,7 @@ static int lowpan_header_create(struct sk_buff *skb,
                break;
        default:
                *hc06_ptr = hdr->hop_limit;
+               hc06_ptr += 1;
                break;
        }
 
-- 
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