sys/net: Fix unaligned access on Samr21/Cortex-M0
*((uint16_t)*dest) results in a ldrh (load halfword) instruction on an address that seems to not be halfword-aligned (?), causing a hard-fault on the samr21-xpro board (cortex-m0 architecture). The issue seems to be very similar to the one described in http://stackoverflow.com/a/21661366/124257
This commit is contained in:
parent
821cf81608
commit
5910cadb58
@ -1107,7 +1107,8 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len,
|
|||||||
else if (ipv6_buf->destaddr.uint32[2] == HTONL(0x000000ff) &&
|
else if (ipv6_buf->destaddr.uint32[2] == HTONL(0x000000ff) &&
|
||||||
ipv6_buf->destaddr.uint16[6] == HTONS(0xfe00)) {
|
ipv6_buf->destaddr.uint16[6] == HTONS(0xfe00)) {
|
||||||
if (dest_len == 2 &&
|
if (dest_len == 2 &&
|
||||||
ipv6_buf->destaddr.uint16[7] == *((uint16_t *) dest)) {
|
ipv6_buf->destaddr.uint8[14] == dest[0] &&
|
||||||
|
ipv6_buf->destaddr.uint8[15] == dest[1]) {
|
||||||
/* 0 bits. The address is derived using context information
|
/* 0 bits. The address is derived using context information
|
||||||
* and possibly the link-layer addresses.*/
|
* and possibly the link-layer addresses.*/
|
||||||
lowpan_iphc[1] |= 0x03;
|
lowpan_iphc[1] |= 0x03;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user