Fail to compile this tiny C code on FreeBSD...

Hi, all:
I'm just busy working around my graduation thesis about data mining on Internet application identifier, and need to process some traces. I download the NetFlow data here with its recommended program source code (simply a C source code file) to process the data. What confounded me is that, I failed to compile this C code file on FreeBSD while succeeded on Linux, using identical command line:
Code:
gcc -lpcap -o flow flow-extract.c `pkg-config --cflags --libs glib-2.0`
with some annoying errors:
Code:
flow-extract.c: In function 'pkt_callback':
flow-extract.c:329: error: dereferencing pointer to incomplete type
flow-extract.c:329: error: dereferencing pointer to incomplete type
flow-extract.c:333: error: dereferencing pointer to incomplete type
flow-extract.c:367: error: dereferencing pointer to incomplete type
flow-extract.c:370: error: dereferencing pointer to incomplete type
flow-extract.c:373: error: 'struct tcphdr' has no member named 'source'
flow-extract.c:373: error: 'struct tcphdr' has no member named 'source'
flow-extract.c:373: error: 'struct tcphdr' has no member named 'source'
flow-extract.c:373: error: 'struct tcphdr' has no member named 'source'
flow-extract.c:374: error: 'struct tcphdr' has no member named 'dest'
flow-extract.c:374: error: 'struct tcphdr' has no member named 'dest'
flow-extract.c:374: error: 'struct tcphdr' has no member named 'dest'
flow-extract.c:374: error: 'struct tcphdr' has no member named 'dest'
flow-extract.c:378: error: 'struct udphdr' has no member named 'source'
flow-extract.c:378: error: 'struct udphdr' has no member named 'source'
flow-extract.c:378: error: 'struct udphdr' has no member named 'source'
flow-extract.c:378: error: 'struct udphdr' has no member named 'source'
flow-extract.c:379: error: 'struct udphdr' has no member named 'dest'
flow-extract.c:379: error: 'struct udphdr' has no member named 'dest'
flow-extract.c:379: error: 'struct udphdr' has no member named 'dest'
flow-extract.c:379: error: 'struct udphdr' has no member named 'dest'
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:387: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:388: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:398: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type
flow-extract.c:399: error: dereferencing pointer to incomplete type

After google it, I added a line of
Code:
#define __FAVOR_BSD
ahead of this file, but still no go. So, any help is appreciated. Thanks in advance.:P
 
I'm not sure but I think it's caused by the pcap library from FreeBSD. It's slightly different from the Linux version.

There are a few tools regarding NetFlow already in the ports. You might want to have a look at those.

This one seems like a nice start: net-mgmt/flow-tools.
 
SirDice said:
I'm not sure but I think it's caused by the pcap library from FreeBSD. It's slightly different from the Linux version.

There are a few tools regarding NetFlow already in the ports. You might want to have a look at those.

This one seems like a nice start: net-mgmt/flow-tools.
Thank you, but the problem for me is that how to process this downloaded dump file. I need to extract flow information there quickly:e
 
Back
Top