summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-03-03 22:35:33 +1100
committerDamien Miller <djm@mindrot.org>2000-03-03 22:35:33 +1100
commit3c7eeb2af5e97c074ea1ba29f1ebe7a2d710ea48 (patch)
tree69d1e7af0853de884c742c0be1c37aa0fa02f13f /channels.c
parent4095f894dce73a9024493c81190f786b64672c4a (diff)
- Don't permanently fail on bind() if getaddrinfo has more choices left for
us. Needed to work around messy IPv6 on Linux. Patch from Arkadiusz Miskiewicz <misiek@pld.org.pl>
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/channels.c b/channels.c
index ba4c2bef9..7d5e9a1af 100644
--- a/channels.c
+++ b/channels.c
@@ -16,7 +16,7 @@
16 */ 16 */
17 17
18#include "includes.h" 18#include "includes.h"
19RCSID("$Id: channels.c,v 1.16 2000/01/17 02:22:55 damien Exp $"); 19RCSID("$Id: channels.c,v 1.17 2000/03/03 11:35:33 damien Exp $");
20 20
21#include "ssh.h" 21#include "ssh.h"
22#include "packet.h" 22#include "packet.h"
@@ -935,7 +935,11 @@ channel_request_local_forwarding(u_short port, const char *host,
935 /* Bind the socket to the address. */ 935 /* Bind the socket to the address. */
936 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { 936 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
937 /* address can be in use ipv6 address is already bound */ 937 /* address can be in use ipv6 address is already bound */
938 verbose("bind: %.100s", strerror(errno)); 938 if (!ai->ai_next)
939 error("bind: %.100s", strerror(errno));
940 else
941 verbose("bind: %.100s", strerror(errno));
942
939 close(sock); 943 close(sock);
940 continue; 944 continue;
941 } 945 }
@@ -1199,6 +1203,10 @@ x11_create_display_inet(int screen_number, int x11_display_offset)
1199 debug("bind port %d: %.100s", port, strerror(errno)); 1203 debug("bind port %d: %.100s", port, strerror(errno));
1200 shutdown(sock, SHUT_RDWR); 1204 shutdown(sock, SHUT_RDWR);
1201 close(sock); 1205 close(sock);
1206
1207 if (ai->ai_next)
1208 continue;
1209
1202 for (n = 0; n < num_socks; n++) { 1210 for (n = 0; n < num_socks; n++) {
1203 shutdown(socks[n], SHUT_RDWR); 1211 shutdown(socks[n], SHUT_RDWR);
1204 close(socks[n]); 1212 close(socks[n]);