help porting ld preload bind ip address

antolap

Active Member

Thanks: 2
Messages: 138

#1
Could you help me compiling this file on FreeBSD?
http://www.ryde.net/code/bind.c.txt

I need it to bind an application to a specific virtual ip address
example:
Code:
BIND_ADDR="192.168.13.40" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
BIND_ADDR="192.168.13.41" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
BIND_ADDR="192.168.13.42" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
anyone who can help me compiling this file on FreeBSD 11?
Thanks
 

tobik@

Daemon
Developer

Thanks: 1,341
Messages: 1,909

#2
On Linux the command to compile it is: gcc -nostartfiles -fpic -shared bind.c -o bind.so -ldl -D_GNU_SOURCE

On FreeBSD this translates to: cc -nostartfiles -fpic -shared bind.c -o bind.so
 
Top