Merged in antmerlino/apps/ftp-ipv6 (pull request #122)

FTP: Adds support for IPv6 and fixes various transfer issues

* netutils/ftpd: Fix support for IPv6 FTP server

* netutils/ftpc:Adds support for IPv6 sockets

* ftpc: Must convert port received by EPSV reply to network order

* ftpc: Data socket address for passive connection should be same as server address

* ftpc: Must skip human readable string in EPSV response before scanning for port

* ftpc: Don't send PASS command if USER command was sufficient. ie no password required

* ftpc: Generically handle permanent negative completion in shard ftpc_cmd logic

* ftpc: Minor addresssing fix

* ftpc: Tweak logic for overriding network debugging output

* FTP: Adds option for setting stack size of various threads in FTPD and FTPC

* netutils/ftpd: Fixes build error setting IPv4 address. sin_addr => sin_addr.s_addr

* netutils/ftpd: Protects against partial write returns by looping in that case

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino
2017-11-06 23:41:30 +00:00
committed by Gregory Nutt
parent efd1279025
commit f489bcd6f9
22 changed files with 630 additions and 195 deletions

View File

@@ -10,4 +10,9 @@ config EXAMPLES_FTPD
Enable the FTP server example
if EXAMPLES_FTPD
config EXAMPLES_FTPD_STACKSIZE
int "FTP Daemon Stack Size"
default 2048
endif

View File

@@ -37,7 +37,7 @@
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Hello, World! Example
CONFIG_EXAMPLES_FTPD_STACKSIZE ?= 2048
ASRCS =
CSRCS =
@@ -109,10 +109,10 @@ endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_main)
$(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,$(CONFIG_EXAMPLES_FTPD_STACKSIZE),ftpd_main)
$(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop)
$(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,$(CONFIG_EXAMPLES_FTPD_STACKSIZE),ftpd_stop)
context: $(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat $(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat
else

View File

@@ -51,6 +51,20 @@
#include "ftpd.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* If FTP is used and both IPv6 and IPv4 are enabled, then we need to
* pick one.
*/
#ifdef CONFIG_NET_IPv6
# define ADDR_FAMILY AF_INET6
#else
# define ADDR_FAMILY AF_INET
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@@ -167,7 +181,12 @@ int ftpd_daemon(int s_argc, char **s_argv)
/* Open FTPD */
handle = ftpd_open();
#if ADDR_FAMILY == AF_INET6
handle = ftpd_open(AF_INET6);
#else
handle = ftpd_open(AF_INET);
#endif
if (!handle)
{
printf("FTP daemon [%d] failed to open FTPD\n", g_ftpdglob.pid);