[Tinyos-2-commits] [tinyos-main] r5743 committed - - accept patch in Issue 61 to mask U/L bit when compressed addresses ...

tinyos-main at googlecode.com tinyos-main at googlecode.com
Thu Sep 15 19:11:53 PDT 2011


Revision: 5743
Author:   sdhags
Date:     Thu Sep 15 19:10:50 2011
Log:       - accept patch in Issue 61 to mask U/L bit when compressed  
addresses are in use
  - fix test case/add test case to check for this condition

http://code.google.com/p/tinyos-main/source/detail?r=5743

Modified:
  /trunk/support/sdk/c/blip/lib6lowpan/lib6lowpan.c
  /trunk/support/sdk/c/blip/lib6lowpan/tests/test_pack_address.c
  /trunk/support/sdk/c/blip/lib6lowpan/tests/test_unpack_address.c

=======================================
--- /trunk/support/sdk/c/blip/lib6lowpan/lib6lowpan.c	Mon Jun 13 11:10:36  
2011
+++ /trunk/support/sdk/c/blip/lib6lowpan/lib6lowpan.c	Thu Sep 15 19:10:50  
2011
@@ -180,7 +180,7 @@
        memcpy(buf, &addr->s6_addr[14], 2);
        return buf += 2;
      } else if (/* maybe it's a 16-bit address with the IID derived from  
the PANID + address */
-               (addr->s6_addr16[4] == htons(letohs(pan)) &&
+               (addr->s6_addr16[4] == htons(letohs(pan) & ~0x0200) &&
                  addr->s6_addr16[5] == htons(0x00ff) &&
                  addr->s6_addr16[6] == htons(0xfe00) &&
                  (((l2addr->ieee_mode == IEEE154_ADDR_SHORT) &&
@@ -549,7 +549,8 @@
            addr->s6_addr[i+8] = frame->i_laddr.data[7-i];
          addr->s6_addr[8] ^= 0x2;
        } else {
-        addr->s6_addr16[4] = leton16(pan);
+        printf("HERE\n");
+        addr->s6_addr16[4] = htons(letohs(pan) & ~0x0200);
          addr->s6_addr[11] = 0xff;
          addr->s6_addr[12] = 0xfe;
          addr->s6_addr16[7] = leton16(frame->i_saddr);
=======================================
--- /trunk/support/sdk/c/blip/lib6lowpan/tests/test_pack_address.c	Mon Jun   
6 12:47:23 2011
+++ /trunk/support/sdk/c/blip/lib6lowpan/tests/test_pack_address.c	Thu Sep  
15 19:10:50 2011
@@ -34,6 +34,9 @@
    // RFC4944 address, matching 16-bit id
    {"fe80::1:00ff:fe00:1", 0, "1", 1, 0, {0, 0}, LOWPAN_IPHC_AM_0},

+  // RFC4944 address, matching 16-bit id
+  {"fe80::fdff:00ff:fe00:1", 0, "1", 0xffff, 0, {0, 0}, LOWPAN_IPHC_AM_0},
+
    // RFC4944 address, different 16-bit ID
    {"fe80::1:00ff:fe00:2", 0, "1", 8, 8, {0, 1, 0, 0xff, 0xfe, 0x0, 0, 02},  
LOWPAN_IPHC_AM_64},

=======================================
--- /trunk/support/sdk/c/blip/lib6lowpan/tests/test_unpack_address.c	Mon  
Jun  6 12:47:23 2011
+++ /trunk/support/sdk/c/blip/lib6lowpan/tests/test_unpack_address.c	Thu  
Sep 15 19:10:50 2011
@@ -56,7 +56,9 @@
    // RFC4944-style addresses
    {"fe80::1:00ff:fe00:25", LOWPAN_IPHC_AM_0, 0, 0, {}, "25", 1},

-  {"fe80::ffff:00ff:fe00:abcd", LOWPAN_IPHC_AM_0, 0, 0, {}, "abcd",  
0xffff},
+  {"fe80::fdff:00ff:fe00:25", LOWPAN_IPHC_AM_0, 0, 0, {}, "25", 0xffff},
+
+  {"fe80::fdff:00ff:fe00:abcd", LOWPAN_IPHC_AM_0, 0, 0, {}, "abcd",  
0xffff},

    // tests using context
    {"2002::12", LOWPAN_IPHC_AC_CONTEXT |  LOWPAN_IPHC_AM_16, 0, 2, {0,  
0x12}, "1", 1},


More information about the Tinyos-2-commits mailing list