[pfSense] C noob, trying to compile linux binary in FreeBSD

Hey guys, registered as I'm starting to use FreeBSD (based) systems more. Specifically I am building a PFSense 2.0 box and wanted to compile a linux c program for it. The program is called pixelserv and was written originally written in perl. mstombs rewrote the program in c for broadcom/atheros based router for tomoato/ddwrt.

Discusion on the c-port
Version 22 Source

I setup a FreeBSD 8.2 virtual machine.
Threw in the pixelserv22.c file
and ran
Code:
gcc pixelserv22.c -o pixelserv

First output error is
Code:
281: error: 'SOL_TCP' undeclared (first use in this function)

I have no 'C' experience am just a lowly linux user and would like to call out for help in getting this awesome program compiled for FreeBSD/PFSense. It would be great as an plugin for PFSense as it is a super speedy and unobtrusive, network wide adblocker.
 
SOL_SOCKET is defined in sys/socket.h which is being included.

Close enough as you got the error on SOL_TCP. Reading setsockopt(2):

When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; see getprotoent(3).
 
Thanks for the help! I'm gonna try to compile this thing again.

Switched the 2 x 'SOL_TCP' to 'SOL_SOCKET'
I also get the same error about 'TCP_LINGER2', wondering what you guys think I should do.

Good news is I got this compiled in ubuntu very easily. In ubuntu I just..
Code:
cc -c pixelserv.c
cc -o pixelserv pixelserv.c
chmod +x ./pixelserv
sudo pixelserv [IP]
and everything worked great, hope to get this working on freebsd though cause my router is freebsd (PFSense) =]
 
Sorry about the double post, couldn't find an edit button.

Just commented out the TCP_LINGER2 line, then compiled and it's running fine. I hope the changes line and the changed term doesn't cause error, but for now it's working fine on a virtual FreeBSD.

Not at my normal house so I won't test it on PFSense till I'm there but it should work. This combined with a adblock script would be an awesome plugin.
 
Back
Top