Added a -D option to turn on TCP_NODELAY.

This commit is contained in:
David Greenman 1998-12-01 23:27:24 +00:00
parent 822ef72a9d
commit 45166d95d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41445
2 changed files with 18 additions and 5 deletions

View File

@ -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

View File

@ -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 <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
@ -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 <krb.h>
#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);