Skip to content

Commit

Permalink
Merge pull request #97 from rigid/patch-1
Browse files Browse the repository at this point in the history
set default telnet parameters via kconfig
  • Loading branch information
nekromant authored Apr 14, 2018
2 parents 7846382 + 6d01a8b commit 7909483
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions configs/config_default
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ CONFIG_ENV_DEFAULT_STATION_GW="192.168.0.1"
CONFIG_ENV_DEFAULT_AP_IP="192.168.1.1"
CONFIG_ENV_DEFAULT_AP_MASK="255.255.255.0"
CONFIG_ENV_DEFAULT_AP_GW="192.168.1.1"
CONFIG_ENV_DEFAULT_TELNET_AUTOSTART=n
CONFIG_ENV_DEFAULT_TELNET_PORT=23
CONFIG_ENV_DEFAULT_TELNET_DROP=60
# CONFIG_ENABLE_SECOND_UART is not set
CONFIG_ENABLE_BANNER=y
18 changes: 17 additions & 1 deletion kcnf
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,25 @@ endif
config SERVICE_TCP
bool "TCP/IP services"

config SERVICE_TELNET
menuconfig SERVICE_TELNET
bool "Telnet Service"
depends on SERVICE_TCP
help
Provides a commandline interface via telnet.

if SERVICE_TELNET
config ENV_DEFAULT_TELNET_AUTOSTART
bool "always run telnet server after boot"
default n

config ENV_DEFAULT_TELNET_PORT
int "TCP port to bind to"
default 23

config ENV_DEFAULT_TELNET_DROP
int "Drop connection after this many seconds of inactivity"
default 60
endif

config SERVICE_ECHO
bool "Echo Service"
Expand Down
6 changes: 3 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const struct envpair defaultenv[] = {
#endif
#if defined(CONFIG_SERVICE_TELNET)
/* Note: modules requiring their own config might be able to have a 'registration' struct that adds to here */
{ "telnet-port", "23" },
{ "telnet-autostart", "0" },
{ "telnet-drop", "60" },
{ "telnet-port", EXPAND_AND_QUOTE(CONFIG_ENV_DEFAULT_TELNET_PORT) },
{ "telnet-autostart", EXPAND_AND_QUOTE(CONFIG_ENV_DEFAULT_TELNET_AUTOSTART) },
{ "telnet-drop", EXPAND_AND_QUOTE(CONFIG_ENV_DEFAULT_TELNET_DROP) },
#endif
#if defined(CONFIG_CMD_TFTP)
{ "tftp-server", CONFIG_ENV_DEFAULT_TFTP_SERVER_IP},
Expand Down

0 comments on commit 7909483

Please sign in to comment.