mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-17 18:28:31 +00:00
netutils/telnetd and users of telnetd: Add support for IPv6.
This commit is contained in:
parent
98204bad94
commit
28415d662b
9 changed files with 132 additions and 37 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* apps/examples/cc3000/shell.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* This is a leverage of similar logic from uIP:
|
||||
|
|
@ -217,6 +217,7 @@ int shell_main(int argc, char *argv[])
|
|||
/* Configure the telnet daemon */
|
||||
|
||||
config.d_port = HTONS(23);
|
||||
config.d_family = AF_INET;
|
||||
config.d_priority = CONFIG_EXAMPLES_TELNETD_DAEMONPRIO;
|
||||
config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE;
|
||||
config.t_priority = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,16 @@
|
|||
# undef CONFIG_NSH_TELNET
|
||||
#endif
|
||||
|
||||
/* If Telnet 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 Types
|
||||
****************************************************************************/
|
||||
|
|
@ -160,7 +170,7 @@ int nsh_main(int argc, char *argv[])
|
|||
*/
|
||||
|
||||
#if defined(CONFIG_NSH_TELNET) && !defined(CONFIG_NSH_NETLOCAL)
|
||||
ret = nsh_telnetstart();
|
||||
ret = nsh_telnetstart(ADDR_FAMILY);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* The daemon is NOT running. Report the error then fail...
|
||||
|
|
|
|||
|
|
@ -71,6 +71,26 @@
|
|||
|
||||
#include "nxterm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The NSH telnet console requires networking support (and TCP/IP) */
|
||||
|
||||
#ifndef CONFIG_NET
|
||||
# undef CONFIG_NSH_TELNET
|
||||
#endif
|
||||
|
||||
/* If Telnet 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
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
|
@ -234,7 +254,7 @@ int nxterm_main(int argc, char **argv)
|
|||
*/
|
||||
|
||||
#ifdef CONFIG_NSH_TELNET
|
||||
ret = nsh_telnetstart();
|
||||
ret = nsh_telnetstart(ADDR_FAMILY);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* The daemon is NOT running. Report the error then fail...
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* examples/telnetd/telnetd.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* This is a leverage of similar logic from uIP:
|
||||
|
|
@ -53,10 +53,6 @@
|
|||
|
||||
#include "telnetd.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
|
@ -247,6 +243,7 @@ int telnetd_main(int argc, char *argv[])
|
|||
/* Configure the telnet daemon */
|
||||
|
||||
config.d_port = HTONS(23);
|
||||
config.d_family = AF_INET;
|
||||
config.d_priority = CONFIG_EXAMPLES_TELNETD_DAEMONPRIO;
|
||||
config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE;
|
||||
config.t_priority = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue