*/
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}}};
}
// 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;
void adjustPlen(struct ip6_hdr *ip, unpack_info_t *u_info) {
uint16_t adjust_amt = u_info->payload_offset;
- /*
- switch (u_info->nxt_hdr) {
+
+ switch (ip->nxt_hdr) {
case IANA_UDP:
adjust_amt -= sizeof(struct udp_hdr); break;
}
- */
ip->plen = htons(ntohs(ip->plen) - adjust_amt);
}
dest += sizeof(struct udp_hdr);
u_info->nxt_hdr = IANA_UDP;
- // u_info->payload_offset += sizeof(struct udp_hdr);
+ u_info->payload_offset += sizeof(struct udp_hdr);
u_info->transport_ptr = (uint8_t *)udp;
} else {
}
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 {
cur = 0;
}
p++;
- if (*p == '\0')
+ if (*p == '\0') {
+ dest->s6_addr16[block++] = hton16(cur);
return;
+ }
if (*(p - 1) == ':' && *p == ':') {
break;
}