• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

help porting ld preload bind ip address

antolap

Active Member

Thanks: 2
Messages: 136

#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,287
Best answers: 1
Messages: 1,870

#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
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,898
Best answers: 7
Messages: 26,528

#3
I need it to bind an application to a specific virtual ip address
What application? There might be easier ways to accomplish this.
 
Top