- (djm) OpenBSD CVS Sync

- stevesk@cvs.openbsd.org 2002/01/24 21:09:25
     [channels.c misc.c misc.h packet.c]
     add set_nodelay() to set TCP_NODELAY on a socket (prep for nagle tuning).
     no nagle changes just yet; ok djm@ markus@
This commit is contained in:
Damien Miller 2002-02-05 11:52:13 +11:00
parent 1e2c600892
commit 398e1cfa23
5 changed files with 31 additions and 18 deletions

View File

@ -1,3 +1,11 @@
20020205
- (djm) OpenBSD CVS Sync
- stevesk@cvs.openbsd.org 2002/01/24 21:09:25
[channels.c misc.c misc.h packet.c]
add set_nodelay() to set TCP_NODELAY on a socket (prep for nagle tuning).
no nagle changes just yet; ok djm@ markus@
20020130 20020130
- (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
- (tim) [configure.ac] fix logic on when ssh-rand-helper is installed. - (tim) [configure.ac] fix logic on when ssh-rand-helper is installed.
@ -7399,4 +7407,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1798 2002/01/31 06:14:03 tim Exp $ $Id: ChangeLog,v 1.1799 2002/02/05 00:52:13 djm Exp $

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.161 2002/01/21 23:27:10 markus Exp $"); RCSID("$OpenBSD: channels.c,v 1.162 2002/01/24 21:09:25 stevesk Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -986,7 +986,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
{ {
Channel *nc; Channel *nc;
struct sockaddr addr; struct sockaddr addr;
int newsock, on = 1; int newsock;
socklen_t addrlen; socklen_t addrlen;
char buf[16384], *remote_ipaddr; char buf[16384], *remote_ipaddr;
int remote_port; int remote_port;
@ -1004,10 +1004,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
error("accept: %.100s", strerror(errno)); error("accept: %.100s", strerror(errno));
return; return;
} }
if (setsockopt(newsock, IPPROTO_TCP, TCP_NODELAY, &on, set_nodelay(newsock);
sizeof on) == -1)
error("setsockopt TCP_NODELAY: %.100s",
strerror(errno));
remote_ipaddr = get_peer_ipaddr(newsock); remote_ipaddr = get_peer_ipaddr(newsock);
remote_port = get_peer_port(newsock); remote_port = get_peer_port(newsock);
snprintf(buf, sizeof buf, "X11 connection from %.200s port %d", snprintf(buf, sizeof buf, "X11 connection from %.200s port %d",
@ -2495,7 +2492,7 @@ connect_local_xsocket(u_int dnr)
int int
x11_connect_display(void) x11_connect_display(void)
{ {
int display_number, sock = 0, on = 1; int display_number, sock = 0;
const char *display; const char *display;
char buf[1024], *cp; char buf[1024], *cp;
struct addrinfo hints, *ai, *aitop; struct addrinfo hints, *ai, *aitop;
@ -2583,8 +2580,7 @@ x11_connect_display(void)
strerror(errno)); strerror(errno));
return -1; return -1;
} }
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1) set_nodelay(sock);
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
return sock; return sock;
} }

15
misc.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.14 2001/12/19 07:18:56 deraadt Exp $ */ /* $OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $ */
/* /*
* Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2000 Markus Friedl. All rights reserved.
@ -25,7 +25,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: misc.c,v 1.14 2001/12/19 07:18:56 deraadt Exp $"); RCSID("$OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $");
#include "misc.h" #include "misc.h"
#include "log.h" #include "log.h"
@ -92,6 +92,17 @@ unset_nonblock(int fd)
fd, strerror(errno)); fd, strerror(errno));
} }
/* disable nagle on socket */
void
set_nodelay(int fd)
{
int on = 1;
debug("fd %d setting TCP_NODELAY", fd);
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
}
/* Characters considered whitespace in strsep calls. */ /* Characters considered whitespace in strsep calls. */
#define WHITESPACE " \t\r\n" #define WHITESPACE " \t\r\n"

3
misc.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.h,v 1.10 2001/06/26 17:27:24 markus Exp $ */ /* $OpenBSD: misc.h,v 1.11 2002/01/24 21:09:25 stevesk Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -16,6 +16,7 @@ char *chop(char *);
char *strdelim(char **); char *strdelim(char **);
void set_nonblock(int); void set_nonblock(int);
void unset_nonblock(int); void unset_nonblock(int);
void set_nodelay(int);
int a2port(const char *); int a2port(const char *);
char *cleanhostname(char *); char *cleanhostname(char *);
char *colon(char *); char *colon(char *);

View File

@ -37,7 +37,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: packet.c,v 1.85 2002/01/18 18:14:17 stevesk Exp $"); RCSID("$OpenBSD: packet.c,v 1.86 2002/01/24 21:09:25 stevesk Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "buffer.h" #include "buffer.h"
@ -1191,7 +1191,6 @@ packet_set_interactive(int interactive)
int lowdelay = IPTOS_LOWDELAY; int lowdelay = IPTOS_LOWDELAY;
int throughput = IPTOS_THROUGHPUT; int throughput = IPTOS_THROUGHPUT;
#endif #endif
int on = 1;
if (called) if (called)
return; return;
@ -1219,9 +1218,7 @@ packet_set_interactive(int interactive)
strerror(errno)); strerror(errno));
} }
#endif #endif
if (setsockopt(connection_in, IPPROTO_TCP, TCP_NODELAY, (void *) &on, set_nodelay(connection_in);
sizeof(on)) < 0)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
} else if (packet_connection_is_ipv4()) { } else if (packet_connection_is_ipv4()) {
/* /*
* Set IP options for a non-interactive connection. Use * Set IP options for a non-interactive connection. Use