diff options
author | Sergey Ponomarev <stokito@gmail.com> | 2021-08-25 23:12:37 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-09 21:42:48 +0200 |
commit | 82c5eb8e4681ba345500e5c368fb54741bb0c450 (patch) | |
tree | c07e755a12962fab796bb06d351caa0227a3fd4c /networking/telnetd.c | |
parent | 857800c65584d544242c54eb873129c23ba20265 (diff) | |
download | busybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.tar.gz busybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.tar.bz2 busybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.zip |
httpd,telnetd: make default port configurable
BusyBox on Termux can't use ports less than 1024 it's patched to change default port for httpd to 8080 and telnetd to 8023.
https://github.com/termux/termux-packages/blob/master/packages/busybox/0011-networking-telnetd-default-port.patch
https://github.com/termux/termux-packages/blob/master/packages/busybox/0010-networking-httpd-default-port.patch
To avoid such patches we can make port configurable.
function old new delta
packed_usage 33920 33914 -6
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r-- | networking/telnetd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c index de4d733f9..581da1924 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -68,6 +68,12 @@ | |||
68 | //config: help | 68 | //config: help |
69 | //config: Selecting this will make telnetd able to run standalone. | 69 | //config: Selecting this will make telnetd able to run standalone. |
70 | //config: | 70 | //config: |
71 | //config:config FEATURE_TELNETD_PORT_DEFAULT | ||
72 | //config: int "Default port" | ||
73 | //config: default 23 | ||
74 | //config: range 1 65535 | ||
75 | //config: depends on FEATURE_TELNETD_STANDALONE | ||
76 | //config: | ||
71 | //config:config FEATURE_TELNETD_INETD_WAIT | 77 | //config:config FEATURE_TELNETD_INETD_WAIT |
72 | //config: bool "Support -w SEC option (inetd wait mode)" | 78 | //config: bool "Support -w SEC option (inetd wait mode)" |
73 | //config: default y | 79 | //config: default y |
@@ -103,7 +109,7 @@ | |||
103 | //usage: "\n -K Close connection as soon as login exits" | 109 | //usage: "\n -K Close connection as soon as login exits" |
104 | //usage: "\n (normally wait until all programs close slave pty)" | 110 | //usage: "\n (normally wait until all programs close slave pty)" |
105 | //usage: IF_FEATURE_TELNETD_STANDALONE( | 111 | //usage: IF_FEATURE_TELNETD_STANDALONE( |
106 | //usage: "\n -p PORT Port to listen on" | 112 | //usage: "\n -p PORT Port to listen on. Default "STR(CONFIG_FEATURE_TELNETD_PORT_DEFAULT) |
107 | //usage: "\n -b ADDR[:PORT] Address to bind to" | 113 | //usage: "\n -b ADDR[:PORT] Address to bind to" |
108 | //usage: "\n -F Run in foreground" | 114 | //usage: "\n -F Run in foreground" |
109 | //usage: "\n -i Inetd mode" | 115 | //usage: "\n -i Inetd mode" |
@@ -708,7 +714,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv) | |||
708 | } else { | 714 | } else { |
709 | master_fd = 0; | 715 | master_fd = 0; |
710 | if (!(opt & OPT_WAIT)) { | 716 | if (!(opt & OPT_WAIT)) { |
711 | unsigned portnbr = 23; | 717 | unsigned portnbr = CONFIG_FEATURE_TELNETD_PORT_DEFAULT; |
712 | if (opt & OPT_PORT) | 718 | if (opt & OPT_PORT) |
713 | portnbr = xatou16(opt_portnbr); | 719 | portnbr = xatou16(opt_portnbr); |
714 | master_fd = create_and_bind_stream_or_die(opt_bindaddr, portnbr); | 720 | master_fd = create_and_bind_stream_or_die(opt_bindaddr, portnbr); |