While using Snort w/PF_RING I noticed that when I sent Snort a SIGUSR1
to dump its stats that it would also exit. The attached patch is one
way to fix this by making libpcap w/PF_RING behave more like vanilla
libpcap.
-- Jason
Index: userland/libpcap-0.9.4-ring/pcap-linux.c
===================================================================
RCS file: /export/home/ntop/PF_RING/userland/libpcap-0.9.4-ring/pcap-linux.c,v
retrieving revision 1.5
diff -u -r1.5 pcap-linux.c
--- userland/libpcap-0.9.4-ring/pcap-linux.c 11 Jan 2006 17:47:18 -0000
1.5
+++ userland/libpcap-0.9.4-ring/pcap-linux.c 17 Jul 2006 18:44:54 -0000
@@ -482,12 +482,18 @@
#ifdef HAVE_PF_RING
if(handle->ring) {
- if(pfring_recv(handle->ring, (char*)handle->buffer, handle->bufsize,
- (struct pfring_pkthdr*)&pcap_header, 1 /*
wait_for_incoming_packet */) > 0) {
+ retry:
+ packet_len = pfring_recv(handle->ring, (char*)handle->buffer,
+ handle->bufsize,
+ (struct pfring_pkthdr*)&pcap_header,
+ 1 /* wait_for_incoming_packet */);
+ if (packet_len > 0) {
bp = handle->buffer;
caplen = pcap_header.caplen, packet_len = pcap_header.len;
goto pfring_pcap_read_packet;
- } else
+ } else if (packet_len == -1 && errno == EINTR)
+ goto retry;
+ else
return(-1);
}
_______________________________________________
Ntop-dev mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev