Merged in antmerlino/nuttx/sixlowpan_hc06_fix (pull request #644)

sixlowpan: Preserve big-endian (network order) when uncompressing address.

This change is the counterpart to another recent endianness fix that occurred on compression of the ip address.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2018-05-15 17:32:40 +00:00 committed by Gregory Nutt
parent 034ab467e6
commit 19ebdb4ef9
1 changed files with 7 additions and 1 deletions

View File

@ -499,9 +499,15 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
for (i = destndx; i < endndx; i++) for (i = destndx; i < endndx; i++)
{ {
/* Big-endian, network order */ #ifdef CONFIG_BIG_ENDIAN
/* Preserve big-endian, network order */
ipaddr[i] = (uint16_t)srcptr[0] << 8 | (uint16_t)srcptr[1]; ipaddr[i] = (uint16_t)srcptr[0] << 8 | (uint16_t)srcptr[1];
#else
/* Preserve big-endian, network order */
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
#endif
srcptr += 2; srcptr += 2;
} }