mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Merged in antmerlino/nuttx/uncompress-addr-fix (pull request #786)
net/sixlowpan: Fixes decompression of ipaddr from MAC address. The logic used to populate the IP from the radio address should match sixlowpan_ipfromsaddr/sixlowpan_ipfromeaddr Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
committed by
GregoryN
parent
52aae032f7
commit
35232d4997
@@ -513,15 +513,22 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
|
||||
|
||||
for (i = destndx; i < 8; i++)
|
||||
{
|
||||
if (usemac)
|
||||
{
|
||||
ipaddr[i] = (uint16_t)srcptr[0] << 8 | (uint16_t)srcptr[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
/* Preserve big-endian, network order */
|
||||
/* 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 */
|
||||
/* Preserve big-endian, network order */
|
||||
|
||||
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
|
||||
ipaddr[i] = (uint16_t)srcptr[1] << 8 | (uint16_t)srcptr[0];
|
||||
#endif
|
||||
}
|
||||
srcptr += 2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user