]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve/flow: turn error into debug assertion
authorVictor Julien <vjulien@oisf.net>
Wed, 18 Sep 2024 07:35:43 +0000 (09:35 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 20 Sep 2024 09:49:15 +0000 (11:49 +0200)
In case this hits logging an error is harmful, better to silently
continue.

Remove use of `default` to help the compiler flag new enum additions.

src/output-json-flow.c

index 14f62aa0040159e64adf27e7ee62b66e4e207aa5..8172d26d37b437686e58b21a20e01a21357978e4 100644 (file)
@@ -252,8 +252,9 @@ static void EveFlowLogJSON(OutputJsonThreadCtx *aft, JsonBuilder *jb, Flow *f)
             JB_SET_STRING(jb, "bypass", "capture");
             break;
 #endif
-        default:
-            SCLogError("Invalid flow state: %d, contact developers", flow_state);
+        case FLOW_STATE_SIZE:
+            DEBUG_VALIDATE_BUG_ON(1);
+            SCLogDebug("invalid flow state: %d, contact developers", flow_state);
     }
 
     const char *reason = NULL;