diff options
author | 2001-01-13 18:32:50 +0000 | |
---|---|---|
committer | 2001-01-13 18:32:50 +0000 | |
commit | f80ca8c438df6aae9de126b6e620b22dea21dd19 (patch) | |
tree | 8cd31dc75b822893c98618f8009ce929d8f0c99b /usr.bin/ssh/sshconnect.c | |
parent | enable kerberos passwd auth in ssh2, use k_setpag; ok hin, dugsong, from ksulliva@psc.edu (diff) | |
download | wireguard-openbsd-f80ca8c438df6aae9de126b6e620b22dea21dd19.tar.xz wireguard-openbsd-f80ca8c438df6aae9de126b6e620b22dea21dd19.zip |
split out keepalive from packet_interactive (from dale@accentre.com)
set IPTOS_LOWDELAY TCP_NODELAY IPTOS_THROUGHPUT for ssh2, too.
Diffstat (limited to 'usr.bin/ssh/sshconnect.c')
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index e4c8c92697e..8d24f8852cc 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.89 2001/01/04 22:41:03 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.90 2001/01/13 18:32:50 markus Exp $"); #include <openssl/bn.h> #include <openssl/dsa.h> @@ -187,12 +187,13 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, int anonymous, uid_t original_real_uid, const char *proxy_command) { + int gaierr; + int on = 1; int sock = -1, attempt; - struct servent *sp; - struct addrinfo hints, *ai, *aitop; char ntop[NI_MAXHOST], strport[NI_MAXSERV]; - int gaierr; + struct addrinfo hints, *ai, *aitop; struct linger linger; + struct servent *sp; debug("ssh_connect: getuid %u geteuid %u anon %d", (u_int) getuid(), (u_int) geteuid(), anonymous); @@ -294,7 +295,13 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, /* setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); */ linger.l_onoff = 1; linger.l_linger = 5; - setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger)); + setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *)&linger, sizeof(linger)); + + /* Set keepalives if requested. */ + if (options.keepalives && + setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, + sizeof(on)) < 0) + error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno)); /* Set the connection. */ packet_set_connection(sock, sock); |