Bugzilla – Attachment 956 Details for
Bug 1076
X11 applications can sometimes not connect to 127.0.0.1:60xx
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Set SO_REUSEADDR for X11 sockets too
reuseaddr_x11.diff (text/plain), 1.81 KB, created by
Damien Miller
on 2005-09-19 21:16:15 AEST
(
hide
)
Description:
Set SO_REUSEADDR for X11 sockets too
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2005-09-19 21:16:15 AEST
Size:
1.81 KB
patch
obsolete
>Index: channels.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/channels.c,v >retrieving revision 1.224 >diff -u -p -r1.224 channels.c >--- channels.c 7 Sep 2005 08:53:53 -0000 1.224 >+++ channels.c 19 Sep 2005 11:13:34 -0000 >@@ -1226,6 +1226,19 @@ port_open_helper(Channel *c, char *rtype > xfree(remote_ipaddr); > } > >+static void >+channel_set_reuseaddr(int fd) >+{ >+ int on = 1; >+ >+ /* >+ * Set socket options. >+ * Allow local port reuse in TIME_WAIT. >+ */ >+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) >+ error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno)); >+} >+ > /* > * This socket is listening for connections to a forwarded TCP/IP port. > */ >@@ -2182,7 +2195,7 @@ channel_setup_fwd_listener(int type, con > const char *host_to_connect, u_short port_to_connect, int gateway_ports) > { > Channel *c; >- int sock, r, success = 0, on = 1, wildcard = 0, is_client; >+ int sock, r, success = 0, wildcard = 0, is_client; > struct addrinfo hints, *ai, *aitop; > const char *host, *addr; > char ntop[NI_MAXHOST], strport[NI_MAXSERV]; >@@ -2269,13 +2282,8 @@ channel_setup_fwd_listener(int type, con > verbose("socket: %.100s", strerror(errno)); > continue; > } >- /* >- * Set socket options. >- * Allow local port reuse in TIME_WAIT. >- */ >- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, >- sizeof(on)) == -1) >- error("setsockopt SO_REUSEADDR: %s", strerror(errno)); >+ >+ channel_set_reuseaddr(sock); > > debug("Local forwarding listening on %s port %s.", ntop, strport); > >@@ -2682,6 +2690,7 @@ x11_create_display_inet(int x11_display_ > freeaddrinfo(aitop); > return -1; > } >+ channel_set_reuseaddr(sock); > if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { > debug2("bind port %d: %.100s", port, strerror(errno)); > close(sock);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1076
: 956 |
958