From 24689f2c761b81d2198221b7096cb6ff90f7b3ca Mon Sep 17 00:00:00 2001 From: dg Date: Tue, 1 Dec 1998 23:27:24 +0000 Subject: Added a -D option to turn on TCP_NODELAY. --- libexec/rshd/rshd.8 | 9 +++++++-- libexec/rshd/rshd.c | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'libexec') diff --git a/libexec/rshd/rshd.8 b/libexec/rshd/rshd.8 index 86041e0..acd89be 100644 --- a/libexec/rshd/rshd.8 +++ b/libexec/rshd/rshd.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)rshd.8 8.1 (Berkeley) 6/4/93 -.\" $Id: rshd.8,v 1.10 1997/12/02 12:29:56 charnier Exp $ +.\" $Id: rshd.8,v 1.11 1997/12/18 07:39:27 charnier Exp $ .\" .Dd June 4, 1993 .Dt RSHD 8 @@ -40,7 +40,7 @@ .Nd remote shell server .Sh SYNOPSIS .Nm rshd -.Op Fl alnL +.Op Fl alnDL .Sh DESCRIPTION The .Nm @@ -164,6 +164,11 @@ The use of keepalive messages allows sessions to be timed out if the client crashes or becomes unreachable. .Pp The +.Fl D +option sets the TCP_NODELAY socket option which improves performance of small back-to-back +writes at the expense of additional network traffic. +.Pp +The .Fl L option causes all successful accesses to be logged to .Xr syslogd 8 diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index da03189..1f3278a 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -42,7 +42,7 @@ static const char copyright[] = static const char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; #endif static const char rcsid[] = - "$Id: rshd.c,v 1.20 1997/12/02 12:30:04 charnier Exp $"; + "$Id: rshd.c,v 1.21 1998/05/05 00:28:51 rnordier Exp $"; #endif /* not lint */ /* @@ -61,6 +61,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -82,6 +83,7 @@ int keepalive = 1; int check_all; int log_success; /* If TRUE, log all successful accesses */ int sent_null; +int no_delay; void doit __P((struct sockaddr_in *)); void error __P((const char *, ...)); @@ -95,13 +97,13 @@ void usage __P((void)); #include #define VERSION_SIZE 9 #define SECURE_MESSAGE "This rsh session is using DES encryption for all transmissions.\r\n" -#define OPTIONS "alnkvxL" +#define OPTIONS "alnkvxDL" char authbuf[sizeof(AUTH_DAT)]; char tickbuf[sizeof(KTEXT_ST)]; int doencrypt, use_kerberos, vacuous; Key_schedule schedule; #else -#define OPTIONS "alnL" +#define OPTIONS "alnDL" #endif int @@ -143,6 +145,9 @@ main(argc, argv) break; #endif #endif + case 'D': + no_delay = 1; + break; case 'L': log_success = 1; break; @@ -182,6 +187,9 @@ main(argc, argv) if (setsockopt(0, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof (linger)) < 0) syslog(LOG_WARNING, "setsockopt (SO_LINGER): %m"); + if (no_delay && + setsockopt(0, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) + syslog(LOG_WARNING, "setsockopt (TCP_NODELAY): %m"); doit(&from); /* NOTREACHED */ return(0); -- cgit v1.1