mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
6LoWPAN: Fix a src/dest address confusion
This commit is contained in:
@@ -766,11 +766,11 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
|
|||||||
SIXLOWPAN_IPHC_SAM_BIT);
|
SIXLOWPAN_IPHC_SAM_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No address context found for this address */
|
/* No address context found for the source address */
|
||||||
|
|
||||||
else if (net_is_addr_linklocal(ipv6->srcipaddr) &&
|
else if (net_is_addr_linklocal(ipv6->srcipaddr) &&
|
||||||
ipv6->destipaddr[1] == 0 && ipv6->destipaddr[2] == 0 &&
|
ipv6->srcipaddr[1] == 0 && ipv6->srcipaddr[2] == 0 &&
|
||||||
ipv6->destipaddr[3] == 0)
|
ipv6->srcipaddr[3] == 0)
|
||||||
{
|
{
|
||||||
iphc1 |= compress_laddr(ipv6->srcipaddr,
|
iphc1 |= compress_laddr(ipv6->srcipaddr,
|
||||||
&ieee->i_dev.d_mac.ieee802154,
|
&ieee->i_dev.d_mac.ieee802154,
|
||||||
@@ -778,7 +778,7 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Send the full address ipaddr: SAC = 0, SAM = 00 */
|
/* Send the full source address ipaddr: SAC = 0, SAM = 00 */
|
||||||
|
|
||||||
ninfo("Uncompressable srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
ninfo("Uncompressable srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||||
ipv6->srcipaddr[0], ipv6->srcipaddr[1], ipv6->srcipaddr[2],
|
ipv6->srcipaddr[0], ipv6->srcipaddr[1], ipv6->srcipaddr[2],
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock,
|
|||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
nwarn("WARNING: Not routable\n");
|
nwarn("WARNING: Not routable or not IEEE802.15.4 MAC\n");
|
||||||
return (ssize_t)-ENETUNREACH;
|
return (ssize_t)-ENETUNREACH;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -260,6 +260,8 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock,
|
|||||||
net_ipv6addr_hdrcopy(ipv6udp.ipv6.destipaddr, to6->sin6_addr.in6_u.u6_addr16);
|
net_ipv6addr_hdrcopy(ipv6udp.ipv6.destipaddr, to6->sin6_addr.in6_u.u6_addr16);
|
||||||
#ifdef CONFIG_NETDEV_MULTINIC
|
#ifdef CONFIG_NETDEV_MULTINIC
|
||||||
net_ipv6addr_hdrcopy(ipv6udp.ipv6.srcipaddr, conn->u.ipv6.laddr);
|
net_ipv6addr_hdrcopy(ipv6udp.ipv6.srcipaddr, conn->u.ipv6.laddr);
|
||||||
|
#else
|
||||||
|
net_ipv6addr_hdrcopy(ipv6udp.ipv6.srcipaddr, dev->d_ipv6addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ninfo("IPv6 length: %d\n",
|
ninfo("IPv6 length: %d\n",
|
||||||
|
|||||||
@@ -311,6 +311,10 @@ static int lo_loopback(FAR struct net_driver_s *dev)
|
|||||||
ind.dest.mode = IEEE802154_ADDRMODE_SHORT;
|
ind.dest.mode = IEEE802154_ADDRMODE_SHORT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Only loopback the local address is the destination and some (arbitrary)
|
||||||
|
* address is the source.
|
||||||
|
*/
|
||||||
|
|
||||||
IEEE802154_PANIDCOPY(ind.src.panid, g_panid);
|
IEEE802154_PANIDCOPY(ind.src.panid, g_panid);
|
||||||
IEEE802154_SADDRCOPY(ind.src.saddr, g_src_saddr);
|
IEEE802154_SADDRCOPY(ind.src.saddr, g_src_saddr);
|
||||||
IEEE802154_EADDRCOPY(ind.src.eaddr, g_src_eaddr);
|
IEEE802154_EADDRCOPY(ind.src.eaddr, g_src_eaddr);
|
||||||
|
|||||||
Reference in New Issue
Block a user