From 82a2dd859b07c492ce78ea6e7e4bb876582f1f54 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Fri, 17 Jan 2014 17:43:50 +0100 Subject: [PATCH] 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 --- src/source-af-packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;