Serious telnetd/rlogin/telnet performance bug

Stephen Hemminger steveh at hammer.UUCP
Sat Apr 19 04:12:34 AEST 1986


In article <380 at quest.UUCP> stuart at quest.UUCP (Stuart Levy ) writes:
>
>I think the main problem with telnetd is not inefficiencies
>in the kernel interface, pty code, and so on.
>Any telnetd which uses select() and non-blocking I/O, as 4.2 and presumably
>4.1c telnetd do, faces a serious performance problem.
>So also do rlogin and user telnet on at least 4.2.
>So, for that matter, will any program which uses select() to determine
>when to attempt non-blocking write()'s.
>
>The REAL way to fix this problem would be to redefine non-blocking
>I/O, I think, to make it possible to indicate a partial read or write
>accompanied by an error, such as EWOULDBLOCK or EINTR.
>Then the problematic case of a terminal read interrupted by a signal,
>where some data had already been transferred, and of this non-blocking
>write where some but not all data could be transferred,
>could be handled neatly.

If you make the simple change (done from 4.2 to 4.3) all these problems
go away.

In <sys/socketvar.h>
Wrong (4.2)
-------
/* do we have to send all at once on a socket? */
#define	sosendallatonce(so) \
    (((so)->so_state & SS_NBIO) || ((so)->so_proto->pr_flags & PR_ATOMIC))
-------
Correct (4.3)
-------
/* do we have to send all at once on a socket? */
#define	sosendallatonce(so) \
    ((so)->so_proto->pr_flags & PR_ATOMIC)
------


Fix this and rebuild your kernel and this problem goes away.

write on a non-blocking socket will do a partial write (unless it is atomic)
-- 
  Stephen Hemminger		{ihnp4,decvax,ucbvax}!tektronix!hammer!steveh
  Tektronix GWD Networking	(503)685-2103
  



More information about the Comp.bugs.4bsd.ucb-fixes mailing list