Skip to content

Commit

Permalink
net_if: proper u/l-bit inversion for short addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
cgundogan authored and OlegHahm committed Mar 31, 2015
1 parent 7e01f27 commit c85d960
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
15 changes: 1 addition & 14 deletions sys/net/link_layer/net_if/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,20 +433,7 @@ int net_if_get_eui64(net_if_eui64_t *eui64, int if_id, int force_generation)
* the local/universal bit to 1. */
eui64->uint32[0] = HTONL(0x020000ff);
eui64->uint16[2] = HTONS(0xfe00);

if (sizeof(hwaddr) == 2) {
eui64->uint16[3] = HTONS(hwaddr);
}
else if (sizeof(hwaddr) == 1) {
eui64->uint8[6] = 0;
eui64->uint8[7] = (uint8_t)hwaddr;
}
else {
DEBUG("Error on EUI-64 generation: do not know what to do with "
"hardware address of length %d\n", sizeof(hwaddr));
return 0;
}

eui64->uint16[3] = HTONS(hwaddr);
}

return 1;
Expand Down
8 changes: 0 additions & 8 deletions sys/net/network_layer/sixlowpan/ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,7 @@ ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id,

if (net_if_get_eui64((net_if_eui64_t *) &out->uint8[8], if_id,
force_generation)) {
#ifdef MODULE_SIXLOWPAN

if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *)&out->uint8[8])) {
out->uint8[8] ^= 0x02;
}

#else
out->uint8[8] ^= 0x02;
#endif
return out;
}
else {
Expand Down

0 comments on commit c85d960

Please sign in to comment.