Export to GitHub

connectbot - issue #609

can't bind forwarded ports to INADDR_ANY (with patch)


Posted on Sep 23, 2012 by Quick Camel

What steps will reproduce the problem? 1. Set up a local port forward such as 9000 -> remotehost:9000. 2. From another nearby machine, try to connect to port 9000 on the tunneling device. 3. Have a sad.

What is the expected output? What do you see instead?

Would be nice to be able to bind forwarded ports to INADDR_ANY so that other machines on the local network can connect via the tunnel. I realize why it's not the default behavior, but it is useful sometimes. (in this case, for making a remote squeezebox server available.)

Attached patch works well enough for me, but, several things to beware of:

  • whitespace is probably screwed up by my emacs
  • the "bind remote listen socket to INADDR_ANY" function is untested
  • the horrible implementation of "bind local listen socket to INADDR_ANY" doesn't really do that, because the stupid JVM behavior of INADDR_ANY is "only bind to IPv6 no matter what you say." Instead it searches through the local interfaces until it finds an IPv4 address that isn't localhost, and binds to that by name. Nothing else worked.
  • when you check "bind to INADDR_ANY" the resulting socket will not be available on 127.0.0.1 or ::, which will be surprising to some

So, best to think of it as "proof of concept," but it compiles and works for me.

Attachments

Status: New

Labels:
Type-Defect Priority-Medium