From 0b652d04515fcd44bf7e161e438b418ac284c165 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 16 Jun 2017 13:24:07 -0600 Subject: [PATCH 1/3] Update some Kconfig help comments --- net/sixlowpan/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/sixlowpan/Kconfig b/net/sixlowpan/Kconfig index 674eff01f6..ae977359e0 100644 --- a/net/sixlowpan/Kconfig +++ b/net/sixlowpan/Kconfig @@ -141,6 +141,12 @@ config NET_6LOWPAN_EXTENDEDADDR device's link layer address. If this option is selected, then an 8-byte extended address will be used. + All devices operating on a network have unique, 8-byte addresses, + referred to as extended addresses. A device will use either the + extended address for direct communication within the PAN or the + short 2-byte address that was allocated by the PAN coordinator when + the device associated. + config NET_6LOWPAN_MAXAGE int "Packet reassembly timeout" default 20 From 1f42ab7b7dbab8218d777476d1ec2a1499e3cd78 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 16 Jun 2017 15:40:00 -0600 Subject: [PATCH 2/3] Clicker2-stm32: Allow both IEEE 802.15.4 MAC character and network devices to be registered. --- configs/clicker2-stm32/src/stm32_mrf24j40.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configs/clicker2-stm32/src/stm32_mrf24j40.c b/configs/clicker2-stm32/src/stm32_mrf24j40.c index c89b28b838..1d5733edde 100644 --- a/configs/clicker2-stm32/src/stm32_mrf24j40.c +++ b/configs/clicker2-stm32/src/stm32_mrf24j40.c @@ -255,7 +255,7 @@ static int stm32_mrf24j40_devsetup(FAR struct stm32_priv_s *priv) return -ENODEV; } -#if defined(CONFIG_IEEE802154_NETDEV) +#ifdef CONFIG_IEEE802154_NETDEV /* Use the IEEE802.15.4 MAC interface instance to create a 6loWPAN * network interface by wrapping the MAC intrface instance in a * network device driver via mac802154dev_register(). @@ -268,7 +268,9 @@ static int stm32_mrf24j40_devsetup(FAR struct stm32_priv_s *priv) 0, ret); return ret; } -#elif defined(CONFIG_IEEE802154_MAC_DEV) +#endif + +#ifdef CONFIG_IEEE802154_MAC_DEV /* If want to call these APIs from userspace, you have to wrap the MAC * interface in a character device viamac802154dev_register(). */ From 4588226d7198a08ce792c4b694c8cf2233d10056 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 16 Jun 2017 16:47:27 -0600 Subject: [PATCH 3/3] Clicker2-STM32: Enable networking and 6loWPAN in the mrf24j40-6lowpan configuration. Fix a couple of new 6loWPAN compile issues revealed by this new configuration. --- configs/clicker2-stm32/README.txt | 12 +- .../clicker2-stm32/mrf24j40-6lowpan/defconfig | 240 +++++++++++++++++- net/Kconfig | 2 +- net/sixlowpan/sixlowpan_tcpsend.c | 2 + net/sixlowpan/sixlowpan_udpsend.c | 6 +- 5 files changed, 249 insertions(+), 13 deletions(-) diff --git a/configs/clicker2-stm32/README.txt b/configs/clicker2-stm32/README.txt index da90fdd8ac..274b9a2b0c 100644 --- a/configs/clicker2-stm32/README.txt +++ b/configs/clicker2-stm32/README.txt @@ -418,7 +418,7 @@ Configurations to support any future debugging needs that you may have. If you don't plan on using the debug features, then by all means - disable this feature and save 16KiB of RAM! + disable this feature and save 8KiB of RAM! NOTE: There is an issue with capturing data in the RAMLOG: If the system crashes, all of the crash dump information will go into @@ -426,6 +426,16 @@ Configurations the system has crashed because (a) it will be unresponsive and (b) the LD2 will be blinking at about 2Hz. + 4. IPv6 networking is enabled with TCP/IP, UDP, 6loWPAN, and NSH + Telnet support. + + 5. Configuration instructions: Basic PAN configuration is the same as + for the ieee802154-mac configuration with the exception that after + the PAN has been configured with the i8sak utility, you must + explicity bring the network up: + + nsh> ifup wpan0 + nsh: Configures the NuttShell (nsh) located at examples/nsh. This diff --git a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig index 649fd33700..37297ef9dd 100644 --- a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig +++ b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig @@ -800,6 +800,27 @@ CONFIG_SPI_EXCHANGE=y # CONFIG_MODEM is not set # CONFIG_MTD is not set # CONFIG_EEPROM is not set +CONFIG_NETDEVICES=y + +# +# General Ethernet MAC Driver Options +# +# CONFIG_NETDEV_LOOPBACK is not set +CONFIG_NETDEV_TELNET=y +CONFIG_TELNET_RXBUFFER_SIZE=256 +CONFIG_TELNET_TXBUFFER_SIZE=256 +# CONFIG_NETDEV_MULTINIC is not set +# CONFIG_ARCH_HAVE_NETDEV_STATISTICS is not set +CONFIG_NETDEV_LATEINIT=y + +# +# External Ethernet MAC Device Support +# +# CONFIG_NET_DM90x0 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +# CONFIG_NET_SLIP is not set +# CONFIG_NET_FTMAC100 is not set # CONFIG_PIPES is not set # CONFIG_PM is not set # CONFIG_POWER is not set @@ -912,9 +933,129 @@ CONFIG_RAMLOG_SYSLOG=y # # Networking Support # -# CONFIG_ARCH_HAVE_NET is not set +CONFIG_ARCH_HAVE_NET=y # CONFIG_ARCH_HAVE_PHY is not set -# CONFIG_NET is not set +CONFIG_NET=y +# CONFIG_NET_PROMISCUOUS is not set + +# +# Driver buffer configuration +# +CONFIG_NET_GUARDSIZE=2 + +# +# Data link support +# +# CONFIG_NET_MULTILINK is not set +# CONFIG_NET_ETHERNET is not set +CONFIG_NET_6LOWPAN=y +# CONFIG_NET_LOOPBACK is not set +# CONFIG_NET_TUN is not set +# CONFIG_NET_USRSOCK is not set + +# +# Network Device Operations +# +CONFIG_NETDEV_IOCTL=y +# CONFIG_NETDEV_PHY_IOCTL is not set +CONFIG_NETDEV_WIRELESS_IOCTL=y + +# +# Internet Protocol Selection +# +# CONFIG_NET_IPv4 is not set +CONFIG_NET_IPv6=y +CONFIG_NET_IPv6_NCONF_ENTRIES=8 + +# +# 6LoWPAN Configuration +# +CONFIG_NET_6LOWPAN_FRAG=y +CONFIG_NET_6LOWPAN_FRAMELEN=127 +# CONFIG_NET_6LOWPAN_COMPRESSION_IPv6 is not set +# CONFIG_NET_6LOWPAN_COMPRESSION_HC1 is not set +CONFIG_NET_6LOWPAN_COMPRESSION_HC06=y +CONFIG_NET_6LOWPAN_COMPRESSION_THRESHOLD=63 +CONFIG_NET_6LOWPAN_MAXADDRCONTEXT=1 +CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_0=0xaa +CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_1=0xaa +# CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_1 is not set +# CONFIG_NET_6LOWPAN_EXTENDEDADDR is not set +CONFIG_NET_6LOWPAN_MAXAGE=20 +CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS=4 +CONFIG_NET_6LOWPAN_MTU=1294 +CONFIG_NET_6LOWPAN_TCP_RECVWNDO=1220 + +# +# Socket Support +# +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +# CONFIG_NET_SOLINGER is not set + +# +# Raw Socket Support +# +# CONFIG_NET_PKT is not set + +# +# Unix Domain Socket Support +# +# CONFIG_NET_LOCAL is not set + +# +# TCP/IP Networking +# +CONFIG_NET_TCP=y +# CONFIG_NET_TCP_NO_STACK is not set +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=20 +CONFIG_NET_TCP_READAHEAD=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_TCP_NWRBCHAINS=8 +CONFIG_NET_TCP_RECVDELAY=0 +CONFIG_NET_TCPBACKLOG=y +# CONFIG_NET_SENDFILE is not set + +# +# UDP Networking +# +CONFIG_NET_UDP=y +# CONFIG_NET_UDP_NO_STACK is not set +CONFIG_NET_UDP_CHECKSUMS=y +CONFIG_NET_UDP_CONNS=8 +CONFIG_NET_BROADCAST=y +# CONFIG_NET_RXAVAIL is not set +CONFIG_NET_UDP_READAHEAD=y + +# +# ICMPv6 Networking Support +# +# CONFIG_NET_ICMPv6 is not set + +# +# IGMPv2 Client Support +# +# CONFIG_NET_IGMP is not set + +# +# ARP Configuration +# + +# +# User-space networking stack API +# +# CONFIG_NET_ARCH_INCR32 is not set +# CONFIG_NET_ARCH_CHKSUM is not set +CONFIG_NET_STATISTICS=y + +# +# Routing Table Configuration +# +# CONFIG_NET_ROUTE is not set +CONFIG_NET_HOSTNAME="MRF24J40" # # Crypto API @@ -959,6 +1100,7 @@ CONFIG_FS_PROCFS=y # CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set # CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set # CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set +# CONFIG_FS_PROCFS_EXCLUDE_NET is not set # CONFIG_FS_UNIONFS is not set # @@ -978,10 +1120,10 @@ CONFIG_MM_REGIONS=1 # Common I/O Buffer Support # CONFIG_MM_IOB=y -CONFIG_IOB_NBUFFERS=8 -CONFIG_IOB_BUFSIZE=196 -CONFIG_IOB_NCHAINS=0 -CONFIG_IOB_THROTTLE=0 +CONFIG_IOB_NBUFFERS=32 +CONFIG_IOB_BUFSIZE=128 +CONFIG_IOB_NCHAINS=16 +CONFIG_IOB_THROTTLE=8 # # Audio Support @@ -999,6 +1141,8 @@ CONFIG_MAC802154_HPWORK=y CONFIG_IEEE802154_NTXDESC=3 CONFIG_IEEE802154_IND_PREALLOC=20 CONFIG_IEEE802154_IND_IRQRESERVE=10 +# CONFIG_IEEE802154_NETDEV is not set +# CONFIG_IEEE802154_LOOPBACK is not set # # Binary Loader @@ -1101,13 +1245,13 @@ CONFIG_ARCH_HAVE_TLS=y # Network-Related Options # # CONFIG_LIBC_IPv4_ADDRCONV is not set -# CONFIG_LIBC_IPv6_ADDRCONV is not set -# CONFIG_LIBC_NETDB is not set +CONFIG_LIBC_NETDB=y # # NETDB Support # # CONFIG_NETDB_HOSTFILE is not set +# CONFIG_NETDB_DNSCLIENT is not set # CONFIG_LIBC_IOCTL_VARIADIC is not set CONFIG_LIB_SENDFILE_BUFSIZE=512 @@ -1158,6 +1302,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # CONFIG_EXAMPLES_CONFIGDATA is not set # CONFIG_EXAMPLES_CXXTEST is not set # CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_DISCOVER is not set # CONFIG_EXAMPLES_ELF is not set # CONFIG_EXAMPLES_FSTEST is not set # CONFIG_EXAMPLES_FTPC is not set @@ -1172,6 +1317,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # CONFIG_EXAMPLES_MM is not set # CONFIG_EXAMPLES_MODBUS is not set # CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_NETTEST is not set # CONFIG_EXAMPLES_NRF24L01TERM is not set CONFIG_EXAMPLES_NSH=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y @@ -1202,6 +1348,8 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y # CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UDPBLASTER is not set # CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_WATCHDOG is not set # CONFIG_EXAMPLES_WEBSERVER is not set @@ -1242,10 +1390,19 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y # Network Utilities # # CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DISCOVER is not set # CONFIG_NETUTILS_ESP8266 is not set # CONFIG_NETUTILS_FTPC is not set # CONFIG_NETUTILS_JSON is not set +CONFIG_NETUTILS_NETLIB=y +# CONFIG_NETUTILS_NTPCLIENT is not set +# CONFIG_NETUTILS_PPPD is not set # CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_WEBCLIENT is not set +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_XMLRPC is not set # # NSH Library @@ -1343,10 +1500,72 @@ CONFIG_NSH_FILEIOSIZE=512 # CONFIG_NSH_CONSOLE=y # CONFIG_NSH_USBCONSOLE is not set -# CONFIG_NSH_ALTCONDEV is not set CONFIG_NSH_ARCHINIT=y + +# +# Networking Configuration +# +CONFIG_NSH_NETINIT=y +CONFIG_NSH_NETLOCAL=y + +# +# IP Address Configuration +# + +# +# Target IPv6 address +# +CONFIG_NSH_IPv6ADDR_1=0xfc00 +CONFIG_NSH_IPv6ADDR_2=0x0000 +CONFIG_NSH_IPv6ADDR_3=0x0000 +CONFIG_NSH_IPv6ADDR_4=0x0000 +CONFIG_NSH_IPv6ADDR_5=0x0000 +CONFIG_NSH_IPv6ADDR_6=0x00ff +CONFIG_NSH_IPv6ADDR_7=0xfe00 +CONFIG_NSH_IPv6ADDR_8=0xa9cd + +# +# Router IPv6 address +# +CONFIG_NSH_DRIPv6ADDR_1=0xfc00 +CONFIG_NSH_DRIPv6ADDR_2=0x0000 +CONFIG_NSH_DRIPv6ADDR_3=0x0000 +CONFIG_NSH_DRIPv6ADDR_4=0x0000 +CONFIG_NSH_DRIPv6ADDR_5=0x0000 +CONFIG_NSH_DRIPv6ADDR_6=0x00ff +CONFIG_NSH_DRIPv6ADDR_7=0xfe00 +CONFIG_NSH_DRIPv6ADDR_8=0x1034 + +# +# IPv6 Network mask +# +CONFIG_NSH_IPv6NETMASK_1=0xffff +CONFIG_NSH_IPv6NETMASK_2=0xffff +CONFIG_NSH_IPv6NETMASK_3=0xffff +CONFIG_NSH_IPv6NETMASK_4=0xffff +CONFIG_NSH_IPv6NETMASK_5=0xffff +CONFIG_NSH_IPv6NETMASK_6=0xffff +CONFIG_NSH_IPv6NETMASK_7=0xffff +CONFIG_NSH_IPv6NETMASK_8=0x0000 +CONFIG_NSH_NOMAC=y +CONFIG_NSH_SWMAC=y +CONFIG_NSH_MACADDR=0xabcd +CONFIG_NSH_PANID=0xface +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# Telnet Configuration +# +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 # CONFIG_NSH_LOGIN is not set # CONFIG_NSH_CONSOLE_LOGIN is not set +# CONFIG_NSH_TELNET_LOGIN is not set # # NxWidgets/NxWM @@ -1368,6 +1587,8 @@ CONFIG_HAVE_CXXINITIALIZE=y # CONFIG_SYSTEM_HEX2BIN is not set # CONFIG_SYSTEM_HEXED is not set # CONFIG_SYSTEM_INSTALL is not set +# CONFIG_SYSTEM_NETDB is not set +# CONFIG_SYSTEM_NTPC is not set # CONFIG_SYSTEM_RAMTEST is not set CONFIG_READLINE_HAVE_EXTMATCH=y CONFIG_SYSTEM_READLINE=y @@ -1393,3 +1614,4 @@ CONFIG_IEEE802154_LIBUTILS=y CONFIG_IEEE802154_I8SAK=y CONFIG_IEEE802154_I8SAK_PRIORITY=100 CONFIG_IEEE802154_I8SAK_STACKSIZE=2048 +# CONFIG_WIRELESS_IWPAN is not set diff --git a/net/Kconfig b/net/Kconfig index c5f7d26117..62b5e5ae39 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -137,7 +137,7 @@ config NET_6LOWPAN select NETDEV_MULTINIC if NET_ETHERNET || NET_LOOPBACK || NET_SLIP || NET_TUN select NET_MULTILINK if NET_ETHERNET || NET_LOOPBACK || NET_SLIP || NET_TUN select NETDEV_IOCTL - depends on EXPERIMENTAL && NET_IPv6 + depends on NET_IPv6 ---help--- Enable support for IEEE 802.15.4 Low power Wireless Personal Area Networking (6LoWPAN). diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index 5ae5de0b81..d15e4f024a 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -263,7 +263,9 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Copy the source and destination addresses */ +#ifdef CONFIG_NETDEV_MULTINIC net_ipv6addr_hdrcopy(ipv6tcp.ipv6.srcipaddr, conn->u.ipv6.laddr); +#endif net_ipv6addr_hdrcopy(ipv6tcp.ipv6.destipaddr, conn->u.ipv6.raddr); ninfo("IPv6 length: %d\n", diff --git a/net/sixlowpan/sixlowpan_udpsend.c b/net/sixlowpan/sixlowpan_udpsend.c index 7036589e09..f9efd643cc 100644 --- a/net/sixlowpan/sixlowpan_udpsend.c +++ b/net/sixlowpan/sixlowpan_udpsend.c @@ -78,7 +78,7 @@ ****************************************************************************/ #ifdef CONFIG_NET_UDP_CHECKSUMS -static uint16_t sixlowpan_udp_chksum(FAR struct ipv6udp_hdr_s *ipv6udp, +static uint16_t sixlowpan_udp_chksum(FAR const struct ipv6udp_hdr_s *ipv6udp, FAR const uint8_t *buf, uint16_t buflen) { uint16_t upperlen; @@ -258,7 +258,9 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock, /* Copy the source and destination addresses */ net_ipv6addr_hdrcopy(ipv6udp.ipv6.destipaddr, to6->sin6_addr.in6_u.u6_addr16); +#ifdef CONFIG_NETDEV_MULTINIC net_ipv6addr_hdrcopy(ipv6udp.ipv6.srcipaddr, conn->u.ipv6.laddr); +#endif ninfo("IPv6 length: %d\n", ((int)ipv6udp.ipv6.len[0] << 8) + ipv6udp.ipv6.len[1]); @@ -275,7 +277,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock, ipv6udp.udp.udpchksum = 0; #ifdef CONFIG_NET_UDP_CHECKSUMS - ipv6udp.udp.udpchksum = ~sixlowpan_udp_chksum(ipv6udp, buf, buflen); + ipv6udp.udp.udpchksum = ~sixlowpan_udp_chksum(&ipv6udp, buf, buflen); if (ipv6udp.udp.udpchksum == 0) { ipv6udp.udp.udpchksum = 0xffff;