IEEE 802.15.4/6LoWPAN: Correct one more usage of saddr; also update a README and the TODO list.

This commit is contained in:
Gregory Nutt
2017-06-19 07:31:52 -06:00
parent f685f30fb2
commit cd82d03ddf
3 changed files with 39 additions and 19 deletions
+1 -1
View File
@@ -1260,7 +1260,7 @@ o Network (net/, drivers/net)
implementation. implementation.
If we want to use IPv6 neighbor discovery, we could dispense If we want to use IPv6 neighbor discovery, we could dispense
with the all MAC based addressing. But if we want to retain with the all MAC based addressing. But if we want to retain
the more compact MAC-based addressing, then we don't need the more compact MAC-based addressing, then we don't need
IPv6 neighbor discovery. IPv6 neighbor discovery.
+33 -8
View File
@@ -3,16 +3,41 @@
The current 6LoWPAN implementation uses only link local, MAC-based The current 6LoWPAN implementation uses only link local, MAC-based
addressing addressing (as discussed in more detail below). Thus if you know addressing addressing (as discussed in more detail below). Thus if you know
the node addressing, then you know the IPv6 address (and vice-versa) the node addressing, then you know the IPv6 address (and vice-versa).
As a configuration option, the 6LoWPAN implementation will use either the
node's 2-byte short address or 8-byte extended address as the MAC address
that the IPv6 address is based on. This is determined by the configuration
setting CONFIG_NET_6LOWPAN_EXTENDEDADDR. By default, the 2-byte short
address is used for the IEEE802.15.4 MAC device's link layer address. If
this option is selected, then an 8-byte extended address will be used,
instead.
All nodes operating on a network have unique, 8-byte extended address,
that was assigned before the network is configured. 6LoWPAN will use
either the extended address for direct communication within the PAN or
the short 2-byte address. The short 2-byte address, however, is allocated
by the PAN coordinator when the device associated. If short addresses are
used, the network cannot be brought up until is is associated.
Node addressing is modified through IOCTL calls from application logic.
The network must be in the DOWN state when ever the node addressing is
modified. The modified node addresses will have no effect on the reported
IPv6 address until the network is brought to the UP state. The new IPv6
MAC-based addresses are only instantiated when the network transitions
from the DOWN to UP state.
IPv6 Neighbor Discovery
-----------------------
IPv6 Neighbor Discovery is not supported. The current ICMPv6 and neighbor- IPv6 Neighbor Discovery is not supported. The current ICMPv6 and neighbor-
related logic only works with Ethernet MAC. For 6LoWPAN, a related logic only works with Ethernet MAC. For 6LoWPAN, a new more
new more conservative IPv6 neigbor discovery is provided by RFC 6775 which conservative IPv6 neigbor discovery is provided by RFC 6775 which is not
is not currently suppored. With IPv6 neighbor discovery, any IPv6 address currently supported. With IPv6 neighbor discovery, any IPv6 address may be
may be associated with any short or extended address. In fact, that is the associated with any short or extended address. In fact, that is the whole
whole purpose of the neighbor discover logic: It plays the same role as ARP purpose of the neighbor discover logic: It plays the same role as ARP in
in IPv4; it ultimately just manages a neighbor table that, like the arp IPv4; it ultimately just manages a neighbor table that, like the arp table,
table, provides the mapping between IP addresses and node addresses. provides the mapping between IP addresses and node addresses.
The NuttX, Contiki-based 6LoWPAN implementation circumvents the need for The NuttX, Contiki-based 6LoWPAN implementation circumvents the need for
the neighbor discovery logic by using only MAC-based addressing, i.e., the the neighbor discovery logic by using only MAC-based addressing, i.e., the
+5 -10
View File
@@ -276,6 +276,8 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
} }
#else #else
uint8_t *saddr;
/* Get the saddr from the MAC */ /* Get the saddr from the MAC */
memcpy(arg.ifr_name, dev->d_ifname, IFNAMSIZ); memcpy(arg.ifr_name, dev->d_ifname, IFNAMSIZ);
@@ -289,15 +291,8 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
} }
else else
{ {
union saddr = arg.u.getreq.attrval.mac.saddr;
{ IEEE802154_SADDRCOPY(dev->d_mac.ieee802154.u8, saddr);
uint16_t u16;
uint8_t u8[2];
} u;
u.u16 = arg.u.getreq.attrval.mac.saddr;
dev->d_mac.ieee802154.u8[0] = u.u8[0];
dev->d_mac.ieee802154.u8[1] = u.u8[1];
/* Set the IP address based on the saddr */ /* Set the IP address based on the saddr */
@@ -308,7 +303,7 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
dev->d_ipv6addr[4] = 0; dev->d_ipv6addr[4] = 0;
dev->d_ipv6addr[5] = HTONS(0x00ff); dev->d_ipv6addr[5] = HTONS(0x00ff);
dev->d_ipv6addr[6] = HTONS(0xfe00); dev->d_ipv6addr[6] = HTONS(0xfe00);
dev->d_ipv6addr[7] = u.u16; dev->d_ipv6addr[7] = (uint16_t)saddr[0] << 8 | (uint16_t)saddr[1];
dev->d_ipv6addr[7] ^= 0x200; dev->d_ipv6addr[7] ^= 0x200;
return OK; return OK;
} }