pkelsey / libuinet

a library version of FreeBSD's TCP/IP stack plus extras
750 stars 198 forks source link

linux compile issues #32

Open pthornton opened 9 years ago

pthornton commented 9 years ago

Looks like the Linux port is out of sync. It's referencing a BSD file vnet.h which is included under sys/net/vnet.h, but that folder is not included in the Makefile. If I modify the Makefile, there are too many errors to list here. I've tried this on Centos 6(preferred) and Ubuntu 12.04. -randy

caladri commented 9 years ago

Please include the command you ran, the directory within libuinet you ran it in, and the output you got.

pthornton commented 9 years ago

git clone https://code.google.com/p/netmap/ git clone https://github.com/pkelsey/libuinet.git cd libuinet/lib/libuinet/ make NETMAP_INCLUDES=/home/pthornton/netmap/sys/

pthornton commented 9 years ago

pthornton@pthornton-virtual-machine:~/libuinet/lib/libuinet$ make cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -O -gdwarf-2 -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-inline -Wcast-qual -Wno-pointer-sign -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unused-but-set-variable -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -DUINET=1 -fstack-protector -I. -I/home/pthornton/libuinet/lib/libuinet/api_include -I../libuinetnv -Werror uinet_host_sysctl_api.c In file included from uinet_host_sysctl_api.c:44:0: uinet_internal.h:33:22: fatal error: net/vnet.h: No such file or directory compilation terminated. make: *\ [uinet_host_sysctl_api.o] Error 1

weliu commented 9 years ago

I resolved this issue by adding forward declaration of vnet and removing the vnet.h header file

ratliffstan commented 9 years ago

weliu, can you be more specific as to what forward delcaration you added? I've hit the same issue, and I'm looking at vnet.h on github - it's almost 400 lines of code...

caladri commented 9 years ago

@ratliffstan, what @weliu is saying is that removing the net/vnet.h include from uinet_internal.h and then adding, I believe, a forward declaration in its place of struct vnet; or similar. It should be fairly obvious what is missing if you remove the include, by seeing what the next compile error is. It's not clear to me why this error would occur in the first place, however. But it should be straightforward to work around if @weliu is correct.

ratliffstan commented 9 years ago

@caladri Thanks! I have one other naive question. Let's assume I have started the WANproxy with libuinet, and have assigned 'eth1' to the proxy. But ingress traffic to that port includes some "non-proxy" traffic (e.g. VoIP packets, multicast traffic, and the like). From my tentative testing, it appears that this traffic gets dropped. Is there a way to configure the proxy/libuinet such that this traffic continues to flow to the correct destination?

ratliffstan commented 9 years ago

My apologies for spamming this board, but I have one more question. Does libuinet support route or raw sockets?

weliu commented 9 years ago

@caladri, this issue occured because the vnet.h file does not exist in Linux /usr/include, but FreeBSD does, because VIMAGE is a FreeBSD feature.

@ratliffstan, I have used uinet_socreate() uinet_sosend() API to add or remove route in libuinet instance. If your are under Linux, you also need to copy FreeBSD's route.h file to Linux /usr/include, because LINUX don't have struct rt_msghdr or other route related structs definition.

caladri commented 9 years ago

@weliu, some of that sounds suspicious to me. It seems likely that the files in question should be using the libuinet copies of headers, not the ones in /usr/include. Right, @pkelsey?

ratliffstan commented 9 years ago

@weliu - Interesting, thanks.

@caladri @pkelsey - I'm still concerned about running the proxy and getting other traffic dropped. I have WANproxy running on eth1 (via Netmap), and have multiple addresses for my Linux host. Trying to "ping" from a secondary host, via eth1, and the traffic is dropped when the proxy is running. Is there a way to configure such that other traffic (like ICMP) gets passed through as it should?

caladri commented 9 years ago

@ratliffstan, that is a reasonable concern, but honestly I'm not sure libuinet is the place to fix it. Honestly, in that sort of situation what you want is to use VALE to have a virtual network set up on which the proxy is connected to two different VALE switches, and you have a packet processor with a configurable policy determining which packets to pass to the proxy and which get bridged or sent to the host network stack. I've started on something that would be useful for this, but am not aware of any complete open source options. Maybe Intel's openvswitch stuff? I could provide you with a sample configuration that would do this with a tool I've written, but it has some rough edges.

ratliffstan commented 9 years ago

@caladri Thank you for the information. I'll go check openvswitch. And yes, I'd be happy to take a look at your sample config and tool. Thanks again.