From 8d34651b6c76da47148db090fc1423cc222798e5 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Wed, 3 May 1995 06:25:56 +0000 Subject: [PATCH] Added a "-D" option to set the TCP_NODELAY socket option. --- usr.bin/rlogin/rlogin.1 | 7 ++++++- usr.bin/rlogin/rlogin.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr.bin/rlogin/rlogin.1 b/usr.bin/rlogin/rlogin.1 index 60da3cc07beb..8f4453a31be6 100644 --- a/usr.bin/rlogin/rlogin.1 +++ b/usr.bin/rlogin/rlogin.1 @@ -39,7 +39,7 @@ .Nd remote login .Sh SYNOPSIS .Ar rlogin -.Op Fl 8EKLdx +.Op Fl 8DEKLdx .Op Fl e Ar char .Op Fl k Ar realm .Op Fl l Ar username @@ -63,6 +63,11 @@ option allows an eight-bit input data path at all times; otherwise parity bits are stripped except when the remote side's stop and start characters are other than ^S/^Q . +.It Fl D +The +.Fl D +option sets the TCP_NODELAY socket option which can improve interactive response +at the expense of increased network load. .It Fl E The .Fl E diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index d9379c2550ed..bdd60a311e5f 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93"; #include #include #include +#include #include #include @@ -150,10 +151,10 @@ main(argc, argv) struct servent *sp; struct sgttyb ttyb; long omask; - int argoff, ch, dflag, one, uid; + int argoff, ch, dflag, Dflag, one, uid; char *host, *p, *user, term[1024]; - argoff = dflag = 0; + argoff = dflag = Dflag = 0; one = 1; host = user = NULL; @@ -172,15 +173,18 @@ main(argc, argv) } #ifdef KERBEROS -#define OPTIONS "8EKLde:k:l:x" +#define OPTIONS "8DEKLde:k:l:x" #else -#define OPTIONS "8EKLde:l:" +#define OPTIONS "8DEKLde:l:" #endif while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != EOF) switch(ch) { case '8': eight = 1; break; + case 'D': + Dflag = 1; + break; case 'E': noescape = 1; break; @@ -337,6 +341,10 @@ try_connect: setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) < 0) (void)fprintf(stderr, "rlogin: setsockopt: %s.\n", strerror(errno)); + if (Dflag && + setsockopt(rem, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) < 0) + perror("rlogin: setsockopt NODELAY (ignored)"); + one = IPTOS_LOWDELAY; if (setsockopt(rem, IPPROTO_IP, IP_TOS, (char *)&one, sizeof(int)) < 0) perror("rlogin: setsockopt TOS (ignored)");