Client connections and telnetd (-K flag?)
Magnus Carlsson
grimmymail at gmail.com
Tue Nov 23 08:19:20 UTC 2010
Hi
I have encountered a little problem with busybox telnetd that I hope
someone can shed a little light on.
If I connect several telnet clients to the system I can't exit them in
any order.
A connects
B connects
A exits (this "session" will hang)
B exits (both "sessions" will end)
Another way to put it (I think):
Running:
sleep 10 & exit
will wait 10 seconds before the exit
I use BusyBox 1.13.3 on an embedded system (mipsel), running telnetd
it from within inittab.
busybox config file:
...
CONFIG_TELNET=y
CONFIG_FEATURE_TELNET_TTYPE=y
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
CONFIG_TELNETD=y
CONFIG_FEATURE_TELNETD_STANDALONE=y
...
I have read through the mail conversation that seems to have triggered
the -K flag:
http://lists.busybox.net/pipermail/busybox/2007-October/063090.html
So I added the -K flag to inittab
::wait:/usr/sbin/telnetd -K
But I still get the same behaviour, maybe there is a small change in
that before the -K I got a newline after I typed exit and pressed
return. With -K it simply hangs directly after exit.
listing filedescriptors
/ # ls -l /proc/423/fd/
lrwx------ 1 0 0 64 Nov 22 11:00 0 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 1 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 2 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 3 -> socket:[645]
lrwx------ 1 0 0 64 Nov 22 11:00 4 -> socket:[508752]
lrwx------ 1 0 0 64 Nov 22 11:00 5 -> /dev/ptmx
lrwx------ 1 0 0 64 Nov 22 11:00 6 -> socket:[508964]
lrwx------ 1 0 0 64 Nov 22 11:00 7 -> /dev/ptmx
=== Here I exit the session connected to socket:[508752]
/ # ls -l /proc/423/fd/
lrwx------ 1 0 0 64 Nov 22 11:00 0 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 1 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 2 -> /dev/null
lrwx------ 1 0 0 64 Nov 22 11:00 3 -> socket:[645]
lrwx------ 1 0 0 64 Nov 22 11:00 6 -> socket:[508964]
lrwx------ 1 0 0 64 Nov 22 11:00 7 -> /dev/ptmx
/ #
Looking with ps the associated shell process seems to die:
Before exiting:
2185 0 1244 S sh
2186 0 1248 S sh
After:
2186 0 1248 S sh
The ps we are running doesn't support any flags so I can't give you -a
-o output.
So to me it looks like the child process has died and associated
sockets have gone but there seems to be something that still holds the
connection open.
I have tested to use telnet clients from Fedora 13 and Ubuntu 10.10.
--
Magnus Carlsson
More information about the busybox
mailing list