Age | Commit message (Collapse) | Author |
|
After a network outage, a long-running telnetd was spinning trying to
read from a socket that was in TIME_WAIT. It's easy to reproduce this by
using the regular telnet client and typing ^]^D to exit abruptly.
I don't think these sockets should ever have been non-blocking, and we
want to give up on the client if we hit EOF. All of this needs
rewriting to be less complicated (and not use select(2)), but this seems
to be a minimal fix for the spin without harming normal usage (where by
"usage" I mean "testing the telnet client").
|
|
Handling utmp is login's job: telnetd should just pass the appropriate
option to login.
(I was investigating a different bug that caused telnetd to take 100%
CPU after a network outage and noticed an unexpected utmp fd. It turned
out to not be relevant to my actual problem, but it did remind me that
this utmp code isn't right in small details like that, but also in the
bigger picture: it's writing the wrong information, and only on logout,
not login. But rather than try to fix it, let's just let login do its
job.)
|
|
Noticed while using telnetd to manually test some telnet fixes: telnetd
would sometimes exit when I'd disconnect because it couldn't find pid 0
on its list of sessions.
I've not seen obscure exits because select() times out, but I've also
changed that `return` to an error_exit() so we'll at least know what's
happened if that ever occurs.
Also use <arpa/telnet.h> rather than manually #define'ing its constants,
use the FLAG() macro throughout, and xsetsockopt(). Don't pointlessly
set errno to 0 at the start of main and then never look at it again.
|
|
|
|
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room
for new xbind/xconnect that are more like 'x' versions of the regular
bind and connect. Move explicit bind/connect callers over to
xbind/xconnect.
Of the affected commands, only netcat is actually used by Android. It
was the most recent patch to netcat that made the lack of a more
traditional xbind/xconnect apparent.
|
|
|
|
Android is missing all of these; we need to probe for some so we have
a config symbol to depend on.
sethostname() is easily replaced.
We got termios.h via pty.h; now it's not included in configure-step tools,
so we need termios.h to generate globals.
|
|
|
|
where a SIGCHLD could get lost.
|
|
|