]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
napatech: Check for out-of-band control operations
authorJeff Lucovsky <jeff@lucovsky.org>
Fri, 24 Apr 2020 14:28:32 +0000 (10:28 -0400)
committerVictor Julien <victor@inliniac.net>
Mon, 27 Apr 2020 18:06:56 +0000 (20:06 +0200)
This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.

(cherry picked from commit f12adcc58cf5b79aec13609c672918f5279d4a7d)

src/source-napatech.c

index 2b9ba58ec2bbcc3efbad99d919f2557038ba49bf..906bc8520b6a79cb22b472dfb9f0e799975f354c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Open Information Security Foundation
+/* Copyright (C) 2012-2020 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -369,7 +369,11 @@ TmEcode NapatechPacketLoopZC(ThreadVars *tv, void *data, void *slot)
 
         /* Napatech returns packets 1 at a time */
         status = NT_NetRxGet(ntv->rx_stream, &packet_buffer, 1000);
-        if (unlikely(status == NT_STATUS_TIMEOUT || status == NT_STATUS_TRYAGAIN)) {
+        if (unlikely(
+                status == NT_STATUS_TIMEOUT || status == NT_STATUS_TRYAGAIN)) {
+            if (status == NT_STATUS_TIMEOUT) {
+                TmThreadsCaptureHandleTimeout(tv, ntv->slot, NULL);
+            }
             continue;
         } else if (unlikely(status != NT_SUCCESS)) {
             NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);