mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
net/sixlowpan: When uncompressing link local addresses, the source of the address matters. Apparently address by byte reversed in IP addresses. But if the source of the address is the locally assigned address, bytes are not reversed.
This commit is contained in:
@@ -489,10 +489,21 @@ 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 */
|
#ifndef CONFIG_BIG_ENDIAN
|
||||||
|
if (usemac)
|
||||||
|
{
|
||||||
|
/* Local address is already network order. Retain host order */
|
||||||
|
|
||||||
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
|
ipaddr[i] = (uint16_t)srcptr[0] << 8 | (uint16_t)srcptr[1];
|
||||||
srcptr += 2;
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* Big-endian, network order */
|
||||||
|
|
||||||
|
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
|
||||||
|
srcptr += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle any remaining odd byte */
|
/* Handle any remaining odd byte */
|
||||||
|
|||||||
Reference in New Issue
Block a user