]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow-bypass: clock_gettime error handling
authorEric Leblond <eric@regit.org>
Sun, 17 Mar 2019 19:00:04 +0000 (20:00 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2019 05:07:02 +0000 (07:07 +0200)
Only reason clock_gettime could fail is a permission so let's
error and leave the flow bypass manager if it is the case.

Also let's suppress the error message if ever the error appear in
the middle of a run (which is unlikely).

src/flow-bypass.c

index 23bc8b99a74afd01c826ddf9b230ff8b2de0a941..7bd9100940a744fa33f8a5636030511806ca2c5d 100644 (file)
@@ -64,8 +64,9 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data)
     struct timespec curtime = {0, 0};
 
     if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "Can't get time: %s (%d)",
+        SCLogError(SC_ERR_INVALID_VALUE, "Can't get time: %s (%d)",
                 strerror(errno), errno);
+        return TM_ECODE_FAILED;
     }
     for (i = 0; i < g_bypassed_func_max_index; i++) {
         if (BypassedFuncList[i].FuncInit) {
@@ -76,8 +77,6 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data)
     while (1) {
         SCLogDebug("Dumping the table");
         if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Can't get time: %s (%d)",
-                         strerror(errno), errno);
             usleep(10000);
             continue;
         }