Kirill,
I have been using your jsocks package [ BTW: thanks! ]
and have a small patch to work around a problem with
Socks 5 UDP support.
In particular, there is a problem with the way the UDP
relay IP address is derived under some conditions. In
the UDPRelayServer() constructor, there is logic that
compares the IP address derived from the client socket
with 0.0.0.0 and, if matches, replaces the IP address
with the
address derived from InetAddress.getLocalHost().
However, depending on how the host is configured, the
address returned by this call may not be reachable from
the socks client.
My patch changes the mapping logic so that it firsts
tries to use the local address of the control
connection. This IP address should be visible to the
socks client, since the client had to use that address
to connect to the server in the first place. [ This
assumes that the local address of an accepted socket is
sensibly related to the IP address of the interface
from which the connection was received. In my case (AIX
5.2), it is ].
In UDPRelayServer(...):
< if(relayIP.getHostAddress().equals("0.0.0.0"))
< relayIP = InetAddress.getLocalHost();
becomes:
> if(relayIP.getHostAddress().equals("0.0.0.0"))
> relayIP =
controlConnection.getLocalAddress();
>
> if(relayIP.getHostAddress().equals("0.0.0.0"))
> relayIP = InetAddress.getLocalHost();
Just wanted to let you know the JSocks sources are now checked into CVS. If
you want, you may check in your changes. Thanks!