FrankPingYang / opendpi

Automatically exported from code.google.com/p/opendpi
GNU Lesser General Public License v3.0
0 stars 0 forks source link

[PATCH] FreeBSD support #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

The attached patch provides adds FreeBSD support to OpenDPI (and it should
also work with other BSDs as well).

Let me know if you're also interested in a patch that adds basic CMake
support, compiling it as a shared library instead too.

Regards,

Original issue reported on code.google.com by fernando...@gmail.com on 6 Oct 2009 at 5:09

Attachments:

GoogleCodeExporter commented 8 years ago
The attached patch (which applies on top of opendpi_freebsd.patch) makes 
OpenDPI work
on FreeBSD on big endian platforms, as FreeBSD doesn't define
__LITTLE_ENDIAN_BITFIELD or __BYTE_ORDER (but rather BYTE_ORDER, LITTLE_ENDIAN,
BIG_ENDIAN).

Original comment by fernando...@gmail.com on 8 Oct 2009 at 1:18

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
After aplaing both of this patches I have error on freebsd 7.2:

cd ./lib && cc -c -I ../include -O2 -g -pipe -Wall -Wimplicit -Wunused 
-Wcomment -
Wchar-subscripts -Wuninitialized -Wparentheses -Wformat -Winline -Wreturn-type 
-fPIC 
-Wmissing-prototypes -Wundef -Wstrict-prototypes -Wno-trigraphs 
-fno-strict-aliasing 
-fno-common -Werror-implicit-function-declaration -maccumulate-outgoing-args 
-Wno-
sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Werror -
D_FILE_OFFSET_BITS=64 *.c
cd ./lib/protocols && cc -c -I .. -I ../../include -O2 -g -pipe -Wall 
-Wimplicit -
Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wparentheses -Wformat 
-Winline -
Wreturn-type -fPIC -Wmissing-prototypes -Wundef -Wstrict-prototypes 
-Wno-trigraphs -
fno-strict-aliasing -fno-common -Werror-implicit-function-declaration 
-maccumulate-
outgoing-args -Wno-sign-compare -fno-asynchronous-unwind-tables 
-fomit-frame-pointer 
-Werror -D_FILE_OFFSET_BITS=64 *.c
ar rcs ./libOpenDPI.a ./lib/*.o ./lib/protocols/*.o
cc -O2 -g -pipe -Wall -Wimplicit -Wunused -Wcomment -Wchar-subscripts -
Wuninitialized -Wparentheses -Wformat -Winline -Wreturn-type -fPIC -Wmissing-
prototypes -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-
common -Werror-implicit-function-declaration -maccumulate-outgoing-args 
-Wno-sign-
compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Werror -
D_FILE_OFFSET_BITS=64 -I include OpenDPI_demo.c libOpenDPI.a -lpcap -o 
OpenDPI_demo
OpenDPI_demo.c:32:22: error: linux/ip.h: No such file or directory
OpenDPI_demo.c:33:23: error: linux/tcp.h: No such file or directory
OpenDPI_demo.c:34:23: error: linux/udp.h: No such file or directory
OpenDPI_demo.c:35:28: error: linux/if_ether.h: No such file or directory
cc1: warnings being treated as errors
OpenDPI_demo.c:230: warning: 'struct iphdr' declared inside parameter list
OpenDPI_demo.c:230: warning: its scope is only this definition or declaration, 
which 
is probably not what you want
OpenDPI_demo.c: In function 'get_osdpi_flow':
OpenDPI_demo.c:245: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:245: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:246: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:249: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:249: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:251: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:251: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:252: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:253: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:255: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:256: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:259: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:261: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:262: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:262: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:263: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:264: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:266: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:267: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:269: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:271: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:272: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:272: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:273: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:274: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:276: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:277: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:286: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:298: error: dereferencing pointer to incomplete type
OpenDPI_demo.c: At top level:
OpenDPI_demo.c:378: warning: 'struct iphdr' declared inside parameter list
OpenDPI_demo.c: In function 'packet_processing':
OpenDPI_demo.c:387: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:388: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:390: warning: passing argument 1 of 'get_osdpi_flow' from 
incompatible pointer type
OpenDPI_demo.c:406: error: dereferencing pointer to incomplete type
OpenDPI_demo.c: In function 'pcap_packet_callback':
OpenDPI_demo.c:485: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
OpenDPI_demo.c:502: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:505: error: 'ETH_P_IP' undeclared (first use in this function)
OpenDPI_demo.c:505: error: (Each undeclared identifier is reported only once
OpenDPI_demo.c:505: error: for each function it appears in.)
OpenDPI_demo.c:506: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
OpenDPI_demo.c:518: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:528: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
OpenDPI_demo.c:528: warning: passing argument 2 of 'packet_processing' from 
incompatible pointer type
*** Error code 1

version OpenDPI_1.0.1

Original comment by astras...@gmail.com on 31 Oct 2009 at 5:56

GoogleCodeExporter commented 8 years ago
compilation on BSD-like systems should now work with revision 7
Thanks fernandoctl

Original comment by martin.w...@ipoque.com on 5 Nov 2009 at 3:47

GoogleCodeExporter commented 8 years ago
Sorry, but

pandora# make
cd ./lib && cc -c -I ../include -O2 -g -pipe -Wall -Wimplicit -Wunused 
-Wcomment -
Wchar-subscripts -Wuninitialized -Wparentheses -Wformat -Winline -Wreturn-type 
-fPIC 
-Wmissing-prototypes -Wundef -Wstrict-prototypes -Wno-trigraphs 
-fno-strict-aliasing 
-fno-common -Werror-implicit-function-declaration -maccumulate-outgoing-args 
-Wno-
sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Werror -
D_FILE_OFFSET_BITS=64 *.c
cd ./lib/protocols && cc -c -I .. -I ../../include -O2 -g -pipe -Wall 
-Wimplicit -
Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wparentheses -Wformat 
-Winline -
Wreturn-type -fPIC -Wmissing-prototypes -Wundef -Wstrict-prototypes 
-Wno-trigraphs -
fno-strict-aliasing -fno-common -Werror-implicit-function-declaration 
-maccumulate-
outgoing-args -Wno-sign-compare -fno-asynchronous-unwind-tables 
-fomit-frame-pointer 
-Werror -D_FILE_OFFSET_BITS=64 *.c
ar rcs ./libOpenDPI.a ./lib/*.o ./lib/protocols/*.o
cc -O2 -g -pipe -Wall -Wimplicit -Wunused -Wcomment -Wchar-subscripts -
Wuninitialized -Wparentheses -Wformat -Winline -Wreturn-type -fPIC -Wmissing-
prototypes -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-
common -Werror-implicit-function-declaration -maccumulate-outgoing-args 
-Wno-sign-
compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Werror -
D_FILE_OFFSET_BITS=64 -I include OpenDPI_demo.c libOpenDPI.a -lpcap -o 
OpenDPI_demo
OpenDPI_demo.c: In function 'pcap_packet_callback':
OpenDPI_demo.c:488: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
OpenDPI_demo.c:505: error: dereferencing pointer to incomplete type
OpenDPI_demo.c:508: error: 'ETH_P_IP' undeclared (first use in this function)
OpenDPI_demo.c:508: error: (Each undeclared identifier is reported only once
OpenDPI_demo.c:508: error: for each function it appears in.)
OpenDPI_demo.c:509: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
OpenDPI_demo.c:531: error: invalid application of 'sizeof' to incomplete type 
'struct ethhdr'
*** Error code 1

Original comment by i...@house4rentonline.com on 5 Nov 2009 at 4:30

GoogleCodeExporter commented 8 years ago
I'm sorry, something went into the wrong header
I also made a small adjustment to make it compile under Mac OS X
It now should really work with revision 9

Original comment by martin.w...@ipoque.com on 6 Nov 2009 at 8:21

GoogleCodeExporter commented 8 years ago
It's works now! thanks

Original comment by astras...@gmail.com on 7 Nov 2009 at 10:06