summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/channels.c b/channels.c
index 0ae37b6d8..cf1a6462b 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.181 2002/09/09 14:54:14 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.182 2002/09/13 19:23:09 stevesk Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2022,7 +2022,6 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
2022 struct addrinfo hints, *ai, *aitop; 2022 struct addrinfo hints, *ai, *aitop;
2023 const char *host; 2023 const char *host;
2024 char ntop[NI_MAXHOST], strport[NI_MAXSERV]; 2024 char ntop[NI_MAXHOST], strport[NI_MAXSERV];
2025 struct linger linger;
2026 2025
2027 success = 0; 2026 success = 0;
2028 host = (type == SSH_CHANNEL_RPORT_LISTENER) ? 2027 host = (type == SSH_CHANNEL_RPORT_LISTENER) ?
@@ -2065,13 +2064,13 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
2065 continue; 2064 continue;
2066 } 2065 }
2067 /* 2066 /*
2068 * Set socket options. We would like the socket to disappear 2067 * Set socket options.
2069 * as soon as it has been closed for whatever reason. 2068 * Allow local port reuse in TIME_WAIT.
2070 */ 2069 */
2071 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); 2070 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on,
2072 linger.l_onoff = 1; 2071 sizeof(on)) == -1)
2073 linger.l_linger = 5; 2072 error("setsockopt SO_REUSEADDR: %s", strerror(errno));
2074 setsockopt(sock, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); 2073
2075 debug("Local forwarding listening on %s port %s.", ntop, strport); 2074 debug("Local forwarding listening on %s port %s.", ntop, strport);
2076 2075
2077 /* Bind the socket to the address. */ 2076 /* Bind the socket to the address. */