]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: fix problem introduced in recent commit 780/head
authorEric Leblond <eric@regit.org>
Fri, 17 Jan 2014 16:43:50 +0000 (17:43 +0100)
committerEric Leblond <eric@regit.org>
Fri, 17 Jan 2014 16:43:50 +0000 (17:43 +0100)
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
src/source-af-packet.c

index 054866b70f1db3fcfdd6ce361e13ebbb7a204d2b..456b8be30c421dccf7edf394be3e4c75c3c36f19 100644 (file)
@@ -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;