NetBSD Problem Report #47584

From www@NetBSD.org  Fri Feb 22 13:54:54 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id D6AF663E500
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Feb 2013 13:54:53 +0000 (UTC)
Message-Id: <20130222135452.D983763E500@www.NetBSD.org>
Date: Fri, 22 Feb 2013 13:54:52 +0000 (UTC)
From: sdaoden@gmail.com
Reply-To: sdaoden@gmail.com
To: gnats-bugs@NetBSD.org
Subject: rlogin(1): responsiveness could be better
X-Send-Pr-Version: www-1.0

>Number:         47584
>Category:       bin
>Synopsis:       rlogin(1): responsiveness could be better
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 22 13:55:00 +0000 2013
>Closed-Date:    Mon Oct 07 07:01:36 +0000 2013
>Last-Modified:  Mon Oct 07 07:01:36 +0000 2013
>Originator:     Steffen
>Release:        6.99.16
>Organization:
>Environment:
NetBSD nhead 6.99.16 NetBSD 6.99.16 (GENERIC) #0: Mon Feb 11 21:12:26 UTC 2013  builds@b6.netbsd.org:/home/builds/ab/HEAD/amd64/201302111840Z-obj/home/builds/ab/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
Other BSD systems offer the -D flag which enables TCP_NODELAY, and that, when used, improves responsiveness massively in a normal terminal session.
>How-To-Repeat:
Use NetBSD for a rlogin(1) session in a secured private network because it's so much smaller than ssh(1).
>Fix:
I'll reply with a patch that adds -D (better than pasting here).

>Release-Note:

>Audit-Trail:
From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/47584: rlogin(1): responsiveness could be better
Date: Fri, 22 Feb 2013 15:01:19 +0100

  |>Number:         47584
  |>Category:       bin
  |>Synopsis:       rlogin(1): responsiveness could be better
  |>Description:
  |Other BSD systems offer the -D flag which enables TCP_NODELAY, and that, =
 \
  |when used, improves responsiveness massively in a normal terminal session=
 .
  |>Fix:
  |I'll reply with a patch that adds -D (better than pasting here).

 (Also cleans up some weird spacing.)

 --steffen

 diff -Napru rlogin.orig/rlogin.1 rlogin/rlogin.1
 --- rlogin.orig/rlogin.1	2013-02-22 13:37:55.000000000 +0100
 +++ rlogin/rlogin.1	2013-02-22 14:33:35.000000000 +0100
 @@ -29,7 +29,7 @@
  .\"
  .\"	@(#)rlogin.1	8.2 (Berkeley) 4/29/95
  .\"
 -.Dd July 16, 2005
 +.Dd Febuary 22, 2013
  .Dt RLOGIN 1
  .Os
  .Sh NAME
 @@ -37,20 +37,20 @@
  .Nd remote login
  .Sh SYNOPSIS
  .Nm
 -.Op Fl 468Ed
 +.Op Fl 468DdE
  .Op Fl e Ar char
  .Op Fl l Ar username
  .Op Fl p Ar port
  .Ar host
  .Nm
 -.Op Fl 468Ed
 +.Op Fl 468DdE
  .Op Fl e Ar char
  .Op Fl p Ar port
  .Ar username@host
  .Sh DESCRIPTION
  .Nm
  starts a terminal session on a remote host
 -.Ar host  .
 +.Ar host .
  .Pp
  .Nm
  first attempts to use the standard Berkeley
 @@ -69,6 +69,18 @@ option allows an eight-bit input data pa
  parity bits are stripped except when the remote side's stop and start
  characters are other than
  .Sq \&^S/^Q .
 +.It Fl D
 +Set the
 +.Dv TCP_NODELAY
 +socket option,
 +which can improve interactive responsiveness at the possible downside of
 +increased network load.
 +.It Fl d
 +The
 +.Fl d
 +option turns on socket debugging (see
 +.Xr setsockopt 2 )
 +on the TCP sockets used for communication with the remote host.
  .It Fl E
  The
  .Fl E
 @@ -76,12 +88,6 @@ option stops any character from being re
  When used with the
  .Fl 8
  option, this provides a completely transparent connection.
 -.It Fl d
 -The
 -.Fl d
 -option turns on socket debugging (see
 -.Xr setsockopt 2 )
 -on the TCP sockets used for communication with the remote host.
  .It Fl e Ar char
  The
  .Fl e
 diff -Napru rlogin.orig/rlogin.c rlogin/rlogin.c
 --- rlogin.orig/rlogin.c	2013-02-22 13:37:55.000000000 +0100
 +++ rlogin/rlogin.c	2013-02-22 13:50:42.000000000 +0100
 @@ -56,6 +56,7 @@ __RCSID("$NetBSD: rlogin.c,v 1.41 2011/0
  #include <netinet/in.h>
  #include <netinet/in_systm.h>
  #include <netinet/ip.h>
 +#include <netinet/tcp.h>
 =20
  #include <err.h>
  #include <errno.h>
 @@ -73,7 +74,6 @@ __RCSID("$NetBSD: rlogin.c,v 1.41 2011/0
 =20
  #include "getport.h"
 =20
 -
  #ifndef TIOCPKT_WINDOW
  #define	TIOCPKT_WINDOW	0x80
  #endif
 @@ -134,7 +134,7 @@ main(int argc, char *argv[])
  	struct termios tty;
  	sigset_t smask;
  	uid_t uid;
 -	int argoff, ch, dflag, one;
 +	int argoff, ch, dflag, Dflag, one;
  	int i, len, len2;
  	int family =3D AF_UNSPEC;
  	char *host, *p, *user, *name, term[1024] =3D "network";
 @@ -143,7 +143,7 @@ main(int argc, char *argv[])
  	char *service =3D NULL;
  	struct rlimit rlim;
 =20
 -	argoff =3D dflag =3D 0;
 +	argoff =3D dflag =3D Dflag =3D 0;
  	one =3D 1;
  	host =3D user =3D NULL;
  	sp =3D NULL;
 @@ -160,7 +160,7 @@ main(int argc, char *argv[])
  		argoff =3D 1;
  	}
 =20
 -#define	OPTIONS	"468dEe:l:p:"
 +#define	OPTIONS	"468DdEe:l:p:"
  	while ((ch =3D getopt(argc - argoff, argv + argoff, OPTIONS)) !=3D -1)
  		switch(ch) {
  		case '4':
 @@ -172,6 +172,9 @@ main(int argc, char *argv[])
  		case '8':
  			eight =3D 1;
  			break;
 +		case 'D':
 +			Dflag =3D 1;
 +			break;
  		case 'd':
  			dflag =3D 1;
  			break;
 @@ -258,21 +261,23 @@ main(int argc, char *argv[])
  	(void)sigaction(SIGURG, &sa, (struct sigaction *) 0);
  	sa.sa_handler =3D writeroob;
  	(void)sigaction(SIGUSR1, &sa, (struct sigaction *) 0);
 -=09
 +
  	/* don't dump core */
  	rlim.rlim_cur =3D rlim.rlim_max =3D 0;
  	if (setrlimit(RLIMIT_CORE, &rlim) < 0)
  		warn("setrlimit");
 =20
  	rem =3D rcmd_af(&host, sp->s_port, name, user, term, 0, family);
 -
 -
  	if (rem < 0)
  		exit(1);
 =20
  	if (dflag &&
  	    setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) < 0)
  		warn("setsockopt DEBUG (ignored)");
 +        if (Dflag &&
 +	    setsockopt(rem, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) < 0)
 +		warn("setsockopt NODELAY (ignored)");
 +
      {
  	struct sockaddr_storage ss;
  	socklen_t sslen;
 @@ -471,14 +476,14 @@ writer(void)
  				continue;
  			}
  			if (c !=3D escapechar) {
 -					(void)write(rem, &escapechar, 1);
 +				(void)write(rem, &escapechar, 1);
  			}
  		}
 =20
 -			if (write(rem, &c, 1) =3D=3D 0) {
 -				msg("line gone");
 -				break;
 -			}
 +		if (write(rem, &c, 1) =3D=3D 0) {
 +			msg("line gone");
 +			break;
 +		}
 =20
  		bol =3D CCEQ(deftty.c_cc[VKILL], c) ||
  		    CCEQ(deftty.c_cc[VEOF], c) ||
 @@ -559,7 +564,7 @@ sendwindow(void)
  	wp->ws_xpixel =3D htons(winsize.ws_xpixel);
  	wp->ws_ypixel =3D htons(winsize.ws_ypixel);
 =20
 -		(void)write(rem, obuf, sizeof(obuf));
 +	(void)write(rem, obuf, sizeof(obuf));
  }
 =20
  /*
 @@ -689,8 +694,7 @@ reader(sigset_t *smask)
  		rcvcnt =3D 0;
  		rcvstate =3D READING;
 =20
 -			rcvcnt =3D read(rem, rcvbuf, sizeof (rcvbuf));
 -
 +		rcvcnt =3D read(rem, rcvbuf, sizeof (rcvbuf));
  		if (rcvcnt =3D=3D 0)
  			return (0);
  		if (rcvcnt < 0) {
 @@ -759,7 +763,6 @@ msg(const char *str)
  	(void)fprintf(stderr, "rlogin: %s\r\n", str);
  }
 =20
 -
  static void
  usage(void)
  {

From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/47584: rlogin(1): responsiveness could be better
Date: Sat, 02 Mar 2013 13:27:38 +0100

 Steffen "Daode" Nurpmeso <sdaoden@gmail.com> wrote:
  |The following reply was made to PR bin/47584; it has been noted by GNATS.
  ||I'll reply with a patch that adds -D (better than pasting here).

 Is noone interested?  This is a good thing i'd commit myself;
 i would even say it's a pain to use rlogin(1) without it!

 --steffen

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47584 CVS commit: src/usr.bin/rlogin
Date: Sat, 2 Mar 2013 11:35:18 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Mar  2 16:35:18 UTC 2013

 Modified Files:
 	src/usr.bin/rlogin: rlogin.1 rlogin.c

 Log Message:
 PR/47584: Steffen Daoden: Add option to turn off Nagle to rlogin


 To generate a diff of this commit:
 cvs rdiff -u -r1.25 -r1.26 src/usr.bin/rlogin/rlogin.1
 cvs rdiff -u -r1.41 -r1.42 src/usr.bin/rlogin/rlogin.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 07:01:36 +0000
State-Changed-Why:
Christos committed it in March.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.