# trouble w/ compiling fragrouter due to libnet



## danjmw (Apr 17, 2006)

hey all,

I know this is a reach as I've found nobody talking about running fragrouter on Mac OS X, but I'm really interested in getting this stable.  I've had a number of issues come up during the configure and the start of make that I've been able to resolve through write-ups on other linux-based apps, but here I've reached a dead end.

Here's what I'm getting while running the make two or three times after a few attempts as fixes (including dropping back to the gcc 3.3 compiler, as advised by someone on this forum for another linux app having a similar problem; this attempt was run using gcc 4.0):

sed -e 's/.*/#define VERSION "&"/' ./VERSION > version.h
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/resolve.c -o src/resolve.o
In file included from src/../include/libnet.h:93,
                 from src/resolve.c:37:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
src/resolve.c: In function 'host_lookup':
src/resolve.c:68: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness
src/resolve.c:73: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
src/resolve.c: In function 'host_lookup_r':
src/resolve.c:96: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness
src/resolve.c:101: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
src/resolve.c: In function 'name_resolve':
src/resolve.c:117: warning: pointer targets in passing argument 1 of 'inet_addr' differ in signedness
src/resolve.c:119: warning: pointer targets in passing argument 1 of 'gethostbyname' differ in signedness
src/resolve.c: In function 'get_ipaddr':
src/resolve.c:173: warning: pointer targets in passing argument 2 of 'strncpy' differ in signedness
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/socket.c -o src/socket.o
In file included from src/../include/libnet.h:93,
                 from src/socket.c:38:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/checksum.c -o src/checksum.o
In file included from src/../include/libnet.h:93,
                 from src/checksum.c:15:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/prand.c -o src/prand.o
In file included from src/../include/libnet.h:93,
                 from src/prand.c:37:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/version.c -o src/version.o
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/error.c -o src/error.o
In file included from src/../include/libnet.h:93,
                 from src/error.c:37:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/write_ip.c -o src/write_ip.o
In file included from src/../include/libnet.h:93,
                 from src/write_ip.c:37:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
gcc -O3 -funroll-loops -fomit-frame-pointer -pipe -Wall   -DHAVE_CONFIG_H -c src/insert_ipo.c -o src/insert_ipo.o
In file included from src/../include/libnet.h:93,
                 from src/insert_ipo.c:37:
src/../include/./libnet/libnet-functions.h:389: warning: 'struct ipoption' declared inside parameter list
src/../include/./libnet/libnet-functions.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
src/../include/./libnet/libnet-functions.h:692: warning: 'struct ipoption' declared inside parameter list
src/insert_ipo.c:40: warning: 'struct ipoption' declared inside parameter list
src/insert_ipo.c:41: error: conflicting types for 'insert_ipo'
src/../include/./libnet/libnet-functions.h:389: error: previous declaration of 'insert_ipo' was here
src/insert_ipo.c: In function 'insert_ipo':
src/insert_ipo.c:78: error: dereferencing pointer to incomplete type
make[1]: *** [src/insert_ipo.o] Error 1
make: *** [Libnet-0.99b/libnet.a] Error 2

I appreciate any pointers or oppinions anyone has on this, as the Internet is dry on the subject.

Thanx.

Dan


----------



## tomdkat (Apr 17, 2006)

It looks like you need to get to the bottom of this:

src/insert_ipo.c:40: warning: 'struct ipoption' declared inside parameter list
src/insert_ipo.c:41: error: conflicting types for 'insert_ipo'
src/../include/./libnet/libnet-functions.h:389: error: previous declaration of 'insert_ipo' was here
src/insert_ipo.c: In function 'insert_ipo':
src/insert_ipo.c:78: error: dereferencing pointer to incomplete type
make[1]: *** [src/insert_ipo.o] Error 1

I was able to find the source of fragrouter online and looked at insert_ipo.c.  From what I can tell, it looks like this tool isn't very portable.  The "struct ipoption", from what I can determine online, is a Solaris (or maybe even SunOS) structure, defined in a header called "ip_var.h".  This message thread refers to ip_var.h being available on Solaris (Sun).   So, you'll need to find that header to define "struct ipoption" and that might solve the compiler error.  If the compiler can't find the definition of "struct ipoption", it might have a problem compiling the insert_ipo() function since that struct is an argument to that function.

Are you sure you're using the latest version of fragrouter source?    Where did you get the source you're trying to build?

Peace...


----------



## danjmw (Apr 18, 2006)

hey tomdkat,

thanks for taking a look.  when I went back to search for other sources that could be more inline with Mac OS X I found that fragroute had already been ported over by DarwinPort.  there was some discretion with using the version available by DarwinPort as it is ver. 1.2 and the author of fragroute, who's changed the name to fragrouter, has available ver. 1.6, but since I could find no mention of 1.6 for the Mac I went with 1.2 (should be fine).  I'm not sure about the difference between fragroute and fragrouter (although I did find a chat session that pointed to fragrouter 1.7 as a trojan), but fragroute 1.2 has been ported over and that should do the trick.

thanks again for the help.


----------



## danjmw (Apr 18, 2006)

actually, I just learned what the difference between fragroute and fragrouter is.  As stated in fragroute's man page:

Unlike  fragrouter(8),  this  program  only affects packets originating
       from the local machine destined for a remote host.  Do  not  enable  IP
       forwarding on the local machine.

So, since fragroute is limited in that way, I will continue my search for a source copy of fragrouter for the Mac, but at the moment I've reached a dead end.

If anyone has fragrouter running on Mac OS X I could use a point in the right direction.

Thank.


----------



## tomdkat (Apr 18, 2006)

danjmw said:
			
		

> when I went back to search for other sources that could be more inline with Mac OS X I found that fragroute had already been ported over by DarwinPort.


It's funny you mention DarwinPort since I found a thread where someone had the exact same problem as you on OpenDarwin.org.  

Good luck!

Peace...


----------

