mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +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:
parent
06aee06a8d
commit
12002d1604
1 changed files with 14 additions and 3 deletions
|
@ -489,10 +489,21 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
|
|||
|
||||
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];
|
||||
srcptr += 2;
|
||||
ipaddr[i] = (uint16_t)srcptr[0] << 8 | (uint16_t)srcptr[1];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Big-endian, network order */
|
||||
|
||||
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
|
||||
srcptr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle any remaining odd byte */
|
||||
|
|
Loading…
Reference in a new issue