This repo serves as a mirror of a bind shim written by Robert J. McKay, which was downloaded from here. Another copy of it exists here.
More information about the shim and how and why to use it can be found in Daniel Lange’s article Binding applications to a specific IP
A simple LD_PRELOAD hack to let you specify the source address for all outbound connections or if you want to limit a process to only listening on one IP
Copyright (C) 2005 Robert J. McKay <robert@mckay.com>
License: You can do whatever you want with it.
Compile:
gcc -fPIC -static -shared -o bindhack.so bindhack.c -lc -ldl
You can add -DDEBUG to see debug output.
Usage:
LD_PRELOAD=/path/to/bindhack.so <command>
eg:
LD_PRELOAD=/home/rm/bindhack.so telnet example.com
you can also specify the address to use at runtime like so:
LD_PRELOAD=/home/rm/bindhack.so BIND_SRC=192.168.0.1 telnet example.com