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

@ -47,6 +47,7 @@
#include <signal.h>
#include <time.h>
#include <sys/socket.h>
#include <netinet/in.h>
/****************************************************************************
@ -113,9 +114,9 @@
typedef FAR void *SESSION;
/* This structure provides information to connect to a host FTP server.
/* This union provides information to connect to a host FTP server.
*
* addr - The IPv4 address of the FTP server (or the proxy) for the FTP
* addr - The IPv4 or IPv6 address of the FTP server (or the proxy) for the FTP
* server.
* port - The port number on the FTP server to connect to (in host byte
* order). This is usually port 21 for FTP. You may set this
@ -123,10 +124,17 @@ typedef FAR void *SESSION;
* you (it will use CONFIG_FTP_DEFPORT).
*/
struct ftpc_connect_s
union ftpc_sockaddr_u
{
struct in_addr addr; /* Server/proxy IP address */
uint16_t port; /* Server/proxy port number (usually 21) in network order */
uint8_t raw[sizeof(struct sockaddr_storage)];
struct sockaddr_storage ss;
struct sockaddr sa;
#ifdef CONFIG_NET_IPv6
struct sockaddr_in6 in6;
#endif
#ifdef CONFIG_NET_IPv4
struct sockaddr_in in4;
#endif
};
/* This structure provides FTP login information */
@ -177,7 +185,7 @@ extern "C"
****************************************************************************/
/* Connection management ****************************************************/
SESSION ftpc_connect(FAR struct ftpc_connect_s *server);
SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server);
void ftpc_disconnect(SESSION handle);
/* FTP commands *************************************************************/

View file

@ -135,7 +135,8 @@ extern "C"
* used to run the server.
*
* Input Parameters:
* None
* family - The type of INET family to use when opening the socket. AF_INET
* and AF_INET6 are supported.
*
* Returned Value:
* On success, a non-NULL handle is returned that can be used to reference
@ -143,7 +144,7 @@ extern "C"
*
****************************************************************************/
FTPD_SESSION ftpd_open(void);
FTPD_SESSION ftpd_open(sa_family_t family);
/****************************************************************************
* Name: ftpd_adduser