reidwooten99 / connectbot

Automatically exported from code.google.com/p/connectbot
Apache License 2.0
0 stars 0 forks source link

Local port forward binds to ::ffff:127.0.0.1:<port> only #518

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Login to remote server with SSH public key
2. Add a port forward mapping say, 8000 (local) to remote host localhost:80
3. Try to access any of 127.0.0.1:8000, localhost:8000, ::1:8000 or 
::ffff:127.0.0.1:8000/ in either built in browser or Opera.

Expect to connect to remote host's local webserver (confirmed can connect 
locally). Unable to use port forwarding with browsers as cannot address the 
local port.

Running netstat locally shows that ::ffff:127.0.0.1:8000 is listening locally, 
but on no other local addresses (bind any would be nice).

What version of the product are you using (you can see this by using Menu
-> About in the Host List)?

Version: 1.7.1 (v1.7.1 2010.10.08)
Running on a Samsung Galaxy S2 with O2 UK settings.

What type of system are you trying to connect to?
Remote host is a GNU Linux / Ubuntu 11.10 server.

Original issue reported on code.google.com by colin.jo...@gmail.com on 17 Oct 2011 at 2:48

GoogleCodeExporter commented 8 years ago
Same problem with latest development snapshot 2011-10-15_16-30-54

Original comment by colin.jo...@gmail.com on 17 Oct 2011 at 3:02

GoogleCodeExporter commented 8 years ago
Having skimmed the source, looks like org/connectbot/transport/SSH.java line 
609 may be the problem:

   lpf = connection.createLocalPortForwarder(
      new InetSocketAddress(InetAddress.getLocalHost(), portForward.getSourcePort()),
                            portForward.getDestAddr(), portForward.getDestPort());

I suggest replacing InetAddress.getLocalHost() with:
InetAddress.getByAddress("localhost", new byte[]{127, 0, 0, 1});

or some heuristic, or a configurable option. Probably don't want to bind to 
every local address including potentially external addresses.

See: 
http://developer.android.com/reference/java/net/InetAddress.html#getLocalHost
for justification - in the hybrid ipv4/ipv6 environment these phones run in you 
can't guarantee that resolving localhost will return what you need.

Original comment by colin.jo...@gmail.com on 17 Oct 2011 at 3:26

GoogleCodeExporter commented 8 years ago
Maybe I'm missing something. What's the problem with binding to 
::ffff:127.0.0.1:8000 ? It's essentially the same thing as what you suggest.

If you're asking for listening on INADDR_ANY, I believe that's covered in 
another bug.

Original comment by kenny@the-b.org on 20 Oct 2011 at 6:30

GoogleCodeExporter commented 8 years ago
I can confirm the same problem on ICS 4.0.3 (Google Nexus S) with ConnectBot 
1.7.1 (v1.7.1 2010.10.08). Ports forwarded to remote web hosts are inaccessible 
in the browser because they only listen on ip6 addresses. This is a real 
bummer...

Original comment by troels.g...@gmail.com on 9 Jan 2012 at 6:11

GoogleCodeExporter commented 8 years ago
Still broken -- app hasn't been updated since 2010.  Ugh.  Need to find a 
replacement for it now.

Original comment by ide...@gmail.com on 18 Jul 2012 at 4:26

GoogleCodeExporter commented 8 years ago
Not the same issue, but related, see patch for binding to INADDR_ANY:

http://code.google.com/p/connectbot/issues/detail?id=609

Original comment by pomonami...@gmail.com on 23 Sep 2012 at 6:26