Allow remote-to-local forwardings to use IPv6.
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Tue, 18 Sep 2012 21:50:47 +0000 (21:50 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Tue, 18 Sep 2012 21:50:47 +0000 (21:50 +0000)
RFC 4245 section 7.1 specifies the meaning of the "address to bind"
parameter in a "tcpip-forward" request.  "0.0.0.0" and "127.0.0.1" are
specified to be all interfaces and the loopback interface respectively
in IPv4, while "" and "localhost" are the address-family-agnostic
equivalents.  Switch PuTTY to using the latter, since it doesn't seem
right to force IPv4.

There's an argument that PuTTY should provide a means of configuring the
address family used for remote forwardings like it does for local ones.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9668 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index 1cbb471..66c84d1 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -4618,9 +4618,9 @@ static void ssh_setup_portfwd(Ssh ssh, Conf *conf)
                        /* XXX: rport_acceptall may not represent
                         * what was used to open the original connection,
                         * since it's reconfigurable. */
-                       ssh2_pkt_addstring(pktout, "0.0.0.0");
+                       ssh2_pkt_addstring(pktout, "");
                    } else {
-                       ssh2_pkt_addstring(pktout, "127.0.0.1");
+                       ssh2_pkt_addstring(pktout, "localhost");
                    }
                    ssh2_pkt_adduint32(pktout, epf->sport);
                    ssh2_pkt_send(ssh, pktout);
@@ -4733,9 +4733,9 @@ static void ssh_setup_portfwd(Ssh ssh, Conf *conf)
                        if (epf->saddr) {
                            ssh2_pkt_addstring(pktout, epf->saddr);
                        } else if (conf_get_int(conf, CONF_rport_acceptall)) {
-                           ssh2_pkt_addstring(pktout, "0.0.0.0");
+                           ssh2_pkt_addstring(pktout, "");
                        } else {
-                           ssh2_pkt_addstring(pktout, "127.0.0.1");
+                           ssh2_pkt_addstring(pktout, "localhost");
                        }
                        ssh2_pkt_adduint32(pktout, epf->sport);
                        ssh2_pkt_send(ssh, pktout);