Merged in antmerlino/nuttx/sixlowpan-mcast-uncompress (pull request #738)
net/sixlowpan: Fixes bug in uncompress_addr handling of odd postfix. This affected multicast compress/uncompress since it's the only logic that used an odd postfix. The odd byte needs to be handled first, not last. Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
parent
511c90d050
commit
1adfef8113
@ -495,9 +495,25 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
|
||||
/* If the postcount is even then take extra care with endian-ness */
|
||||
|
||||
destndx = 8 - (postcount >> 1);
|
||||
endndx = 8 - (postcount & 1);
|
||||
|
||||
for (i = destndx; i < endndx; i++)
|
||||
/* Handle any odd byte first */
|
||||
|
||||
if ((postcount & 1) != 0)
|
||||
{
|
||||
#ifdef CONFIG_BIG_ENDIAN
|
||||
/* Preserve big-endian, network order */
|
||||
|
||||
ipaddr[destndx - 1] = (uint16_t)(*srcptr) << 8;
|
||||
#else
|
||||
/* Preserve big-endian, network order */
|
||||
|
||||
ipaddr[destndx - 1] = (uint16_t)(*srcptr);
|
||||
#endif
|
||||
|
||||
srcptr++;
|
||||
}
|
||||
|
||||
for (i = destndx; i < 8; i++)
|
||||
{
|
||||
#ifdef CONFIG_BIG_ENDIAN
|
||||
/* Preserve big-endian, network order */
|
||||
@ -511,13 +527,6 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
|
||||
srcptr += 2;
|
||||
}
|
||||
|
||||
/* Handle any remaining odd byte */
|
||||
|
||||
if ((postcount & 1) != 0)
|
||||
{
|
||||
ipaddr[7] = (uint16_t)(*srcptr) << 8;
|
||||
}
|
||||
|
||||
/* If the was a standard MAC based address then toggle */
|
||||
|
||||
if (fullmac)
|
||||
|
Loading…
Reference in New Issue
Block a user