From 19ebdb4ef944b300072d6a67ba4cc21d564a4f80 Mon Sep 17 00:00:00 2001 From: Anthony Merlino Date: Tue, 15 May 2018 17:32:40 +0000 Subject: [PATCH] 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 --- net/sixlowpan/sixlowpan_hc06.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index 5fb1e81709..ebf7a318e2 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -499,9 +499,15 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr, 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]; +#else + /* Preserve big-endian, network order */ + + ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0]; +#endif srcptr += 2; }