From d6c56e7105c5a99f4afac09f831cee11c8633baa Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Mon, 3 Apr 2023 16:21:13 +0800 Subject: [PATCH] driver/telnet: Remove TELNET_CHARACTER_MODE If TELNET_CHARACTER_MODE is set, the ECHO must be handled by the telnet server. So this option is useless. We need a new approach to control the ECHO behavior. Signed-off-by: Huang Qi --- .../lc823450-xgevk/configs/bt/defconfig | 1 - .../lc823450-xgevk/configs/krndis/defconfig | 1 - .../lc823450-xgevk/configs/rndis/defconfig | 1 - .../sim/sim/sim/configs/tcpblaster/defconfig | 1 - .../esp32-audio-kit/configs/audio/defconfig | 1 - .../esp32-audio-kit/configs/wifi/defconfig | 1 - .../esp32-devkitc/configs/audio/defconfig | 1 - .../esp32-devkitc/configs/blewifi/defconfig | 1 - .../esp32-devkitc/configs/efuse/defconfig | 1 - .../esp32-devkitc/configs/nxlooper/defconfig | 1 - .../esp32-devkitc/configs/wifi/defconfig | 1 - .../esp32/esp32-lyrat/configs/audio/defconfig | 1 - .../esp32/esp32-lyrat/configs/wifi/defconfig | 1 - drivers/net/Kconfig | 8 ---- drivers/net/telnet.c | 39 ++++--------------- 15 files changed, 7 insertions(+), 53 deletions(-) diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/bt/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/bt/defconfig index a91c18d3d5..6e9c11e211 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/bt/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/bt/defconfig @@ -145,7 +145,6 @@ CONFIG_SYSTEM_SYSTEM=y CONFIG_SYSTEM_TASKSET=y CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_TESTING_SMP=y diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig index 95bc96c44e..0140754590 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig @@ -171,7 +171,6 @@ CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_RXBUFSIZE=512 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/rndis/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/rndis/defconfig index a3f3a83399..af3b2275ed 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/rndis/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/rndis/defconfig @@ -172,7 +172,6 @@ CONFIG_SYSTEM_SYSTEM=y CONFIG_SYSTEM_TASKSET=y CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_TESTING_SMP=y diff --git a/boards/sim/sim/sim/configs/tcpblaster/defconfig b/boards/sim/sim/sim/configs/tcpblaster/defconfig index 46d29f78b9..9fe7662145 100644 --- a/boards/sim/sim/sim/configs/tcpblaster/defconfig +++ b/boards/sim/sim/sim/configs/tcpblaster/defconfig @@ -113,7 +113,6 @@ CONFIG_SYSTEM_SYSTEM=y CONFIG_SYSTEM_TELNET_CLIENT=y CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=32 -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TELNET_TXBUFFER_SIZE=64 CONFIG_TTY_SIGINT=y CONFIG_TTY_SIGINT_CHAR=0x3 diff --git a/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig b/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig index 8ce0811cd8..44f1ba3ff7 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig +++ b/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig @@ -112,7 +112,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-audio-kit/configs/wifi/defconfig b/boards/xtensa/esp32/esp32-audio-kit/configs/wifi/defconfig index 6ff6b8c758..a2e91de2d3 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/configs/wifi/defconfig +++ b/boards/xtensa/esp32/esp32-audio-kit/configs/wifi/defconfig @@ -82,7 +82,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_STACKMONITOR=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/audio/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/audio/defconfig index 8fbc8481b3..baaabf67bd 100644 --- a/boards/xtensa/esp32/esp32-devkitc/configs/audio/defconfig +++ b/boards/xtensa/esp32/esp32-devkitc/configs/audio/defconfig @@ -117,7 +117,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/blewifi/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/blewifi/defconfig index ec2b42fd80..35012de689 100644 --- a/boards/xtensa/esp32/esp32-devkitc/configs/blewifi/defconfig +++ b/boards/xtensa/esp32/esp32-devkitc/configs/blewifi/defconfig @@ -142,7 +142,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_TELNETD=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/efuse/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/efuse/defconfig index 3f847f4a3c..395432e886 100644 --- a/boards/xtensa/esp32/esp32-devkitc/configs/efuse/defconfig +++ b/boards/xtensa/esp32/esp32-devkitc/configs/efuse/defconfig @@ -94,7 +94,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_STACKMONITOR=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig index 9817112f82..c76afce602 100644 --- a/boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig +++ b/boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig @@ -119,7 +119,6 @@ CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NXLOOPER=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/wifi/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/wifi/defconfig index 0cc0d9a5ea..5f322498fb 100644 --- a/boards/xtensa/esp32/esp32-devkitc/configs/wifi/defconfig +++ b/boards/xtensa/esp32/esp32-devkitc/configs/wifi/defconfig @@ -82,7 +82,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_STACKMONITOR=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig index a7bf4aafe5..17c49d786e 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig @@ -116,7 +116,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/wifi/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/wifi/defconfig index 790ed9c53c..09bd613d23 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/wifi/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/wifi/defconfig @@ -82,7 +82,6 @@ CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_STACKMONITOR=y -CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TLS_TASK_NELEM=4 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WIRELESS=y diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a8fe30d9d9..b8c855083a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -73,14 +73,6 @@ config TELNET_MAXLCLIENTS number. This limitation is somewhat artificial since it only determines the size of a fixed-size, preallocated, internal array. -config TELNET_CHARACTER_MODE - bool "Character mode" - default n - ---help--- - The Telnet daemon works in character mode. In this case, the daemon - will echo a character which telnet client sent. By default, it works - in line mode. - config TELNET_SUPPORT_NAWS bool "Support NAWS (Negotiate About Window Size)" default n diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 5176ee0457..1a77e29d00 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -311,18 +311,11 @@ static void telnet_getchar(FAR struct telnet_dev_s *priv, uint8_t ch, { register int index; -#ifndef CONFIG_TELNET_CHARACTER_MODE - /* Ignore carriage returns */ + /* Add all characters to the destination buffer */ - if (ch != TELNET_CR) -#endif - { - /* Add all other characters to the destination buffer */ - - index = *nread; - dest[index++] = ch; - *nread = index; - } + index = *nread; + dest[index++] = ch; + *nread = index; } /**************************************************************************** @@ -420,25 +413,12 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, break; case STATE_DO: -#ifdef CONFIG_TELNET_CHARACTER_MODE - if (ch == TELNET_SGA || ch == TELNET_ECHO) - { - /* If it received 'ECHO' or 'Suppress Go Ahead', then do - * nothing. - */ - } - else - { - /* Reply with a WONT */ - telnet_sendopt(priv, TELNET_WONT, ch); - ninfo("WONT: 0x%02X\n", ch); - } -#else - /* Reply with a WONT */ + /* FIXME: Handle ECHO and SGA setting here + * Used to disable ECHO password in login nsh via telnet + */ telnet_sendopt(priv, TELNET_WONT, ch); -#endif priv->td_state = STATE_NORMAL; break; @@ -1001,11 +981,6 @@ static int telnet_session(FAR struct telnet_session_s *session) telnet_sendopt(priv, TELNET_DO, TELNET_NAWS); #endif -#ifdef CONFIG_TELNET_CHARACTER_MODE - telnet_sendopt(priv, TELNET_WILL, TELNET_SGA); - telnet_sendopt(priv, TELNET_WILL, TELNET_ECHO); -#endif - /* Save ourself in the list of Telnet client threads */ g_telnet_clients[priv->td_minor] = priv;