1
0
Fork 0
forked from nuttx/nuttx-update

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

View file

@ -712,6 +712,7 @@ CONFIG_WIRELESS_IEEE802154=y
CONFIG_IEEE802154_DEFAULT_EADDR=0x00fade00deadbeef
CONFIG_MAC802154_HPWORK=y
CONFIG_MAC802154_NTXDESC=3
CONFIG_MAC802154_NNOTIF=3
CONFIG_IEEE802154_IND_PREALLOC=20
CONFIG_IEEE802154_IND_IRQRESERVE=10
# CONFIG_IEEE802154_MACDEV is not set

View file

@ -3,7 +3,7 @@
* Defines architecture-specific device driver interfaces to the NuttX
* network.
*
* Copyright (C) 2007, 2009, 2011-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2011-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Derived largely from portions of uIP with has a similar BSD-styple license:

View file

@ -236,7 +236,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
#endif
int ret;
ninfo("buflen=%lu", (unsigned long)buflen);
ninfo("buflen=%lu\n", (unsigned long)buflen);
/* Initialize global data. Locking the network guarantees that we have
* exclusive use of the global values for intermediate calculations.

View file

@ -303,7 +303,7 @@ static void uncompress_addr(FAR net_ipv6addr_t ipaddr, uint8_t const prefix[],
uint8_t prefcount = prefpost >> 4;
uint8_t postcount = prefpost & 0x0f;
/* Full nibble 15 => 16 */
/* The value 16 is encoded as 0xf in the 4 bit-fields. */
prefcount = prefcount == 15 ? 16 : prefcount;
postcount = postcount == 15 ? 16 : postcount;
@ -758,7 +758,7 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
FAR struct udp_hdr_s *udp =
(FAR struct udp_hdr_s *)((FAR uint8_t *)ipv6 + IPv6_HDRLEN);
ninfo("Uncompressed UDP ports on send side: srcport=%04x destport=%04x\n",
ninfo("Uncompressed UDP ports: srcport=%04x destport=%04x\n",
ntohs(udp->srcport), ntohs(udp->destport));
/* Mask out the last 4 bits can be used as a mask */
@ -770,7 +770,7 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
*g_hc06ptr = SIXLOWPAN_NHC_UDP_CS_P_11;
ninfo("Remove 12b of both source & dest with prefix 0xfob\n");
ninfo("Remove 12b of both source & dest with prefix 0xf0b*\n");
*(g_hc06ptr + 1) =
(uint8_t)((ntohs(udp->srcport) - SIXLOWPAN_UDP_4_BIT_PORT_MIN) << 4) +

View file

@ -156,7 +156,8 @@ bool sixlowpan_issaddrbased(const net_ipv6addr_t ipaddr,
{
FAR const uint8_t *byteptr = saddr->u8;
return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) &&
return (ipaddr[5] == HTONS(0x00ff) &&
ipaddr[6] == HTONS(0xfe00) &&
ipaddr[7] == (GETUINT16(byteptr, 0) ^ 0x0200));
}

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;

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);