summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2002-02-24 19:59:43 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2002-02-24 19:59:43 +0000
commite9457b687d19ead08556a374576390b130faae2a (patch)
tree7af97572ddd77f0ee0776635ddd4e4943f0f052c /usr.bin/ssh
parent7a6dbd92b72d614832cb5d825abb6f5f11883b36 (diff)
disable Nagle in connect_to() and channel_post_port_listener() (port
forwarding endpoints). the intention is to preserve the on-the-wire appearance to applications at either end; the applications can then enable TCP_NODELAY according to their requirements. ok markus@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/channels.c4
-rw-r--r--usr.bin/ssh/misc.c18
2 files changed, 17 insertions, 5 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 2daa37aeb8d..abe83e0ca9c 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.168 2002/02/14 23:27:59 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.169 2002/02/24 19:59:42 stevesk Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1116,6 +1116,7 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)
error("accept: %.100s", strerror(errno));
return;
}
+ set_nodelay(newsock);
nc = channel_new(rtype,
nextstate, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket,
@@ -2264,6 +2265,7 @@ connect_to(const char *host, u_short port)
return -1;
}
/* success */
+ set_nodelay(sock);
return sock;
}
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index a5447b4dacd..478e66ce5ca 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $ */
+/* $OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $");
+RCSID("$OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $");
#include "misc.h"
#include "log.h"
@@ -96,10 +96,20 @@ unset_nonblock(int fd)
void
set_nodelay(int fd)
{
- int on = 1;
+ int opt, optlen;
+ optlen = sizeof opt;
+ if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) {
+ error("getsockopt TCP_NODELAY: %.100s", strerror(errno));
+ return;
+ }
+ if (opt == 1) {
+ debug2("fd %d is TCP_NODELAY", fd);
+ return;
+ }
+ opt = 1;
debug("fd %d setting TCP_NODELAY", fd);
- if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1)
+ if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
}