Dear Yuri,
                 I am a very newbie to pf_ring. So I want to write an 
application which will read the packet header and store in  a db. So I was 
thinking to learn it basis from pfcount so that is why I tried to make a copy 
of pfcount rename as pf1 and would like to modify to learn how things are done. 
If that is wrong move for me please guide me. Thank you. Below is how I compile 
and errors. Where can I learn the basic programming for pf_ring as is stated in 
the user guide.
[root@localhost examples]# gcc -o pf1 pf1.c
In file included from pf1.c:47:
/usr/local/include/pfring.h:59:27: error: linux/pf_ring.h: No such file or 
directory
In file included from pf1.c:47:
/usr/local/include/pfring.h:132: error: expected specifier-qualifier-list 
before ‘packet_direction’
/usr/local/include/pfring.h:231: error: ‘MAX_NUM_RX_CHANNELS’ undeclared here 
(not in a function)
/usr/local/include/pfring.h:248: error: expected declaration specifiers or 
‘...’ before ‘hw_filtering_rule’
/usr/local/include/pfring.h:258: error: expected declaration specifiers or 
‘...’ before ‘packet_direction’
/usr/local/include/pfring.h:259: error: expected declaration specifiers or 
‘...’ before ‘cluster_type’
/usr/local/include/pfring.h:269: error: expected declaration specifiers or 
‘...’ before ‘hash_filtering_rule’
/usr/local/include/pfring.h:272: error: expected declaration specifiers or 
‘...’ before ‘hash_filtering_rule’
/usr/local/include/pfring.h:275: error: expected declaration specifiers or 
‘...’ before ‘filtering_rule’
/usr/local/include/pfring.h:287: error: expected declaration specifiers or 
‘...’ before ‘virtual_filtering_device_info’
pf1.c: In function ‘add_rule’:
pf1.c:158: error: ‘hash_filtering_rule’ undeclared (first use in this function)
pf1.c:158: error: (Each undeclared identifier is reported only once
pf1.c:158: error: for each function it appears in.)
pf1.c:158: error: expected ‘;’ before ‘rule’
pf1.c:160: error: ‘rule’ undeclared (first use in this function)
pf1.c:162: error: ‘dont_forward_packet_and_stop_rule_evaluation’ undeclared 
(first use in this function)
pf1.c:166: error: too many arguments to function 
‘pfring_handle_hash_filtering_rule’
pf1.c:173: error: too many arguments to function 
‘pfring_handle_hash_filtering_rule’
pf1.c: At top level:
pf1.c:329: warning: ‘struct pfring_pkthdr’ declared inside parameter list
pf1.c: In function ‘dummyProcesssPacket’:
pf1.c:341: error: dereferencing pointer to incomplete type
pf1.c:342: error: dereferencing pointer to incomplete type
pf1.c:342: error: invalid application of ‘sizeof’ to incomplete type ‘struct 
pkt_parsing_info’ 
pf1.c:343: warning: passing argument 2 of ‘pfring_parse_pkt’ from incompatible 
pointer type
/usr/local/include/pfring.h:306: note: expected ‘struct pfring_pkthdr *’ but 
argument is of type ‘struct pfring_pkthdr *’
pf1.c:346: error: dereferencing pointer to incomplete type
pf1.c:347: error: dereferencing pointer to incomplete type
pf1.c:348: error: dereferencing pointer to incomplete type
pf1.c:349: error: dereferencing pointer to incomplete type
pf1.c:351: error: dereferencing pointer to incomplete type
pf1.c:352: error: dereferencing pointer to incomplete type
pf1.c:368: error: dereferencing pointer to incomplete type
pf1.c:370: error: dereferencing pointer to incomplete type
pf1.c:371: error: dereferencing pointer to incomplete type
pf1.c:373: error: dereferencing pointer to incomplete type
pf1.c:374: error: dereferencing pointer to incomplete type
pf1.c:374: error: dereferencing pointer to incomplete type
pf1.c:375: error: dereferencing pointer to incomplete type
pf1.c:376: error: dereferencing pointer to incomplete type
pf1.c:377: error: dereferencing pointer to incomplete type
pf1.c:377: error: dereferencing pointer to incomplete type
pf1.c:378: error: dereferencing pointer to incomplete type
pf1.c:381: error: dereferencing pointer to incomplete type
pf1.c:382: error: dereferencing pointer to incomplete type
pf1.c:385: error: dereferencing pointer to incomplete type
pf1.c:389: error: dereferencing pointer to incomplete type
pf1.c:390: error: dereferencing pointer to incomplete type
pf1.c:403: error: dereferencing pointer to incomplete type
pf1.c:405: error: dereferencing pointer to incomplete type
pf1.c:406: error: dereferencing pointer to incomplete type
pf1.c:410: error: dereferencing pointer to incomplete type
pf1.c:411: error: dereferencing pointer to incomplete type
pf1.c:411: error: dereferencing pointer to incomplete type
pf1.c:412: error: dereferencing pointer to incomplete type
pf1.c:412: error: dereferencing pointer to incomplete type
pf1.c:412: error: dereferencing pointer to incomplete type
pf1.c:413: error: dereferencing pointer to incomplete type
pf1.c:414: error: dereferencing pointer to incomplete type
pf1.c:415: error: dereferencing pointer to incomplete type
pf1.c:416: error: dereferencing pointer to incomplete type
pf1.c:426: error: dereferencing pointer to incomplete type
pf1.c:426: error: dereferencing pointer to incomplete type
pf1.c:426: error: dereferencing pointer to incomplete type
pf1.c:427: error: dereferencing pointer to incomplete type
pf1.c:428: error: dereferencing pointer to incomplete type
pf1.c:429: error: dereferencing pointer to incomplete type
pf1.c:430: error: dereferencing pointer to incomplete type
pf1.c:434: error: dereferencing pointer to incomplete type
pf1.c: In function ‘packet_consumer_thread’:
pf1.c:514: error: storage size of ‘hdr’ isn’t known
pf1.c: In function ‘main’:
pf1.c:574: error: ‘packet_direction’ undeclared (first use in this function)
pf1.c:574: error: expected ‘;’ before ‘direction’
pf1.c:628: error: ‘rx_and_tx_direction’ undeclared (first use in this function)
pf1.c:629: error: ‘rx_only_direction’ undeclared (first use in this function)
pf1.c:630: error: ‘tx_only_direction’ undeclared (first use in this function)
pf1.c:631: error: ‘direction’ undeclared (first use in this function)
pf1.c:718: error: ‘cluster_round_robin’ undeclared (first use in this function)
pf1.c:718: error: too many arguments to function ‘pfring_set_cluster’
pf1.c:722: error: too many arguments to function ‘pfring_set_direction’
pf1.c:799: error: ‘filtering_rule’ undeclared (first use in this function)
pf1.c:799: error: expected ‘;’ before ‘rule’
pf1.c:802: error: ‘rule’ undeclared (first use in this function)
pf1.c:805: error: ‘dont_forward_packet_and_stop_rule_evaluation’ undeclared 
(first use in this function)
pf1.c:808: error: too many arguments to function ‘pfring_add_filtering_rule’
pf1.c:821: error: too many arguments to function ‘pfring_add_filtering_rule’
pf1.c:834: error: too many arguments to function ‘pfring_add_filtering_rule’
pf1.c:865: error: expected ‘;’ before ‘rule’
pf1.c:872: error: ‘forward_packet_and_stop_rule_evaluation’ undeclared (first 
use in this function)
pf1.c:877: error: too many arguments to function ‘pfring_add_filtering_rule’
pf1.c:897: warning: passing argument 2 of ‘pfring_loop’ from incompatible 
pointer type
/usr/local/include/pfring.h:235: note: expected ‘pfringProcesssPacket’ but 
argument is of type ‘void (*)(const struct pfring_pkthdr *, const u_char *, 
const u_char *)’



From: [email protected]
Date: Wed, 9 Nov 2011 10:53:34 +0100
To: [email protected]
Subject: Re: [Ntop-misc] PF Ring Sample Program Problem.



I can't understand the reason why you are doing that.If you are not able to 
compile by yourself pfcount, use the one provided by Luca and you will be sure 
it will work out of the box.Y

###############################################Yuri Francalacci   -   
[email protected]   -   http://www.ntop.org
"Simplicity is the ultimate sophistication" - Leonardo da Vinci
###############################################



On Nov 9, 2011, at 9:03 AM, sukbir singh wrote:Dear Yuri,
                 I would like to share with you something. What I did this I 
had reformated my machine and had a clean centos 6. I did all the steps work 
well according to your user guide using svn method, all worked fine except for 
this step insmod pf_ring.ko when I put the option I get error. So what I did 
was just put this type this insmod pf_ring.ko it got registered. Next I run cat 
/proc/net/pf_ring/info and below is the information I get.
PF_RING Version     : 5.1.0 ($Revision: 4971$)
Ring slots          : 4096
Slot version        : 13
Capture TX          : Yes [RX+TX]
IP Defragment       : No
Socket Mode         : Standard
Transparent mode    : Yes (mode 0)
Total rings         : 1
Total plugins       : 0

The problem now I copied your pfcount.c and rename is pf1.c I did a gcc -o pf1 
pf1.c and I get a whole lot of errors. So what else am I missing why I cannot 
compile properly? After the clean installation now in my /usr/local/lib is only 
2 files libpfring.a and libpfring.so. The example like pfcount run perfectly 
fine. Did I miss any steps? Thank you.



From: [email protected]
Date: Wed, 9 Nov 2011 08:58:36 +0100
To: [email protected]
Subject: Re: [Ntop-misc] PF Ring Sample Program Problem.

As rootecho '/usr/local/lib' >> /etc/ld.so.confldconfig

Sent from my iPhone
Il giorno 09/nov/2011, alle ore 01:08, sukbir singh <[email protected]> ha 
scritto:

Dear Yuri,
              Further to my steps I went into the userland/libpcap folder and 
also run make install. Now what I can see in my /usr/local/lib the files are 
libpcap.a, libpcap.so.1,libpring.a,libpcap.so,libpcap.so.1.1.1 and 
libpfring.so. So what else am I missing yet? Thank you.
 
From: [email protected]
Date: Tue, 8 Nov 2011 09:59:17 +0100
To: [email protected]
Subject: Re: [Ntop-misc] PF Ring Sample Program Problem.

By default it is installed in /usr/local/lib/ and I don't know if it is added 
into your ld.so.conf fileY

Sent from my iPhone
Il giorno 08/nov/2011, alle ore 02:26, sukbir singh <[email protected]> ha 
scritto:

Dear Yuri,
              How to check on the pfring lib got install into my directory or 
not? Because what I did I went into PR_RING-4.6.0/userland/lib then I run make 
install command here. So what else command must I run?
 

 
From: [email protected]
Date: Mon, 7 Nov 2011 20:34:49 +0100
To: [email protected]
Subject: Re: [Ntop-misc] PF Ring Sample Program Problem.

Did you add the pfring lib install directory to your library path?Y

Sent from my iPhone
Il giorno 07/nov/2011, alle ore 19:35, sukbir singh <[email protected]> ha 
scritto:

Dear Yuri,
                  I went into userland/lib and run make install. So now I 
compile and that error is gone but I get some new things as below.

/tmp/ccVSDSgn.o: In function `print_stats':
pftry1.c:(.text+0xed): undefined reference to `pfring_stats'
/tmp/ccVSDSgn.o: In function `add_rule':
pftry1.c:(.text+0x43f): undefined reference to `pfring_add_filtering_rule'
/tmp/ccVSDSgn.o: In function `sigproc':
pftry1.c:(.text+0x4ca): undefined reference to `pfring_close'
/tmp/ccVSDSgn.o: In function `packet_consumer_thread':
pftry1.c:(.text+0x11b3): undefined reference to `pthread_setaffinity_np'
pftry1.c:(.text+0x123e): undefined reference to `pfring_recv'
/tmp/ccVSDSgn.o: In function `main':
pftry1.c:(.text+0x1456): undefined reference to `pthread_rwlock_init'
pftry1.c:(.text+0x1486): undefined reference to `pfring_open'
pftry1.c:(.text+0x14a0): undefined reference to `pfring_open_dna'
pftry1.c:(.text+0x14db): undefined reference to `pfring_set_application_name'
pftry1.c:(.text+0x14f1): undefined reference to `pfring_version'
pftry1.c:(.text+0x152f): undefined reference to `pfring_get_num_rx_channels'
pftry1.c:(.text+0x157f): undefined reference to `pfring_set_cluster'
pftry1.c:(.text+0x15ad): undefined reference to `pfring_set_direction'
pftry1.c:(.text+0x1657): undefined reference to `pfring_enable_ring'
pftry1.c:(.text+0x168a): undefined reference to `pthread_create'
pftry1.c:(.text+0x16b6): undefined reference to `pfring_close'
collect2: ld returned 1 exit status


> From: [email protected]
> Date: Mon, 7 Nov 2011 19:30:14 +0100
> To: [email protected]
> Subject: Re: [Ntop-misc] PF Ring Sample Program Problem.
> 
> pfring.h: No such file or directory
> This could be the issue
> Yuri
> 
> Sent from my iPhone
> 
> Il giorno 07/nov/2011, alle ore 19:04, sukbir singh <[email protected]> ha 
> scritto:
> 
> > pfring.h: No such file or directory
> _______________________________________________
> Ntop-misc mailing list
> [email protected]
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

_______________________________________________ Ntop-misc mailing list 
[email protected] 
http://listgateway.unipi.it/mailman/listinfo/ntop-misc_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

_______________________________________________ Ntop-misc mailing list 
[email protected]http://listgateway.unipi.it/mailman/listinfo/ntop-misc_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

_______________________________________________ Ntop-misc mailing list 
[email protected]http://listgateway.unipi.it/mailman/listinfo/ntop-misc_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc


_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc                          
          
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to