From: Eric Leblond Date: Fri, 17 Jan 2014 16:43:50 +0000 (+0100) Subject: af-packet: fix problem introduced in recent commit X-Git-Tag: suricata-2.0rc1~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F780%2Fhead;p=thirdparty%2Fsuricata.git af-packet: fix problem introduced in recent commit Logic of patch 98e4a14f6d59fe8928fd6e2af3d9c3e8b42d00bf was correct but implementation is wrong because TP_STATUS_KERNEL is equal to zero and thus can not be evaluated in a binary operation. This patch updates the logic by doing two tests. Reported-by: Alessandro Guido --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 054866b70f..456b8be30c 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -723,7 +723,7 @@ int AFPReadFromRing(AFPThreadVars *ptv) SCReturnInt(AFP_FAILURE); } - if (h.h2->tp_status & (TP_STATUS_KERNEL|TP_STATUS_USER_BUSY)) { + if ((! h.h2->tp_status) || (h.h2->tp_status & TP_STATUS_USER_BUSY)) { if (read_pkts == 0) { if (loop_start == -1) { loop_start = ptv->frame_offset;