Skip to content

Commit

Permalink
[SQUASH ME] ipv6_nc: add debug messages for translate
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 15, 2015
1 parent fd14ad2 commit c790ee9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sys/net/network_layer/ng_ipv6/nc/ng_ipv6_nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ int ng_ipv6_nc_translate_mc(void *l2_addr, size_t l2_addr_len,
{
uint8_t *l2_u8 = l2_addr;

DEBUG("ipv6_nc: translate to multicast address\n");

if (!ng_ipv6_addr_is_multicast(ipv6_addr)) {
DEBUG("ipv6_nc: %s is no multicast address\n",
ng_ipv6_addr_to_str(addr_str, ipv6_addr, sizeof(addr_str)));
return -EADDRNOTAVAIL;
}

Expand All @@ -199,12 +203,17 @@ int ng_ipv6_nc_translate_mc(void *l2_addr, size_t l2_addr_len,
l2_u8[1] = 0xff;

case 1:
DEBUG("ipv6_nc: return generic broadcast address (all 0xff) of length %zu\n",
l2_addr_len);
l2_u8[0] = 0xff;
break;

case 6:
l2_u8[0] = l2_u8[1] = 0x33;
memcpy(l2_u8 + 2, ipv6_addr->u8 + 12, sizeof(uint32_t));
DEBUG("ipv6_nc: return IPv6 multicast MAC-48 address: "
"33:33:%02x:%02x:%02x:%02x\n", l2_u8[2], l2_u8[3], l2_u8[4],
l2_u8[5]);
break;

case 8:
Expand All @@ -213,9 +222,14 @@ int ng_ipv6_nc_translate_mc(void *l2_addr, size_t l2_addr_len,
l2_u8[3] = 0xff;
l2_u8[4] = 0xfe;
memcpy(l2_u8 + 4, ipv6_addr->u8 + 13, sizeof(uint32_t));
DEBUG("ipv6_nc: return IPv6 multicast EUI-64 address: "
"33:33:%02x:ff:fe:%02x:%02x:%02x\n", l2_u8[2], l2_u8[3], l2_u8[4],
l2_u8[5]);
break;

default:
DEBUG("ipv6_nc: no support for link-layer address of length %zu\n",
l2_addr_len);
return -EINVAL;
}

Expand Down

0 comments on commit c790ee9

Please sign in to comment.