6LoWPAN: Various fixes from retesting on simulator with short addressing.

This commit is contained in:
Gregory Nutt
2017-06-22 11:42:52 -06:00
parent b5994560cc
commit bc8ad02ee5
7 changed files with 27 additions and 7 deletions
+14
View File
@@ -190,6 +190,12 @@ static int lo_req_data(FAR struct ieee802154_driver_s *netdev,
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
static void lo_addr2ip(FAR struct net_driver_s *dev)
{
/* Set the MAC address as the eaddr */
IEEE802154_EADDRCOPY(dev->d_mac.ieee802154.u8, g_eaddr);
/* Set the IP address based on the eaddr */
dev->d_ipv6addr[0] = HTONS(0xfe80);
dev->d_ipv6addr[1] = 0;
dev->d_ipv6addr[2] = 0;
@@ -199,10 +205,18 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
dev->d_ipv6addr[6] = (uint16_t)g_eaddr[4] << 8 | (uint16_t)g_eaddr[5];
dev->d_ipv6addr[7] = (uint16_t)g_eaddr[6] << 8 | (uint16_t)g_eaddr[6];
dev->d_ipv6addr[4] ^= 0x200;
memcpy(dev->d_mac.ieee802154, g_eaddr, IEEE802154_EADDRSIZE);
}
#else
static void lo_addr2ip(FAR struct net_driver_s *dev)
{
/* Set the MAC address as the saddr */
IEEE802154_SADDRCOPY(dev->d_mac.ieee802154.u8, g_saddr);
/* Set the IP address based on the saddr */
dev->d_ipv6addr[0] = HTONS(0xfe80);
dev->d_ipv6addr[1] = 0;
dev->d_ipv6addr[2] = 0;
+5 -1
View File
@@ -258,11 +258,13 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
}
else
{
/* Set the IP address based on the eaddr */
/* Set the MAC address as the eaddr */
eaddr = arg.u.getreq.attrval.mac.eaddr;
IEEE802154_EADDRCOPY(dev->d_mac.ieee802154.u8, eaddr);
/* Set the IP address based on the eaddr */
dev->d_ipv6addr[0] = HTONS(0xfe80);
dev->d_ipv6addr[1] = 0;
dev->d_ipv6addr[2] = 0;
@@ -291,6 +293,8 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
}
else
{
/* Set the MAC address as the saddr */
saddr = arg.u.getreq.attrval.mac.saddr;
IEEE802154_SADDRCOPY(dev->d_mac.ieee802154.u8, saddr);