File openssh-7.6p1-X_forward_with_disabled_ipv6.patch of Package openssh.18131
# HG changeset patch
# Parent 28370dbd73f8dc216cd732703e10dd3f8a30d7b0
Do not throw away already open sockets for X11 forwarding if another socket
family is not available for bind()
Index: openssh-7.6p1/channels.c
===================================================================
--- openssh-7.6p1.orig/channels.c 2019-03-12 14:33:57.495374866 +0100
+++ openssh-7.6p1/channels.c 2019-03-12 14:38:35.816933438 +0100
@@ -4444,6 +4444,13 @@ x11_create_display_inet(struct ssh *ssh,
debug2("%s: bind port %d: %.100s", __func__,
port, strerror(errno));
close(sock);
+ /* do not remove successfully opened sockets if
+ * the request failed because the protocol
+ * IPv4/6 is not available (e.g. IPv6 may be
+ * disabled while being supported)
+ */
+ if (EADDRNOTAVAIL == errno)
+ continue;
for (n = 0; n < num_socks; n++)
close(socks[n]);
num_socks = 0;