Any single failed connection killed the whole daemon:
- A peer that resets before the accept completes (a port scanner, or a
simple "nc -z" probe) surfaces as an accept4() error such as
ECONNABORTED, which took the errout path and closed the listener.
- The per-connection error paths after a successful accept (setsockopt,
opening /dev/telnet, SIOCTELNET, opening the session device, spawning
the session) likewise exited the daemon instead of dropping the one
connection.
Either way, one bad or aborted connection and the telnet console is
dead until reboot - a trivial remote way to take out the NuttX console
on any reachable network. Verified on hardware: one "nc -zv" probe
permanently killed the listener.
Treat these as per-connection failures: drop the connection and keep
accepting. Genuinely unrecoverable accept4() errors (EBADF, ENOTSOCK,
EINVAL, EOPNOTSUPP - a bad listen socket) still exit loudly, and a
short pause on repeated transient failures avoids busy-spinning while
an interface is down. Daemon setup errors (socket/bind/listen) exit
as before.
Assisted-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ricard Rosson <ricard@groundbits.com>