summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/channels.c
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2002-09-13 19:23:10 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2002-09-13 19:23:10 +0000
commit9ca41423a0ace5bb744f979e8c86e4f7f2b610ee (patch)
tree1fb58c8b6b26d56ff65dbdb0c7354f3908c713b9 /usr.bin/ssh/channels.c
parentd385f0245668d9ea3953ac1fdd4f973e3739c50d (diff)
remove use of SO_LINGER, it should not be needed. error check
SO_REUSEADDR. fixup comments. ok markus@
Diffstat (limited to 'usr.bin/ssh/channels.c')
-rw-r--r--usr.bin/ssh/channels.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index b59a4632c19..0b0a87587f6 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.181 2002/09/09 14:54:14 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.182 2002/09/13 19:23:09 stevesk Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -2016,7 +2016,6 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
struct addrinfo hints, *ai, *aitop;
const char *host;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
- struct linger linger;
success = 0;
host = (type == SSH_CHANNEL_RPORT_LISTENER) ?
@@ -2059,13 +2058,13 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
continue;
}
/*
- * Set socket options. We would like the socket to disappear
- * as soon as it has been closed for whatever reason.
+ * Set socket options.
+ * Allow local port reuse in TIME_WAIT.
*/
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
- linger.l_onoff = 1;
- linger.l_linger = 5;
- setsockopt(sock, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger));
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on,
+ sizeof(on)) == -1)
+ error("setsockopt SO_REUSEADDR: %s", strerror(errno));
+
debug("Local forwarding listening on %s port %s.", ntop, strport);
/* Bind the socket to the address. */