On Thu, Apr 26, 2012 at 11:46:23PM +0200, Tony Cheneau wrote:
> Hello,
> 
> 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?


Contiki does what you suggest. In
 
http://contiki.git.sourceforge.net/git/gitweb.cgi?p=contiki/contiki;a=blob;f=core/net/sicslowpan.c

 598   /*
 599    * Hop limit
 600    * if 1: compress, encoding is 01
 601    * if 64: compress, encoding is 10
 602    * if 255: compress, encoding is 11
 603    * else do not compress
 604    */
 605   switch(UIP_IP_BUF->ttl) {
 606     case 1:
 607       iphc0 |= SICSLOWPAN_IPHC_TTL_1;
 608       break;
 609     case 64:
 610       iphc0 |= SICSLOWPAN_IPHC_TTL_64;
 611       break;
 612     case 255:
 613       iphc0 |= SICSLOWPAN_IPHC_TTL_255;
 614       break;
 615     default:
 616       *hc06_ptr = UIP_IP_BUF->ttl;
 617       hc06_ptr += 1;
 618       break;
 619   }

-Mar.

------------------------------------------------------------------------------
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