diff --git a/TODO b/TODO index 6f1e540fe6..1cac77e862 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated June 17, 2017) +NuttX TODO List (Last updated June 18, 2017) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -1237,8 +1237,39 @@ o Network (net/, drivers/net) Ethernet MAC. For 6loWPAN, a new more conservative ICMPv6 definitions is provided by RFC 6775. This RFC needs to be supported in order to support ping6 on a 6loWPAN network. + If RFC 6775 were implemented, then arbitrary IPv6 addresses, + including addresses from DHCPv6 could be used. + can + + UPDATE: With ICMPv6 neighbor discovery, any IPv6 address may + be associated with any short or extended address. In fact, + that is the whole purpose of the neighbor discover logic: It + plays the same role as ARP in IPv4; it ultimately just manages + a neighbor table that, like the arp table, provides the + mapping between IP addresses and node addresses. + + The NuttX, Contiki-based 6loWPAN implementation circumvented + the need for the neighbor discovery logic by using only MAC- + based addressing, i.e., the lower two or eight bytes of the + IP address are the node address. + + Most of the 6loWPAN compression algorithms exploit this to + compress the IPv6 address to nothing but a bit indicating + that the IP address derives from the node address. So I + think ICMPv6 is useless in the current implementation. + + If we want to use ICMPv6, we could dispense with the all MAC + based addressing. But if we want to retain the more compact + MAC-based addressing, then we don't need ICMPv6. + + So, the full neighbor discovery logic is not currently useful, + but it would still be nice to have enough in place to support + ping6. + Status: Open - Priority: Low for now. + Priority: Low for now. I don't plan on implementing this. It would + only be relevant if we were to decide to abandon the use of + MAC-based addressing in the 6loWPAN implementation. Title: ETHERNET LOCAL BROADCAST DOES NOT WORK diff --git a/include/nuttx/net/rfc6775.h b/include/nuttx/net/rfc6775.h new file mode 100644 index 0000000000..7b842dc125 --- /dev/null +++ b/include/nuttx/net/rfc6775.h @@ -0,0 +1,141 @@ +/**************************************************************************** + * include/nuttx/net/enc28j60.h + * + * Copyright (C) 2010, 2012, 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_RFC6775_H +#define __INCLUDE_NUTTX_NET_RFC6775_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* 4.2 Bit definitions for 6CO resccid field */ + +#define RESCCID_CID_SHIFT (0) /* Bits 0-3: Context identifier */ +#define RESCCID_CID_MASK (7 << RESCCID_CID_SHIFT) +#define RESCCID_C (1 << 4) /* Bit 4: Compression Flag */ + /* Bits 5-7: Reserved */ + +/* 9 Protocol Constants */ + +/* 6LBR Constants: */ + +#define MIN_CONTEXT_CHANGE_DELAY 300 /* Seconds */ + +/* 6LR Constants: */ + +#define MAX_RTR_ADVERTISEMENTS 3 /* Transmissions */ +#define MIN_DELAY_BETWEEN_RAS 10 /* Seconds */ +#define MAX_RA_DELAY_TIME 2 /* Seconds */ +#define TENTATIVE_NCE_LIFETIME 20 /* Seconds */ + +/* Router Constants: */ + +#define MULTIHOP_HOPLIMI 64 + +/* Host Constants: */ + +#define RTR_SOLICITATION_INTERVAL 10 /* Seconds */ +#define MAX_RTR_SOLICITATIONS 3 /* Transmissions */ +#define MAX_RTR_SOLICITATION_INTERVAL 60 /* Seconds */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* Table 1. alues for status field */ + +enum icmpv6_status_e +{ + ICMPV6_SUCCESS = 0, /* Success */ + ICMPV6_DUPLICATE = 1, /* Duplicate address */ + ICMPV6_FULL = 2, /* Neighbor cache full */ + ICMPV6_ALLOCATED = 3 /* 3-255: Allocated using standard action (RFC5226 */ +}; + +/* 4.1 Source Link-Layer Address Option (SLLAO) */ + +struct icmpv6_sllao_s +{ + uint8_t type; /* Byte 0: Type = 33 */ + uint8_t length; /* Byte 1: Length in units of 8 bytes = 2 */ + uint8_t status; /* Byte 2: Status of NS message. See enum icmpv6_status_e */ + uint8_t reserved[3]; /* Bytes 3-5: Reserved */ + uint8_t lifetime[2]; /* Bytes 6-7: Registration lifetime */ + uint8_t eui64[8]; /* Bytes 8-15: EUI-64 identifier assigned to interface */ +}; + +/* 4.2 6loWPAN Context Option (6CO) */ + +struct icmpv6_6co_s +{ + uint8_t type; /* Byte 0: Type = 34 */ + uint8_t length; /* Byte 1: Length in units of 8 bytes = 2 or 3 */ + uint8_t ctxlen; /* Byte 2: Context length = 0-128 bits */ + uint8_t resccid; /* Byte 3: See RESCCID_* bit definitions */ + uint8_t reserved[2]; /* Bytes 4-6: Reserved */ + uint8_t lifetime[2]; /* Bytes 6-7: Valid lifetime */ + uint8_t prefix[1]; /* Bytes 8-15 or 8-23: Context Prefix */ +}; + +#define ICMPV6_6CO_LEN(b) ((b > 64) ? 16 : 8) +#define SIZEOF_ICMPV6_6CO_S(b) (sizeof(struct icmpv6_6co_s) + CMPV6_6CO_LEN(b) - 1) + +/* 4.3 Authoritative Border Router Option (ABRO) */ + +struct icmpv6_abro_s +{ + uint8_t type; /* Byte 0: Type = 35 */ + uint8_t length; /* Byte 1: Length in units of 8 bytes = 3 */ + uint8_t verlo[2]; /* Bytes 2-3: Version low */ + uint8_t verhi[2]; /* Bytes 4-5: Version high */ + uint8_t lifetime[2]; /* Bytes 6-7: Valid lifetime */ + uint8_t ipv6[16]; /* Bytes 8-23: IPv6 address of the 6LBR orign of version */ +}; + +/* 4.4 Duplicate Address Messages (DAD for both DAR and DAC) */ + +struct icmpv6_dad_s +{ + uint8_t type; /* Byte 0: Type = 157 (DAR) or 158 (DAC) */ + uint8_t code; /* Byte 1: Code */ + uint8_t chksum[2]; /* Bytes 2-3: Checksum */ + uint8_t status; /* Byte 4: Status of DAR. See enum icmpv6_status_e */ + uint8_t reserved; /* Byte 5: Reserved */ + uint8_t lifetime[2]; /* Bytes 6-7: Registration lifetime */ + uint8_t eui64[8]; /* Bytes 8-15: EUI-64 identifier registered address */ + uint8_t ipv6[16]; /* Bytes 16-31: Registered address */ +}; + +#endif /* __INCLUDE_NUTTX_NET_RFC6775_H */