]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
error: use SC_EINVAL for invalid input
authorVictor Julien <vjulien@oisf.net>
Fri, 21 Oct 2022 10:24:58 +0000 (12:24 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 20 Dec 2022 07:51:33 +0000 (08:51 +0100)
69 files changed:
src/app-layer-htp-range.c
src/app-layer-htp.c
src/counters.c
src/datasets.c
src/decode.c
src/defrag-config.c
src/detect-asn1.c
src/detect-bytejump.c
src/detect-bytetest.c
src/detect-classtype.c
src/detect-datarep.c
src/detect-dataset.c
src/detect-detection-filter.c
src/detect-engine-content-inspection.c
src/detect-engine-mpm.c
src/detect-engine-threshold.c
src/detect-engine.c
src/detect-flow.c
src/detect-fragbits.c
src/detect-id.c
src/detect-ipproto.c
src/detect-isdataat.c
src/detect-lua.c
src/detect-mqtt-connect-flags.c
src/detect-mqtt-flags.c
src/detect-noalert.c
src/detect-nocase.c
src/detect-prefilter.c
src/detect-rawbytes.c
src/detect-replace.c
src/detect-rpc.c
src/detect-ssl-version.c
src/detect-tag.c
src/detect-target.c
src/detect-tls-version.c
src/detect-xbits.c
src/flow.c
src/output-json-flow.c
src/reputation.c
src/runmode-af-packet.c
src/runmode-dpdk.c
src/runmode-napatech.c
src/runmode-netmap.c
src/runmode-pcap.c
src/runmode-pfring.c
src/source-af-packet.c
src/source-erf-dag.c
src/source-netmap.c
src/source-nflog.c
src/source-nfq.c
src/source-pcap.c
src/source-pfring.c
src/tests/stream-tcp.c
src/unix-manager.c
src/util-cpu.c
src/util-device.c
src/util-ebpf.c
src/util-error.c
src/util-error.h
src/util-hash.c
src/util-host-info.c
src/util-ja3.c
src/util-log-redis.c
src/util-napatech.c
src/util-print.c
src/util-runmodes.c
src/util-spm.c
src/util-storage.c
src/util-threshold-config.c

index 4826142e167057f5d040e9f62ef2473ad0f12a9b..5067fb5fd50f45ceecc676fb2cc0f35aa1327f47 100644 (file)
@@ -155,7 +155,7 @@ void HttpRangeContainersInit(void)
     uint32_t timeout = HTTP_RANGE_DEFAULT_TIMEOUT;
     if (ConfGet("app-layer.protocols.http.byterange.memcap", &str) == 1) {
         if (ParseSizeStringU64(str, &memcap) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
+            SCLogWarning(SC_EINVAL,
                     "memcap value cannot be deduced: %s,"
                     " resetting to default",
                     str);
@@ -165,7 +165,7 @@ void HttpRangeContainersInit(void)
     if (ConfGet("app-layer.protocols.http.byterange.timeout", &str) == 1) {
         size_t slen = strlen(str);
         if (slen > UINT16_MAX || StringParseUint32(&timeout, 10, (uint16_t)slen, str) <= 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
+            SCLogWarning(SC_EINVAL,
                     "timeout value cannot be deduced: %s,"
                     " resetting to default",
                     str);
index c3dec401d76e03a20580c79ce99d9e7339a60018..c0cab849061ca87e26bbd379e67e5aa7939ad148 100644 (file)
@@ -2587,16 +2587,19 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                     SCLogDebug("LIBHTP adding ipv6 server %s at %s: %p",
                                s->name, pval->val, cfg_prec->cfg);
                     if (SCRadixAddKeyIPV6String(pval->val, tree, cfg_prec) == NULL) {
-                        SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP failed to "
-                                     "add ipv6 server %s, ignoring", pval->val);
+                        SCLogWarning(SC_EINVAL,
+                                "LIBHTP failed to "
+                                "add ipv6 server %s, ignoring",
+                                pval->val);
                     }
                 } else {
                     SCLogDebug("LIBHTP adding ipv4 server %s at %s: %p",
                                s->name, pval->val, cfg_prec->cfg);
                     if (SCRadixAddKeyIPV4String(pval->val, tree, cfg_prec) == NULL) {
-                            SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP failed "
-                                         "to add ipv4 server %s, ignoring",
-                                         pval->val);
+                        SCLogWarning(SC_EINVAL,
+                                "LIBHTP failed "
+                                "to add ipv4 server %s, ignoring",
+                                pval->val);
                     }
                 } /* else - if (strchr(pval->val, ':') != NULL) */
             } /* TAILQ_FOREACH(pval, &p->head, next) */
@@ -2611,8 +2614,10 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                 SCLogDebug("LIBHTP default: %s=%s (%d)", p->name, p->val,
                            personality);
                 if (htp_config_set_server_personality(cfg_prec->cfg, personality) == HTP_ERROR){
-                    SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP Failed adding "
-                                 "personality \"%s\", ignoring", p->val);
+                    SCLogWarning(SC_EINVAL,
+                            "LIBHTP Failed adding "
+                            "personality \"%s\", ignoring",
+                            p->val);
                 } else {
                     SCLogDebug("LIBHTP personality set to %s",
                                HTPLookupPersonalityString(personality));
@@ -2843,11 +2848,12 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
             uint32_t range;
             if (StringParseU32RangeCheck(&range, 10, 0,
                                          (const char *)p->val, 0, 100) < 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for randomize"
-                           "-inspection-range setting from conf file - \"%s\"."
-                           " It should be a valid integer less than or equal to 100."
-                           " Killing engine",
-                           p->val);
+                SCLogError(SC_EINVAL,
+                        "Invalid value for randomize"
+                        "-inspection-range setting from conf file - \"%s\"."
+                        " It should be a valid integer less than or equal to 100."
+                        " Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
             cfg_prec->randomize_range = range;
index 33ebbe43c7db616f96db0003c6e5e87fcf877702..b568d335e7f63b1c70356410515774a21c78c3bb 100644 (file)
@@ -271,9 +271,10 @@ static void StatsInitCtxPreOutput(void)
         const char *interval = ConfNodeLookupChildValue(stats, "interval");
         if (interval != NULL)
             if (StringParseUint32(&stats_tts, 10, 0, interval) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                             "interval: \"%s\". Resetting to %d.", interval,
-                             STATS_MGMTT_TTS);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid value for "
+                        "interval: \"%s\". Resetting to %d.",
+                        interval, STATS_MGMTT_TTS);
                 stats_tts = STATS_MGMTT_TTS;
             }
 
index e61456b1983ec9d4cade91d6b1652d1a96cfb80f..69f364fc8f48f9393f477725173c7c9cb2cd8385 100644 (file)
@@ -855,7 +855,7 @@ static void GetDefaultMemcap(uint64_t *memcap, uint32_t *hashsize)
     const char *str = NULL;
     if (ConfGet("datasets.defaults.memcap", &str) == 1) {
         if (ParseSizeStringU64(str, memcap) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
+            SCLogWarning(SC_EINVAL,
                     "memcap value cannot be deduced: %s,"
                     " resetting to default",
                     str);
@@ -864,7 +864,7 @@ static void GetDefaultMemcap(uint64_t *memcap, uint32_t *hashsize)
     }
     if (ConfGet("datasets.defaults.hashsize", &str) == 1) {
         if (ParseSizeStringU32(str, hashsize) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
+            SCLogWarning(SC_EINVAL,
                     "hashsize value cannot be deduced: %s,"
                     " resetting to default",
                     str);
@@ -925,7 +925,7 @@ int DatasetsInit(void)
             ConfNode *set_memcap = ConfNodeLookupChild(iter, "memcap");
             if (set_memcap) {
                 if (ParseSizeStringU64(set_memcap->val, &memcap) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "memcap value cannot be"
                             " deduced: %s, resetting to default",
                             set_memcap->val);
@@ -935,7 +935,7 @@ int DatasetsInit(void)
             ConfNode *set_hashsize = ConfNodeLookupChild(iter, "hashsize");
             if (set_hashsize) {
                 if (ParseSizeStringU32(set_hashsize->val, &hashsize) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "hashsize value cannot be"
                             " deduced: %s, resetting to default",
                             set_hashsize->val);
index fec718c64ce94935b7d181dfea5b50636eba1f99..dbe7f2d9efe9f190f344398a16e60e18f77f3440 100644 (file)
@@ -850,7 +850,7 @@ void DecodeGlobalConfig(void)
     intmax_t value = 0;
     if (ConfGetInt("decoder.max-layers", &value) == 1) {
         if (value < 0 || value > UINT8_MAX) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for decoder.max-layers");
+            SCLogWarning(SC_EINVAL, "Invalid value for decoder.max-layers");
         } else {
             decoder_max_layers = (uint8_t)value;
         }
@@ -863,8 +863,8 @@ void PacketAlertGetMaxConfig(void)
     intmax_t max = 0;
     if (ConfGetInt("packet-alert-max", &max) == 1) {
         if (max <= 0 || max > UINT8_MAX) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                    "Invalid value for packet-alert-max, default value set instead");
+            SCLogWarning(
+                    SC_EINVAL, "Invalid value for packet-alert-max, default value set instead");
         } else {
             packet_alert_max = (uint16_t)max;
         }
index beafe962f657f577f52627cffb7319d65bdf7620..9660b2e98efd1f5d8baa9b57aa463d6c38517416 100644 (file)
@@ -52,14 +52,12 @@ static void DefragPolicyAddHostInfo(char *host_ip_range, uint64_t timeout)
     if (strchr(host_ip_range, ':') != NULL) {
         SCLogDebug("adding ipv6 host %s", host_ip_range);
         if (SCRadixAddKeyIPV6String(host_ip_range, defrag_tree, (void *)user_data) == NULL) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                        "failed to add ipv6 host %s", host_ip_range);
+            SCLogWarning(SC_EINVAL, "failed to add ipv6 host %s", host_ip_range);
         }
     } else {
         SCLogDebug("adding ipv4 host %s", host_ip_range);
         if (SCRadixAddKeyIPV4String(host_ip_range, defrag_tree, (void *)user_data) == NULL) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                        "failed to add ipv4 host %s", host_ip_range);
+            SCLogWarning(SC_EINVAL, "failed to add ipv4 host %s", host_ip_range);
         }
     }
 }
index b21445e37a5d8c55a231f6f292f15a41dd16f3ab..eea1810d11d104fd90291943fcee219519d07816 100644 (file)
@@ -104,8 +104,7 @@ static DetectAsn1Data *DetectAsn1Parse(const char *asn1str)
     DetectAsn1Data *ad = rs_detect_asn1_parse(asn1str);
 
     if (ad == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Malformed asn1 argument: %s",
-                   asn1str);
+        SCLogError(SC_EINVAL, "Malformed asn1 argument: %s", asn1str);
     }
 
     return ad;
index 7a842f38b7cef1054db6ca4eb5bcd70da05c2dc0..e78fa674ad84f1603545e76f5bff2eec46007248 100644 (file)
@@ -399,7 +399,7 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
 
     /* Number of bytes */
     if (StringParseUint32(&nbytes, 10, (uint16_t)strlen(args[0]), args[0]) <= 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Malformed number of bytes: %s", optstr);
+        SCLogError(SC_EINVAL, "Malformed number of bytes: %s", optstr);
         goto error;
     }
 
@@ -416,7 +416,7 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
             goto error;
     } else {
         if (StringParseInt32(&data->offset, 0, (uint16_t)strlen(args[1]), args[1]) <= 0) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Malformed offset: %s", optstr);
+            SCLogError(SC_EINVAL, "Malformed offset: %s", optstr);
             goto error;
         }
     }
@@ -450,19 +450,19 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
         } else if (strncasecmp("multiplier ", args[i], 11) == 0) {
             if (StringParseUint32(
                         &data->multiplier, 10, (uint16_t)strlen(args[i]) - 11, args[i] + 11) <= 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Malformed multiplier: %s", optstr);
+                SCLogError(SC_EINVAL, "Malformed multiplier: %s", optstr);
                 goto error;
             }
         } else if (strncasecmp("post_offset ", args[i], 12) == 0) {
             if (StringParseInt32(&data->post_offset, 10, (uint16_t)strlen(args[i]) - 12,
                         args[i] + 12) <= 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Malformed post_offset: %s", optstr);
+                SCLogError(SC_EINVAL, "Malformed post_offset: %s", optstr);
                 goto error;
             }
         } else if (strcasecmp("dce", args[i]) == 0) {
             data->flags |= DETECT_BYTEJUMP_DCE;
         } else {
-            SCLogError(SC_ERR_INVALID_VALUE, "Unknown option: \"%s\"", args[i]);
+            SCLogError(SC_EINVAL, "Unknown option: \"%s\"", args[i]);
             goto error;
         }
     }
@@ -482,19 +482,25 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
          * "01777777777777777777777" = 0xffffffffffffffff
          */
         if (nbytes > 23) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 23 bytes "
-                   "with \"string\": %s", optstr);
+            SCLogError(SC_EINVAL,
+                    "Cannot test more than 23 bytes "
+                    "with \"string\": %s",
+                    optstr);
             goto error;
         }
     } else {
         if (nbytes > 8) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 8 bytes "
-                   "without \"string\": %s\n", optstr);
+            SCLogError(SC_EINVAL,
+                    "Cannot test more than 8 bytes "
+                    "without \"string\": %s\n",
+                    optstr);
             goto error;
         }
         if (data->base != DETECT_BYTEJUMP_BASE_UNSET) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot use a base "
-                   "without \"string\": %s", optstr);
+            SCLogError(SC_EINVAL,
+                    "Cannot use a base "
+                    "without \"string\": %s",
+                    optstr);
             goto error;
         }
     }
index d231b6edb44ff1e35fb9b49699634fecc21422f8..dcdf2734a5c4bb5614d621a2cbf73bfe33dbdf90 100644 (file)
@@ -327,7 +327,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
 
     /* Number of bytes */
     if (StringParseUint32(&nbytes, 10, 0, args[0]) <= 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Malformed number of bytes: %s", str_ptr);
+        SCLogError(SC_EINVAL, "Malformed number of bytes: %s", str_ptr);
         goto error;
     }
 
@@ -388,7 +388,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
                 goto error;
         } else {
             if (ByteExtractStringUint64(&data->value, 0, 0, test_value) <= 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Malformed value: %s", test_value);
+                SCLogError(SC_EINVAL, "Malformed value: %s", test_value);
                 goto error;
             }
         }
@@ -417,7 +417,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
                 goto error;
         } else {
             if (StringParseInt32(&data->offset, 0, 0, data_offset) <= 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Malformed offset: %s", data_offset);
+                SCLogError(SC_EINVAL, "Malformed offset: %s", data_offset);
                 goto error;
             }
         }
@@ -467,18 +467,16 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
          * "01777777777777777777777" = 0xffffffffffffffff
          */
         if (nbytes > 23) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 23 bytes with \"string\": %s",
-                        optstr);
+            SCLogError(SC_EINVAL, "Cannot test more than 23 bytes with \"string\": %s", optstr);
             goto error;
         }
     } else {
         if (nbytes > 8) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 8 bytes without \"string\": %s",
-                        optstr);
+            SCLogError(SC_EINVAL, "Cannot test more than 8 bytes without \"string\": %s", optstr);
             goto error;
         }
         if (data->base != DETECT_BYTETEST_BASE_UNSET) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Cannot use a base without \"string\": %s", optstr);
+            SCLogError(SC_EINVAL, "Cannot use a base without \"string\": %s", optstr);
             goto error;
         }
     }
@@ -488,7 +486,8 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
 
     if (bitmask_index != -1 && data->flags & DETECT_BYTETEST_BITMASK) {
         if (ByteExtractStringUint32(&data->bitmask, 0, 0, args[bitmask_index]+strlen("bitmask")) <= 0) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Malformed bitmask value: %s", args[bitmask_index]+strlen("bitmask"));
+            SCLogError(SC_EINVAL, "Malformed bitmask value: %s",
+                    args[bitmask_index] + strlen("bitmask"));
             goto error;
         }
         /* determine how many trailing 0's are in the bitmask. This will be used
index ae4490c035c24fd744b5c066f5e1c309f761b2e1..002ebc6f51c792053ec41afd34706bb22a6815a6 100644 (file)
@@ -88,8 +88,8 @@ static int DetectClasstypeParseRawString(const char *rawstr, char *out, size_t o
     }
 
     if (strlen(e) >= CLASSTYPE_NAME_MAX_LEN) {
-        SCLogError(SC_ERR_INVALID_VALUE, "classtype '%s' is too big: max %d",
-                rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
+        SCLogError(
+                SC_EINVAL, "classtype '%s' is too big: max %d", rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
         return -1;
     }
     (void)strlcpy(out, e, outsize);
index fac0a131dab798ccabad67856681841d5238c71e..cfc3ba35052e508c15493107bcaa0440a5417ff9 100644 (file)
@@ -176,7 +176,7 @@ static int DetectDatarepParse(const char *str, char *cmd, int cmd_len, char *nam
             }
             if (strcmp(key, "memcap") == 0) {
                 if (ParseSizeStringU64(val, memcap) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "invalid value for memcap: %s,"
                             " resetting to default",
                             val);
@@ -185,7 +185,7 @@ static int DetectDatarepParse(const char *str, char *cmd, int cmd_len, char *nam
             }
             if (strcmp(key, "hashsize") == 0) {
                 if (ParseSizeStringU32(val, hashsize) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "invalid value for hashsize: %s,"
                             " resetting to default",
                             val);
index ad6a5805895c09fcaf49b3d2ca9ea79afdf88800..2384a0758536e1d6122f4d03398e4886996baabe 100644 (file)
@@ -198,7 +198,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
             }
             if (strcmp(key, "memcap") == 0) {
                 if (ParseSizeStringU64(val, memcap) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "invalid value for memcap: %s,"
                             " resetting to default",
                             val);
@@ -207,7 +207,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
             }
             if (strcmp(key, "hashsize") == 0) {
                 if (ParseSizeStringU32(val, hashsize) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
+                    SCLogWarning(SC_EINVAL,
                             "invalid value for hashsize: %s,"
                             " resetting to default",
                             val);
index 1212c6952f3cdc2bd9a897e6d5a95af657ebee3e..b7b15b53e5f7540d6cda70c4510f429eb4a757f1 100644 (file)
@@ -180,7 +180,7 @@ static DetectThresholdData *DetectDetectionFilterParse(const char *rawstr)
     }
 
     if (df->count == 0 || df->seconds == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "found an invalid value");
+        SCLogError(SC_EINVAL, "found an invalid value");
         goto error;
     }
 
index 529f5155d161a825be04492ab132f90c216b5a64..ae8b5cf42167ea8573b1fb667a2d9c4d19646c54 100644 (file)
@@ -328,7 +328,7 @@ uint8_t DetectEngineContentInspection(DetectEngineCtx *de_ctx, DetectEngineThrea
                              * cast to non-const as replace writes to it. */
                             det_ctx->replist = DetectReplaceAddToList(det_ctx->replist, (uint8_t *)found, cd);
                         } else {
-                            SCLogWarning(SC_ERR_INVALID_VALUE, "Can't modify payload without packet");
+                            SCLogWarning(SC_EINVAL, "Can't modify payload without packet");
                         }
                     }
 
index e7b2b45e56f120303747f32cc8e45bb721e76c6c..c6d33a29e0d29046b43f1290e1e65cc58347ca29 100644 (file)
@@ -870,8 +870,8 @@ uint8_t PatternMatchDefaultMatcher(void)
 
 #ifndef BUILD_HYPERSCAN
             if ((strcmp(mpm_algo, "hs") == 0)) {
-                FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is "
-                        "not compiled into Suricata.");
+                FatalError(SC_EINVAL, "Hyperscan (hs) support for mpm-algo is "
+                                      "not compiled into Suricata.");
             }
 #endif
         }
index 3190550fcfd81fa67ecc93954c5b77d004fe696a..1645013fc33198e24b730f39ed35a846c602a5e9 100644 (file)
@@ -281,8 +281,7 @@ static int ThresholdHandlePacketSuppress(Packet *p,
             break;
         case TRACK_RULE:
         default:
-            SCLogError(SC_ERR_INVALID_VALUE,
-                    "track mode %d is not supported", td->track);
+            SCLogError(SC_EINVAL, "track mode %d is not supported", td->track);
             break;
     }
     if (m == NULL)
@@ -529,7 +528,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
         }
         /* case TYPE_SUPPRESS: is not handled here */
         default:
-            SCLogError(SC_ERR_INVALID_VALUE, "type %d is not supported", td->type);
+            SCLogError(SC_EINVAL, "type %d is not supported", td->type);
     }
     return ret;
 }
index 3df1d334f6bad7f547c3d0d38c1aa62a6c484b4f..bdaebda10ad988b45c3ad152df5bd103fbfa8435 100644 (file)
@@ -2722,10 +2722,11 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
             if (insp_recursion_limit != NULL) {
                 if (StringParseInt32(&de_ctx->inspection_recursion_limit, 10,
                                      0, (const char *)insp_recursion_limit) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                                 "detect-engine.inspection-recursion-limit: %s "
-                                 "resetting to %d", insp_recursion_limit,
-                                 DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT);
+                    SCLogWarning(SC_EINVAL,
+                            "Invalid value for "
+                            "detect-engine.inspection-recursion-limit: %s "
+                            "resetting to %d",
+                            insp_recursion_limit, DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT);
                     de_ctx->inspection_recursion_limit =
                         DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT;
                 }
@@ -4006,8 +4007,8 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
 
                 int vlanbool = 0;
                 if ((ConfGetBool("vlan.use-for-tracking", &vlanbool)) == 1 && vlanbool == 0) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "vlan tracking is disabled, "
-                            "can't use multi-detect selector 'vlan'");
+                    SCLogError(SC_EINVAL, "vlan tracking is disabled, "
+                                          "can't use multi-detect selector 'vlan'");
                     SCMutexUnlock(&master->lock);
                     goto error;
                 }
@@ -4024,8 +4025,10 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
                 }
 
             } else {
-                SCLogError(SC_ERR_INVALID_VALUE, "unknown value %s "
-                                                 "multi-detect.selector", handler);
+                SCLogError(SC_EINVAL,
+                        "unknown value %s "
+                        "multi-detect.selector",
+                        handler);
                 SCMutexUnlock(&master->lock);
                 goto error;
             }
index 6f9e4142761ea4696f423a50ef51196d811f6a01..ae26b05dc0638d6443efd0fafae8e77843b75b81 100644 (file)
@@ -306,7 +306,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
                 }
                 fd->flags |= DETECT_FLOW_FLAG_ONLY_FRAG;
             } else {
-                SCLogError(SC_ERR_INVALID_VALUE, "invalid flow option \"%s\"", args[i]);
+                SCLogError(SC_EINVAL, "invalid flow option \"%s\"", args[i]);
                 goto error;
             }
 
index 0dbca7a672d1fc60cb8ee3ce7b22605c66ab0aa6..248364849586af710f6a1a8d5b0071e5cca30d32 100644 (file)
@@ -193,7 +193,7 @@ static DetectFragBitsData *DetectFragBitsParse (const char *rawstr)
     }
 
     if (args[1] == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "invalid value");
+        SCLogError(SC_EINVAL, "invalid value");
         goto error;
     }
 
index 2f9b54245cd991db34d111508185c94bbcdd9b60..3a086c2bcc9c95f18c49ef721da6c5ad45f93227 100644 (file)
@@ -129,9 +129,10 @@ static DetectIdData *DetectIdParse (const char *idstr)
     ret = DetectParsePcreExec(&parse_regex, idstr, 0, 0);
 
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_ERR_INVALID_VALUE, "invalid id option '%s'. The id option "
-                    "value must be in the range %u - %u",
-                    idstr, DETECT_IPID_MIN, DETECT_IPID_MAX);
+        SCLogError(SC_EINVAL,
+                "invalid id option '%s'. The id option "
+                "value must be in the range %u - %u",
+                idstr, DETECT_IPID_MIN, DETECT_IPID_MAX);
         return NULL;
     }
 
@@ -154,7 +155,7 @@ static DetectIdData *DetectIdParse (const char *idstr)
 
     /* ok, fill the id data */
     if (StringParseUint16(&temp, 10, 0, (const char *)tmp_str) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "invalid id option '%s'", tmp_str);
+        SCLogError(SC_EINVAL, "invalid id option '%s'", tmp_str);
         return NULL;
     }
 
index 656f07daee5ef7633cf515a9301d60888a384752..4b6ca45abfac94d6536dbecb99c1192808906dbc 100644 (file)
@@ -124,15 +124,14 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
     if (!isdigit((unsigned char)*(args[1]))) {
         uint8_t proto;
         if (!SCGetProtoByName(args[1], &proto)) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Unknown protocol name: \"%s\"", str_ptr);
+            SCLogError(SC_EINVAL, "Unknown protocol name: \"%s\"", str_ptr);
             goto error;
         }
         data->proto = proto;
     }
     else {
         if (StringParseUint8(&data->proto, 10, 0, args[1]) <= 0) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Malformed protocol number: %s",
-                       str_ptr);
+            SCLogError(SC_EINVAL, "Malformed protocol number: %s", str_ptr);
             goto error;
         }
     }
index 9da32162608621d4a831ef66a69d3466258e46d4..faf4c43aa8f39769db3659c85f5166646804c64e 100644 (file)
@@ -158,7 +158,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
         } else {
             if (StringParseUint16(&idad->dataat, 10,
                                         strlen(args[0]), args[0]) < 0 ) {
-                SCLogError(SC_ERR_INVALID_VALUE, "isdataat out of range");
+                SCLogError(SC_EINVAL, "isdataat out of range");
                 SCFree(idad);
                 idad = NULL;
                 goto error;
index f3b29a53db044c8d8e6bafd3484e6676f3e08a3b..8196c546a6ffc8da8652ee5c754196ead37ac9e8 100644 (file)
@@ -268,8 +268,10 @@ int DetectLuaMatchBuffer(DetectEngineThreadCtx *det_ctx,
                 if (strcmp(k, "retval") == 0) {
                     int val;
                     if (StringParseInt32(&val, 10, 0, (const char *)v) < 0) {
-                        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
-                                   "for \"retval\" from LUA return table: '%s'", v);
+                        SCLogError(SC_EINVAL,
+                                "Invalid value "
+                                "for \"retval\" from LUA return table: '%s'",
+                                v);
                         ret = 0;
                     }
                     else if (val == 1) {
@@ -423,8 +425,10 @@ static int DetectLuaMatch (DetectEngineThreadCtx *det_ctx,
                     int val;
                     if (StringParseInt32(&val, 10, 0,
                                          (const char *)v) < 0) {
-                        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
-                                   "for \"retval\" from LUA return table: '%s'", v);
+                        SCLogError(SC_EINVAL,
+                                "Invalid value "
+                                "for \"retval\" from LUA return table: '%s'",
+                                v);
                         ret = 0;
                     }
                     else if (val == 1) {
@@ -532,8 +536,10 @@ static int DetectLuaAppMatchCommon (DetectEngineThreadCtx *det_ctx,
                     int val;
                     if (StringParseInt32(&val, 10, 0,
                                          (const char *)v) < 0) {
-                        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
-                                   "for \"retval\" from LUA return table: '%s'", v);
+                        SCLogError(SC_EINVAL,
+                                "Invalid value "
+                                "for \"retval\" from LUA return table: '%s'",
+                                v);
                         ret = 0;
                     }
                     else if (val == 1) {
index c5ff4261f392494392e2c5b2de56419e10db271d..e2119a82aac8446404f0c69171005490b5550366 100644 (file)
@@ -152,31 +152,31 @@ static DetectMQTTConnectFlagsData *DetectMQTTConnectFlagsParse(const char *rawst
             }
             if (strcmp(flagv+offset, "username") == 0) {
                 if (de->username != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->username = fs_to_set;
             } else if (strcmp(flagv+offset, "password") == 0) {
                 if (de->password != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->password = fs_to_set;
             } else if (strcmp(flagv+offset, "will") == 0) {
                 if (de->will != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->will = fs_to_set;
             } else if (strcmp(flagv+offset, "will_retain") == 0) {
                 if (de->will_retain != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->will_retain = fs_to_set;
             } else if (strcmp(flagv+offset, "clean_session") == 0) {
                 if (de->clean_session != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->clean_session = fs_to_set;
index bbde89e9a2c41bb39b0e773adf4febb2facec5d3..33e470e92a1256b64dd62d08e789bd251067c0bb 100644 (file)
@@ -150,13 +150,13 @@ static DetectMQTTFlagsData *DetectMQTTFlagsParse(const char *rawstr)
             }
             if (strcmp(flagv+offset, "dup") == 0) {
                 if (de->dup != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->dup = fs_to_set;
             } else if (strcmp(flagv+offset, "retain") == 0) {
                 if (de->retain != MQTT_DONT_CARE) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->retain = fs_to_set;
index 0a89163e45d04a49aa6c42a6163b9ef7bd421318..9ca2d29a44fc1d5ceeaefaf276f4c1ed607a11e7 100644 (file)
@@ -42,7 +42,7 @@ void DetectNoalertRegister (void)
 static int DetectNoalertSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr)
 {
     if (nullstr != NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "nocase has no value");
+        SCLogError(SC_EINVAL, "nocase has no value");
         return -1;
     }
 
index b2d8b834a0c9d83113ffc6a34365d2c552d9c867..a8d67fb7119bc2ff18127b69208717c3dceca695 100644 (file)
@@ -62,7 +62,7 @@ static int DetectNocaseSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     int ret = -1;
 
     if (nullstr != NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "nocase has value");
+        SCLogError(SC_EINVAL, "nocase has value");
         goto end;
     }
 
index 87e8491e7c00ed620b13c70838c983c2fbbc69fd..a348022b869cddefc95bf4b8dbe46f9b001e2287 100644 (file)
@@ -57,7 +57,7 @@ static int DetectPrefilterSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
     SCEnter();
 
     if (nullstr != NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "prefilter has value");
+        SCLogError(SC_EINVAL, "prefilter has value");
         SCReturnInt(-1);
     }
 
index d478f70724041896dac405987228c79cb13f70fb..e28a1f51c8097aaefc84f7d63dd7952ae1e4c6bc 100644 (file)
@@ -55,7 +55,7 @@ static int DetectRawbytesSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     SCEnter();
 
     if (nullstr != NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "rawbytes has no value");
+        SCLogError(SC_EINVAL, "rawbytes has no value");
         SCReturnInt(-1);
     }
 
index cb0cf169f8bc880685cb5a99ee04939747d392bd..72d547ea6ff07197fce4367bcc6f6f28709c26bd 100644 (file)
@@ -96,8 +96,7 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
     uint16_t len = 0;
 
     if (s->init_data->negated) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Can't negate replacement string: %s",
-                   replacestr);
+        SCLogError(SC_EINVAL, "Can't negate replacement string: %s", replacestr);
         return -1;
     }
 
index 5394511027cb8733aaba58c5c39e80998bc01921..95ef8f08c8577d10917fc708029533c9a17f33af 100644 (file)
@@ -227,7 +227,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
                 break;
             }
         } else {
-            SCLogError(SC_ERR_INVALID_VALUE, "invalid rpc option %s",rpcstr);
+            SCLogError(SC_EINVAL, "invalid rpc option %s", rpcstr);
             goto error;
         }
     }
index ad81c82374b66c7ff3a5650a600e13fd332e5c23..e91d092393e321a27d7eb41410bd5cf49e87a4f5 100644 (file)
@@ -215,7 +215,7 @@ static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, cons
         tmp_str++;
     }
     if (tmp_str[0] == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid empty value");
+        SCLogError(SC_EINVAL, "Invalid empty value");
         goto error;
     }
     // iterate every version separated by comma
@@ -236,7 +236,7 @@ static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, cons
             if (tmp_len == strlen(ssl_version_keywords[i].word) &&
                     strncasecmp(ssl_version_keywords[i].word, tmp_str, tmp_len) == 0) {
                 if (ssl->data[ssl_version_keywords[i].index].ver != 0) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "Invalid duplicate value");
+                    SCLogError(SC_EINVAL, "Invalid duplicate value");
                     goto error;
                 }
                 ssl->data[ssl_version_keywords[i].index].ver = ssl_version_keywords[i].value;
@@ -247,7 +247,7 @@ static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, cons
             }
         }
         if (!is_keyword) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Invalid unknown value");
+            SCLogError(SC_EINVAL, "Invalid unknown value");
             goto error;
         }
 
@@ -257,7 +257,7 @@ static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, cons
         if (found == 0) {
             found |= 1 << neg;
         } else if (found != 1 << neg) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Invalid value mixing negative and positive forms");
+            SCLogError(SC_EINVAL, "Invalid value mixing negative and positive forms");
             goto error;
         }
 
index c9e0a4dbddd6f7fd69ba6330b7a45c2b535d6bac..0a3e64d4f89996015082302e5a14174e4eb7d68b 100644 (file)
@@ -178,7 +178,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
     } else if (strcasecmp("host", str_ptr) == 0) {
         td.type = DETECT_TAG_TYPE_HOST;
     } else {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument type. Must be session or host (%s)", tagstr);
+        SCLogError(SC_EINVAL, "Invalid argument type. Must be session or host (%s)", tagstr);
         goto error;
     }
     pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
@@ -200,7 +200,10 @@ static DetectTagData *DetectTagParse(const char *tagstr)
         /* count */
         if (StringParseUint32(&td.count, 10, strlen(str_ptr),
                     str_ptr) <= 0) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument for count. Must be a value in the range of 0 to %"PRIu32" (%s)", UINT32_MAX, tagstr);
+            SCLogError(SC_EINVAL,
+                    "Invalid argument for count. Must be a value in the range of 0 to %" PRIu32
+                    " (%s)",
+                    UINT32_MAX, tagstr);
             goto error;
         }
 
@@ -225,7 +228,10 @@ static DetectTagData *DetectTagParse(const char *tagstr)
         } else if (strcasecmp("bytes", str_ptr) == 0) {
             td.metric = DETECT_TAG_METRIC_BYTES;
         } else {
-            SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument metric. Must be one of \"seconds\", \"packets\" or \"bytes\" (%s)", tagstr);
+            SCLogError(SC_EINVAL,
+                    "Invalid argument metric. Must be one of \"seconds\", \"packets\" or \"bytes\" "
+                    "(%s)",
+                    tagstr);
             goto error;
         }
 
@@ -247,12 +253,18 @@ static DetectTagData *DetectTagParse(const char *tagstr)
             } else if (strcasecmp("dst", str_ptr) == 0) {
                 td.direction = DETECT_TAG_DIR_DST;
             } else {
-                SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument direction. Must be one of \"src\" or \"dst\" (only valid for tag host type, not sessions) (%s)", tagstr);
+                SCLogError(SC_EINVAL,
+                        "Invalid argument direction. Must be one of \"src\" or \"dst\" (only valid "
+                        "for tag host type, not sessions) (%s)",
+                        tagstr);
                 goto error;
             }
 
             if (td.type != DETECT_TAG_TYPE_HOST) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Argument direction doesn't make sense for type \"session\" (%s [%"PRIu8"])", tagstr, td.type);
+                SCLogWarning(SC_EINVAL,
+                        "Argument direction doesn't make sense for type \"session\" (%s [%" PRIu8
+                        "])",
+                        tagstr, td.type);
             }
 
             pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
index bd842427d85b47bd37e4f41c75914c424d0e1e43..10e182de1384a97ba5642751c85df5d5c671b89e 100644 (file)
@@ -114,7 +114,7 @@ static int DetectTargetParse(Signature *s, const char *targetstr)
         }
         s->flags |= SIG_FLAG_DEST_IS_TARGET;
     } else {
-        SCLogError(SC_ERR_INVALID_VALUE, "only 'src_ip' and 'dest_ip' are supported as target value");
+        SCLogError(SC_EINVAL, "only 'src_ip' and 'dest_ip' are supported as target value");
         return -1;
     }
     return 0;
index 20dac3ef1048e467cf35b233cae5c76eb007405f..6bc0259f847d2f49a5650b903c9a4d35d2bd5037 100644 (file)
@@ -196,7 +196,7 @@ static DetectTlsVersionData *DetectTlsVersionParse (DetectEngineCtx *de_ctx, con
             temp = (uint16_t)strtol(tmp_str, NULL, 0);
             tls->flags |= DETECT_TLS_VERSION_FLAG_RAW;
         } else {
-            SCLogError(SC_ERR_INVALID_VALUE, "Invalid value");
+            SCLogError(SC_EINVAL, "Invalid value");
             goto error;
         }
 
index 6dc3dd425c15acde83b9083b3e174a3fc60395f3..1e21468fef402a4baabeafb0e943933c7c88fe6e 100644 (file)
@@ -259,12 +259,14 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
                 }
                 SCLogDebug("expire_str %s", expire_str);
                 if (StringParseUint32(&expire, 10, 0, (const char *)expire_str) < 0) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for "
-                               "expire: \"%s\"", expire_str);
+                    SCLogError(SC_EINVAL,
+                            "Invalid value for "
+                            "expire: \"%s\"",
+                            expire_str);
                     return -1;
                 }
                 if (expire == 0) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "expire must be bigger than 0");
+                    SCLogError(SC_EINVAL, "expire must be bigger than 0");
                     return -1;
                 }
                 SCLogDebug("expire %d", expire);
index 47d3beca6442fe0b056417b391492895db5968ca..3375c98057c75e26c14b2191f7cca6bcad14146d 100644 (file)
@@ -564,8 +564,8 @@ void FlowInitConfig(bool quiet)
         if (val <= 100 && val >= 1) {
             flow_config.emergency_recovery = (uint8_t)val;
         } else {
-            SCLogError(SC_ERR_INVALID_VALUE, "flow.emergency-recovery must be in the range of "
-                                             "1 and 100 (as percentage)");
+            SCLogError(SC_EINVAL, "flow.emergency-recovery must be in the range of "
+                                  "1 and 100 (as percentage)");
             flow_config.emergency_recovery = FLOW_DEFAULT_EMERGENCY_RECOVERY;
         }
     } else {
index f817bc1fb27950a397ee38a542be4a38bcd4318a..46484a814037d38e4ba87d0a9471757e2a48aedd 100644 (file)
@@ -249,9 +249,7 @@ static void EveFlowLogJSON(OutputJsonThreadCtx *aft, JsonBuilder *jb, Flow *f)
                 break;
 #endif
             default:
-                SCLogError(SC_ERR_INVALID_VALUE,
-                           "Invalid flow state: %d, contact developers",
-                           flow_state);
+                SCLogError(SC_EINVAL, "Invalid flow state: %d, contact developers", flow_state);
         }
     }
 
index e6907c8b159f045cd50ac3709a19fc8dda7c03e1..012d4acf8d527bac5450bc973fd7fa2cd1863e46 100644 (file)
@@ -100,8 +100,7 @@ static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, uint8
 
         SCLogDebug("adding ipv6 host %s", ip);
         if (SCRadixAddKeyIPV6String(ip, cidr_ctx->srepIPV6_tree[cat], (void *)user_data) == NULL) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                        "failed to add ipv6 host %s", ip);
+            SCLogWarning(SC_EINVAL, "failed to add ipv6 host %s", ip);
         }
 
     } else {
@@ -116,8 +115,7 @@ static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, uint8
 
         SCLogDebug("adding ipv4 host %s", ip);
         if (SCRadixAddKeyIPV4String(ip, cidr_ctx->srepIPV4_tree[cat], (void *)user_data) == NULL) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                        "failed to add ipv4 host %s", ip);
+            SCLogWarning(SC_EINVAL, "failed to add ipv4 host %s", ip);
         }
     }
 }
index 2b01edab5573900c9805197662c39d2031717088..badd786f221361e2aed2bcc32d2288ba87876c66 100644 (file)
@@ -198,8 +198,8 @@ static void *ParseAFPConfig(const char *iface)
                 aconf->threads = 0;
             } else {
                 if (StringParseInt32(&aconf->threads, 10, 0, (const char *)threadsstr) < 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid number of "
-                                 "threads, resetting to default");
+                    SCLogWarning(SC_EINVAL, "Invalid number of "
+                                            "threads, resetting to default");
                     aconf->threads = 0;
                 }
             }
@@ -283,7 +283,7 @@ static void *ParseAFPConfig(const char *iface)
         aconf->cluster_id = (uint16_t)(cluster_id_auto++);
     } else {
         if (StringParseUint16(&aconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid cluster_id, resetting to 0");
+            SCLogWarning(SC_EINVAL, "Invalid cluster_id, resetting to 0");
             aconf->cluster_id = 0;
         }
         SCLogDebug("Going to use cluster-id %" PRIu16, aconf->cluster_id);
@@ -406,7 +406,7 @@ static void *ParseAFPConfig(const char *iface)
                                &aconf->ebpf_lb_fd,
                                &aconf->ebpf_t_config);
         if (ret != 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Error when loading eBPF lb file");
+            SCLogWarning(SC_EINVAL, "Error when loading eBPF lb file");
         }
     }
 #else
@@ -445,8 +445,7 @@ static void *ParseAFPConfig(const char *iface)
                                &aconf->ebpf_filter_fd,
                                &aconf->ebpf_t_config);
         if (ret != 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                         "Error when loading eBPF filter file");
+            SCLogWarning(SC_EINVAL, "Error when loading eBPF filter file");
         }
 #else
         SCLogError(SC_ERR_UNIMPLEMENTED, "eBPF support is not build-in");
@@ -496,8 +495,7 @@ static void *ParseAFPConfig(const char *iface)
                 aconf->xdp_mode = XDP_FLAGS_HW_MODE;
                 aconf->ebpf_t_config.flags |= EBPF_XDP_HW_MODE;
             } else {
-                SCLogWarning(SC_ERR_INVALID_VALUE,
-                             "Invalid xdp-mode value: '%s'", xdp_mode);
+                SCLogWarning(SC_EINVAL, "Invalid xdp-mode value: '%s'", xdp_mode);
             }
         }
 
@@ -523,14 +521,12 @@ static void *ParseAFPConfig(const char *iface)
                 SCLogInfo("Loaded pinned maps from sysfs");
                 break;
             case -1:
-                SCLogWarning(SC_ERR_INVALID_VALUE,
-                             "Error when loading XDP filter file");
+                SCLogWarning(SC_EINVAL, "Error when loading XDP filter file");
                 break;
             case 0:
                 ret = EBPFSetupXDP(aconf->iface, aconf->xdp_filter_fd, aconf->xdp_mode);
                 if (ret != 0) {
-                    SCLogWarning(SC_ERR_INVALID_VALUE,
-                            "Error when setting up XDP");
+                    SCLogWarning(SC_EINVAL, "Error when setting up XDP");
                 } else {
                     /* Try to get the xdp-cpu-redirect key */
                     const char *cpuset;
@@ -539,8 +535,7 @@ static void *ParseAFPConfig(const char *iface)
                         SCLogConfig("Setting up CPU map XDP");
                         ConfNode *node = ConfGetChildWithDefault(if_root, if_default, "xdp-cpu-redirect");
                         if (node == NULL) {
-                            SCLogError(SC_ERR_INVALID_VALUE,
-                                       "Previously found node has disappeared");
+                            SCLogError(SC_EINVAL, "Previously found node has disappeared");
                         } else {
                             EBPFBuildCPUSet(node, aconf->iface);
                         }
@@ -570,7 +565,7 @@ static void *ParseAFPConfig(const char *iface)
 
     if ((ConfGetChildValueIntWithDefault(if_root, if_default, "block-size", &value)) == 1) {
         if (value % getpagesize()) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Block-size must be a multiple of pagesize.");
+            SCLogError(SC_EINVAL, "Block-size must be a multiple of pagesize.");
         } else {
             aconf->block_size = value;
         }
@@ -712,7 +707,7 @@ int AFPRunModeIsIPS()
     for (ldev = 0; ldev < nlive; ldev++) {
         const char *live_dev = LiveGetDeviceName(ldev);
         if (live_dev == NULL) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+            SCLogError(SC_EINVAL, "Problem with config file");
             return 0;
         }
         const char *copymodestr = NULL;
@@ -720,7 +715,7 @@ int AFPRunModeIsIPS()
 
         if (if_root == NULL) {
             if (if_default == NULL) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                SCLogError(SC_EINVAL, "Problem with config file");
                 return 0;
             }
             if_root = if_default;
@@ -744,7 +739,7 @@ int AFPRunModeIsIPS()
         for (ldev = 0; ldev < nlive; ldev++) {
             const char *live_dev = LiveGetDeviceName(ldev);
             if (live_dev == NULL) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                SCLogError(SC_EINVAL, "Problem with config file");
                 return 0;
             }
             if_root = ConfNodeLookupKeyValue(af_packet_node, "interface", live_dev);
@@ -752,7 +747,7 @@ int AFPRunModeIsIPS()
 
             if (if_root == NULL) {
                 if (if_default == NULL) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                    SCLogError(SC_EINVAL, "Problem with config file");
                     return 0;
                 }
                 if_root = if_default;
index 5118d2bd59acffc1f39f21f46b3a3af4c5a1f261..798e63bfd5eb04155f635cc894badf80fdb71286 100644 (file)
@@ -333,7 +333,7 @@ static void ConfigSetIface(DPDKIfaceConfig *iconf, const char *entry_str)
     int retval;
 
     if (entry_str == NULL || entry_str[0] == '\0')
-        FatalError(SC_ERR_INVALID_VALUE, "Interface name in DPDK config is NULL or empty");
+        FatalError(SC_EINVAL, "Interface name in DPDK config is NULL or empty");
 
     retval = rte_eth_dev_get_port_by_name(entry_str, &iconf->port_id);
     if (retval < 0)
@@ -354,8 +354,7 @@ static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
     }
 
     if (entry_str == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Number of threads for interface \"%s\" not specified",
-                iconf->iface);
+        SCLogError(SC_EINVAL, "Number of threads for interface \"%s\" not specified", iconf->iface);
         SCReturnInt(-EINVAL);
     }
 
@@ -366,15 +365,14 @@ static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
     }
 
     if (StringParseInt32(&iconf->threads, 10, 0, entry_str) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
+        SCLogError(SC_EINVAL,
                 "Threads entry for interface %s contain non-numerical characters - \"%s\"",
                 iconf->iface, entry_str);
         SCReturnInt(-EINVAL);
     }
 
     if (iconf->threads < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Interface %s has a negative number of threads",
-                iconf->iface);
+        SCLogError(SC_EINVAL, "Interface %s has a negative number of threads", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -386,8 +384,8 @@ static int ConfigSetRxQueues(DPDKIfaceConfig *iconf, uint16_t nb_queues)
     SCEnter();
     iconf->nb_rx_queues = nb_queues;
     if (iconf->nb_rx_queues < 1) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Interface %s requires to have positive number of RX queues", iconf->iface);
+        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX queues",
+                iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -399,8 +397,8 @@ static int ConfigSetTxQueues(DPDKIfaceConfig *iconf, uint16_t nb_queues)
     SCEnter();
     iconf->nb_tx_queues = nb_queues;
     if (iconf->nb_tx_queues < 1) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Interface %s requires to have positive number of TX queues", iconf->iface);
+        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX queues",
+                iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -411,8 +409,8 @@ static int ConfigSetMempoolSize(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Interface %s requires to have positive memory pool size",
-                iconf->iface);
+        SCLogError(
+                SC_EINVAL, "Interface %s requires to have positive memory pool size", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -429,8 +427,7 @@ static int ConfigSetMempoolCacheSize(DPDKIfaceConfig *iconf, const char *entry_s
         //   RTE_MEMPOOL_CACHE_MAX_SIZE (by default 512) and "mempool-size / 1.5"
         // and at the same time "mempool-size modulo cache_size == 0".
         if (iconf->mempool_size == 0) {
-            SCLogError(SC_ERR_INVALID_VALUE,
-                    "Cannot calculate mempool cache size of a mempool with size %d",
+            SCLogError(SC_EINVAL, "Cannot calculate mempool cache size of a mempool with size %d",
                     iconf->mempool_size);
             SCReturnInt(-EINVAL);
         }
@@ -441,7 +438,7 @@ static int ConfigSetMempoolCacheSize(DPDKIfaceConfig *iconf, const char *entry_s
     }
 
     if (StringParseUint32(&iconf->mempool_cache_size, 10, 0, entry_str) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
+        SCLogError(SC_EINVAL,
                 "Mempool cache size entry for interface %s contain non-numerical "
                 "characters - \"%s\"",
                 iconf->iface, entry_str);
@@ -449,7 +446,7 @@ static int ConfigSetMempoolCacheSize(DPDKIfaceConfig *iconf, const char *entry_s
     }
 
     if (iconf->mempool_cache_size <= 0 || iconf->mempool_cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
-        SCLogError(SC_ERR_INVALID_VALUE,
+        SCLogError(SC_EINVAL,
                 "Interface %s requires to have mempool cache size set to a positive number smaller "
                 "than %" PRIu32,
                 iconf->iface, RTE_MEMPOOL_CACHE_MAX_SIZE);
@@ -463,8 +460,8 @@ static int ConfigSetRxDescriptors(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Interface %s requires to have positive number of RX descriptors", iconf->iface);
+        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX descriptors",
+                iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -476,8 +473,8 @@ static int ConfigSetTxDescriptors(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Interface %s requires to have positive number of TX descriptors", iconf->iface);
+        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX descriptors",
+                iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -494,7 +491,7 @@ static int ConfigSetRSSHashFunctions(DPDKIfaceConfig *iconf, const char *entry_s
     }
 
     if (StringParseUint64(&iconf->rss_hf, 0, 0, entry_str) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
+        SCLogError(SC_EINVAL,
                 "RSS hash functions entry for interface %s contain non-numerical "
                 "characters - \"%s\"",
                 iconf->iface, entry_str);
@@ -508,7 +505,7 @@ static int ConfigSetMtu(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int < RTE_ETHER_MIN_MTU || entry_int > RTE_ETHER_MAX_JUMBO_FRAME_LEN) {
-        SCLogError(SC_ERR_INVALID_VALUE,
+        SCLogError(SC_EINVAL,
                 "Interface %s requires to have size of MTU between %" PRIu32 " and %" PRIu32,
                 iconf->iface, RTE_ETHER_MIN_MTU, RTE_ETHER_MAX_JUMBO_FRAME_LEN);
         SCReturnInt(-ERANGE);
@@ -580,15 +577,14 @@ static int ConfigSetCopyMode(DPDKIfaceConfig *iconf, const char *entry_str)
 {
     SCEnter();
     if (entry_str == NULL) {
-        SCLogWarning(SC_ERR_INVALID_VALUE,
-                "Interface %s has no copy mode specified, changing to %s ", iconf->iface,
-                DPDK_CONFIG_DEFAULT_COPY_MODE);
+        SCLogWarning(SC_EINVAL, "Interface %s has no copy mode specified, changing to %s ",
+                iconf->iface, DPDK_CONFIG_DEFAULT_COPY_MODE);
         entry_str = DPDK_CONFIG_DEFAULT_COPY_MODE;
     }
 
     if (strcmp(entry_str, "none") != 0 && strcmp(entry_str, "tap") != 0 &&
             strcmp(entry_str, "ips") != 0) {
-        SCLogWarning(SC_ERR_INVALID_VALUE,
+        SCLogWarning(SC_EINVAL,
                 "Copy mode \"%s\" is not one of the possible values (none|tap|ips) for interface "
                 "%s. Changing to %s",
                 entry_str, iconf->iface, DPDK_CONFIG_DEFAULT_COPY_MODE);
index 76726926d5a7377428d9915eab5a126372e94c2d..8350014ff58b1e6330ad0804484b979d5aa4e81f 100644 (file)
@@ -195,7 +195,7 @@ static void *NapatechConfigParser(const char *device)
 
     /* device+2 is a pointer to the beginning of the stream id after the constant nt portion */
     if (StringParseUint16(&conf->stream_id, 10, 0, device + 2) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for stream_id: %s", device + 2);
+        SCLogError(SC_EINVAL, "Invalid value for stream_id: %s", device + 2);
         SCFree(conf);
         return NULL;
     }
index a4f22b7c400b3f4a43e2d2afe7ae38553310b7e7..c198b81ed21aa007ff688df747274d6adda78c2c 100644 (file)
@@ -151,8 +151,10 @@ static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
             ns->threads_auto = true;
         } else {
             if (StringParseUint16(&ns->threads, 10, 0, threadsstr) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid config value for "
-                             "threads: %s, resetting to 0", threadsstr);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid config value for "
+                        "threads: %s, resetting to 0",
+                        threadsstr);
                 ns->threads = 0;
             }
         }
@@ -347,7 +349,7 @@ int NetmapRunModeIsIPS()
     for (ldev = 0; ldev < nlive; ldev++) {
         const char *live_dev = LiveGetDeviceName(ldev);
         if (live_dev == NULL) {
-            SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+            SCLogError(SC_EINVAL, "Problem with config file");
             return 0;
         }
         const char *copymodestr = NULL;
@@ -355,7 +357,7 @@ int NetmapRunModeIsIPS()
 
         if (if_root == NULL) {
             if (if_default == NULL) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                SCLogError(SC_EINVAL, "Problem with config file");
                 return 0;
             }
             if_root = if_default;
@@ -379,7 +381,7 @@ int NetmapRunModeIsIPS()
         for (ldev = 0; ldev < nlive; ldev++) {
             const char *live_dev = LiveGetDeviceName(ldev);
             if (live_dev == NULL) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                SCLogError(SC_EINVAL, "Problem with config file");
                 return 0;
             }
             if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
@@ -387,7 +389,7 @@ int NetmapRunModeIsIPS()
 
             if (if_root == NULL) {
                 if (if_default == NULL) {
-                    SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+                    SCLogError(SC_EINVAL, "Problem with config file");
                     return 0;
                 }
                 if_root = if_default;
index 942277e36ed6e5667e1b893c0c92cc274c3d7784..a81b5649a6ca8f0aa79b82e438d62dba376a038c 100644 (file)
@@ -142,8 +142,10 @@ static void *ParsePcapConfig(const char *iface)
     } else {
         if (threadsstr != NULL) {
             if (StringParseInt32(&aconf->threads, 10, 0, (const char *)threadsstr) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                             "pcap.threads: %s, resetting to 1", threadsstr);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid value for "
+                        "pcap.threads: %s, resetting to 1",
+                        threadsstr);
                 aconf->threads = 1;
             }
         }
index 58f3322a0253350ab32698d45a7374c90c3e792c..774f7bcb24321f75d7387dcc1e92890384f51912 100644 (file)
@@ -124,8 +124,10 @@ static void *OldParsePfringConfig(const char *iface)
     } else {
         if (threadsstr != NULL) {
             if (StringParseInt32(&pfconf->threads, 10, 0, threadsstr) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                             "pfring.threads: '%s'. Resetting to 1.", threadsstr);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid value for "
+                        "pfring.threads: '%s'. Resetting to 1.",
+                        threadsstr);
                 pfconf->threads = 1;
             }
         }
@@ -146,8 +148,10 @@ static void *OldParsePfringConfig(const char *iface)
         SCLogError(SC_ERR_INVALID_ARGUMENT,"Could not get cluster-id from config");
     } else {
         if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                         "pfring.cluster_id: '%s'. Resetting to 1.", tmpclusterid);
+            SCLogWarning(SC_EINVAL,
+                    "Invalid value for "
+                    "pfring.cluster_id: '%s'. Resetting to 1.",
+                    tmpclusterid);
             pfconf->cluster_id = 1;
         }
         pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
@@ -265,8 +269,10 @@ static void *ParsePfringConfig(const char *iface)
         } else {
             uint16_t threads = 0;
             if (StringParseUint16(&threads, 10, 0, (const char *)threadsstr) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                             "pfring.threads: '%s'. Resetting to 1.", threadsstr);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid value for "
+                        "pfring.threads: '%s'. Resetting to 1.",
+                        threadsstr);
                 pfconf->threads = 1;
             } else {
                 pfconf->threads = threads;
@@ -283,8 +289,10 @@ static void *ParsePfringConfig(const char *iface)
     /* command line value has precedence */
     if (ConfGet("pfring.cluster-id", &tmpclusterid) == 1) {
         if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                         "pfring.cluster-id: '%s'. Resetting to 1.", tmpclusterid);
+            SCLogWarning(SC_EINVAL,
+                    "Invalid value for "
+                    "pfring.cluster-id: '%s'. Resetting to 1.",
+                    tmpclusterid);
             pfconf->cluster_id = 1;
         }
         pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
@@ -303,8 +311,10 @@ static void *ParsePfringConfig(const char *iface)
                        "Could not get cluster-id from config");
         } else {
             if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-                SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
-                             "pfring.cluster-id: '%s'. Resetting to 1.", tmpclusterid);
+                SCLogWarning(SC_EINVAL,
+                        "Invalid value for "
+                        "pfring.cluster-id: '%s'. Resetting to 1.",
+                        tmpclusterid);
                 pfconf->cluster_id = 1;
             }
             pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
index 901173e823ba4ffe5474f1a3bcbc9c4cc6b98a16..ad20c8e8c834945724e03ff54068fdae0a194901 100644 (file)
@@ -655,7 +655,7 @@ static void AFPWritePacket(Packet *p, int version)
     }
 
     if (p->ethh == NULL) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "Should have an Ethernet header");
+        SCLogWarning(SC_EINVAL, "Should have an Ethernet header");
         return;
     }
 
@@ -1553,8 +1553,7 @@ frame size: TPACKET_ALIGN(snaplen + TPACKET_ALIGN(TPACKET_ALIGN(tp_hdrlen) + siz
     if (snaplen == 0) {
         snaplen = GetIfaceMaxPacketSize(ptv->iface);
         if (snaplen <= 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                         "Unable to get MTU, setting snaplen to sane default of 1514");
+            SCLogWarning(SC_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
             snaplen = 1514;
         }
     }
@@ -1563,7 +1562,7 @@ frame size: TPACKET_ALIGN(snaplen + TPACKET_ALIGN(TPACKET_ALIGN(tp_hdrlen) + siz
     ptv->req.v2.tp_block_size = getpagesize() << order;
     int frames_per_block = ptv->req.v2.tp_block_size / ptv->req.v2.tp_frame_size;
     if (frames_per_block == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Frame size bigger than block size");
+        SCLogError(SC_EINVAL, "Frame size bigger than block size");
         return -1;
     }
     ptv->req.v2.tp_frame_nr = ptv->ring_size;
@@ -1588,8 +1587,7 @@ static int AFPComputeRingParamsV3(AFPThreadVars *ptv)
     if (snaplen == 0) {
         snaplen = GetIfaceMaxPacketSize(ptv->iface);
         if (snaplen <= 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                         "Unable to get MTU, setting snaplen to sane default of 1514");
+            SCLogWarning(SC_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
             snaplen = 1514;
         }
     }
@@ -1598,9 +1596,8 @@ static int AFPComputeRingParamsV3(AFPThreadVars *ptv)
     frames_per_block = ptv->req.v3.tp_block_size / ptv->req.v3.tp_frame_size;
 
     if (frames_per_block == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Block size is too small, it should be at least %d",
-                   ptv->req.v3.tp_frame_size);
+        SCLogError(SC_EINVAL, "Block size is too small, it should be at least %d",
+                ptv->req.v3.tp_frame_size);
         return -1;
     }
     ptv->req.v3.tp_block_nr = ptv->ring_size / frames_per_block + 1;
@@ -1806,8 +1803,10 @@ int AFPIsFanoutSupported(uint16_t cluster_id)
     close(fd);
 
     if (r < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "fanout not supported by kernel: "
-                "Kernel too old or cluster-id %d already in use.", cluster_id);
+        SCLogError(SC_EINVAL,
+                "fanout not supported by kernel: "
+                "Kernel too old or cluster-id %d already in use.",
+                cluster_id);
         return 0;
     }
     return 1;
@@ -1822,13 +1821,12 @@ static int SockFanoutSeteBPF(AFPThreadVars *ptv)
 {
     int pfd = ptv->ebpf_lb_fd;
     if (pfd == -1) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Fanout file descriptor is invalid");
+        SCLogError(SC_EINVAL, "Fanout file descriptor is invalid");
         return -1;
     }
 
     if (setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT_DATA, &pfd, sizeof(pfd))) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Error setting ebpf");
+        SCLogError(SC_EINVAL, "Error setting ebpf");
         return -1;
     }
     SCLogInfo("Activated eBPF on socket");
@@ -1840,13 +1838,12 @@ static int SetEbpfFilter(AFPThreadVars *ptv)
 {
     int pfd = ptv->ebpf_filter_fd;
     if (pfd == -1) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Filter file descriptor is invalid");
+        SCLogError(SC_EINVAL, "Filter file descriptor is invalid");
         return -1;
     }
 
     if (setsockopt(ptv->socket, SOL_SOCKET, SO_ATTACH_BPF, &pfd, sizeof(pfd))) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Error setting ebpf: %s", strerror(errno));
+        SCLogError(SC_EINVAL, "Error setting ebpf: %s", strerror(errno));
         return -1;
     }
     SCLogInfo("Activated eBPF filter on socket");
@@ -2506,7 +2503,7 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
 
     ptv->livedev = LiveGetDevice(ptv->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+        SCLogError(SC_EINVAL, "Unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -2546,16 +2543,14 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
         ptv->v4_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v4");
         if (ptv->v4_map_fd == -1) {
             if (g_flowv4_ok == false) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'",
-                           "flow_table_v4");
+                SCLogError(SC_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v4");
                 g_flowv4_ok = true;
             }
         }
         ptv->v6_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v6");
         if (ptv->v6_map_fd  == -1) {
             if (g_flowv6_ok) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'",
-                           "flow_table_v6");
+                SCLogError(SC_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v6");
                 g_flowv6_ok = false;
             }
         }
index 424ecb3cee4942b664eb25b757868d8a329f93a2..531b986aa21b13566fe7be517724e1c919388345 100644 (file)
@@ -209,8 +209,7 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
 
     ewtn->livedev = LiveGetDevice(initdata);
     if (ewtn->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to get %s live device",
-            (char *)initdata);
+        SCLogError(SC_EINVAL, "Unable to get %s live device", (char *)initdata);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
index 61de69fe36ae2302009ddd712f6a146ed540ae5c..c1d97666ef8cb6a43edebe656f134d7eb0430e11 100644 (file)
@@ -518,7 +518,7 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, const void *initdata, voi
 
     ntv->livedev = LiveGetDevice(aconf->iface_name);
     if (ntv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+        SCLogError(SC_EINVAL, "Unable to find Live device");
         goto error_ntv;
     }
 
index e9d035e145e1eb94563a970d24bd3445b933a4da..70645306709bad6e827388d1703033fa13d26bf3 100644 (file)
@@ -286,9 +286,9 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
 
     ntv->livedev = LiveGetDevice(nflconfig->numgroup);
     if (ntv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
-           SCFree(ntv);
-               SCReturnInt(TM_ECODE_FAILED);
+        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCFree(ntv);
+        SCReturnInt(TM_ECODE_FAILED);
     }
 
     /* set a timeout to the socket so we can check for a signal
index fcf28cb44a379dc71fc55b619c7b731fc64b3805..a9d34813bff04610cff6bc094a2a031e36403d05 100644 (file)
@@ -845,7 +845,7 @@ int NFQRegisterQueue(const uint16_t number)
     ntv->livedev = LiveGetDevice(queue);
 
     if (ntv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+        SCLogError(SC_EINVAL, "Unable to find Live device");
         return -1;
     }
 
index 8df56da60c232d2decc286d3b48533c97681ae63..9f59cde2848249c5f1eb6a3c6e3e881c20bac28d 100644 (file)
@@ -409,7 +409,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
 
     ptv->livedev = LiveGetDevice(pcapconfig->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "unable to find Live device");
+        SCLogError(SC_EINVAL, "unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
index 4b8205f56ce74380d4b9436e403704e561fea943..2077811f6d9d530cb540366e3128cd16c2511732 100644 (file)
@@ -514,7 +514,7 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
 
     ptv->livedev = LiveGetDevice(pfconf->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+        SCLogError(SC_EINVAL, "Unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -536,9 +536,8 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
 
     if (ptv->checksum_mode == CHECKSUM_VALIDATION_RXONLY) {
         if (strncmp(ptv->interface, "dna", 3) == 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE,
-                         "Can't use rxonly checksum-checks on DNA interface,"
-                         " resetting to auto");
+            SCLogWarning(SC_EINVAL, "Can't use rxonly checksum-checks on DNA interface,"
+                                    " resetting to auto");
             ptv->checksum_mode = CHECKSUM_VALIDATION_AUTO;
         } else {
             opflag |= PF_RING_LONG_HEADER;
@@ -610,8 +609,7 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
             SCMutexUnlock(&pfring_bpf_set_filter_lock);
 
             if (rc < 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "Failed to compile BPF \"%s\"",
-                           ptv->bpf_filter);
+                SCLogError(SC_EINVAL, "Failed to compile BPF \"%s\"", ptv->bpf_filter);
                 return TM_ECODE_FAILED;
             }
         }
index 8b9d962bd46c166502268553b21418961a28bc14..f19717fd4c217c86be4be0ad86c9697e84413dd9 100644 (file)
@@ -1065,7 +1065,7 @@ static const char *StreamTcpParseOSPolicy(char *conf_var_name)
 
     if (snprintf(conf_var_full_name, strlen(conf_var_type_name) + strlen(conf_var_name) + 2,
                 "%s.%s", conf_var_type_name, conf_var_name) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Error in making the conf full name");
+        SCLogError(SC_EINVAL, "Error in making the conf full name");
         goto end;
     }
 
index 313de0f9683f675240182f02dae647a881c2c4ad..31e1cbf517cb1330b7e43c26371d7d79e1b97260 100644 (file)
@@ -272,7 +272,7 @@ static void UnixCommandClose(UnixCommand  *this, int fd)
     }
 
     if (found == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "No fd found in client list");
+        SCLogError(SC_EINVAL, "No fd found in client list");
         return;
     }
 
index 39f0db582b6ce0933a5b691c7f666eaa23fbd66d..2fcd435079dcbdc365fba48ed15bc6bf45dd02ab 100644 (file)
@@ -80,8 +80,10 @@ uint16_t UtilCpuGetNumProcessorsConfigured(void)
     const char* envvar = getenv("NUMBER_OF_PROCESSORS");
     if (envvar != NULL) {
         if (StringParseInt64(&nprocs, 10, 0, envvar) < 0) {
-            SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for number of "
-                         "processors: %s", envvar);
+            SCLogWarning(SC_EINVAL,
+                    "Invalid value for number of "
+                    "processors: %s",
+                    envvar);
             return 0;
         }
     }
index 11432863816fe392708c0988446adaa1e1ddc98d..48a4616b0c0af8bc45b8c2cb9692397fc157f589 100644 (file)
@@ -288,7 +288,7 @@ LiveDevice *LiveGetDevice(const char *name)
     LiveDevice *pd;
 
     if (name == NULL) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "Name of device should not be null");
+        SCLogWarning(SC_EINVAL, "Name of device should not be null");
         return NULL;
     }
 
index b4a07785287a4a25b6bd38c8e56d250af1c71503..ee31526ec313f49607b8478e0fc5e98da4dc6083 100644 (file)
@@ -328,7 +328,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
     }
 
     if (! path) {
-        SCLogError(SC_ERR_INVALID_VALUE, "No file defined to load eBPF from");
+        SCLogError(SC_EINVAL, "No file defined to load eBPF from");
         return -1;
     }
 
@@ -347,9 +347,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
         char err_buf[128];
         libbpf_strerror(error, err_buf,
                         sizeof(err_buf));
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Unable to load eBPF objects in '%s': %s",
-                   path, err_buf);
+        SCLogError(SC_EINVAL, "Unable to load eBPF objects in '%s': %s", path, err_buf);
         return -1;
     }
 
@@ -392,10 +390,8 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
     }
 
     if (found == false) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "No section '%s' in '%s' file. Will not be able to use the file",
-                   section,
-                   path);
+        SCLogError(SC_EINVAL, "No section '%s' in '%s' file. Will not be able to use the file",
+                section, path);
         return -1;
     }
 
@@ -408,10 +404,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
         } else {
             char buf[129];
             libbpf_strerror(err, buf, sizeof(buf));
-            SCLogError(SC_ERR_INVALID_VALUE,
-                    "Unable to load eBPF object: %s (%d)",
-                    buf,
-                    err);
+            SCLogError(SC_EINVAL, "Unable to load eBPF object: %s (%d)", buf, err);
         }
         return -1;
     }
@@ -471,8 +464,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
      * (XDP case). */
     pfd = bpf_program__fd(bpfprog);
     if (pfd == -1) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Unable to find %s section", section);
+        SCLogError(SC_EINVAL, "Unable to find %s section", section);
         return -1;
     }
 
@@ -494,8 +486,7 @@ int EBPFSetupXDP(const char *iface, int fd, uint8_t flags)
 #ifdef HAVE_PACKET_XDP
     unsigned int ifindex = if_nametoindex(iface);
     if (ifindex == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Unknown interface '%s'", iface);
+        SCLogError(SC_EINVAL, "Unknown interface '%s'", iface);
         return -1;
     }
 #ifdef HAVE_BPF_XDP_ATTACH
@@ -507,8 +498,7 @@ int EBPFSetupXDP(const char *iface, int fd, uint8_t flags)
     if (err != 0) {
         char buf[129];
         libbpf_strerror(err, buf, sizeof(buf));
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to set XDP on '%s': %s (%d)",
-                iface, buf, err);
+        SCLogError(SC_EINVAL, "Unable to set XDP on '%s': %s (%d)", iface, buf, err);
         return -1;
     }
 #endif
@@ -826,7 +816,7 @@ static int EBPFForEachFlowV6Table(ThreadVars *th_v,
     uint64_t hash_cnt = 0;
 
     if (tcfg->cpus_count == 0) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "CPU count should not be 0");
+        SCLogWarning(SC_EINVAL, "CPU count should not be 0");
         return 0;
     }
 
@@ -978,8 +968,7 @@ static int EBPFAddCPUToMap(const char *iface, uint32_t i)
 static void EBPFRedirectMapAddCPU(int i, void *data)
 {
     if (EBPFAddCPUToMap(data, i) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Unable to add CPU %d to set", i);
+        SCLogError(SC_EINVAL, "Unable to add CPU %d to set", i);
     } else {
         g_redirect_iface_cpu_counter++;
     }
@@ -990,8 +979,7 @@ void EBPFBuildCPUSet(ConfNode *node, char *iface)
     uint32_t key0 = 0;
     int mapfd = EBPFGetMapFDByName(iface, "cpus_count");
     if (mapfd < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Unable to find 'cpus_count' map");
+        SCLogError(SC_EINVAL, "Unable to find 'cpus_count' map");
         return;
     }
     g_redirect_iface_cpu_counter = 0;
@@ -1023,21 +1011,19 @@ int EBPFSetPeerIface(const char *iface, const char *out_iface)
 {
     int mapfd = EBPFGetMapFDByName(iface, "tx_peer");
     if (mapfd < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Unable to find 'tx_peer' map");
+        SCLogError(SC_EINVAL, "Unable to find 'tx_peer' map");
         return -1;
     }
     int intmapfd = EBPFGetMapFDByName(iface, "tx_peer_int");
     if (intmapfd < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                   "Unable to find 'tx_peer_int' map");
+        SCLogError(SC_EINVAL, "Unable to find 'tx_peer_int' map");
         return -1;
     }
 
     int key0 = 0;
     unsigned int peer_index = if_nametoindex(out_iface);
     if (peer_index == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "No iface '%s'", out_iface);
+        SCLogError(SC_EINVAL, "No iface '%s'", out_iface);
         return -1;
     }
     int ret = bpf_map_update_elem(mapfd, &key0, &peer_index, BPF_ANY);
index 65e50b411747721e0ab3cb72b59516ff60da9018..c50556121f4db418fa612555bf22b95ba9bd98a8 100644 (file)
@@ -156,8 +156,7 @@ const char * SCErrorToString(SCError err)
         CASE_CODE (SC_ERR_MULTIPLE_RUN_MODE);
         CASE_CODE (SC_ERR_BPF);
         CASE_CODE (SC_ERR_MISSING_CONFIG_PARAM);
-        CASE_CODE (SC_ERR_UNKNOWN_VALUE);
-        CASE_CODE (SC_ERR_INVALID_VALUE);
+        CASE_CODE(SC_ERR_UNKNOWN_VALUE);
         CASE_CODE (SC_ERR_UNKNOWN_REGEX_MOD);
         CASE_CODE (SC_ERR_INVALID_OPERATOR);
         CASE_CODE (SC_ERR_PCAP_RECV_INIT);
index be7a480817df963888b9fb3ef78ed821a5c00758..b6f9ff142fc01ddf30b6dbd5bf42e8566e9dfba0 100644 (file)
@@ -158,7 +158,6 @@ typedef enum {
     SC_ERR_BPF,
     SC_ERR_BYTE_EXTRACT_FAILED,
     SC_ERR_UNKNOWN_VALUE,
-    SC_ERR_INVALID_VALUE,
     SC_ERR_UNKNOWN_REGEX_MOD,
     SC_ERR_INVALID_OPERATOR,
     SC_ERR_PCAP_RECV_INIT,
index a2b72209ecf404a661db9f5b088e61db2ab89608..73ab69e235c9b21d5568919d43b0b098eb3690a0 100644 (file)
@@ -127,7 +127,7 @@ int HashTableAdd(HashTable *ht, void *data, uint16_t datalen)
     hb->next = NULL;
 
     if (hash >= ht->array_size) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "attempt to insert element out of hash array\n");
+        SCLogWarning(SC_EINVAL, "attempt to insert element out of hash array\n");
         goto error;
     }
 
@@ -201,7 +201,7 @@ void *HashTableLookup(HashTable *ht, void *data, uint16_t datalen)
     hash = ht->Hash(ht, data, datalen);
 
     if (hash >= ht->array_size) {
-        SCLogWarning(SC_ERR_INVALID_VALUE, "attempt to access element out of hash array\n");
+        SCLogWarning(SC_EINVAL, "attempt to access element out of hash array\n");
         return NULL;
     }
 
index eac28fe2123cc2500dc7e4123bfb6359591e93e8..08d1ff18139e701f73aaf19687835ddcafbd889a 100644 (file)
@@ -48,8 +48,7 @@ int SCKernelVersionIsAtLeast(int major, int minor)
 
     /* get local version */
     if (uname(&kuname) != 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid uname return: %s",
-                   strerror(errno));
+        SCLogError(SC_EINVAL, "Invalid uname return: %s", strerror(errno));
         return 0;
     }
 
@@ -85,11 +84,11 @@ int SCKernelVersionIsAtLeast(int major, int minor)
 
     bool err = false;
     if (StringParseInt32(&kmajor, 10, 0, (const char *)list[1]) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for kmajor: '%s'", list[1]);
+        SCLogError(SC_EINVAL, "Invalid value for kmajor: '%s'", list[1]);
         err = true;
     }
     if (StringParseInt32(&kminor, 10, 0, (const char *)list[2]) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for kminor: '%s'", list[2]);
+        SCLogError(SC_EINVAL, "Invalid value for kminor: '%s'", list[2]);
         err = true;
     }
 
index dbbf28063f900cb1d94ad9e80b86c72b06f30a27..eeadecd4030369359505672cdede751b270b6152 100644 (file)
@@ -219,7 +219,7 @@ char *Ja3GenerateHash(JA3Buffer *buffer)
     }
 
     if (buffer->data == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Buffer data should not be NULL");
+        SCLogError(SC_EINVAL, "Buffer data should not be NULL");
         return NULL;
     }
 
index cec126505aaceae41a28467d2fee67f9b138d988..57aad70378e4b6bac3c38f6070a49df01586eac6 100644 (file)
@@ -387,9 +387,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
                             }
                             break;
                         default:
-                            SCLogWarning(SC_ERR_INVALID_VALUE,
-                                    "Unsupported error code %d",
-                                    redis->err);
+                            SCLogWarning(SC_EINVAL, "Unsupported error code %d", redis->err);
                             return -1;
                     }
                 }
@@ -414,8 +412,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
                     ret = 0;
                     break;
                 default:
-                    SCLogError(SC_ERR_INVALID_VALUE,
-                            "Redis default triggered with %d", reply->type);
+                    SCLogError(SC_EINVAL, "Redis default triggered with %d", reply->type);
                     SCConfLogReopenSyncRedis(file_ctx);
                     break;
             }
@@ -538,7 +535,7 @@ int SCConfLogOpenRedis(ConfNode *redis_node, void *lf_ctx)
         FatalError(SC_ERR_FATAL, "Error allocating redis server string");
     }
     if (StringParseUint16(&log_ctx->redis_setup.port, 10, 0, (const char *)redis_port) < 0) {
-        FatalError(SC_ERR_INVALID_VALUE, "Invalid value for redis port: %s", redis_port);
+        FatalError(SC_EINVAL, "Invalid value for redis port: %s", redis_port);
     }
     log_ctx->Close = SCLogFileCloseRedis;
 
index b61aa85dd48e2f7216118a73d73d28ba8e69ee15..05aa4a8f091f289a9cb2684121c335b872a5abbb 100644 (file)
@@ -763,16 +763,22 @@ static uint32_t CountWorkerThreads(void)
 
 
                         if (StringParseUint8(&start, 10, end_str - lnode->val, (const char *)lnode->val) < 0) {
-                            FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
-                                       " worker range start: '%s'", lnode->val);
+                            FatalError(SC_EINVAL,
+                                    "Napatech invalid"
+                                    " worker range start: '%s'",
+                                    lnode->val);
                         }
                         if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
-                            FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
-                                       " worker range end: '%s'", (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
+                            FatalError(SC_EINVAL,
+                                    "Napatech invalid"
+                                    " worker range end: '%s'",
+                                    (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
                         }
                         if (end < start) {
-                            FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
-                                       " worker range start: '%d' is greater than end: '%d'", start, end);
+                            FatalError(SC_EINVAL,
+                                    "Napatech invalid"
+                                    " worker range start: '%d' is greater than end: '%d'",
+                                    start, end);
                         }
                         worker_count = end - start + 1;
 
@@ -918,12 +924,16 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
 
                     if (StringParseUint8(&start, 10, end_str - stream->val,
                                 (const char *)stream->val) < 0) {
-                        FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
-                                   "stream id start: '%s'", stream->val);
+                        FatalError(SC_EINVAL,
+                                "Napatech invalid "
+                                "stream id start: '%s'",
+                                stream->val);
                     }
                     if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
-                        FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
-                                   "stream id end: '%s'", (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
+                        FatalError(SC_EINVAL,
+                                "Napatech invalid "
+                                "stream id end: '%s'",
+                                (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
                     }
                 } else {
                     if (stream_spec == CONFIG_SPECIFIER_RANGE) {
@@ -933,8 +943,10 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
                     stream_spec = CONFIG_SPECIFIER_INDIVIDUAL;
                     if (StringParseUint8(&stream_config[instance_cnt].stream_id,
                                           10, 0, (const char *)stream->val) < 0) {
-                        FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
-                                   "stream id: '%s'", stream->val);
+                        FatalError(SC_EINVAL,
+                                "Napatech invalid "
+                                "stream id: '%s'",
+                                stream->val);
                     }
                     start = stream_config[instance_cnt].stream_id;
                     end = stream_config[instance_cnt].stream_id;
index efef9021633af4c4deb5cb66e5da986870713497..47a9bec1b3b8c9b220d6c7c34fb5e676958b4641 100644 (file)
@@ -290,7 +290,7 @@ const char *PrintInet(int af, const void *src, char *dst, socklen_t size)
             /* Format IPv6 without deleting zeroes */
             return PrintInetIPv6(src, dst, size);
         default:
-            SCLogError(SC_ERR_INVALID_VALUE, "Unsupported protocol: %d", af);
+            SCLogError(SC_EINVAL, "Unsupported protocol: %d", af);
     }
     return NULL;
 }
index 3510a5ec43ee83a7a51784513b96a13fd061a5fa..0089474fad507aa442b5d17e75227a06fc6c197d 100644 (file)
@@ -296,13 +296,13 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod
 
         tm_module = TmModuleGetByName(recv_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName failed for %s", recv_mod_name);
+            FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, aconf);
 
         tm_module = TmModuleGetByName(decode_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName %s failed", decode_mod_name);
+            FatalError(SC_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
@@ -547,13 +547,13 @@ int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
 
         tm_module = TmModuleGetByName(recv_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName failed for %s", recv_mod_name);
+            FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
 
         tm_module = TmModuleGetByName(decode_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName %s failed", decode_mod_name);
+            FatalError(SC_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
index d3251a8e39585dd41c4f0c8411cff7a63cb664c4..095132e0c02de54f08377b0a95f1c0d811758cf5 100644 (file)
@@ -85,8 +85,8 @@ uint16_t SinglePatternMatchDefaultMatcher(void)
 
 #ifndef BUILD_HYPERSCAN
         if ((spm_algo != NULL) && (strcmp(spm_algo, "hs") == 0)) {
-            FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for spm-algo is "
-                       "not compiled into Suricata.");
+            FatalError(SC_EINVAL, "Hyperscan (hs) support for spm-algo is "
+                                  "not compiled into Suricata.");
         }
 #endif
         SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
index 4efc2333ae3369c50d56a98731de45d9dc216b01..8f61ed34f7798fd52035f292f0cd82285416a5d2 100644 (file)
@@ -109,9 +109,10 @@ int StorageRegister(const StorageEnum type, const char *name, const unsigned int
     StorageList *list = storage_list;
     while (list) {
         if (strcmp(name, list->map.name) == 0 && type == list->map.type) {
-            SCLogError(SC_ERR_INVALID_VALUE, "storage for type \"%s\" with "
-                "name \"%s\" already registered", StoragePrintType(type),
-                name);
+            SCLogError(SC_EINVAL,
+                    "storage for type \"%s\" with "
+                    "name \"%s\" already registered",
+                    StoragePrintType(type), name);
             return -1;
         }
 
index dc9d3a9b7941315f845263a994aa96d4509d4074..7a7024143ba2fb7f7f6f4afa17209a8cc07b575b 100644 (file)
@@ -391,9 +391,9 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
             SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_SUPPRESS);
         }
     } else if (id > 0 && gid == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Can't use a event config that has "
-                                         "sid > 0 and gid == 0. Please fix this "
-                                         "in your threshold.config file");
+        SCLogError(SC_EINVAL, "Can't use a event config that has "
+                              "sid > 0 and gid == 0. Please fix this "
+                              "in your threshold.config file");
         goto error;
     } else {
         s = SigFindSignatureBySidGid(de_ctx, id, gid);
@@ -548,9 +548,9 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
             }
         }
     } else if (id > 0 && gid == 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Can't use a event config that has "
-                   "sid > 0 and gid == 0. Please fix this "
-                   "in your threshold.conf file");
+        SCLogError(SC_EINVAL, "Can't use a event config that has "
+                              "sid > 0 and gid == 0. Please fix this "
+                              "in your threshold.conf file");
     } else {
         s = SigFindSignatureBySidGid(de_ctx, id, gid);
         if (s == NULL) {
@@ -709,7 +709,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
     } else if (strcasecmp(th_rule_type,"suppress") == 0) {
         rule_type = THRESHOLD_TYPE_SUPPRESS;
     } else {
-        SCLogError(SC_ERR_INVALID_VALUE, "rule type %s is unknown", th_rule_type);
+        SCLogError(SC_EINVAL, "rule type %s is unknown", th_rule_type);
         goto error;
     }
 
@@ -901,7 +901,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
             else if (strcasecmp(th_track,"by_rule") == 0)
                 parsed_track = TRACK_RULE;
             else {
-                SCLogError(SC_ERR_INVALID_VALUE, "Invalid track parameter %s in %s", th_track, rawstr);
+                SCLogError(SC_EINVAL, "Invalid track parameter %s in %s", th_track, rawstr);
                 goto error;
             }
 
@@ -909,7 +909,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 goto error;
             }
             if (parsed_count == 0) {
-                SCLogError(SC_ERR_INVALID_VALUE, "rate filter count should be > 0");
+                SCLogError(SC_EINVAL, "rate filter count should be > 0");
                 goto error;
             }
 
@@ -929,7 +929,8 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                     parsed_track = TRACK_EITHER;
                 }
                 else {
-                    SCLogError(SC_ERR_INVALID_VALUE, "Invalid track parameter %s in %s", th_track, rule_extend);
+                    SCLogError(
+                            SC_EINVAL, "Invalid track parameter %s in %s", th_track, rule_extend);
                     goto error;
                 }
             }