]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - support/sdk/c/blip/lib6lowpan/lib6lowpanIP.c
- fix last nits needed to compile
[tinyos-2.x.git] / support / sdk / c / blip / lib6lowpan / lib6lowpanIP.c
index 54a70e89e5627dc71ce25b4759ab0c08c8483392..2cf73577b8bcb7d42518e1574376d2dadcc33eee 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 uint8_t linklocal_prefix [] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-uint8_t multicast_prefix [] = {0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 struct in6_addr __my_address       = {{{0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65}}};
@@ -134,8 +133,10 @@ static inline int decompressShortAddress(uint8_t dispatch, uint8_t *s_addr, uint
   }
   // otherwise we either have an invalid compression, or else it's a
   // multicast address
-  ip_memcpy(dest, multicast_prefix, 8);
-  ip_memclr(dest + 8, 8);
+  // ip_memcpy(dest, multicast_prefix, 8);
+  ip_memclr(dest, 16);
+  dest[0] = 0xff;
+  dest[1] = 0x02;
   switch (*s_addr & LOWPAN_IPHC_SHORT_LONG_MASK) {
   case LOWPAN_IPHC_HC1_MCAST:
     dest[14] = (*s_addr) & ~LOWPAN_IPHC_SHORT_LONG_MASK;
@@ -483,7 +484,8 @@ uint8_t packHeaders(struct split_ip_msg *msg,
   }
 
   nxt_hdr = hdr->nxt_hdr;
-  if (hdr->nxt_hdr == IANA_UDP /* or other compressed values... */) {
+  if (hdr->nxt_hdr == IANA_UDP && /* or other compressed values... */
+      msg->headers != NULL) {
     // we will add the HCNH encoding at the end of the header
     *encoding |= LOWPAN_IPHC_NH_MASK;
   } else {