Four Easy Steps to SOCKSify (Most of) Your Favorite Network Programs
For use with SOCKS 4.3
(Ying-Da Lee, firstname.lastname@example.org or email@example.com)
1) Find out if UDP is used in the program by doing "grep SOCK_DGRAM" on
all the source files. If any such lines are found (and are not comments),
you can't make it work with SOCKS. There is, however, a UDP relayer
which is to UDP what SOCKS is to TCP, and you may want to look into
it. It is written by Tom Fitzgerald <firstname.lastname@example.org> and is available
from host ftp.wang.com, file /pub/fitz/udprelay-0.2.tar.Z.
2) At or near the beginning of the main procedure, add this line:
This step can be omitted. The only consequence is that the generic
'SOCKSclient' rather than the actual client program name will be
used in the syslog lines on the client host.
-Dconnect=Rconnect -Dselect=Rselect -Dgethostbyname=Rgethostbyname -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten
(or, on AIX,
-Dconnect=Rconnect -Dselect=Rselect -Dgethostbyname=Rgethostbyname -Dngetsockname=Rgetsockname -Dbind=Rbind -Dnaccept=Raccept -Dlisten=Rlisten
to all cc lines. If Makefile is used, this is simply done by adding
the above to the definition of macro CFLAGS.
If the application does not use the bind/listen/accept/getsockname
sequence to establish passive connections (most don't) or if your
SOCKS server does not support RBIND ('sockd -ver' will tell you
whether it does or not), you can drop the corresponding definitions
for those functions; i.e., end with -Dgethostbyname=Rgethostbyname.
4) Make sure that the appropriate SOCKS library (version 4.2, built with
-DSHORTENED_RBIND) is linked in in the ld or the last cc command to
produce the executable.
That's it for most programs. Build the program and try it, chances
are it would work. If it doesn't and you still like to have a SOCKSified
version, please read the file What_SOCKS_expects.