]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: remove error codes from output
authorVictor Julien <vjulien@oisf.net>
Wed, 30 Nov 2022 07:02:46 +0000 (08:02 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 20 Dec 2022 07:51:33 +0000 (08:51 +0100)
326 files changed:
rust/src/core.rs
rust/src/log.rs
src/alert-syslog.c
src/app-layer-detect-proto.c
src/app-layer-dnp3.c
src/app-layer-enip.c
src/app-layer-events.c
src/app-layer-ftp.c
src/app-layer-htp-mem.c
src/app-layer-htp-range.c
src/app-layer-htp-xff.c
src/app-layer-htp.c
src/app-layer-mqtt.c
src/app-layer-parser.c
src/app-layer-register.c
src/app-layer-smtp.c
src/app-layer-ssl.c
src/conf-yaml-loader.c
src/conf.c
src/counters.c
src/datasets.c
src/decode-erspan.c
src/decode-geneve.c
src/decode-teredo.c
src/decode-vxlan.c
src/decode.c
src/decode.h
src/defrag-config.c
src/defrag-hash.c
src/defrag-queue.c
src/defrag.c
src/detect-app-layer-event.c
src/detect-app-layer-protocol.c
src/detect-asn1.c
src/detect-base64-data.c
src/detect-base64-decode.c
src/detect-bsize.c
src/detect-bypass.c
src/detect-byte-extract.c
src/detect-bytejump.c
src/detect-bytemath.c
src/detect-bytetest.c
src/detect-cipservice.c
src/detect-classtype.c
src/detect-config.c
src/detect-content.c
src/detect-datarep.c
src/detect-dataset.c
src/detect-dce-iface.c
src/detect-dce-opnum.c
src/detect-depth.c
src/detect-detection-filter.c
src/detect-dhcp-leasetime.c
src/detect-dhcp-rebinding-time.c
src/detect-dhcp-renewal-time.c
src/detect-distance.c
src/detect-dnp3.c
src/detect-dns-opcode.c
src/detect-dsize.c
src/detect-engine-address.c
src/detect-engine-alert.c
src/detect-engine-analyzer.c
src/detect-engine-build.c
src/detect-engine-content-inspection.c
src/detect-engine-event.c
src/detect-engine-iponly.c
src/detect-engine-loader.c
src/detect-engine-mpm.c
src/detect-engine-port.c
src/detect-engine-prefilter.c
src/detect-engine-register.c
src/detect-engine-sigorder.c
src/detect-engine-tag.c
src/detect-engine-threshold.c
src/detect-engine.c
src/detect-fast-pattern.c
src/detect-file-data.c
src/detect-file-hash-common.c
src/detect-filemagic.c
src/detect-filestore.c
src/detect-flow.c
src/detect-flowbits.c
src/detect-flowint.c
src/detect-flowvar.c
src/detect-fragbits.c
src/detect-fragoffset.c
src/detect-frame.c
src/detect-ftpdata.c
src/detect-geoip.c
src/detect-gid.c
src/detect-hostbits.c
src/detect-http-host.c
src/detect-http-method.c
src/detect-http-raw-header.c
src/detect-http2.c
src/detect-icmp-id.c
src/detect-icmp-seq.c
src/detect-id.c
src/detect-ike-chosen-sa.c
src/detect-ipopts.c
src/detect-ipproto.c
src/detect-iprep.c
src/detect-isdataat.c
src/detect-krb5-errcode.c
src/detect-krb5-msgtype.c
src/detect-l3proto.c
src/detect-lua.c
src/detect-mark.c
src/detect-metadata.c
src/detect-modbus.c
src/detect-mqtt-connack-sessionpresent.c
src/detect-mqtt-connect-flags.c
src/detect-mqtt-flags.c
src/detect-mqtt-qos.c
src/detect-mqtt-reason-code.c
src/detect-mqtt-type.c
src/detect-msg.c
src/detect-nfs-procedure.c
src/detect-nfs-version.c
src/detect-noalert.c
src/detect-nocase.c
src/detect-offset.c
src/detect-parse.c
src/detect-pcre.c
src/detect-pkt-data.c
src/detect-pktvar.c
src/detect-prefilter.c
src/detect-priority.c
src/detect-quic-cyu-hash.c
src/detect-rawbytes.c
src/detect-reference.c
src/detect-replace.c
src/detect-rev.c
src/detect-rfb-secresult.c
src/detect-rfb-sectype.c
src/detect-rpc.c
src/detect-sid.c
src/detect-sip-method.c
src/detect-snmp-pdu_type.c
src/detect-snmp-version.c
src/detect-ssh-hassh-server-string.c
src/detect-ssh-hassh-server.c
src/detect-ssh-hassh-string.c
src/detect-ssh-hassh.c
src/detect-ssh-proto-version.c
src/detect-ssh-software-version.c
src/detect-ssl-state.c
src/detect-ssl-version.c
src/detect-tag.c
src/detect-target.c
src/detect-tcp-flags.c
src/detect-tcp-window.c
src/detect-template.c
src/detect-threshold.c
src/detect-tls-cert-fingerprint.c
src/detect-tls-cert-serial.c
src/detect-tls-cert-validity.c
src/detect-tls-certs.c
src/detect-tls-ja3-hash.c
src/detect-tls-ja3-string.c
src/detect-tls-ja3s-hash.c
src/detect-tls-ja3s-string.c
src/detect-tls-version.c
src/detect-tls.c
src/detect-tos.c
src/detect-transform-md5.c
src/detect-transform-pcrexform.c
src/detect-transform-sha1.c
src/detect-transform-sha256.c
src/detect-transform-xor.c
src/detect-uricontent.c
src/detect-urilen.c
src/detect-within.c
src/detect-xbits.c
src/detect.c
src/feature.c
src/flow-manager.c
src/flow-queue.c
src/flow-spare-pool.c
src/flow-worker.c
src/flow.c
src/host-bit.c
src/host-queue.c
src/host.c
src/ippair-bit.c
src/ippair-queue.c
src/ippair.c
src/log-cf-common.c
src/log-httplog.c
src/log-pcap.c
src/log-stats.c
src/log-tcp-data.c
src/log-tlslog.c
src/log-tlsstore.c
src/output-eve-syslog.c
src/output-filestore.c
src/output-json-alert.c
src/output-json-anomaly.c
src/output-json-dns.c
src/output-json-drop.c
src/output-json-flow.c
src/output-json-stats.c
src/output-json-tls.c
src/output-json.c
src/output-lua.c
src/output-tx.c
src/output.c
src/reputation.c
src/respond-reject-libnet11.c
src/runmode-af-packet.c
src/runmode-af-xdp.c
src/runmode-dpdk.c
src/runmode-erf-dag.c
src/runmode-erf-file.c
src/runmode-napatech.c
src/runmode-netmap.c
src/runmode-nflog.c
src/runmode-pcap-file.c
src/runmode-pcap.c
src/runmode-pfring.c
src/runmode-unittests.c
src/runmode-unix-socket.c
src/runmodes.c
src/rust-context.h
src/source-af-packet.c
src/source-af-xdp.c
src/source-dpdk.c
src/source-erf-dag.c
src/source-erf-file.c
src/source-ipfw.c
src/source-napatech.c
src/source-netmap.c
src/source-nflog.c
src/source-nfq.c
src/source-pcap-file-directory-helper.c
src/source-pcap-file-helper.c
src/source-pcap-file.c
src/source-pcap.c
src/source-pfring.c
src/source-windivert.c
src/stream-tcp-reassemble.c
src/stream-tcp.c
src/stream.c
src/suricata.c
src/tests/stream-tcp.c
src/tm-modules.c
src/tm-queues.c
src/tm-threads.c
src/tmqh-flow.c
src/tmqh-packetpool.c
src/unix-manager.c
src/util-action.c
src/util-affinity.c
src/util-buffer.c
src/util-byte.c
src/util-classification-config.c
src/util-conf.c
src/util-coredump-config.c
src/util-cpu.c
src/util-daemon.c
src/util-debug-filters.c
src/util-debug.c
src/util-debug.h
src/util-decode-mime.c
src/util-detect.c
src/util-device.c
src/util-dpdk-i40e.c
src/util-dpdk.c
src/util-ebpf.c
src/util-exception-policy.c
src/util-file.c
src/util-hash.c
src/util-host-info.c
src/util-host-os-info.c
src/util-ioctl.c
src/util-ip.c
src/util-ja3.c
src/util-landlock.c
src/util-log-redis.c
src/util-logopenfile.c
src/util-lua-common.c
src/util-luajit.c
src/util-macset.c
src/util-magic.c
src/util-mem.c
src/util-misc.c
src/util-misc.h
src/util-mpm-ac-bs.c
src/util-mpm-ac-ks.c
src/util-mpm-ac.c
src/util-mpm-hs.c
src/util-mpm.c
src/util-napatech.c
src/util-napatech.h
src/util-path.c
src/util-pidfile.c
src/util-plugin.c
src/util-pool-thread.c
src/util-prefilter.c
src/util-print.c
src/util-privs.c
src/util-profiling-keywords.c
src/util-profiling-locks.c
src/util-profiling-prefilter.c
src/util-profiling-rulegroups.c
src/util-profiling-rules.c
src/util-profiling.c
src/util-profiling.h
src/util-proto-name.c
src/util-radix-tree.c
src/util-reference-config.c
src/util-rohash.c
src/util-rule-vars.c
src/util-runmodes.c
src/util-spm-bm.c
src/util-spm-hs.c
src/util-spm.c
src/util-storage.c
src/util-streaming-buffer.c
src/util-sysfs.c
src/util-thash.c
src/util-threshold-config.c
src/util-unittest-helper.c
src/util-unittest.c
src/win32-service.c
src/win32-syscall.c

index 740099e05d85aaba5397c3e965b2b9c404265b2b..9f0dd9bd672c31ba4fb0d1d6478f2dfbd1189af0 100644 (file)
@@ -129,7 +129,6 @@ pub type SCLogMessageFunc =
                   filename: *const std::os::raw::c_char,
                   line: std::os::raw::c_uint,
                   function: *const std::os::raw::c_char,
-                  code: std::os::raw::c_int,
                   message: *const std::os::raw::c_char) -> std::os::raw::c_int;
 
 pub type DetectEngineStateFreeFunc =
index 84aa03d69907e172836aa6519600497b470e4bf5..7dc881257ffaa85442c612c490db715943b6288d 100644 (file)
@@ -68,14 +68,13 @@ fn basename(filename: &str) -> &str {
 }
 
 pub fn sclog(level: Level, file: &str, line: u32, function: &str,
-         code: i32, message: &str)
+         message: &str)
 {
     let filename = basename(file);
     sc_log_message(level,
                    filename,
                    line,
                    function,
-                   code,
                    message);
 }
 
@@ -99,9 +98,9 @@ macro_rules!function {
 
 #[macro_export]
 macro_rules!do_log {
-    ($level:expr, $code:expr, $($arg:tt)*) => {
+    ($level:expr, $($arg:tt)*) => {
         if $crate::log::get_log_level() >= $level as i32 {
-            $crate::log::sclog($level, file!(), line!(), $crate::function!(), $code,
+            $crate::log::sclog($level, file!(), line!(), $crate::function!(),
                   &(format!($($arg)*)));
         }
     }
@@ -110,35 +109,35 @@ macro_rules!do_log {
 #[macro_export]
 macro_rules!SCLogError {
     ($($arg:tt)*) => {
-        $crate::do_log!($crate::log::Level::Error, 0, $($arg)*);
+        $crate::do_log!($crate::log::Level::Error, $($arg)*);
     };
 }
 
 #[macro_export]
 macro_rules!SCLogNotice {
     ($($arg:tt)*) => {
-        $crate::do_log!($crate::log::Level::Notice, 0, $($arg)*);
+        $crate::do_log!($crate::log::Level::Notice, $($arg)*);
     }
 }
 
 #[macro_export]
 macro_rules!SCLogInfo {
     ($($arg:tt)*) => {
-        $crate::do_log!($crate::log::Level::Info, 0, $($arg)*);
+        $crate::do_log!($crate::log::Level::Info, $($arg)*);
     }
 }
 
 #[macro_export]
 macro_rules!SCLogPerf {
     ($($arg:tt)*) => {
-        $crate::do_log!($crate::log::Level::Perf, 0, $($arg)*);
+        $crate::do_log!($crate::log::Level::Perf, $($arg)*);
     }
 }
 
 #[macro_export]
 macro_rules!SCLogConfig {
     ($($arg:tt)*) => {
-        $crate::do_log!($crate::log::Level::Config, 0, $($arg)*);
+        $crate::do_log!($crate::log::Level::Config, $($arg)*);
     }
 }
 
@@ -147,7 +146,7 @@ macro_rules!SCLogConfig {
 #[macro_export]
 macro_rules!SCLogDebug {
     ($($arg:tt)*) => {
-        do_log!($crate::log::Level::Debug, 0, $($arg)*);
+        do_log!($crate::log::Level::Debug, $($arg)*);
     }
 }
 
@@ -168,7 +167,6 @@ pub fn sc_log_message(level: Level,
                       filename: &str,
                       line: std::os::raw::c_uint,
                       function: &str,
-                      code: std::os::raw::c_int,
                       message: &str) -> std::os::raw::c_int
 {
     unsafe {
@@ -178,7 +176,6 @@ pub fn sc_log_message(level: Level,
                 to_safe_cstring(filename).as_ptr(),
                 line,
                 to_safe_cstring(function).as_ptr(),
-                code,
                 to_safe_cstring(message).as_ptr());
         }
     }
index 86593f54dae45fdf88c740295765ff1dfa212b10..39d0978f4477e364526726796af35b6550f9c987 100644 (file)
@@ -101,9 +101,9 @@ static OutputInitResult AlertSyslogInitCtx(ConfNode *conf)
 
     int facility = SCMapEnumNameToValue(facility_s, SCSyslogGetFacilityMap());
     if (facility == -1) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid syslog facility: \"%s\","
-                " now using \"%s\" as syslog facility", facility_s,
-                DEFAULT_ALERT_SYSLOG_FACILITY_STR);
+        SCLogWarning("Invalid syslog facility: \"%s\","
+                     " now using \"%s\" as syslog facility",
+                facility_s, DEFAULT_ALERT_SYSLOG_FACILITY_STR);
         facility = DEFAULT_ALERT_SYSLOG_FACILITY;
     }
 
index c826bbcd6a5645a958db00cde3596a096e2eb349..863fb920afd67efff8b6f3aa7b7ceae7083144ff 100644 (file)
@@ -683,7 +683,7 @@ static uint32_t AppLayerProtoDetectProbingParserGetMask(AppProto alproto)
     SCEnter();
 
     if (!(alproto > ALPROTO_UNKNOWN && alproto < ALPROTO_FAILED)) {
-        FatalError(SC_ERR_ALPARSER, "Unknown protocol detected - %u", alproto);
+        FatalError("Unknown protocol detected - %u", alproto);
     }
 
     SCReturnUInt(1UL << (uint32_t)alproto);
@@ -793,13 +793,14 @@ AppLayerProtoDetectProbingParserElementCreate(AppProto alproto,
     pe->next = NULL;
 
     if (max_depth != 0 && min_depth >= max_depth) {
-        SCLogError(SC_ERR_ALPARSER, "Invalid arguments sent to "
+        SCLogError("Invalid arguments sent to "
                    "register the probing parser.  min_depth >= max_depth");
         goto error;
     }
     if (alproto <= ALPROTO_UNKNOWN || alproto >= ALPROTO_MAX) {
-        SCLogError(SC_ERR_ALPARSER, "Invalid arguments sent to register "
-                   "the probing parser.  Invalid alproto - %d", alproto);
+        SCLogError("Invalid arguments sent to register "
+                   "the probing parser.  Invalid alproto - %d",
+                alproto);
         goto error;
     }
 
@@ -1199,13 +1200,12 @@ static void AppLayerProtoDetectInsertNewProbingParser(AppLayerProtoDetectProbing
         curr_pe = curr_port->sp;
     while (curr_pe != NULL) {
         if (curr_pe->alproto == alproto) {
-            SCLogError(SC_ERR_ALPARSER, "Duplicate pp registered - "
-                       "ipproto - %"PRIu8" Port - %"PRIu16" "
+            SCLogError("Duplicate pp registered - "
+                       "ipproto - %" PRIu8 " Port - %" PRIu16 " "
                        "App Protocol - NULL, App Protocol(ID) - "
-                       "%"PRIu16" min_depth - %"PRIu16" "
-                       "max_dept - %"PRIu16".",
-                       ipproto, port, alproto,
-                       min_depth, max_depth);
+                       "%" PRIu16 " min_depth - %" PRIu16 " "
+                       "max_dept - %" PRIu16 ".",
+                    ipproto, port, alproto, min_depth, max_depth);
             goto error;
         }
         curr_pe = curr_pe->next;
@@ -1747,9 +1747,9 @@ int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
     r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.",
                  alproto_name, ".detection-ports");
     if (r < 0) {
-        FatalError(SC_ERR_FATAL, "snprintf failure.");
+        FatalError("snprintf failure.");
     } else if (r > (int)sizeof(param)) {
-        FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+        FatalError("buffer not big enough to write param.");
     }
     node = ConfGetNode(param);
     if (node == NULL) {
@@ -1757,9 +1757,9 @@ int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
         r = snprintf(param, sizeof(param), "%s%s%s%s%s", "app-layer.protocols.",
                      alproto_name, ".", ipproto_name, ".detection-ports");
         if (r < 0) {
-            FatalError(SC_ERR_FATAL, "snprintf failure.");
+            FatalError("snprintf failure.");
         } else if (r > (int)sizeof(param)) {
-            FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+            FatalError("buffer not big enough to write param.");
         }
         node = ConfGetNode(param);
         if (node == NULL)
@@ -1857,7 +1857,7 @@ int AppLayerProtoDetectSetup(void)
 
     alpd_ctx.spm_global_thread_ctx = SpmInitGlobalThreadCtx(spm_matcher);
     if (alpd_ctx.spm_global_thread_ctx == NULL) {
-        FatalError(SC_ERR_FATAL, "Unable to alloc SpmGlobalThreadCtx.");
+        FatalError("Unable to alloc SpmGlobalThreadCtx.");
     }
 
     for (i = 0; i < FLOW_PROTO_DEFAULT; i++) {
@@ -2029,9 +2029,9 @@ int AppLayerProtoDetectConfProtoDetectionEnabledDefault(
     r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.",
                  alproto, ".enabled");
     if (r < 0) {
-        FatalError(SC_ERR_FATAL, "snprintf failure.");
+        FatalError("snprintf failure.");
     } else if (r > (int)sizeof(param)) {
-        FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+        FatalError("buffer not big enough to write param.");
     }
 
     node = ConfGetNode(param);
@@ -2040,9 +2040,9 @@ int AppLayerProtoDetectConfProtoDetectionEnabledDefault(
         r = snprintf(param, sizeof(param), "%s%s%s%s%s", "app-layer.protocols.",
                      alproto, ".", ipproto, ".enabled");
         if (r < 0) {
-            FatalError(SC_ERR_FATAL, "snprintf failure.");
+            FatalError("snprintf failure.");
         } else if (r > (int)sizeof(param)) {
-            FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+            FatalError("buffer not big enough to write param.");
         }
 
         node = ConfGetNode(param);
@@ -2067,7 +2067,7 @@ int AppLayerProtoDetectConfProtoDetectionEnabledDefault(
     }
 
     /* Invalid or null value. */
-    SCLogError(SC_ERR_FATAL, "Invalid value found for %s.", param);
+    SCLogError("Invalid value found for %s.", param);
     exit(EXIT_FAILURE);
 
  disabled:
@@ -2253,8 +2253,7 @@ void AppLayerRegisterExpectationProto(uint8_t proto, AppProto alproto)
 {
     if (expectation_proto[alproto]) {
         if (proto != expectation_proto[alproto]) {
-            SCLogError(SC_ERR_NOT_SUPPORTED,
-                       "Expectation on 2 IP protocols are not supported");
+            SCLogError("Expectation on 2 IP protocols are not supported");
         }
     }
     expectation_proto[alproto] = proto;
index a8256c572bb4db089e08386decff4c0fa8ac9d7e..f5f454867cd74ee249ba1d9d6e46f5cfc3b9359b 100644 (file)
@@ -471,7 +471,7 @@ static void DNP3SetEvent(DNP3State *dnp3, uint8_t event)
         dnp3->events++;
     }
     else {
-        SCLogWarning(SC_ERR_ALPARSER, "Failed to set event, state or tx pointer was NULL.");
+        SCLogWarning("Failed to set event, state or tx pointer was NULL.");
     }
 }
 
@@ -1460,8 +1460,9 @@ static int DNP3StateGetEventInfo(const char *event_name, int *event_id,
 {
     *event_id = SCMapEnumNameToValue(event_name, dnp3_decoder_event_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "Event \"%s\" not present in "
-            "the DNP3 enum event map table.", event_name);
+        SCLogError("Event \"%s\" not present in "
+                   "the DNP3 enum event map table.",
+                event_name);
         return -1;
     }
 
@@ -1478,8 +1479,9 @@ static int DNP3StateGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, dnp3_decoder_event_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "Event \"%d\" not present in "
-            "the DNP3 enum event map table.", event_id);
+        SCLogError("Event \"%d\" not present in "
+                   "the DNP3 enum event map table.",
+                event_id);
         return -1;
     }
 
index a46ddb8afbef3d19f3e85af4f3df20cae7afd7d8..59ea9c73ec944d351dc61dfa8f6745473a62ce12 100644 (file)
@@ -108,8 +108,9 @@ static int ENIPStateGetEventInfo(const char *event_name, int *event_id, AppLayer
     *event_id = SCMapEnumNameToValue(event_name, enip_decoder_event_table);
 
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "enip's enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "enip's enum map table.",
+                event_name);
         /* yes this is fatal */
         return -1;
     }
@@ -124,8 +125,9 @@ static int ENIPStateGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, enip_decoder_event_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
-                   "enip's enum map table.",  event_id);
+        SCLogError("event \"%d\" not present in "
+                   "enip's enum map table.",
+                event_id);
         /* yes this is fatal */
         return -1;
     }
index 65016e2eaedbe94e3073815633234b0768a7cc85..2ff47ecb69d0405455e2a734b238a2b901f8a83d 100644 (file)
@@ -53,8 +53,9 @@ int AppLayerGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, app_layer_event_pkt_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
-                   "app-layer-event's enum map table.",  event_id);
+        SCLogError("event \"%d\" not present in "
+                   "app-layer-event's enum map table.",
+                event_id);
         /* yes this is fatal */
         return -1;
     }
@@ -68,8 +69,9 @@ int AppLayerGetPktEventInfo(const char *event_name, int *event_id)
 {
     *event_id = SCMapEnumNameToValue(event_name, app_layer_event_pkt_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "app-layer-event's packet event table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "app-layer-event's packet event table.",
+                event_name);
         /* this should be treated as fatal */
         return -1;
     }
index 74f1716557682dd1470d785b057e9872aea161a9..d0231b46acc522fbf1392fc891a14417ec7c8184 100644 (file)
@@ -118,9 +118,9 @@ static void FTPParseMemcap(void)
     if ((ConfGet("app-layer.protocols.ftp.memcap", &conf_val)) == 1)
     {
         if (ParseSizeStringU64(conf_val, &ftp_config_memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing ftp.memcap "
+            SCLogError("Error parsing ftp.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         }
         SCLogInfo("FTP memcap: %"PRIu64, ftp_config_memcap);
@@ -134,9 +134,8 @@ static void FTPParseMemcap(void)
 
     if ((ConfGet("app-layer.protocols.ftp.max-tx", &conf_val)) == 1) {
         if (ParseSizeStringU32(conf_val, &ftp_config_maxtx) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE,
-                    "Error parsing ftp.max-tx "
-                    "from conf file - %s.",
+            SCLogError("Error parsing ftp.max-tx "
+                       "from conf file - %s.",
                     conf_val);
         }
         SCLogInfo("FTP max tx: %" PRIu32, ftp_config_maxtx);
@@ -144,8 +143,7 @@ static void FTPParseMemcap(void)
 
     if ((ConfGet("app-layer.protocols.ftp.max-line-length", &conf_val)) == 1) {
         if (ParseSizeStringU32(conf_val, &ftp_max_line_len) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing ftp.max-line-length from conf file - %s.",
-                    conf_val);
+            SCLogError("Error parsing ftp.max-line-length from conf file - %s.", conf_val);
         }
         SCLogConfig("FTP max line length: %" PRIu32, ftp_max_line_len);
     }
index 7d06db0b1f51a25077aa4ee78f0d6ae42a730156..8b13b75ccaa101f83003e5c3fb8ed5560fcde742 100644 (file)
@@ -51,9 +51,9 @@ void HTPParseMemcap()
     if ((ConfGet("app-layer.protocols.http.memcap", &conf_val)) == 1)
     {
         if (ParseSizeStringU64(conf_val, &memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing http.memcap "
+            SCLogError("Error parsing http.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(htp_config_memcap, memcap);
index 5067fb5fd50f45ceecc676fb2cc0f35aa1327f47..18c44ef409c258359970fa29711826a594f1f5c4 100644 (file)
@@ -155,9 +155,8 @@ 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_EINVAL,
-                    "memcap value cannot be deduced: %s,"
-                    " resetting to default",
+            SCLogWarning("memcap value cannot be deduced: %s,"
+                         " resetting to default",
                     str);
             memcap = 0;
         }
@@ -165,9 +164,8 @@ 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_EINVAL,
-                    "timeout value cannot be deduced: %s,"
-                    " resetting to default",
+            SCLogWarning("timeout value cannot be deduced: %s,"
+                         " resetting to default",
                     str);
             timeout = 0;
         }
index 35e62aff359cfe1c8633e9510ac2f96154a3d8e6..c145e5818e23377836589b2c4c2db0f7de64a169 100644 (file)
@@ -218,11 +218,11 @@ void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result)
             result->flags |= XFF_OVERWRITE;
         } else {
             if (xff_mode == NULL) {
-                SCLogWarning(SC_WARN_XFF_INVALID_MODE, "The XFF mode hasn't been defined, falling back to extra-data mode");
+                SCLogWarning("The XFF mode hasn't been defined, falling back to extra-data mode");
             }
             else if (strcasecmp(xff_mode, "extra-data") != 0) {
-                SCLogWarning(SC_WARN_XFF_INVALID_MODE, "The XFF mode %s is invalid, falling back to extra-data mode",
-                        xff_mode);
+                SCLogWarning(
+                        "The XFF mode %s is invalid, falling back to extra-data mode", xff_mode);
             }
             result->flags |= XFF_EXTRADATA;
         }
@@ -233,10 +233,11 @@ void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result)
             result->flags |= XFF_FORWARD;
         } else {
             if (xff_deployment == NULL) {
-                SCLogWarning(SC_WARN_XFF_INVALID_DEPLOYMENT, "The XFF deployment hasn't been defined, falling back to reverse proxy deployment");
+                SCLogWarning("The XFF deployment hasn't been defined, falling back to reverse "
+                             "proxy deployment");
             }
             else if (strcasecmp(xff_deployment, "reverse") != 0) {
-                SCLogWarning(SC_WARN_XFF_INVALID_DEPLOYMENT, "The XFF mode %s is invalid, falling back to reverse proxy deployment",
+                SCLogWarning("The XFF mode %s is invalid, falling back to reverse proxy deployment",
                         xff_deployment);
             }
             result->flags |= XFF_REVERSE;
@@ -247,8 +248,7 @@ void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result)
         if (xff_header != NULL) {
             result->header = (char *) xff_header;
         } else {
-            SCLogWarning(SC_WARN_XFF_INVALID_HEADER, "The XFF header hasn't been defined, using the default %s",
-                    XFF_DEFAULT);
+            SCLogWarning("The XFF header hasn't been defined, using the default %s", XFF_DEFAULT);
             result->header = XFF_DEFAULT;
         }
     }
index c0cab849061ca87e26bbd379e67e5aa7939ad148..b1a306d20f1dc0f2b5c166cabb3a846ff83d68fd 100644 (file)
@@ -282,15 +282,17 @@ static int HTPLookupPersonality(const char *str)
     IF_HTP_PERSONALITY_NUM(IIS_7_5);
     IF_HTP_PERSONALITY_NUM(APACHE_2);
     if (strcasecmp("TOMCAT_6_0", str) == 0) {
-        SCLogError(SC_WARN_OPTION_OBSOLETE, "Personality %s no "
-                   "longer supported by libhtp.", str);
+        SCLogError("Personality %s no "
+                   "longer supported by libhtp.",
+                str);
         return -1;
     } else if ((strcasecmp("APACHE", str) == 0) ||
                (strcasecmp("APACHE_2_2", str) == 0))
     {
-        SCLogWarning(SC_WARN_OPTION_OBSOLETE, "Personality %s no "
-                   "longer supported by libhtp, failing back to "
-                   "Apache2 personality.", str);
+        SCLogWarning("Personality %s no "
+                     "longer supported by libhtp, failing back to "
+                     "Apache2 personality.",
+                str);
         return HTP_SERVER_APACHE_2;
     }
 
@@ -803,7 +805,7 @@ static int Setup(Flow *f, HtpState *hstate)
         (void)SCRadixFindKeyIPV6BestMatch((uint8_t *)GET_IPV6_DST_ADDR(f), cfgtree, &user_data);
     }
     else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown address family, bug!");
+        SCLogError("unknown address family, bug!");
         goto error;
     }
 
@@ -2587,18 +2589,16 @@ 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_EINVAL,
-                                "LIBHTP failed to "
-                                "add ipv6 server %s, ignoring",
+                        SCLogWarning("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_EINVAL,
-                                "LIBHTP failed "
-                                "to add ipv4 server %s, ignoring",
+                        SCLogWarning("LIBHTP failed "
+                                     "to add ipv4 server %s, ignoring",
                                 pval->val);
                     }
                 } /* else - if (strchr(pval->val, ':') != NULL) */
@@ -2614,9 +2614,8 @@ 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_EINVAL,
-                            "LIBHTP Failed adding "
-                            "personality \"%s\", ignoring",
+                    SCLogWarning("LIBHTP Failed adding "
+                                 "personality \"%s\", ignoring",
                             p->val);
                 } else {
                     SCLogDebug("LIBHTP personality set to %s",
@@ -2628,37 +2627,42 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                  * Signatures do not expect this, so override it. */
                 htp_config_set_convert_lowercase(cfg_prec->cfg, HTP_DECODER_URL_PATH, 0);
             } else {
-                SCLogWarning(SC_ERR_UNKNOWN_VALUE, "LIBHTP Unknown personality "
-                             "\"%s\", ignoring", p->val);
+                SCLogWarning("LIBHTP Unknown personality "
+                             "\"%s\", ignoring",
+                        p->val);
                 continue;
             }
 
         } else if (strcasecmp("request-body-limit", p->name) == 0 ||
                    strcasecmp("request_body_limit", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->request.body_limit) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing request-body-limit "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing request-body-limit "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
         } else if (strcasecmp("response-body-limit", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->response.body_limit) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing response-body-limit "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing response-body-limit "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
         } else if (strcasecmp("request-body-minimal-inspect-size", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->request.inspect_min_size) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing request-body-minimal-inspect-size "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing request-body-minimal-inspect-size "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
         } else if (strcasecmp("request-body-inspect-window", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->request.inspect_window) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing request-body-inspect-window "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing request-body-inspect-window "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
@@ -2676,30 +2680,34 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
 
         } else if (strcasecmp("response-body-minimal-inspect-size", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->response.inspect_min_size) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing response-body-minimal-inspect-size "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing response-body-minimal-inspect-size "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
         } else if (strcasecmp("response-body-inspect-window", p->name) == 0) {
             if (ParseSizeStringU32(p->val, &cfg_prec->response.inspect_window) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing response-body-inspect-window "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing response-body-inspect-window "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 
         } else if (strcasecmp("response-body-decompress-layer-limit", p->name) == 0) {
             uint32_t value = 2;
             if (ParseSizeStringU32(p->val, &value) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing response-body-inspect-window "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error parsing response-body-inspect-window "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
 #ifdef HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT
             htp_config_set_response_decompression_layer_limit(cfg_prec->cfg, value);
 #else
-            SCLogWarning(SC_WARN_OUTDATED_LIBHTP, "can't set response-body-decompress-layer-limit "
-                    "to %u, libhtp version too old", value);
+            SCLogWarning("can't set response-body-decompress-layer-limit "
+                         "to %u, libhtp version too old",
+                    value);
 #endif
         } else if (strcasecmp("path-convert-backslash-separators", p->name) == 0) {
             htp_config_set_backslash_convert_slashes(cfg_prec->cfg,
@@ -2711,7 +2719,7 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                                                         HTP_DECODER_URL_PATH,
                                                         p->val[0]);
             } else {
-                SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid entry "
+                SCLogError("Invalid entry "
                            "for libhtp param path-bestfit-replacement-char");
             }
         } else if (strcasecmp("path-convert-lowercase", p->name) == 0) {
@@ -2747,7 +2755,7 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
             } else if (strcasecmp(p->val, "decode_invalid") == 0) {
                 handling = HTP_URL_DECODE_PROCESS_INVALID;
             } else {
-                SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid entry "
+                SCLogError("Invalid entry "
                            "for libhtp param path-url-encoding-invalid-handling");
                 return;
             }
@@ -2769,12 +2777,13 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
         } else if (strcasecmp("meta-field-limit", p->name) == 0) {
             uint32_t limit = 0;
             if (ParseSizeStringU32(p->val, &limit) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error meta-field-limit "
-                           "from conf file - %s.  Killing engine", p->val);
+                SCLogError("Error meta-field-limit "
+                           "from conf file - %s.  Killing engine",
+                        p->val);
                 exit(EXIT_FAILURE);
             }
             if (limit == 0) {
-                FatalError(SC_ERR_FATAL, "Error meta-field-limit "
+                FatalError("Error meta-field-limit "
                            "from conf file cannot be 0.  Killing engine");
             }
             /* set default soft-limit with our new hard limit */
@@ -2785,11 +2794,12 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
         } else if (strcasecmp("lzma-memlimit", p->name) == 0) {
             uint32_t limit = 0;
             if (ParseSizeStringU32(p->val, &limit) < 0) {
-                FatalError(SC_ERR_SIZE_PARSE, "failed to parse 'lzma-memlimit' "
-                           "from conf file - %s.", p->val);
+                FatalError("failed to parse 'lzma-memlimit' "
+                           "from conf file - %s.",
+                        p->val);
             }
             if (limit == 0) {
-                FatalError(SC_ERR_SIZE_PARSE, "'lzma-memlimit' "
+                FatalError("'lzma-memlimit' "
                            "from conf file cannot be 0.");
             }
             /* set default soft-limit with our new hard limit */
@@ -2803,9 +2813,8 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
             } else if (!ConfValIsFalse(p->val)) {
                 int8_t limit;
                 if (StringParseInt8(&limit, 10, 0, (const char *)p->val) < 0) {
-                    FatalError(SC_ERR_SIZE_PARSE,
-                            "failed to parse 'lzma-enabled' "
-                            "from conf file - %s.",
+                    FatalError("failed to parse 'lzma-enabled' "
+                               "from conf file - %s.",
                             p->val);
                 }
                 SCLogConfig("Setting HTTP LZMA decompression layers to %" PRIu32 "", (int)limit);
@@ -2816,11 +2825,12 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
         } else if (strcasecmp("compression-bomb-limit", p->name) == 0) {
             uint32_t limit = 0;
             if (ParseSizeStringU32(p->val, &limit) < 0) {
-                FatalError(SC_ERR_SIZE_PARSE, "failed to parse 'compression-bomb-limit' "
-                           "from conf file - %s.", p->val);
+                FatalError("failed to parse 'compression-bomb-limit' "
+                           "from conf file - %s.",
+                        p->val);
             }
             if (limit == 0) {
-                FatalError(SC_ERR_SIZE_PARSE, "'compression-bomb-limit' "
+                FatalError("'compression-bomb-limit' "
                            "from conf file cannot be 0.");
             }
             /* set default soft-limit with our new hard limit */
@@ -2832,9 +2842,8 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
             uint32_t limit = 0;
             // between 1 usec and 1 second
             if (StringParseU32RangeCheck(&limit, 10, 0, p->val, 1, 1000000) < 0) {
-                FatalError(SC_ERR_SIZE_PARSE,
-                        "failed to parse 'decompression-time-limit' "
-                        "from conf file - %s.",
+                FatalError("failed to parse 'decompression-time-limit' "
+                           "from conf file - %s.",
                         p->val);
             }
             SCLogConfig("Setting HTTP decompression time limit to %" PRIu32 " usec", limit);
@@ -2848,11 +2857,10 @@ 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_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",
+                SCLogError("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);
             }
@@ -2894,33 +2902,34 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                     } else if (strcasecmp("both", pval->val) == 0) {
                         cfg_prec->swf_compression_type = HTTP_SWF_COMPRESSION_BOTH;
                     } else {
-                        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                                   "Invalid entry for "
+                        SCLogError("Invalid entry for "
                                    "swf-decompression.type: %s - "
-                                   "Killing engine", pval->val);
+                                   "Killing engine",
+                                pval->val);
                         exit(EXIT_FAILURE);
                     }
                 } else if (strcasecmp("compress-depth", pval->name) == 0) {
                     if (ParseSizeStringU32(pval->val, &cfg_prec->swf_compress_depth) < 0) {
-                        SCLogError(SC_ERR_SIZE_PARSE,
-                                   "Error parsing swf-decompression.compression-depth "
-                                   "from conf file - %s. Killing engine", p->val);
+                        SCLogError("Error parsing swf-decompression.compression-depth "
+                                   "from conf file - %s. Killing engine",
+                                p->val);
                         exit(EXIT_FAILURE);
                     }
                 } else if (strcasecmp("decompress-depth", pval->name) == 0) {
                     if (ParseSizeStringU32(pval->val, &cfg_prec->swf_decompress_depth) < 0) {
-                        SCLogError(SC_ERR_SIZE_PARSE,
-                                   "Error parsing swf-decompression.decompression-depth "
-                                   "from conf file - %s. Killing engine", p->val);
+                        SCLogError("Error parsing swf-decompression.decompression-depth "
+                                   "from conf file - %s. Killing engine",
+                                p->val);
                         exit(EXIT_FAILURE);
                     }
                 } else {
-                    SCLogWarning(SC_ERR_UNKNOWN_VALUE, "Ignoring unknown param %s", pval->name);
+                    SCLogWarning("Ignoring unknown param %s", pval->name);
                 }
             }
         } else {
-            SCLogWarning(SC_ERR_UNKNOWN_VALUE, "LIBHTP Ignoring unknown "
-                         "default config: %s", p->name);
+            SCLogWarning("LIBHTP Ignoring unknown "
+                         "default config: %s",
+                    p->name);
         }
     } /* TAILQ_FOREACH(p, &default_config->head, next) */
 
@@ -2940,7 +2949,7 @@ void HTPConfigure(void)
     /* Default Config */
     cfglist.cfg = htp_config_create();
     if (NULL == cfglist.cfg) {
-        FatalError(SC_ERR_FATAL, "Failed to create HTP default config");
+        FatalError("Failed to create HTP default config");
     }
     SCLogDebug("LIBHTP default config: %p", cfglist.cfg);
     HTPConfigSetDefaultsPhase1(&cfglist);
@@ -2988,7 +2997,7 @@ void HTPConfigure(void)
         cfglist.next->next = nextrec;
         cfglist.next->cfg = htp_config_create();
         if (NULL == cfglist.next->cfg) {
-            FatalError(SC_ERR_FATAL, "Failed to create HTP server config");
+            FatalError("Failed to create HTP server config");
         }
 
         HTPConfigSetDefaultsPhase1(htprec);
@@ -3079,8 +3088,9 @@ static int HTPStateGetEventInfo(const char *event_name,
 {
     *event_id = SCMapEnumNameToValue(event_name, http_decoder_event_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "http's enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "http's enum map table.",
+                event_name);
         /* this should be treated as fatal */
         return -1;
     }
@@ -3095,8 +3105,9 @@ static int HTPStateGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, http_decoder_event_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
-                   "http's enum map table.",  event_id);
+        SCLogError("event \"%d\" not present in "
+                   "http's enum map table.",
+                event_id);
         /* this should be treated as fatal */
         return -1;
     }
index 3735ce14c184e0a6dbbbf0872ebba67e10ad088e..96b4cc27afcc97909021bcddfd8409bb51697182 100644 (file)
@@ -44,7 +44,7 @@ void RegisterMQTTParsers(void)
         if (p != NULL) {
             uint32_t value;
             if (ParseSizeStringU32(p->val, &value) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "invalid value for max-msg-length: %s", p->val);
+                SCLogError("invalid value for max-msg-length: %s", p->val);
             } else {
                 max_msg_len = value;
             }
index bb75292073ed39872f5211dbfb51d7cc9e14ec8d..11d27034559d65a8b547f3b4fb9dc469a588b0df 100644 (file)
@@ -347,9 +347,9 @@ int AppLayerParserConfParserEnabled(const char *ipproto,
     r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.",
                  alproto_name, ".enabled");
     if (r < 0) {
-        FatalError(SC_ERR_FATAL, "snprintf failure.");
+        FatalError("snprintf failure.");
     } else if (r > (int)sizeof(param)) {
-        FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+        FatalError("buffer not big enough to write param.");
     }
 
     node = ConfGetNode(param);
@@ -358,9 +358,9 @@ int AppLayerParserConfParserEnabled(const char *ipproto,
         r = snprintf(param, sizeof(param), "%s%s%s%s%s", "app-layer.protocols.",
                      alproto_name, ".", ipproto, ".enabled");
         if (r < 0) {
-            FatalError(SC_ERR_FATAL, "snprintf failure.");
+            FatalError("snprintf failure.");
         } else if (r > (int)sizeof(param)) {
-            FatalError(SC_ERR_FATAL, "buffer not big enough to write param.");
+            FatalError("buffer not big enough to write param.");
         }
 
         node = ConfGetNode(param);
@@ -377,7 +377,7 @@ int AppLayerParserConfParserEnabled(const char *ipproto,
     } else if (strcasecmp(node->val, "detection-only") == 0) {
         goto disabled;
     } else {
-        SCLogError(SC_ERR_FATAL, "Invalid value found for %s.", param);
+        SCLogError("Invalid value found for %s.", param);
         exit(EXIT_FAILURE);
     }
 
index a679369b8445a7579e8fa230cbabd48e79b4ab61..7233bf4b7f78e99dbaa5f78ea4cf8ad531e4c1fb 100644 (file)
@@ -41,15 +41,15 @@ AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *p, int e
     const char *ip_proto_str = NULL;
 
     if (p == NULL)
-        FatalError(SC_ERR_FATAL, "Call to %s with NULL pointer.", __FUNCTION__);
+        FatalError("Call to %s with NULL pointer.", __FUNCTION__);
 
     alproto = StringToAppProto(p->name);
     if (alproto == ALPROTO_UNKNOWN || alproto == ALPROTO_FAILED)
-        FatalError(SC_ERR_FATAL, "Unknown or invalid AppProto '%s'.", p->name);
+        FatalError("Unknown or invalid AppProto '%s'.", p->name);
 
     ip_proto_str = IpProtoToString(p->ip_proto);
     if (ip_proto_str == NULL)
-        FatalError(SC_ERR_FATAL, "Unknown or unsupported ip_proto field in parser '%s'", p->name);
+        FatalError("Unknown or unsupported ip_proto field in parser '%s'", p->name);
 
     SCLogDebug("%s %s protocol detection enabled.", ip_proto_str, p->name);
 
@@ -97,14 +97,14 @@ int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto)
     const char *ip_proto_str = NULL;
 
     if (p == NULL)
-        FatalError(SC_ERR_FATAL, "Call to %s with NULL pointer.", __FUNCTION__);
+        FatalError("Call to %s with NULL pointer.", __FUNCTION__);
 
     if (alproto == ALPROTO_UNKNOWN || alproto >= ALPROTO_FAILED)
-        FatalError(SC_ERR_FATAL, "Unknown or invalid AppProto '%s'.", p->name);
+        FatalError("Unknown or invalid AppProto '%s'.", p->name);
 
     ip_proto_str = IpProtoToString(p->ip_proto);
     if (ip_proto_str == NULL)
-        FatalError(SC_ERR_FATAL, "Unknown or unsupported ip_proto field in parser '%s'", p->name);
+        FatalError("Unknown or unsupported ip_proto field in parser '%s'", p->name);
 
     SCLogDebug("Registering %s protocol parser.", p->name);
 
index 9b4a27a67662b3418317babaa2c5489555205ff4..6fab7cb77ae3333888f9c363f474d59ca81c2f64 100644 (file)
@@ -302,16 +302,16 @@ static void SMTPConfigure(void) {
                 /* new_val_len: scheme value from config e.g. 'http' + '://' + null terminator */
                 size_t new_val_len = strlen(scheme->val) + 3 + 1;
                 if (new_val_len > UINT16_MAX) {
-                    FatalError(SC_ERR_FATAL, "Too long value for extract-urls-schemes");
+                    FatalError("Too long value for extract-urls-schemes");
                 }
                 char *new_val = SCMalloc(new_val_len);
                 if (unlikely(new_val == NULL)) {
-                    FatalError(SC_ERR_FATAL, "SCMalloc failure.");
+                    FatalError("SCMalloc failure.");
                 }
 
                 int r = snprintf(new_val, new_val_len, "%s://", scheme->val);
                 if (r < 0 || r >= (int)new_val_len) {
-                    FatalError(SC_ERR_FATAL, "snprintf failure.");
+                    FatalError("snprintf failure.");
                 }
 
                 /* replace existing scheme value stored on the linked list with new value including
@@ -326,20 +326,20 @@ static void SMTPConfigure(void) {
              * extract-urls-schemes wasn't found in the config */
             ConfNode *seq_node = ConfNodeNew();
             if (unlikely(seq_node == NULL)) {
-                FatalError(SC_ERR_FATAL, "ConfNodeNew failure.");
+                FatalError("ConfNodeNew failure.");
             }
             ConfNode *scheme = ConfNodeNew();
             if (unlikely(scheme == NULL)) {
-                FatalError(SC_ERR_FATAL, "ConfNodeNew failure.");
+                FatalError("ConfNodeNew failure.");
             }
 
             seq_node->name = SCStrdup("extract-urls-schemes");
             if (unlikely(seq_node->name == NULL)) {
-                FatalError(SC_ERR_FATAL, "SCStrdup failure.");
+                FatalError("SCStrdup failure.");
             }
             scheme->val = SCStrdup("http://");
             if (unlikely(scheme->val == NULL)) {
-                FatalError(SC_ERR_FATAL, "SCStrdup failure.");
+                FatalError("SCStrdup failure.");
             }
 
             seq_node->is_seq = 1;
@@ -374,8 +374,7 @@ static void SMTPConfigure(void) {
         TAILQ_FOREACH(p, &t->head, next) {
             if (strcasecmp("content-limit", p->name) == 0) {
                 if (ParseSizeStringU32(p->val, &content_limit) < 0) {
-                    SCLogWarning(SC_ERR_SIZE_PARSE,
-                            "parsing content-limit %s failed", p->val);
+                    SCLogWarning("parsing content-limit %s failed", p->val);
                     content_limit = FILEDATA_CONTENT_LIMIT;
                 }
                 smtp_config.content_limit = content_limit;
@@ -383,8 +382,7 @@ static void SMTPConfigure(void) {
 
             if (strcasecmp("content-inspect-min-size", p->name) == 0) {
                 if (ParseSizeStringU32(p->val, &content_inspect_min_size) < 0) {
-                    SCLogWarning(SC_ERR_SIZE_PARSE,
-                            "parsing content-inspect-min-size %s failed", p->val);
+                    SCLogWarning("parsing content-inspect-min-size %s failed", p->val);
                     content_inspect_min_size = FILEDATA_CONTENT_INSPECT_MIN_SIZE;
                 }
                 smtp_config.content_inspect_min_size = content_inspect_min_size;
@@ -392,8 +390,7 @@ static void SMTPConfigure(void) {
 
             if (strcasecmp("content-inspect-window", p->name) == 0) {
                 if (ParseSizeStringU32(p->val, &content_inspect_window) < 0) {
-                    SCLogWarning(SC_ERR_SIZE_PARSE,
-                            "parsing content-inspect-window %s failed", p->val);
+                    SCLogWarning("parsing content-inspect-window %s failed", p->val);
                     content_inspect_window = FILEDATA_CONTENT_INSPECT_WINDOW;
                 }
                 smtp_config.content_inspect_window = content_inspect_window;
@@ -408,10 +405,9 @@ static void SMTPConfigure(void) {
         smtp_config.raw_extraction = SMTP_RAW_EXTRACTION_DEFAULT_VALUE;
     }
     if (smtp_config.raw_extraction && smtp_config.decode_mime) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR,
-                "\"decode-mime\" and \"raw-extraction\" "
-                "options can't be enabled at the same time, "
-                "disabling raw extraction");
+        SCLogError("\"decode-mime\" and \"raw-extraction\" "
+                   "options can't be enabled at the same time, "
+                   "disabling raw extraction");
         smtp_config.raw_extraction = 0;
     }
 
@@ -1587,8 +1583,9 @@ static int SMTPStateGetEventInfo(const char *event_name,
 {
     *event_id = SCMapEnumNameToValue(event_name, smtp_decoder_event_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "smtp's enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "smtp's enum map table.",
+                event_name);
         /* yes this is fatal */
         return -1;
     }
@@ -1603,8 +1600,9 @@ static int SMTPStateGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, smtp_decoder_event_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
-                   "smtp's enum map table.",  event_id);
+        SCLogError("event \"%d\" not present in "
+                   "smtp's enum map table.",
+                event_id);
         /* yes this is fatal */
         return -1;
     }
index 21c3b30668dcbb7e73ccf386c9f24b6edc954d55..4496bf4fbd50b18854ad84c4d7b994f4d5164985 100644 (file)
@@ -2781,8 +2781,9 @@ static int SSLStateGetEventInfo(const char *event_name,
 {
     *event_id = SCMapEnumNameToValue(event_name, tls_decoder_event_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "ssl's enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "ssl's enum map table.",
+                event_name);
         /* yes this is fatal */
         return -1;
     }
@@ -2797,8 +2798,9 @@ static int SSLStateGetEventInfoById(int event_id, const char **event_name,
 {
     *event_name = SCMapEnumValueToName(event_id, tls_decoder_event_table);
     if (*event_name == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
-                   "ssl's enum map table.",  event_id);
+        SCLogError("event \"%d\" not present in "
+                   "ssl's enum map table.",
+                event_id);
         /* yes this is fatal */
         return -1;
     }
@@ -3068,8 +3070,7 @@ void RegisterSSLParsers(void)
 
         if (g_disable_hashing) {
             if (SC_ATOMIC_GET(ssl_config.enable_ja3)) {
-                SCLogWarning(
-                        SC_WARN_NO_JA3_SUPPORT, "MD5 calculation has been disabled, disabling JA3");
+                SCLogWarning("MD5 calculation has been disabled, disabling JA3");
                 SC_ATOMIC_SET(ssl_config.enable_ja3, 0);
             }
         } else {
index 99081e4e9c0b51534e59d2d509a08802c79dfa63..f20eeee868c43b4d3110726297db0841517408c1 100644 (file)
@@ -92,15 +92,13 @@ ConfYamlSetConfDirname(const char *filename)
     if (ep == NULL) {
         conf_dirname = SCStrdup(".");
         if (conf_dirname == NULL) {
-               FatalError(SC_ERR_FATAL,
-                          "ERROR: Failed to allocate memory while loading configuration.");
+            FatalError("ERROR: Failed to allocate memory while loading configuration.");
         }
     }
     else {
         conf_dirname = SCStrdup(filename);
         if (conf_dirname == NULL) {
-               FatalError(SC_ERR_FATAL,
-                          "ERROR: Failed to allocate memory while loading configuration.");
+            FatalError("ERROR: Failed to allocate memory while loading configuration.");
         }
         conf_dirname[ep - filename] = '\0';
     }
@@ -124,7 +122,7 @@ ConfYamlHandleInclude(ConfNode *parent, const char *filename)
     int ret = -1;
 
     if (yaml_parser_initialize(&parser) != 1) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Failed to initialize YAML parser");
+        SCLogError("Failed to initialize YAML parser");
         return -1;
     }
 
@@ -138,17 +136,15 @@ ConfYamlHandleInclude(ConfNode *parent, const char *filename)
 
     file = fopen(include_filename, "r");
     if (file == NULL) {
-        SCLogError(SC_ERR_FOPEN,
-            "Failed to open configuration include file %s: %s",
-            include_filename, strerror(errno));
+        SCLogError("Failed to open configuration include file %s: %s", include_filename,
+                strerror(errno));
         goto done;
     }
 
     yaml_parser_set_input_file(&parser, file);
 
     if (ConfYamlParse(&parser, parent, 0, 0) != 0) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR,
-            "Failed to include configuration file %s", filename);
+        SCLogError("Failed to include configuration file %s", filename);
         goto done;
     }
 
@@ -184,16 +180,15 @@ ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int rlevel)
     int was_empty = -1;
 
     if (rlevel++ > RECURSION_LIMIT) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Recursion limit reached while parsing "
-                "configuration file, aborting.");
+        SCLogError("Recursion limit reached while parsing "
+                   "configuration file, aborting.");
         return -1;
     }
 
     while (!done) {
         if (!yaml_parser_parse(parser, &event)) {
-            SCLogError(SC_ERR_CONF_YAML_ERROR,
-                "Failed to parse configuration file at line %" PRIuMAX ": %s\n",
-                (uintmax_t)parser->problem_mark.line, parser->problem);
+            SCLogError("Failed to parse configuration file at line %" PRIuMAX ": %s\n",
+                    (uintmax_t)parser->problem_mark.line, parser->problem);
             retval = -1;
             break;
         }
@@ -206,15 +201,15 @@ ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int rlevel)
             yaml_version_directive_t *ver =
                 event.data.document_start.version_directive;
             if (ver == NULL) {
-                SCLogError(SC_ERR_CONF_YAML_ERROR, "ERROR: Invalid configuration file.");
-                SCLogError(SC_ERR_CONF_YAML_ERROR,
-                           "The configuration file must begin with the following two lines: %%YAML 1.1 and ---");
+                SCLogError("ERROR: Invalid configuration file.");
+                SCLogError("The configuration file must begin with the following two lines: %%YAML "
+                           "1.1 and ---");
                 goto fail;
             }
             int major = ver->major;
             int minor = ver->minor;
             if (!(major == YAML_VERSION_MAJOR && minor == YAML_VERSION_MINOR)) {
-                SCLogError(SC_ERR_CONF_YAML_ERROR, "ERROR: Invalid YAML version.  Must be 1.1");
+                SCLogError("ERROR: Invalid YAML version.  Must be 1.1");
                 goto fail;
             }
         }
@@ -325,13 +320,13 @@ ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int rlevel)
                                     (strcmp(parent->name, "port-groups") == 0)))) {
                                 Mangle(node->name);
                                 if (mangle_errors < MANGLE_ERRORS_MAX) {
-                                    SCLogWarning(SC_WARN_DEPRECATED,
-                                            "%s is deprecated. Please use %s on line %"PRIuMAX".",
-                                            value, node->name, (uintmax_t)parser->mark.line+1);
+                                    SCLogWarning("%s is deprecated. Please use %s on line %" PRIuMAX
+                                                 ".",
+                                            value, node->name, (uintmax_t)parser->mark.line + 1);
                                     mangle_errors++;
                                     if (mangle_errors >= MANGLE_ERRORS_MAX)
-                                        SCLogWarning(SC_WARN_DEPRECATED, "not showing more "
-                                                "parameter name warnings.");
+                                        SCLogWarning("not showing more "
+                                                     "parameter name warnings.");
                                 }
                             }
                         }
@@ -445,15 +440,16 @@ ConfYamlLoadFile(const char *filename)
     ConfNode *root = ConfGetRootNode();
 
     if (yaml_parser_initialize(&parser) != 1) {
-        SCLogError(SC_ERR_FATAL, "failed to initialize yaml parser.");
+        SCLogError("failed to initialize yaml parser.");
         return -1;
     }
 
     struct stat stat_buf;
     if (stat(filename, &stat_buf) == 0) {
         if (stat_buf.st_mode & S_IFDIR) {
-            SCLogError(SC_ERR_FATAL, "yaml argument is not a file but a directory: %s. "
-                    "Please specify the yaml file in your -c option.", filename);
+            SCLogError("yaml argument is not a file but a directory: %s. "
+                       "Please specify the yaml file in your -c option.",
+                    filename);
             yaml_parser_delete(&parser);
             return -1;
         }
@@ -462,8 +458,7 @@ ConfYamlLoadFile(const char *filename)
     // coverity[toctou : FALSE]
     infile = fopen(filename, "r");
     if (infile == NULL) {
-        SCLogError(SC_ERR_FATAL, "failed to open file: %s: %s", filename,
-            strerror(errno));
+        SCLogError("failed to open file: %s: %s", filename, strerror(errno));
         yaml_parser_delete(&parser);
         return -1;
     }
@@ -523,7 +518,7 @@ ConfYamlLoadFileWithPrefix(const char *filename, const char *prefix)
     ConfNode *root = ConfGetNode(prefix);
 
     if (yaml_parser_initialize(&parser) != 1) {
-        SCLogError(SC_ERR_FATAL, "failed to initialize yaml parser.");
+        SCLogError("failed to initialize yaml parser.");
         return -1;
     }
 
@@ -531,8 +526,9 @@ ConfYamlLoadFileWithPrefix(const char *filename, const char *prefix)
     /* coverity[toctou] */
     if (stat(filename, &stat_buf) == 0) {
         if (stat_buf.st_mode & S_IFDIR) {
-            SCLogError(SC_ERR_FATAL, "yaml argument is not a file but a directory: %s. "
-                    "Please specify the yaml file in your -c option.", filename);
+            SCLogError("yaml argument is not a file but a directory: %s. "
+                       "Please specify the yaml file in your -c option.",
+                    filename);
             return -1;
         }
     }
@@ -540,8 +536,7 @@ ConfYamlLoadFileWithPrefix(const char *filename, const char *prefix)
     /* coverity[toctou] */
     infile = fopen(filename, "r");
     if (infile == NULL) {
-        SCLogError(SC_ERR_FATAL, "failed to open file: %s: %s", filename,
-            strerror(errno));
+        SCLogError("failed to open file: %s: %s", filename, strerror(errno));
         yaml_parser_delete(&parser);
         return -1;
     }
index d674fdd647e89bd693a13c16b841cd13a52b5e4e..75abcc9f28bf8cbf739a634d9b33ac474a7b4eac 100644 (file)
@@ -71,8 +71,7 @@ static ConfNode *ConfGetNodeOrCreate(const char *name, int final)
     char *next;
 
     if (strlcpy(node_name, name, sizeof(node_name)) >= sizeof(node_name)) {
-        SCLogError(SC_ERR_CONF_NAME_TOO_LONG,
-            "Configuration name too long: %s", name);
+        SCLogError("Configuration name too long: %s", name);
         return NULL;
     }
 
@@ -84,14 +83,14 @@ static ConfNode *ConfGetNodeOrCreate(const char *name, int final)
         if ((node = ConfNodeLookupChild(parent, key)) == NULL) {
             node = ConfNodeNew();
             if (unlikely(node == NULL)) {
-                SCLogWarning(SC_ENOMEM, "Failed to allocate memory for configuration.");
+                SCLogWarning("Failed to allocate memory for configuration.");
                 goto end;
             }
             node->name = SCStrdup(key);
             if (unlikely(node->name == NULL)) {
                 ConfNodeFree(node);
                 node = NULL;
-                SCLogWarning(SC_ENOMEM, "Failed to allocate memory for configuration.");
+                SCLogWarning("Failed to allocate memory for configuration.");
                 goto end;
             }
             node->parent = parent;
@@ -117,9 +116,8 @@ void ConfInit(void)
     }
     root = ConfNodeNew();
     if (root == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "ERROR: Failed to allocate memory for root configuration node, "
-                       "aborting.");
+        FatalError("ERROR: Failed to allocate memory for root configuration node, "
+                   "aborting.");
     }
     SCLogDebug("configuration module initialized");
 }
@@ -179,8 +177,7 @@ ConfNode *ConfGetNode(const char *name)
     char *next;
 
     if (strlcpy(node_name, name, sizeof(node_name)) >= sizeof(node_name)) {
-        SCLogError(SC_ERR_CONF_NAME_TOO_LONG,
-            "Configuration name too long: %s", name);
+        SCLogError("Configuration name too long: %s", name);
         return NULL;
     }
 
@@ -398,21 +395,24 @@ int ConfGetInt(const char *name, intmax_t *val)
         return 0;
 
     if (strval == NULL) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "malformed integer value "
-                "for %s: NULL", name);
+        SCLogError("malformed integer value "
+                   "for %s: NULL",
+                name);
         return 0;
     }
 
     errno = 0;
     tmpint = strtoimax(strval, &endptr, 0);
     if (strval[0] == '\0' || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "malformed integer value "
-                "for %s: '%s'", name, strval);
+        SCLogError("malformed integer value "
+                   "for %s: '%s'",
+                name, strval);
         return 0;
     }
     if (errno == ERANGE && (tmpint == INTMAX_MAX || tmpint == INTMAX_MIN)) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "integer value for %s out "
-                "of range: '%s'", name, strval);
+        SCLogError("integer value for %s out "
+                   "of range: '%s'",
+                name, strval);
         return 0;
     }
 
@@ -431,13 +431,15 @@ int ConfGetChildValueInt(const ConfNode *base, const char *name, intmax_t *val)
     errno = 0;
     tmpint = strtoimax(strval, &endptr, 0);
     if (strval[0] == '\0' || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "malformed integer value "
-                "for %s with base %s: '%s'", name, base->name, strval);
+        SCLogError("malformed integer value "
+                   "for %s with base %s: '%s'",
+                name, base->name, strval);
         return 0;
     }
     if (errno == ERANGE && (tmpint == INTMAX_MAX || tmpint == INTMAX_MIN)) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "integer value for %s with "
-                " base %s out of range: '%s'", name, base->name, strval);
+        SCLogError("integer value for %s with "
+                   " base %s out of range: '%s'",
+                name, base->name, strval);
         return 0;
     }
 
@@ -944,7 +946,7 @@ ConfNode *ConfSetIfaceNode(const char *ifaces_node_name, const char *iface)
     /* Find initial node which holds all interfaces */
     ifaces_list_node = ConfGetNode(ifaces_node_name);
     if (ifaces_list_node == NULL) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "unable to find %s config", ifaces_node_name);
+        SCLogError("unable to find %s config", ifaces_node_name);
         return NULL;
     }
 
@@ -971,9 +973,8 @@ int ConfSetRootAndDefaultNodes(
     *if_default = ConfSetIfaceNode(ifaces_node_name, default_iface);
 
     if (*if_root == NULL && *if_default == NULL) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR,
-                "unable to find configuration for the interface \"%s\" or the default "
-                "configuration (\"%s\")",
+        SCLogError("unable to find configuration for the interface \"%s\" or the default "
+                   "configuration (\"%s\")",
                 iface, default_iface);
         return (-ENODEV);
     }
index b568d335e7f63b1c70356410515774a21c78c3bb..56c0ab0e03d1c3d803a81193fc3fad3ab9e4b556 100644 (file)
@@ -263,17 +263,17 @@ static void StatsInitCtxPreOutput(void)
         /* warn if we are using legacy config to enable stats */
         ConfNode *gstats = ConfGetNode("stats");
         if (gstats == NULL) {
-            SCLogWarning(SC_ERR_STATS_LOG_GENERIC, "global stats config is missing. "
-                    "Stats enabled through legacy stats.log. "
-                    "See %s/configuration/suricata-yaml.html#stats", GetDocURL());
+            SCLogWarning("global stats config is missing. "
+                         "Stats enabled through legacy stats.log. "
+                         "See %s/configuration/suricata-yaml.html#stats",
+                    GetDocURL());
         }
 
         const char *interval = ConfNodeLookupChildValue(stats, "interval");
         if (interval != NULL)
             if (StringParseUint32(&stats_tts, 10, 0, interval) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid value for "
-                        "interval: \"%s\". Resetting to %d.",
+                SCLogWarning("Invalid value for "
+                             "interval: \"%s\". Resetting to %d.",
                         interval, STATS_MGMTT_TTS);
                 stats_tts = STATS_MGMTT_TTS;
             }
@@ -305,7 +305,7 @@ static void StatsInitCtxPostOutput(void)
 
     /* init the lock used by StatsThreadStore */
     if (SCMutexInit(&stats_ctx->sts_lock, NULL) != 0) {
-        FatalError(SC_ERR_FATAL, "error initializing sts mutex");
+        FatalError("error initializing sts mutex");
     }
 
     if (stats_enabled && !OutputStatsLoggersRegistered()) {
@@ -314,7 +314,7 @@ static void StatsInitCtxPostOutput(void)
         /* if the unix command socket is enabled we do the background
          * stats sync just in case someone runs 'dump-counters' */
         if (!ConfUnixSocketIsEnable()) {
-            SCLogWarning(SC_WARN_NO_STATS_LOGGERS, "stats are enabled but no loggers are active");
+            SCLogWarning("stats are enabled but no loggers are active");
             stats_enabled = false;
             SCReturn;
         }
@@ -395,7 +395,7 @@ static void *StatsMgmtThread(void *arg)
     SCDropCaps(tv_local);
 
     if (stats_ctx == NULL) {
-        SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
+        SCLogError("Stats API not init"
                    "StatsInitCounterApi() has to be called first");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -405,7 +405,7 @@ static void *StatsMgmtThread(void *arg)
     BUG_ON(tm->ThreadInit == NULL);
     int r = tm->ThreadInit(tv_local, NULL, &stats_thread_data);
     if (r != 0 || stats_thread_data == NULL) {
-        SCLogError(SC_ERR_THREAD_INIT, "Stats API "
+        SCLogError("Stats API "
                    "ThreadInit failed");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -445,7 +445,7 @@ static void *StatsMgmtThread(void *arg)
 
     r = tm->ThreadDeinit(tv_local, stats_thread_data);
     if (r != TM_ECODE_OK) {
-        SCLogError(SC_ERR_THREAD_DEINIT, "Stats Counter API "
+        SCLogError("Stats Counter API "
                    "ThreadDeinit failed");
     }
 
@@ -475,7 +475,7 @@ static void *StatsWakeupThread(void *arg)
     SCDropCaps(tv_local);
 
     if (stats_ctx == NULL) {
-        SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
+        SCLogError("Stats API not init"
                    "StatsInitCounterApi() has to be called first");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -662,7 +662,7 @@ static int StatsOutput(ThreadVars *tv)
         stats_table.stats = SCCalloc(stats_table.nstats, sizeof(StatsRecord));
         if (stats_table.stats == NULL) {
             stats_table.nstats = 0;
-            SCLogError(SC_ENOMEM, "could not alloc memory for stats");
+            SCLogError("could not alloc memory for stats");
             return -1;
         }
 
@@ -671,7 +671,7 @@ static int StatsOutput(ThreadVars *tv)
         stats_table.tstats = SCCalloc(stats_table.ntstats, array_size);
         if (stats_table.tstats == NULL) {
             stats_table.ntstats = 0;
-            SCLogError(SC_ENOMEM, "could not alloc memory for stats");
+            SCLogError("could not alloc memory for stats");
             return -1;
         }
 
@@ -879,8 +879,7 @@ void StatsInit(void)
 {
     BUG_ON(stats_ctx != NULL);
     if ( (stats_ctx = SCMalloc(sizeof(StatsGlobalContext))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in StatsInitCtx. Exiting...");
+        FatalError("Fatal error encountered in StatsInitCtx. Exiting...");
     }
     memset(stats_ctx, 0, sizeof(StatsGlobalContext));
 
@@ -919,12 +918,12 @@ void StatsSpawnThreads(void)
     tv_wakeup = TmThreadCreateMgmtThread(thread_name_counter_wakeup,
                                          StatsWakeupThread, 1);
     if (tv_wakeup == NULL) {
-        FatalError(SC_ERR_FATAL, "TmThreadCreateMgmtThread "
+        FatalError("TmThreadCreateMgmtThread "
                    "failed");
     }
 
     if (TmThreadSpawn(tv_wakeup) != 0) {
-        FatalError(SC_ERR_FATAL, "TmThreadSpawn failed for "
+        FatalError("TmThreadSpawn failed for "
                    "StatsWakeupThread");
     }
 
@@ -932,11 +931,11 @@ void StatsSpawnThreads(void)
     tv_mgmt = TmThreadCreateMgmtThread(thread_name_counter_stats,
                                        StatsMgmtThread, 1);
     if (tv_mgmt == NULL) {
-                   FatalError(SC_ERR_FATAL, "TmThreadCreateMgmtThread failed");
+        FatalError("TmThreadCreateMgmtThread failed");
     }
 
     if (TmThreadSpawn(tv_mgmt) != 0) {
-        FatalError(SC_ERR_FATAL, "TmThreadSpawn failed for "
+        FatalError("TmThreadSpawn failed for "
                    "StatsWakeupThread");
     }
 
index 69f364fc8f48f9393f477725173c7c9cb2cd8385..cd658d53ef0224fec1bbdd28a5f47ab7542beb68 100644 (file)
@@ -112,7 +112,7 @@ static int HexToRaw(const uint8_t *in, size_t ins, uint8_t *out, size_t outs)
         if (value >= 0 && value <= 255)
             hash[x] = (uint8_t)value;
         else {
-            SCLogError(SC_ERR_INVALID_HASH, "hash byte out of range %ld", value);
+            SCLogError("hash byte out of range %ld", value);
             return -1;
         }
     }
@@ -156,8 +156,7 @@ static int ParseRepLine(const char *in, size_t ins, DataRepType *rep_out)
     uint16_t v = 0;
     int r = StringParseU16RangeCheck(&v, 10, strlen(ptrs[0]), ptrs[0], 0, USHRT_MAX);
     if (r != (int)strlen(ptrs[0])) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE,
-                "'%s' is not a valid reputation value (0-65535)", ptrs[0]);
+        SCLogError("'%s' is not a valid reputation value (0-65535)", ptrs[0]);
         return -1;
     }
     SCLogDebug("v %"PRIu16" raw %s", v, ptrs[0]);
@@ -179,7 +178,7 @@ static int DatasetLoadIPv4(Dataset *set)
 
     FILE *fp = fopen(set->load, fopen_mode);
     if (fp == NULL) {
-        SCLogError(SC_ERR_DATASET, "fopen '%s' failed: %s", set->load, strerror(errno));
+        SCLogError("fopen '%s' failed: %s", set->load, strerror(errno));
         return -1;
     }
 
@@ -193,14 +192,12 @@ static int DatasetLoadIPv4(Dataset *set)
 
             struct in_addr in;
             if (inet_pton(AF_INET, line, &in) != 1) {
-                FatalErrorOnInit(SC_ERR_DATASET, "dataset data parse failed %s/%s: %s", set->name,
-                        set->load, line);
+                FatalErrorOnInit("dataset data parse failed %s/%s: %s", set->name, set->load, line);
                 continue;
             }
 
             if (DatasetAdd(set, (const uint8_t *)&in.s_addr, 4) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -214,8 +211,7 @@ static int DatasetLoadIPv4(Dataset *set)
 
             struct in_addr in;
             if (inet_pton(AF_INET, line, &in) != 1) {
-                FatalErrorOnInit(SC_ERR_DATASET, "dataset data parse failed %s/%s: %s", set->name,
-                        set->load, line);
+                FatalErrorOnInit("dataset data parse failed %s/%s: %s", set->name, set->load, line);
                 continue;
             }
 
@@ -223,14 +219,13 @@ static int DatasetLoadIPv4(Dataset *set)
 
             DataRepType rep = { .value = 0 };
             if (ParseRepLine(r, strlen(r), &rep) < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad rep for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad rep for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             SCLogDebug("rep v:%u", rep.value);
             if (DatasetAddwRep(set, (const uint8_t *)&in.s_addr, 4, &rep) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
 
@@ -251,8 +246,7 @@ static int ParseIpv6String(Dataset *set, char *line, struct in6_addr *in6)
     if (got_colon) {
         uint32_t ip6addr[4];
         if (inet_pton(AF_INET6, line, in6) != 1) {
-            FatalErrorOnInit(SC_ERR_DATASET, "dataset data parse failed %s/%s: %s", set->name,
-                    set->load, line);
+            FatalErrorOnInit("dataset data parse failed %s/%s: %s", set->name, set->load, line);
             return -1;
         }
         memcpy(&ip6addr, in6->s6_addr, sizeof(ip6addr));
@@ -267,8 +261,7 @@ static int ParseIpv6String(Dataset *set, char *line, struct in6_addr *in6)
         /* IPv4 case */
         struct in_addr in;
         if (inet_pton(AF_INET, line, &in) != 1) {
-            FatalErrorOnInit(SC_ERR_DATASET, "dataset data parse failed %s/%s: %s", set->name,
-                    set->load, line);
+            FatalErrorOnInit("dataset data parse failed %s/%s: %s", set->name, set->load, line);
             return -1;
         }
         memset(in6, 0, sizeof(struct in6_addr));
@@ -290,7 +283,7 @@ static int DatasetLoadIPv6(Dataset *set)
 
     FILE *fp = fopen(set->load, fopen_mode);
     if (fp == NULL) {
-        SCLogError(SC_ERR_DATASET, "fopen '%s' failed: %s", set->load, strerror(errno));
+        SCLogError("fopen '%s' failed: %s", set->load, strerror(errno));
         return -1;
     }
 
@@ -305,13 +298,12 @@ static int DatasetLoadIPv6(Dataset *set)
             struct in6_addr in6;
             int ret = ParseIpv6String(set, line, &in6);
             if (ret < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "unable to parse IP address");
+                FatalErrorOnInit("unable to parse IP address");
                 continue;
             }
 
             if (DatasetAdd(set, (const uint8_t *)&in6.s6_addr, 16) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -326,7 +318,7 @@ static int DatasetLoadIPv6(Dataset *set)
             struct in6_addr in6;
             int ret = ParseIpv6String(set, line, &in6);
             if (ret < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "unable to parse IP address");
+                FatalErrorOnInit("unable to parse IP address");
                 continue;
             }
 
@@ -334,14 +326,13 @@ static int DatasetLoadIPv6(Dataset *set)
 
             DataRepType rep = { .value = 0 };
             if (ParseRepLine(r, strlen(r), &rep) < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad rep for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad rep for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             SCLogDebug("rep v:%u", rep.value);
             if (DatasetAddwRep(set, (const uint8_t *)&in6.s6_addr, 16, &rep) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
 
@@ -368,8 +359,7 @@ static int DatasetLoadMd5(Dataset *set)
 
     FILE *fp = fopen(set->load, fopen_mode);
     if (fp == NULL) {
-        SCLogError(SC_ERR_DATASET, "fopen '%s' failed: %s",
-                set->load, strerror(errno));
+        SCLogError("fopen '%s' failed: %s", set->load, strerror(errno));
         return -1;
     }
 
@@ -383,14 +373,12 @@ static int DatasetLoadMd5(Dataset *set)
 
             uint8_t hash[16];
             if (HexToRaw((const uint8_t *)line, 32, hash, sizeof(hash)) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "bad hash for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad hash for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             if (DatasetAdd(set, (const uint8_t *)hash, 16) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -402,29 +390,26 @@ static int DatasetLoadMd5(Dataset *set)
 
             uint8_t hash[16];
             if (HexToRaw((const uint8_t *)line, 32, hash, sizeof(hash)) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "bad hash for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad hash for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             DataRepType rep = { .value = 0};
             if (ParseRepLine(line + 33, strlen(line) - 33, &rep) < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad rep for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad rep for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             SCLogDebug("rep v:%u", rep.value);
             if (DatasetAddwRep(set, hash, 16, &rep) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
 
             cnt++;
         }
         else {
-            FatalErrorOnInit(
-                    SC_ERR_DATASET, "MD5 bad line len %u: '%s'", (uint32_t)strlen(line), line);
+            FatalErrorOnInit("MD5 bad line len %u: '%s'", (uint32_t)strlen(line), line);
             continue;
         }
     }
@@ -448,8 +433,7 @@ static int DatasetLoadSha256(Dataset *set)
 
     FILE *fp = fopen(set->load, fopen_mode);
     if (fp == NULL) {
-        SCLogError(SC_ERR_DATASET, "fopen '%s' failed: %s",
-                set->load, strerror(errno));
+        SCLogError("fopen '%s' failed: %s", set->load, strerror(errno));
         return -1;
     }
 
@@ -463,14 +447,12 @@ static int DatasetLoadSha256(Dataset *set)
 
             uint8_t hash[32];
             if (HexToRaw((const uint8_t *)line, 64, hash, sizeof(hash)) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "bad hash for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad hash for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             if (DatasetAdd(set, (const uint8_t *)hash, (uint32_t)32) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -482,22 +464,20 @@ static int DatasetLoadSha256(Dataset *set)
 
             uint8_t hash[32];
             if (HexToRaw((const uint8_t *)line, 64, hash, sizeof(hash)) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "bad hash for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad hash for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             DataRepType rep = { .value = 0 };
             if (ParseRepLine(line + 65, strlen(line) - 65, &rep) < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad rep for dataset %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad rep for dataset %s/%s", set->name, set->load);
                 continue;
             }
 
             SCLogDebug("rep %u", rep.value);
 
             if (DatasetAddwRep(set, hash, 32, &rep) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -523,8 +503,7 @@ static int DatasetLoadString(Dataset *set)
 
     FILE *fp = fopen(set->load, fopen_mode);
     if (fp == NULL) {
-        SCLogError(SC_ERR_DATASET, "fopen '%s' failed: %s",
-                set->load, strerror(errno));
+        SCLogError("fopen '%s' failed: %s", set->load, strerror(errno));
         return -1;
     }
 
@@ -545,13 +524,12 @@ static int DatasetLoadString(Dataset *set)
             Base64Ecode code = DecodeBase64(decoded, strlen(line), (const uint8_t *)line,
                     strlen(line), &consumed, &num_decoded, BASE64_MODE_STRICT);
             if (code == BASE64_ECODE_ERR) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad base64 encoding %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad base64 encoding %s/%s", set->name, set->load);
                 continue;
             }
 
             if (DatasetAdd(set, (const uint8_t *)decoded, num_decoded) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -567,7 +545,7 @@ static int DatasetLoadString(Dataset *set)
             Base64Ecode code = DecodeBase64(decoded, strlen(line), (const uint8_t *)line,
                     strlen(line), &consumed, &num_decoded, BASE64_MODE_STRICT);
             if (code == BASE64_ECODE_ERR) {
-                FatalErrorOnInit(SC_ERR_DATASET, "bad base64 encoding %s/%s", set->name, set->load);
+                FatalErrorOnInit("bad base64 encoding %s/%s", set->name, set->load);
                 continue;
             }
 
@@ -576,14 +554,13 @@ static int DatasetLoadString(Dataset *set)
 
             DataRepType rep = { .value = 0 };
             if (ParseRepLine(r, strlen(r), &rep) < 0) {
-                FatalErrorOnInit(SC_ERR_DATASET, "die: bad rep");
+                FatalErrorOnInit("die: bad rep");
                 continue;
             }
             SCLogDebug("rep %u", rep.value);
 
             if (DatasetAddwRep(set, (const uint8_t *)decoded, num_decoded, &rep) < 0) {
-                FatalErrorOnInit(
-                        SC_ERR_DATASET, "dataset data add failed %s/%s", set->name, set->load);
+                FatalErrorOnInit("dataset data add failed %s/%s", set->name, set->load);
                 continue;
             }
             cnt++;
@@ -665,9 +642,9 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
     Dataset *set = DatasetSearchByName(name);
     if (set) {
         if (type != DATASET_TYPE_NOTSET && set->type != type) {
-            SCLogError(SC_ERR_DATASET, "dataset %s already "
-                    "exists and is of type %u",
-                set->name, set->type);
+            SCLogError("dataset %s already "
+                       "exists and is of type %u",
+                    set->name, set->type);
             SCMutexUnlock(&sets_lock);
             return NULL;
         }
@@ -679,15 +656,13 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
         } else {
             if ((save == NULL && strlen(set->save) > 0) ||
                     (save != NULL && strcmp(set->save, save) != 0)) {
-                SCLogError(SC_ERR_DATASET, "dataset %s save mismatch: %s != %s",
-                        set->name, set->save, save);
+                SCLogError("dataset %s save mismatch: %s != %s", set->name, set->save, save);
                 SCMutexUnlock(&sets_lock);
                 return NULL;
             }
             if ((load == NULL && strlen(set->load) > 0) ||
                     (load != NULL && strcmp(set->load, load) != 0)) {
-                SCLogError(SC_ERR_DATASET, "dataset %s load mismatch: %s != %s",
-                        set->name, set->load, load);
+                SCLogError("dataset %s load mismatch: %s != %s", set->name, set->load, load);
                 SCMutexUnlock(&sets_lock);
                 return NULL;
             }
@@ -697,7 +672,7 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
         return set;
     } else {
         if (type == DATASET_TYPE_NOTSET) {
-            SCLogError(SC_ERR_DATASET, "dataset %s not defined", name);
+            SCLogError("dataset %s not defined", name);
             goto out_err;
         }
     }
@@ -855,18 +830,16 @@ 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_EINVAL,
-                    "memcap value cannot be deduced: %s,"
-                    " resetting to default",
+            SCLogWarning("memcap value cannot be deduced: %s,"
+                         " resetting to default",
                     str);
             *memcap = 0;
         }
     }
     if (ConfGet("datasets.defaults.hashsize", &str) == 1) {
         if (ParseSizeStringU32(str, hashsize) < 0) {
-            SCLogWarning(SC_EINVAL,
-                    "hashsize value cannot be deduced: %s,"
-                    " resetting to default",
+            SCLogWarning("hashsize value cannot be deduced: %s,"
+                         " resetting to default",
                     str);
             *hashsize = 0;
         }
@@ -897,8 +870,8 @@ int DatasetsInit(void)
 
             const char *set_name = iter->name;
             if (strlen(set_name) > DATASET_NAME_MAX_LEN) {
-                FatalErrorOnInit(SC_ERR_CONF_NAME_TOO_LONG, "set name '%s' too long, max %d chars",
-                        set_name, DATASET_NAME_MAX_LEN);
+                FatalErrorOnInit(
+                        "set name '%s' too long, max %d chars", set_name, DATASET_NAME_MAX_LEN);
                 continue;
             }
 
@@ -925,9 +898,8 @@ int DatasetsInit(void)
             ConfNode *set_memcap = ConfNodeLookupChild(iter, "memcap");
             if (set_memcap) {
                 if (ParseSizeStringU64(set_memcap->val, &memcap) < 0) {
-                    SCLogWarning(SC_EINVAL,
-                            "memcap value cannot be"
-                            " deduced: %s, resetting to default",
+                    SCLogWarning("memcap value cannot be"
+                                 " deduced: %s, resetting to default",
                             set_memcap->val);
                     memcap = 0;
                 }
@@ -935,9 +907,8 @@ int DatasetsInit(void)
             ConfNode *set_hashsize = ConfNodeLookupChild(iter, "hashsize");
             if (set_hashsize) {
                 if (ParseSizeStringU32(set_hashsize->val, &hashsize) < 0) {
-                    SCLogWarning(SC_EINVAL,
-                            "hashsize value cannot be"
-                            " deduced: %s, resetting to default",
+                    SCLogWarning("hashsize value cannot be"
+                                 " deduced: %s, resetting to default",
                             set_hashsize->val);
                     hashsize = 0;
                 }
@@ -952,7 +923,7 @@ int DatasetsInit(void)
                         memcap > 0 ? memcap : default_memcap,
                         hashsize > 0 ? hashsize : default_hashsize);
                 if (dset == NULL) {
-                    FatalErrorOnInit(SC_ERR_DATASET, "failed to setup dataset for %s", set_name);
+                    FatalErrorOnInit("failed to setup dataset for %s", set_name);
                     continue;
                 }
                 SCLogDebug("dataset %s: id %d type %s", set_name, n, set_type->val);
@@ -964,7 +935,7 @@ int DatasetsInit(void)
                         memcap > 0 ? memcap : default_memcap,
                         hashsize > 0 ? hashsize : default_hashsize);
                 if (dset == NULL) {
-                    FatalErrorOnInit(SC_ERR_DATASET, "failed to setup dataset for %s", set_name);
+                    FatalErrorOnInit("failed to setup dataset for %s", set_name);
                     continue;
                 }
                 SCLogDebug("dataset %s: id %d type %s", set_name, n, set_type->val);
@@ -976,7 +947,7 @@ int DatasetsInit(void)
                         memcap > 0 ? memcap : default_memcap,
                         hashsize > 0 ? hashsize : default_hashsize);
                 if (dset == NULL) {
-                    FatalErrorOnInit(SC_ERR_DATASET, "failed to setup dataset for %s", set_name);
+                    FatalErrorOnInit("failed to setup dataset for %s", set_name);
                     continue;
                 }
                 SCLogDebug("dataset %s: id %d type %s", set_name, n, set_type->val);
index b5a5a722f7aba02d616431732bd005f680a5f143..e9ffac180d7d31b51f43bff0764ad079609a0910 100644 (file)
@@ -53,8 +53,7 @@ void DecodeERSPANConfig(void)
 {
     int enabled = 0;
     if (ConfGetBool("decoder.erspan.typeI.enabled", &enabled) == 1) {
-        SCLogWarning(SC_WARN_ERSPAN_CONFIG,
-                     "ERSPAN Type I is no longer configurable and it is always"
+        SCLogWarning("ERSPAN Type I is no longer configurable and it is always"
                      " enabled; ignoring configuration setting.");
     }
 }
index 5e4dff906b39f1c7537e692ed762a61d913d39bb..b70275cff78b4bd47bcef8bfe5fac9e94b36b93b 100644 (file)
@@ -116,8 +116,7 @@ static void DecodeGeneveConfigPorts(const char *pstr)
     g_geneve_ports_idx = 0;
     for (DetectPort *p = head; p != NULL; p = p->next) {
         if (g_geneve_ports_idx >= GENEVE_MAX_PORTS) {
-            SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "more than %d Geneve ports defined",
-                    GENEVE_MAX_PORTS);
+            SCLogWarning("more than %d Geneve ports defined", GENEVE_MAX_PORTS);
             break;
         }
         g_geneve_ports[g_geneve_ports_idx++] = (int)p->port;
index 8364a2e1e2beb32d69903d35d2435c14b16f08b8..bbeda3efa398c9a632ecf0b3f00e115fd8412253 100644 (file)
@@ -92,8 +92,7 @@ static void DecodeTeredoConfigPorts(const char *pstr)
     g_teredo_ports_cnt = 0;
     for (DetectPort *p = head; p != NULL; p = p->next) {
         if (g_teredo_ports_cnt >= TEREDO_MAX_PORTS) {
-            SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "only %d Teredo ports can be defined",
-                    TEREDO_MAX_PORTS);
+            SCLogWarning("only %d Teredo ports can be defined", TEREDO_MAX_PORTS);
             break;
         }
         g_teredo_ports[g_teredo_ports_cnt++] = (int)p->port;
index 003154c6fb8e503c1f8a35b3f8f431e41311a9d1..61dae9cfc23589251886b9cc8db2505e40bba373 100644 (file)
@@ -86,8 +86,7 @@ static void DecodeVXLANConfigPorts(const char *pstr)
     g_vxlan_ports_idx = 0;
     for (DetectPort *p = head; p != NULL; p = p->next) {
         if (g_vxlan_ports_idx >= VXLAN_MAX_PORTS) {
-            SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "more than %d VXLAN ports defined",
-                    VXLAN_MAX_PORTS);
+            SCLogWarning("more than %d VXLAN ports defined", VXLAN_MAX_PORTS);
             break;
         }
         g_vxlan_ports[g_vxlan_ports_idx++] = (int)p->port;
index dbe7f2d9efe9f190f344398a16e60e18f77f3440..96c618cf2c25d6d3edd2c8d18af867cda4ac925c 100644 (file)
@@ -616,8 +616,8 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
                         StringHashCompareFunc,
                         StringHashFreeFunc);
                 if (g_counter_table == NULL) {
-                    FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
-                            "table init failed");
+                    FatalError("decoder counter hash "
+                               "table init failed");
                 }
             }
 
@@ -631,12 +631,12 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
             if (!found) {
                 char *add = SCStrdup(name);
                 if (add == NULL)
-                    FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
-                            "table name init failed");
+                    FatalError("decoder counter hash "
+                               "table name init failed");
                 int r = HashTableAdd(g_counter_table, add, 0);
                 if (r != 0)
-                    FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
-                            "table name add failed");
+                    FatalError("decoder counter hash "
+                               "table name add failed");
                 found = add;
             }
             dtv->counter_engine_events[i] = StatsRegisterCounter(
@@ -697,7 +697,7 @@ DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv)
     dtv->app_tctx = AppLayerGetCtxThread(tv);
 
     if (OutputFlowLogThreadInit(tv, NULL, &dtv->output_flow_thread_data) != TM_ECODE_OK) {
-        SCLogError(SC_ERR_THREAD_INIT, "initializing flow log API for thread failed");
+        SCLogError("initializing flow log API for thread failed");
         DecodeThreadVarsFree(tv, dtv);
         return NULL;
     }
@@ -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_EINVAL, "Invalid value for decoder.max-layers");
+            SCLogWarning("Invalid value for decoder.max-layers");
         } else {
             decoder_max_layers = (uint8_t)value;
         }
@@ -863,8 +863,7 @@ void PacketAlertGetMaxConfig(void)
     intmax_t max = 0;
     if (ConfGetInt("packet-alert-max", &max) == 1) {
         if (max <= 0 || max > UINT8_MAX) {
-            SCLogWarning(
-                    SC_EINVAL, "Invalid value for packet-alert-max, default value set instead");
+            SCLogWarning("Invalid value for packet-alert-max, default value set instead");
         } else {
             packet_alert_max = (uint16_t)max;
         }
index b229d38c371da3f3f182ab5b45e0f25fb607afe7..ecc8c88f832640c842ee9fc67a845ec64eb77a9f 100644 (file)
@@ -1147,8 +1147,9 @@ static inline void DecodeLinkLayer(ThreadVars *tv, DecodeThreadVars *dtv,
             DecodeCHDLC(tv, dtv, p, data, len);
             break;
         default:
-            SCLogError(SC_ERR_DATALINK_UNIMPLEMENTED, "datalink type "
-                    "%"PRId32" not yet supported", datalink);
+            SCLogError("datalink type "
+                       "%" PRId32 " not yet supported",
+                    datalink);
             break;
     }
 }
index 9660b2e98efd1f5d8baa9b57aa463d6c38517416..9e565c66b0a837adcf014b053e200ee13d976f32 100644 (file)
@@ -44,7 +44,7 @@ static void DefragPolicyAddHostInfo(char *host_ip_range, uint64_t timeout)
     uint64_t *user_data = NULL;
 
     if ( (user_data = SCMalloc(sizeof(uint64_t))) == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory. Exiting");
+        FatalError("Error allocating memory. Exiting");
     }
 
     *user_data = timeout;
@@ -52,12 +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_EINVAL, "failed to add ipv6 host %s", host_ip_range);
+            SCLogWarning("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_EINVAL, "failed to add ipv4 host %s", host_ip_range);
+            SCLogWarning("failed to add ipv4 host %s", host_ip_range);
         }
     }
 }
@@ -106,8 +106,8 @@ static void DefragParseParameters(ConfNode *n)
         if (strcasecmp("timeout", si->name) == 0) {
             SCLogDebug("timeout value  %s", si->val);
             if (ParseSizeStringU64(si->val, &timeout) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing timeout "
-                        "from conf file");
+                SCLogError("Error parsing timeout "
+                           "from conf file");
             }
         }
         if (strcasecmp("address", si->name) == 0) {
@@ -131,8 +131,7 @@ void DefragPolicyLoadFromConfig(void)
 
     defrag_tree = SCRadixCreateRadixTree(DefragPolicyFreeUserData, NULL);
     if (defrag_tree == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "Can't alloc memory for the defrag config tree.");
+        FatalError("Can't alloc memory for the defrag config tree.");
     }
 
     ConfNode *server_config = ConfGetNode("defrag.host-config");
index decc8fd7550172230e84c518832a085c1b76fd93..9a3ab4b1557a062e595d9275f229df1a705d304e 100644 (file)
@@ -192,9 +192,9 @@ void DefragInitConfig(bool quiet)
     if ((ConfGet("defrag.memcap", &conf_val)) == 1)
     {
         if (ParseSizeStringU64(conf_val, &defrag_memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing defrag.memcap "
+            SCLogError("Error parsing defrag.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(defrag_config.memcap, defrag_memcap);
@@ -227,18 +227,18 @@ void DefragInitConfig(bool quiet)
     /* alloc hash memory */
     uint64_t hash_size = defrag_config.hash_size * sizeof(DefragTrackerHashRow);
     if (!(DEFRAG_CHECK_MEMCAP(hash_size))) {
-        SCLogError(SC_ERR_DEFRAG_INIT, "allocating defrag hash failed: "
-                "max defrag memcap is smaller than projected hash size. "
-                "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate "
-                "total hash size by multiplying \"defrag.hash-size\" with %"PRIuMAX", "
-                "which is the hash bucket size.", SC_ATOMIC_GET(defrag_config.memcap), hash_size,
+        SCLogError("allocating defrag hash failed: "
+                   "max defrag memcap is smaller than projected hash size. "
+                   "Memcap: %" PRIu64 ", Hash table size %" PRIu64 ". Calculate "
+                   "total hash size by multiplying \"defrag.hash-size\" with %" PRIuMAX ", "
+                   "which is the hash bucket size.",
+                SC_ATOMIC_GET(defrag_config.memcap), hash_size,
                 (uintmax_t)sizeof(DefragTrackerHashRow));
         exit(EXIT_FAILURE);
     }
     defragtracker_hash = SCCalloc(defrag_config.hash_size, sizeof(DefragTrackerHashRow));
     if (unlikely(defragtracker_hash == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in DefragTrackerInitConfig. Exiting...");
+        FatalError("Fatal error encountered in DefragTrackerInitConfig. Exiting...");
     }
     memset(defragtracker_hash, 0, defrag_config.hash_size * sizeof(DefragTrackerHashRow));
 
@@ -261,16 +261,18 @@ void DefragInitConfig(bool quiet)
             /* pre allocate defrag trackers */
             for (i = 0; i < defrag_config.prealloc; i++) {
                 if (!(DEFRAG_CHECK_MEMCAP(sizeof(DefragTracker)))) {
-                    SCLogError(SC_ERR_DEFRAG_INIT, "preallocating defrag trackers failed: "
-                            "max defrag memcap reached. Memcap %"PRIu64", "
-                            "Memuse %"PRIu64".", SC_ATOMIC_GET(defrag_config.memcap),
-                            ((uint64_t)SC_ATOMIC_GET(defrag_memuse) + (uint64_t)sizeof(DefragTracker)));
+                    SCLogError("preallocating defrag trackers failed: "
+                               "max defrag memcap reached. Memcap %" PRIu64 ", "
+                               "Memuse %" PRIu64 ".",
+                            SC_ATOMIC_GET(defrag_config.memcap),
+                            ((uint64_t)SC_ATOMIC_GET(defrag_memuse) +
+                                    (uint64_t)sizeof(DefragTracker)));
                     exit(EXIT_FAILURE);
                 }
 
                 DefragTracker *h = DefragTrackerAlloc();
                 if (h == NULL) {
-                    SCLogError(SC_ERR_DEFRAG_INIT, "preallocating defrag failed: %s", strerror(errno));
+                    SCLogError("preallocating defrag failed: %s", strerror(errno));
                     exit(EXIT_FAILURE);
                 }
                 DefragTrackerEnqueue(&defragtracker_spare_q,h);
index b4e8ea237d32a7bb8ea093836173023a56c6ee96..0e29f1603573bbe14cd60a5973f5aa453c67ed14 100644 (file)
@@ -42,7 +42,7 @@ DefragTrackerQueue *DefragTrackerQueueNew()
 {
     DefragTrackerQueue *q = (DefragTrackerQueue *)SCMalloc(sizeof(DefragTrackerQueue));
     if (q == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in DefragTrackerQueueNew. Exiting...");
+        SCLogError("Fatal error encountered in DefragTrackerQueueNew. Exiting...");
         exit(EXIT_SUCCESS);
     }
     q = DefragTrackerQueueInit(q);
index c93fab31ea2697f09601512c1379db7513231684..eb2d85b706e03ce15c8a51e67204b1d7fa42137b 100644 (file)
@@ -197,12 +197,10 @@ DefragContextNew(void)
         sizeof(Frag),
         NULL, DefragFragInit, dc, NULL, NULL);
     if (dc->frag_pool == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "Defrag: Failed to initialize fragment pool.");
+        FatalError("Defrag: Failed to initialize fragment pool.");
     }
     if (SCMutexInit(&dc->frag_pool_lock, NULL) != 0) {
-            FatalError(SC_ERR_FATAL,
-                       "Defrag: Failed to initialize frag pool mutex.");
+        FatalError("Defrag: Failed to initialize frag pool mutex.");
     }
 
     /* Set the default timeout. */
@@ -212,12 +210,10 @@ DefragContextNew(void)
     }
     else {
         if (timeout < TIMEOUT_MIN) {
-                FatalError(SC_ERR_FATAL,
-                           "defrag: Timeout less than minimum allowed value.");
+            FatalError("defrag: Timeout less than minimum allowed value.");
         }
         else if (timeout > TIMEOUT_MAX) {
-                FatalError(SC_ERR_FATAL,
-                           "defrag: Tiemout greater than maximum allowed value.");
+            FatalError("defrag: Tiemout greater than maximum allowed value.");
         }
         dc->timeout = timeout;
     }
@@ -1068,8 +1064,7 @@ DefragInit(void)
     /* Allocate the DefragContext. */
     defrag_context = DefragContextNew();
     if (defrag_context == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "Failed to allocate memory for the Defrag module.");
+        FatalError("Failed to allocate memory for the Defrag module.");
     }
 
     DefragSetDefaultTimeout(defrag_context->timeout);
index 49b4cca672571683c0e56cfe05fd80e66b868f50..76c3d8f6e93c2e8fb2976ffaa42f4dc92cbcdcae 100644 (file)
@@ -159,9 +159,10 @@ static DetectAppLayerEventData *DetectAppLayerEventParsePkt(const char *arg,
     int event_id = 0;
     int r = AppLayerGetPktEventInfo(arg, &event_id);
     if (r < 0 || r > UINT8_MAX) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword "
+        SCLogError("app-layer-event keyword "
                    "supplied with packet based event - \"%s\" that isn't "
-                   "supported yet.", arg);
+                   "supported yet.",
+                arg);
         return NULL;
     }
 
@@ -199,19 +200,17 @@ static int DetectAppLayerEventParseAppP2(DetectAppLayerEventData *data,
 
     if (OutdatedEvent(data->arg)) {
         if (SigMatchStrictEnabled(DETECT_AL_APP_LAYER_EVENT)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "app-layer-event keyword no longer supports event \"%s\"", data->arg);
+            SCLogError("app-layer-event keyword no longer supports event \"%s\"", data->arg);
             return -1;
         } else {
-            SCLogWarning(SC_ERR_INVALID_SIGNATURE,
-                    "app-layer-event keyword no longer supports event \"%s\"", data->arg);
+            SCLogWarning("app-layer-event keyword no longer supports event \"%s\"", data->arg);
             return -3;
         }
     }
 
     const char *p_idx = strchr(data->arg, '.');
     if (strlen(data->arg) > MAX_ALPROTO_NAME) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword is too long or malformed");
+        SCLogError("app-layer-event keyword is too long or malformed");
         return -1;
     }
     strlcpy(alproto_name, data->arg, p_idx - data->arg + 1);
@@ -221,7 +220,7 @@ static int DetectAppLayerEventParseAppP2(DetectAppLayerEventData *data,
     } else if (ipproto_bitarray[IPPROTO_UDP / 8] & 1 << (IPPROTO_UDP % 8)) {
         ipproto = IPPROTO_UDP;
     } else {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "protocol %s is disabled", alproto_name);
+        SCLogError("protocol %s is disabled", alproto_name);
         return -1;
     }
 
@@ -233,19 +232,19 @@ static int DetectAppLayerEventParseAppP2(DetectAppLayerEventData *data,
     }
     if (r < 0) {
         if (SigMatchStrictEnabled(DETECT_AL_APP_LAYER_EVENT)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword's "
-                    "protocol \"%s\" doesn't have event \"%s\" registered",
+            SCLogError("app-layer-event keyword's "
+                       "protocol \"%s\" doesn't have event \"%s\" registered",
                     alproto_name, p_idx + 1);
             return -1;
         } else {
-            SCLogWarning(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword's "
-                    "protocol \"%s\" doesn't have event \"%s\" registered",
+            SCLogWarning("app-layer-event keyword's "
+                         "protocol \"%s\" doesn't have event \"%s\" registered",
                     alproto_name, p_idx + 1);
             return -3;
         }
     }
     if (event_id > UINT8_MAX) {
-        SCLogWarning(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword's id has invalid value");
+        SCLogWarning("app-layer-event keyword's id has invalid value");
         return -4;
     }
     data->event_id = (uint8_t)event_id;
@@ -271,7 +270,7 @@ static DetectAppLayerEventData *DetectAppLayerEventParseAppP1(const char *arg)
 
     const char *p_idx = strchr(arg, '.');
     if (strlen(arg) > MAX_ALPROTO_NAME) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword is too long or malformed");
+        SCLogError("app-layer-event keyword is too long or malformed");
         return NULL;
     }
     /* + 1 for trailing \0 */
@@ -282,9 +281,9 @@ static DetectAppLayerEventData *DetectAppLayerEventParseAppP1(const char *arg)
         if (!strcmp(alproto_name, "file")) {
             needs_detctx = true;
         } else {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword "
+            SCLogError("app-layer-event keyword "
                        "supplied with unknown protocol \"%s\"",
-                       alproto_name);
+                    alproto_name);
             return NULL;
         }
     }
@@ -309,7 +308,7 @@ static DetectAppLayerEventData *DetectAppLayerEventParse(const char *arg,
     *event_type = 0;
 
     if (arg == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword supplied "
+        SCLogError("app-layer-event keyword supplied "
                    "with no arguments.  This keyword needs an argument.");
         return NULL;
     }
@@ -455,8 +454,9 @@ static int DetectAppLayerEventTestGetEventInfo(const char *event_name,
 {
     *event_id = SCMapEnumNameToValue(event_name, app_layer_event_test_map);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "app-layer-event's test enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "app-layer-event's test enum map table.",
+                event_name);
         /* this should be treated as fatal */
         return -1;
     }
index 0673eaac09def00cffa13a6230a83db79909232c..47fa99b78618bf6d9c40bba40b51b98c40a377d4 100644 (file)
@@ -105,8 +105,9 @@ static DetectAppLayerProtocolData *DetectAppLayerProtocolParse(const char *arg,
     } else {
         alproto = AppLayerGetProtoByName((char *)arg);
         if (alproto == ALPROTO_UNKNOWN) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-protocol "
-                    "keyword supplied with unknown protocol \"%s\"", arg);
+            SCLogError("app-layer-protocol "
+                       "keyword supplied with unknown protocol \"%s\"",
+                    arg);
             return NULL;
         }
     }
@@ -144,7 +145,7 @@ static int DetectAppLayerProtocolSetup(DetectEngineCtx *de_ctx,
     SigMatch *sm = NULL;
 
     if (s->alproto != ALPROTO_UNKNOWN) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "Either we already "
+        SCLogError("Either we already "
                    "have the rule match on an app layer protocol set through "
                    "other keywords that match on this protocol, or have "
                    "already seen a non-negated app-layer-protocol.");
@@ -161,9 +162,9 @@ static int DetectAppLayerProtocolSetup(DetectEngineCtx *de_ctx,
             const DetectAppLayerProtocolData *them = (const DetectAppLayerProtocolData *)tsm->ctx;
 
             if (HasConflicts(data, them)) {
-                SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "can't mix "
-                        "positive app-layer-protocol match with negated "
-                        "match or match for 'failed'.");
+                SCLogError("can't mix "
+                           "positive app-layer-protocol match with negated "
+                           "match or match for 'failed'.");
                 goto error;
             }
         }
index eea1810d11d104fd90291943fcee219519d07816..e255e057afe5ff23a74afc23387f6a215e8ec898 100644 (file)
@@ -104,7 +104,7 @@ static DetectAsn1Data *DetectAsn1Parse(const char *asn1str)
     DetectAsn1Data *ad = rs_detect_asn1_parse(asn1str);
 
     if (ad == NULL) {
-        SCLogError(SC_EINVAL, "Malformed asn1 argument: %s", asn1str);
+        SCLogError("Malformed asn1 argument: %s", asn1str);
     }
 
     return ad;
index c237e7ac54b641dcaa367a6ad417bc85e75a1f77..4e7aef445947fd3aa5bc9effabb0ce08f20777f4 100644 (file)
@@ -53,8 +53,7 @@ static int DetectBase64DataSetup(DetectEngineCtx *de_ctx, Signature *s,
     /* Check for a preceding base64_decode. */
     pm = DetectGetLastSMFromLists(s, DETECT_BASE64_DECODE, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-            "\"base64_data\" keyword seen without preceding base64_decode.");
+        SCLogError("\"base64_data\" keyword seen without preceding base64_decode.");
         return -1;
     }
 
index d12d48b8fb060505f92140a32f8d80da5da66a9b..3b7d08ef78df6b3ad107947c58ff18d3dc5ef7a4 100644 (file)
@@ -134,8 +134,7 @@ static int DetectBase64DecodeParse(const char *str, uint32_t *bytes,
         if (pcre2_substring_get_bynumber(
                     decode_pcre.match, 2, (PCRE2_UCHAR8 **)&bytes_str, &pcre2_len) == 0) {
             if (StringParseUint32(bytes, 10, 0, bytes_str) <= 0) {
-                SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                    "Bad value for bytes: \"%s\"", bytes_str);
+                SCLogError("Bad value for bytes: \"%s\"", bytes_str);
                 goto error;
             }
         }
@@ -145,8 +144,7 @@ static int DetectBase64DecodeParse(const char *str, uint32_t *bytes,
         if (pcre2_substring_get_bynumber(
                     decode_pcre.match, 4, (PCRE2_UCHAR8 **)&offset_str, &pcre2_len) == 0) {
             if (StringParseUint32(offset, 10, 0, offset_str) <= 0) {
-                SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                    "Bad value for offset: \"%s\"", offset_str);
+                SCLogError("Bad value for offset: \"%s\"", offset_str);
                 goto error;
             }
         }
@@ -159,8 +157,7 @@ static int DetectBase64DecodeParse(const char *str, uint32_t *bytes,
                 *relative = 1;
             }
             else {
-                SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                    "Invalid argument: \"%s\"", relative_str);
+                SCLogError("Invalid argument: \"%s\"", relative_str);
                 goto error;
             }
         }
index 8e4405073fe686f3d30a8b171f112b9aa4e1d367..6639742f8ee4ec69fc05fb68d0fed0c93a91af30 100644 (file)
@@ -79,14 +79,13 @@ bool DetectBsizeValidateContentCallback(Signature *s, int list)
     return true;
 value_error:
     if (bsz->mode == DETECT_UINT_RA) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "signature can't match as required content length %" PRIu64
-                " exceeds bsize range: %" PRIu64 "-%" PRIu64,
+        SCLogError("signature can't match as required content length %" PRIu64
+                   " exceeds bsize range: %" PRIu64 "-%" PRIu64,
                 needed, bsz->arg1, bsz->arg2);
     } else {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "signature can't match as required content length %" PRIu64 " exceeds bsize value: "
-                "%" PRIu64,
+        SCLogError("signature can't match as required content length %" PRIu64
+                   " exceeds bsize value: "
+                   "%" PRIu64,
                 needed, bsz->arg1);
     }
     return false;
index 0ac22151dcba1399b3a4c97384443bf78f7b2840..a0eb534b84db69863376741b4057ee12a7d290d6 100644 (file)
@@ -72,8 +72,7 @@ static int DetectBypassSetup(DetectEngineCtx *de_ctx, Signature *s, const char *
     SigMatch *sm = NULL;
 
     if (s->flags & SIG_FLAG_FILESTORE) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                   "bypass can't work with filestore keyword");
+        SCLogError("bypass can't work with filestore keyword");
         return -1;
     }
     s->flags |= SIG_FLAG_BYPASS;
index e4e07952c489427cb3e8b1ba9c72ac59a5a2287d..1b2ea4ad93f4c20330e94a0113ea0a9d5436c149 100644 (file)
@@ -220,10 +220,10 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
 
     ret = DetectParsePcreExec(&parse_regex, arg, 0, 0);
     if (ret < 3 || ret > 19) {
-        SCLogError(SC_ERR_PCRE_PARSE, "parse error, ret %" PRId32
-                   ", string \"%s\"", ret, arg);
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid arg to byte_extract : %s "
-                   "for byte_extract", arg);
+        SCLogError("parse error, ret %" PRId32 ", string \"%s\"", ret, arg);
+        SCLogError("Invalid arg to byte_extract : %s "
+                   "for byte_extract",
+                arg);
         goto error;
     }
 
@@ -238,14 +238,15 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 1, (PCRE2_UCHAR8 *)nbytes_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                              "for arg 1 for byte_extract");
+        SCLogError("pcre2_substring_copy_bynumber failed "
+                   "for arg 1 for byte_extract");
         goto error;
     }
     if (StringParseUint8(&bed->nbytes, 10, 0,
                                (const char *)nbytes_str) < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid value for number of bytes"
-                   " to be extracted: \"%s\".", nbytes_str);
+        SCLogError("Invalid value for number of bytes"
+                   " to be extracted: \"%s\".",
+                nbytes_str);
         goto error;
     }
 
@@ -255,13 +256,13 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 2, (PCRE2_UCHAR8 *)offset_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                              "for arg 2 for byte_extract");
+        SCLogError("pcre2_substring_copy_bynumber failed "
+                   "for arg 2 for byte_extract");
         goto error;
     }
     int32_t offset;
     if (StringParseI32RangeCheck(&offset, 10, 0, (const char *)offset_str, -65535, 65535) < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid value for offset: \"%s\".", offset_str);
+        SCLogError("Invalid value for offset: \"%s\".", offset_str);
         goto error;
     }
     bed->offset = offset;
@@ -272,8 +273,8 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 3, (PCRE2_UCHAR8 *)varname_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                              "for arg 3 for byte_extract");
+        SCLogError("pcre2_substring_copy_bynumber failed "
+                   "for arg 3 for byte_extract");
         goto error;
     }
     bed->name = SCStrdup(varname_str);
@@ -286,23 +287,22 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
         pcre2len = sizeof(opt_str);
         res = SC_Pcre2SubstringCopy(parse_regex.match, i, (PCRE2_UCHAR8 *)opt_str, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING,
-                    "pcre2_substring_copy_bynumber failed "
-                    "for arg %d for byte_extract with %d",
+            SCLogError("pcre2_substring_copy_bynumber failed "
+                       "for arg %d for byte_extract with %d",
                     i, res);
             goto error;
         }
 
         if (strcmp("relative", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_RELATIVE) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "relative specified more "
+                SCLogError("relative specified more "
                            "than once for byte_extract");
                 goto error;
             }
             bed->flags |= DETECT_BYTE_EXTRACT_FLAG_RELATIVE;
         } else if (strcmp("multiplier", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_MULTIPLIER) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "multiplier specified more "
+                SCLogError("multiplier specified more "
                            "than once for byte_extract");
                 goto error;
             }
@@ -314,9 +314,8 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, i, (PCRE2_UCHAR8 *)multiplier_str, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING,
-                        "pcre2_substring_copy_bynumber failed "
-                        "for arg %d for byte_extract",
+                SCLogError("pcre2_substring_copy_bynumber failed "
+                           "for arg %d for byte_extract",
                         i);
                 goto error;
             }
@@ -324,14 +323,15 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             if (StringParseU16RangeCheck(&multiplier, 10, 0, (const char *)multiplier_str,
                         DETECT_BYTE_EXTRACT_MULTIPLIER_MIN_LIMIT,
                         DETECT_BYTE_EXTRACT_MULTIPLIER_MAX_LIMIT) < 0) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid value for"
-                        "multiplier: \"%s\".", multiplier_str);
+                SCLogError("Invalid value for"
+                           "multiplier: \"%s\".",
+                        multiplier_str);
                 goto error;
             }
             bed->multiplier_value = multiplier;
         } else if (strcmp("big", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_ENDIAN) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "endian option specified "
+                SCLogError("endian option specified "
                            "more than once for byte_extract");
                 goto error;
             }
@@ -339,7 +339,7 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             bed->endian = DETECT_BYTE_EXTRACT_ENDIAN_BIG;
         } else if (strcmp("little", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_ENDIAN) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "endian option specified "
+                SCLogError("endian option specified "
                            "more than once for byte_extract");
                 goto error;
             }
@@ -347,7 +347,7 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             bed->endian = DETECT_BYTE_EXTRACT_ENDIAN_LITTLE;
         } else if (strcmp("dce", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_ENDIAN) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "endian option specified "
+                SCLogError("endian option specified "
                            "more than once for byte_extract");
                 goto error;
             }
@@ -355,12 +355,12 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             bed->endian = DETECT_BYTE_EXTRACT_ENDIAN_DCE;
         } else if (strcmp("string", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_STRING) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "string specified more "
+                SCLogError("string specified more "
                            "than once for byte_extract");
                 goto error;
             }
             if (bed->base != DETECT_BYTE_EXTRACT_BASE_NONE) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "The right way to specify "
+                SCLogError("The right way to specify "
                            "base is (string, base) and not (base, string) "
                            "for byte_extract");
                 goto error;
@@ -368,46 +368,46 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             bed->flags |= DETECT_BYTE_EXTRACT_FLAG_STRING;
         } else if (strcmp("hex", opt_str) == 0) {
             if (!(bed->flags & DETECT_BYTE_EXTRACT_FLAG_STRING)) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Base(hex) specified "
+                SCLogError("Base(hex) specified "
                            "without specifying string.  The right way is "
                            "(string, base) and not (base, string)");
                 goto error;
             }
             if (bed->base != DETECT_BYTE_EXTRACT_BASE_NONE) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "More than one base "
+                SCLogError("More than one base "
                            "specified for byte_extract");
                 goto error;
             }
             bed->base = DETECT_BYTE_EXTRACT_BASE_HEX;
         } else if (strcmp("oct", opt_str) == 0) {
             if (!(bed->flags & DETECT_BYTE_EXTRACT_FLAG_STRING)) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Base(oct) specified "
+                SCLogError("Base(oct) specified "
                            "without specifying string.  The right way is "
                            "(string, base) and not (base, string)");
                 goto error;
             }
             if (bed->base != DETECT_BYTE_EXTRACT_BASE_NONE) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "More than one base "
+                SCLogError("More than one base "
                            "specified for byte_extract");
                 goto error;
             }
             bed->base = DETECT_BYTE_EXTRACT_BASE_OCT;
         } else if (strcmp("dec", opt_str) == 0) {
             if (!(bed->flags & DETECT_BYTE_EXTRACT_FLAG_STRING)) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Base(dec) specified "
+                SCLogError("Base(dec) specified "
                            "without specifying string.  The right way is "
                            "(string, base) and not (base, string)");
                 goto error;
             }
             if (bed->base != DETECT_BYTE_EXTRACT_BASE_NONE) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "More than one base "
+                SCLogError("More than one base "
                            "specified for byte_extract");
                 goto error;
             }
             bed->base = DETECT_BYTE_EXTRACT_BASE_DEC;
         } else if (strcmp("align", opt_str) == 0) {
             if (bed->flags & DETECT_BYTE_EXTRACT_FLAG_ALIGN) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Align specified more "
+                SCLogError("Align specified more "
                            "than once for byte_extract");
                 goto error;
             }
@@ -419,28 +419,30 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, i, (PCRE2_UCHAR8 *)align_str, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING,
-                        "pcre2_substring_copy_bynumber failed "
-                        "for arg %d in byte_extract",
+                SCLogError("pcre2_substring_copy_bynumber failed "
+                           "for arg %d in byte_extract",
                         i);
                 goto error;
             }
             if (StringParseUint8(&bed->align_value, 10, 0,
                                        (const char *)align_str) < 0) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid align_value: "
-                           "\"%s\".", align_str);
+                SCLogError("Invalid align_value: "
+                           "\"%s\".",
+                        align_str);
                 goto error;
             }
             if (!(bed->align_value == 2 || bed->align_value == 4)) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid align_value for "
-                           "byte_extract - \"%d\"", bed->align_value);
+                SCLogError("Invalid align_value for "
+                           "byte_extract - \"%d\"",
+                        bed->align_value);
                 goto error;
             }
         } else if (strcmp("", opt_str) == 0) {
             ;
         } else {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid option - \"%s\" "
-                       "specified in byte_extract", opt_str);
+            SCLogError("Invalid option - \"%s\" "
+                       "specified in byte_extract",
+                    opt_str);
             goto error;
         }
     } /* for (i = 4; i < ret; i++) */
@@ -457,7 +459,7 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             bed->base = DETECT_BYTE_EXTRACT_BASE_DEC;
         }
         if (bed->endian != DETECT_BYTE_EXTRACT_ENDIAN_NONE) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_extract can't have "
+            SCLogError("byte_extract can't have "
                        "endian \"big\" or \"little\" specified along with "
                        "\"string\"");
             goto error;
@@ -466,27 +468,27 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
             /* if are dealing with octal nos, the max no that can fit in a 8
              * byte value is 01777777777777777777777 */
             if (bed->nbytes > STRING_MAX_BYTES_TO_EXTRACT_FOR_OCT) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_extract can't process "
+                SCLogError("byte_extract can't process "
                            "more than %d bytes in \"string\" extraction",
-                           STRING_MAX_BYTES_TO_EXTRACT_FOR_OCT);
+                        STRING_MAX_BYTES_TO_EXTRACT_FOR_OCT);
                 goto error;
             }
         } else if (bed->base == DETECT_BYTE_EXTRACT_BASE_DEC) {
             /* if are dealing with decimal nos, the max no that can fit in a 8
              * byte value is 18446744073709551615 */
             if (bed->nbytes > STRING_MAX_BYTES_TO_EXTRACT_FOR_DEC) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_extract can't process "
+                SCLogError("byte_extract can't process "
                            "more than %d bytes in \"string\" extraction",
-                           STRING_MAX_BYTES_TO_EXTRACT_FOR_DEC);
+                        STRING_MAX_BYTES_TO_EXTRACT_FOR_DEC);
                 goto error;
             }
         } else if (bed->base == DETECT_BYTE_EXTRACT_BASE_HEX) {
             /* if are dealing with hex nos, the max no that can fit in a 8
              * byte value is 0xFFFFFFFFFFFFFFFF */
             if (bed->nbytes > STRING_MAX_BYTES_TO_EXTRACT_FOR_HEX) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_extract can't process "
+                SCLogError("byte_extract can't process "
                            "more than %d bytes in \"string\" extraction",
-                           STRING_MAX_BYTES_TO_EXTRACT_FOR_HEX);
+                        STRING_MAX_BYTES_TO_EXTRACT_FOR_HEX);
                 goto error;
             }
         } else {
@@ -494,9 +496,9 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
         }
     } else {
         if (bed->nbytes > NO_STRING_MAX_BYTES_TO_EXTRACT) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_extract can't process "
+            SCLogError("byte_extract can't process "
                        "more than %d bytes in \"non-string\" extraction",
-                       NO_STRING_MAX_BYTES_TO_EXTRACT);
+                    NO_STRING_MAX_BYTES_TO_EXTRACT);
             goto error;
         }
         /* if string has not been specified and no endian option has been
@@ -590,7 +592,7 @@ static int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, const c
             (data->base == DETECT_BYTE_EXTRACT_BASE_DEC) ||
             (data->base == DETECT_BYTE_EXTRACT_BASE_HEX) ||
             (data->base == DETECT_BYTE_EXTRACT_BASE_OCT) ) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "Invalid option. "
+            SCLogError("Invalid option. "
                        "A byte_jump keyword with dce holds other invalid modifiers.");
             goto error;
         }
index e78fa674ad84f1603545e76f5bff2eec46007248..2518cf94cc2f58a5ddadd92fc8c83b622cfb0f3e 100644 (file)
@@ -332,8 +332,7 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
     /* Execute the regex and populate args with captures. */
     ret = DetectParsePcreExec(&parse_regex, optstr, 0, 0);
     if (ret < 2 || ret > 10) {
-        SCLogError(SC_ERR_PCRE_PARSE,"parse error, ret %" PRId32
-               ", string \"%s\"", ret, optstr);
+        SCLogError("parse error, ret %" PRId32 ", string \"%s\"", ret, optstr);
         goto error;
     }
 
@@ -345,8 +344,8 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
     pcre2len = sizeof(str);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                              "for arg 1");
+        SCLogError("pcre2_substring_copy_bynumber failed "
+                   "for arg 1");
         goto error;
     }
 
@@ -376,8 +375,7 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
         res = pcre2_substring_copy_bynumber(
                 parse_regex.match, i + 1, (PCRE2_UCHAR8 *)args[i + 1], &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed for arg %d",
-                    i + 1);
+            SCLogError("pcre2_substring_copy_bynumber failed for arg %d", i + 1);
             goto error;
         }
         numargs++;
@@ -399,14 +397,14 @@ 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_EINVAL, "Malformed number of bytes: %s", optstr);
+        SCLogError("Malformed number of bytes: %s", optstr);
         goto error;
     }
 
     /* Offset */
     if (args[1][0] != '-' && isalpha((unsigned char)args[1][0])) {
         if (offset == NULL) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_jump supplied with "
+            SCLogError("byte_jump supplied with "
                        "var name for offset.  \"value\" argument supplied to "
                        "this function has to be non-NULL");
             goto error;
@@ -416,7 +414,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_EINVAL, "Malformed offset: %s", optstr);
+            SCLogError("Malformed offset: %s", optstr);
             goto error;
         }
     }
@@ -450,26 +448,26 @@ 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_EINVAL, "Malformed multiplier: %s", optstr);
+                SCLogError("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_EINVAL, "Malformed post_offset: %s", optstr);
+                SCLogError("Malformed post_offset: %s", optstr);
                 goto error;
             }
         } else if (strcasecmp("dce", args[i]) == 0) {
             data->flags |= DETECT_BYTEJUMP_DCE;
         } else {
-            SCLogError(SC_EINVAL, "Unknown option: \"%s\"", args[i]);
+            SCLogError("Unknown option: \"%s\"", args[i]);
             goto error;
         }
     }
 
     if ((data->flags & DETECT_BYTEJUMP_END) && (data->flags & DETECT_BYTEJUMP_BEGIN)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "'from_end' and 'from_beginning' "
-                "cannot be used in the same byte_jump statement");
+        SCLogError("'from_end' and 'from_beginning' "
+                   "cannot be used in the same byte_jump statement");
         goto error;
     }
 
@@ -482,24 +480,21 @@ static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const ch
          * "01777777777777777777777" = 0xffffffffffffffff
          */
         if (nbytes > 23) {
-            SCLogError(SC_EINVAL,
-                    "Cannot test more than 23 bytes "
-                    "with \"string\": %s",
+            SCLogError("Cannot test more than 23 bytes "
+                       "with \"string\": %s",
                     optstr);
             goto error;
         }
     } else {
         if (nbytes > 8) {
-            SCLogError(SC_EINVAL,
-                    "Cannot test more than 8 bytes "
-                    "without \"string\": %s\n",
+            SCLogError("Cannot test more than 8 bytes "
+                       "without \"string\": %s\n",
                     optstr);
             goto error;
         }
         if (data->base != DETECT_BYTEJUMP_BASE_UNSET) {
-            SCLogError(SC_EINVAL,
-                    "Cannot use a base "
-                    "without \"string\": %s",
+            SCLogError("Cannot use a base "
+                       "without \"string\": %s",
                     optstr);
             goto error;
         }
@@ -588,7 +583,7 @@ static int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, const char
             (data->base == DETECT_BYTEJUMP_BASE_DEC) ||
             (data->base == DETECT_BYTEJUMP_BASE_HEX) ||
             (data->base == DETECT_BYTEJUMP_BASE_OCT) ) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "Invalid option. "
+            SCLogError("Invalid option. "
                        "A byte_jump keyword with dce holds other invalid modifiers.");
             goto error;
         }
@@ -597,8 +592,9 @@ static int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     if (offset != NULL) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(offset, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Unknown byte_extract var "
-                       "seen in byte_jump - %s", offset);
+            SCLogError("Unknown byte_extract var "
+                       "seen in byte_jump - %s",
+                    offset);
             goto error;
         }
         data->offset = index;
index b7740575b09ae2e17d47573de4b64eaadf29dfc8..1aa55b5e630e16f66d66c894e5e878444fe52001 100644 (file)
@@ -201,13 +201,13 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
 {
     DetectByteMathData *bmd;
     if ((bmd = ScByteMathParse(arg)) == NULL) {
-        SCLogError(SC_ERR_PCRE_PARSE, "invalid bytemath values");
+        SCLogError("invalid bytemath values");
         return NULL;
     }
 
     if (bmd->rvalue_str) {
         if (rvalue == NULL) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "byte_math supplied with "
+            SCLogError("byte_math supplied with "
                        "var name for rvalue. \"rvalue\" argument supplied to "
                        "this function must be non-NULL");
             goto error;
@@ -269,7 +269,7 @@ static int DetectByteMathSetup(DetectEngineCtx *de_ctx, Signature *s, const char
         if (data->flags & DETECT_BYTEMATH_FLAG_RELATIVE) {
             prev_pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, DETECT_PCRE, -1);
             if (!prev_pm) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "relative specified without "
+                SCLogError("relative specified without "
                            "previous pattern match");
                 goto error;
             }
@@ -321,7 +321,7 @@ static int DetectByteMathSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
         if ((data->flags & DETECT_BYTEMATH_FLAG_STRING) || (data->base == BaseDec) ||
                 (data->base == BaseHex) || (data->base == BaseOct)) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "Invalid option. "
+            SCLogError("Invalid option. "
                        "A bytemath keyword with dce holds other invalid modifiers.");
             goto error;
         }
@@ -330,8 +330,9 @@ static int DetectByteMathSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     if (rvalue != NULL) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(rvalue, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unknown byte_ keyword var "
-                       "seen in byte_math - %s\n", rvalue);
+            SCLogError("unknown byte_ keyword var "
+                       "seen in byte_math - %s\n",
+                    rvalue);
             goto error;
         }
         data->rvalue = index;
index dcdf2734a5c4bb5614d621a2cbf73bfe33dbdf90..fb45105ae9bd85071fd07dfde9dbce5225b3f649 100644 (file)
@@ -279,8 +279,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
     /* Execute the regex and populate args with captures. */
     ret = DetectParsePcreExec(&parse_regex, optstr, 0, 0);
     if (ret < 4 || ret > 9) {
-        SCLogError(SC_ERR_PCRE_PARSE, "parse error, ret %" PRId32
-               ", string %s", ret, optstr);
+        SCLogError("parse error, ret %" PRId32 ", string %s", ret, optstr);
         goto error;
     }
 
@@ -289,9 +288,8 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING,
-                    "pcre2_substring_get_bynumber failed "
-                    "for arg %d",
+            SCLogError("pcre2_substring_get_bynumber failed "
+                       "for arg %d",
                     i + 1);
             goto error;
         }
@@ -327,7 +325,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
 
     /* Number of bytes */
     if (StringParseUint32(&nbytes, 10, 0, args[0]) <= 0) {
-        SCLogError(SC_EINVAL, "Malformed number of bytes: %s", str_ptr);
+        SCLogError("Malformed number of bytes: %s", str_ptr);
         goto error;
     }
 
@@ -361,7 +359,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
         } else if (strcmp("<=", op_ptr) == 0) {
             data->op |= DETECT_BYTETEST_OP_LE;
         } else {
-            SCLogError(SC_ERR_INVALID_OPERATOR, "Invalid operator");
+            SCLogError("Invalid operator");
             goto error;
         }
     }
@@ -378,7 +376,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
 
         if (test_value[0] != '-' && isalpha((unsigned char)test_value[0])) {
             if (value == NULL) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
+                SCLogError("byte_test supplied with "
                            "var name for value.  \"value\" argument supplied to "
                            "this function has to be non-NULL");
                 goto error;
@@ -388,7 +386,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
                 goto error;
         } else {
             if (ByteExtractStringUint64(&data->value, 0, 0, test_value) <= 0) {
-                SCLogError(SC_EINVAL, "Malformed value: %s", test_value);
+                SCLogError("Malformed value: %s", test_value);
                 goto error;
             }
         }
@@ -407,7 +405,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
         data_offset[end_ptr-str_ptr] = '\0';
         if (data_offset[0] != '-' && isalpha((unsigned char)data_offset[0])) {
             if (data_offset == NULL) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
+                SCLogError("byte_test supplied with "
                            "var name for offset.  \"offset\" argument supplied to "
                            "this function has to be non-NULL");
                 goto error;
@@ -417,7 +415,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
                 goto error;
         } else {
             if (StringParseInt32(&data->offset, 0, 0, data_offset) <= 0) {
-                SCLogError(SC_EINVAL, "Malformed offset: %s", data_offset);
+                SCLogError("Malformed offset: %s", data_offset);
                 goto error;
             }
         }
@@ -451,8 +449,7 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
                 data->flags |= DETECT_BYTETEST_BITMASK;
                 bitmask_index = i;
             } else {
-                SCLogError(SC_ERR_UNKNOWN_VALUE, "Unknown value: \"%s\"",
-                        args[i]);
+                SCLogError("Unknown value: \"%s\"", args[i]);
                 goto error;
             }
         }
@@ -467,16 +464,16 @@ static DetectBytetestData *DetectBytetestParse(const char *optstr, char **value,
          * "01777777777777777777777" = 0xffffffffffffffff
          */
         if (nbytes > 23) {
-            SCLogError(SC_EINVAL, "Cannot test more than 23 bytes with \"string\": %s", optstr);
+            SCLogError("Cannot test more than 23 bytes with \"string\": %s", optstr);
             goto error;
         }
     } else {
         if (nbytes > 8) {
-            SCLogError(SC_EINVAL, "Cannot test more than 8 bytes without \"string\": %s", optstr);
+            SCLogError("Cannot test more than 8 bytes without \"string\": %s", optstr);
             goto error;
         }
         if (data->base != DETECT_BYTETEST_BASE_UNSET) {
-            SCLogError(SC_EINVAL, "Cannot use a base without \"string\": %s", optstr);
+            SCLogError("Cannot use a base without \"string\": %s", optstr);
             goto error;
         }
     }
@@ -486,8 +483,7 @@ 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_EINVAL, "Malformed bitmask value: %s",
-                    args[bitmask_index] + strlen("bitmask"));
+            SCLogError("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
@@ -591,7 +587,7 @@ static int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, const char
             (data->base == DETECT_BYTETEST_BASE_DEC) ||
             (data->base == DETECT_BYTETEST_BASE_HEX) ||
             (data->base == DETECT_BYTETEST_BASE_OCT) ) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "Invalid option. "
+            SCLogError("Invalid option. "
                        "A byte_test keyword with dce holds other invalid modifiers.");
             goto error;
         }
@@ -600,8 +596,9 @@ static int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     if (value != NULL) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(value, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Unknown byte_extract var "
-                       "seen in byte_test - %s\n", value);
+            SCLogError("Unknown byte_extract var "
+                       "seen in byte_test - %s\n",
+                    value);
             goto error;
         }
         data->value = index;
@@ -613,8 +610,9 @@ static int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     if (offset != NULL) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(offset, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Unknown byte_extract var "
-                       "seen in byte_test - %s\n", offset);
+            SCLogError("Unknown byte_extract var "
+                       "seen in byte_test - %s\n",
+                    offset);
             goto error;
         }
         data->offset = index;
index 13fe4608068cf277e2323de46201468b78d66128..184dec4b69d48faf7d83d077aec48659489a1535 100644 (file)
@@ -114,7 +114,7 @@ static DetectCipServiceData *DetectCipServiceParse(const char *rulestrc)
     {
         if (i > 2) //for now only need 3 parameters
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "too many parameters");
+            SCLogError("too many parameters");
             goto error;
         }
 
@@ -122,7 +122,7 @@ static DetectCipServiceData *DetectCipServiceParse(const char *rulestrc)
         {
             if (!isdigit((int) *token))
             {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "parameter error %s", token);
+                SCLogError("parameter error %s", token);
                 goto error;
             }
         } else //if on attribute
@@ -136,7 +136,7 @@ static DetectCipServiceData *DetectCipServiceParse(const char *rulestrc)
 
             if (!isdigit((int) *token))
             {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "attribute error  %s", token);
+                SCLogError("attribute error  %s", token);
                 goto error;
             }
 
@@ -145,15 +145,15 @@ static DetectCipServiceData *DetectCipServiceParse(const char *rulestrc)
         unsigned long num = atol(token);
         if ((num > MAX_CIP_SERVICE) && (i == 0))//if service greater than 7 bit
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid CIP service %lu", num);
+            SCLogError("invalid CIP service %lu", num);
             goto error;
         } else if ((num > MAX_CIP_CLASS) && (i == 1))//if service greater than 16 bit
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid CIP class %lu", num);
+            SCLogError("invalid CIP class %lu", num);
             goto error;
         } else if ((num > MAX_CIP_ATTRIBUTE) && (i == 2))//if service greater than 16 bit
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid CIP attribute %lu", num);
+            SCLogError("invalid CIP attribute %lu", num);
             goto error;
         }
 
@@ -164,7 +164,7 @@ static DetectCipServiceData *DetectCipServiceParse(const char *rulestrc)
     }
 
     if (i == 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "no tokens found");
+        SCLogError("no tokens found");
         goto error;
     }
 
@@ -342,14 +342,15 @@ static DetectEnipCommandData *DetectEnipCommandParse(const char *rulestr)
         goto error;
 
     if (!(isdigit((int) *rulestr))) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid ENIP command %s", rulestr);
+        SCLogError("invalid ENIP command %s", rulestr);
         goto error;
     }
 
     uint16_t cmd;
     if (StringParseUint16(&cmd, 10, 0, rulestr) < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid ENIP command"
-                   ": \"%s\"", rulestr);
+        SCLogError("invalid ENIP command"
+                   ": \"%s\"",
+                rulestr);
         goto error;
     }
 
index 002ebc6f51c792053ec41afd34706bb22a6815a6..ea4c921391e442afeca589fc9a49e3785c014812 100644 (file)
@@ -76,20 +76,19 @@ static int DetectClasstypeParseRawString(const char *rawstr, char *out, size_t o
 
     int ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Invalid Classtype in Signature");
+        SCLogError("Invalid Classtype in Signature");
         return -1;
     }
 
     pcre2len = esize;
     ret = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)e, &pcre2len);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
     if (strlen(e) >= CLASSTYPE_NAME_MAX_LEN) {
-        SCLogError(
-                SC_EINVAL, "classtype '%s' is too big: max %d", rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
+        SCLogError("classtype '%s' is too big: max %d", rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
         return -1;
     }
     (void)strlcpy(out, e, outsize);
@@ -114,18 +113,19 @@ static int DetectClasstypeSetup(DetectEngineCtx *de_ctx, Signature *s, const cha
 
     if ((s->class_id > 0) || (s->class_msg != NULL)) {
         if (SigMatchStrictEnabled(DETECT_CLASSTYPE)) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "duplicated 'classtype' "
-                    "keyword detected.");
+            SCLogError("duplicated 'classtype' "
+                       "keyword detected.");
             return -1;
         } else {
-            SCLogWarning(SC_ERR_CONFLICTING_RULE_KEYWORDS, "duplicated 'classtype' "
-                    "keyword detected. Using instance with highest priority");
+            SCLogWarning("duplicated 'classtype' "
+                         "keyword detected. Using instance with highest priority");
         }
     }
 
     if (DetectClasstypeParseRawString(rawstr, parsed_ct_name, sizeof(parsed_ct_name)) < 0) {
-        SCLogError(SC_ERR_PCRE_PARSE, "invalid value for classtype keyword: "
-                "\"%s\"", rawstr);
+        SCLogError("invalid value for classtype keyword: "
+                   "\"%s\"",
+                rawstr);
         return -1;
     }
 
@@ -133,26 +133,24 @@ static int DetectClasstypeSetup(DetectEngineCtx *de_ctx, Signature *s, const cha
     SCClassConfClasstype *ct = SCClassConfGetClasstype(parsed_ct_name, de_ctx);
     if (ct == NULL) {
         if (SigMatchStrictEnabled(DETECT_CLASSTYPE)) {
-            SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown classtype '%s'",
-                    parsed_ct_name);
+            SCLogError("unknown classtype '%s'", parsed_ct_name);
             return -1;
         }
 
         if (s->id > 0) {
-            SCLogWarning(SC_ERR_UNKNOWN_VALUE, "signature sid:%u uses "
-                    "unknown classtype: \"%s\", using default priority %d. "
-                    "This message won't be shown again for this classtype",
+            SCLogWarning("signature sid:%u uses "
+                         "unknown classtype: \"%s\", using default priority %d. "
+                         "This message won't be shown again for this classtype",
                     s->id, parsed_ct_name, DETECT_DEFAULT_PRIO);
         } else if (de_ctx->rule_file != NULL) {
-            SCLogWarning(SC_ERR_UNKNOWN_VALUE, "signature at %s:%u uses "
-                    "unknown classtype: \"%s\", using default priority %d. "
-                    "This message won't be shown again for this classtype",
-                    de_ctx->rule_file, de_ctx->rule_line,
-                    parsed_ct_name, DETECT_DEFAULT_PRIO);
+            SCLogWarning("signature at %s:%u uses "
+                         "unknown classtype: \"%s\", using default priority %d. "
+                         "This message won't be shown again for this classtype",
+                    de_ctx->rule_file, de_ctx->rule_line, parsed_ct_name, DETECT_DEFAULT_PRIO);
         } else {
-            SCLogWarning(SC_ERR_UNKNOWN_VALUE, "unknown classtype: \"%s\", "
-                    "using default priority %d. "
-                    "This message won't be shown again for this classtype",
+            SCLogWarning("unknown classtype: \"%s\", "
+                         "using default priority %d. "
+                         "This message won't be shown again for this classtype",
                     parsed_ct_name, DETECT_DEFAULT_PRIO);
         }
 
index d96ee3e68a7e130d94826207b48b770685ab8440..3cdecd84b54f102316a5b24f9748d98757bda398 100644 (file)
@@ -174,7 +174,7 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
 #if 0
     /* filestore and bypass keywords can't work together */
     if (s->flags & SIG_FLAG_BYPASS) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
+        SCLogError(
                    "filestore can't work with bypass keyword");
         return -1;
     }
@@ -185,7 +185,7 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     sm->type = DETECT_CONFIG;
 
     if (str == NULL || strlen(str) == 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "config keywords need arguments");
+        SCLogError("config keywords need arguments");
         goto error;
     }
     char subsys[32];
@@ -198,18 +198,18 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
 
     ret = DetectParsePcreExec(&parse_regex, str, 0, 0);
     if (ret != 7) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "config is rather picky at this time");
+        SCLogError("config is rather picky at this time");
         goto error;
     }
     pcre2len = sizeof(subsys);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)subsys, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (strcmp(subsys, "logging") != 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'logging' supported at this time");
+        SCLogError("only 'logging' supported at this time");
         goto error;
     }
     SCLogDebug("subsys %s", subsys);
@@ -217,12 +217,12 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     pcre2len = sizeof(state);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)state, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (strcmp(state, "disable") != 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'disable' supported at this time");
+        SCLogError("only 'disable' supported at this time");
         goto error;
     }
     SCLogDebug("state %s", state);
@@ -230,12 +230,12 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     pcre2len = sizeof(type);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 3, (PCRE2_UCHAR8 *)type, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (strcmp(type, "type") != 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'type' supported at this time");
+        SCLogError("only 'type' supported at this time");
         goto error;
     }
     SCLogDebug("type %s", type);
@@ -243,12 +243,12 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     pcre2len = sizeof(typeval);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 4, (PCRE2_UCHAR8 *)typeval, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (!(strcmp(typeval, "tx") == 0 ||strcmp(typeval, "flow") == 0)) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'tx' and 'flow' supported at this time");
+        SCLogError("only 'tx' and 'flow' supported at this time");
         goto error;
     }
     SCLogDebug("typeval %s", typeval);
@@ -256,12 +256,12 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     pcre2len = sizeof(scope);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 5, (PCRE2_UCHAR8 *)scope, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (strcmp(scope, "scope") != 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'scope' supported at this time");
+        SCLogError("only 'scope' supported at this time");
         goto error;
     }
     SCLogDebug("scope %s", scope);
@@ -269,12 +269,12 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     pcre2len = sizeof(scopeval);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 6, (PCRE2_UCHAR8 *)scopeval, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     if (!(strcmp(scopeval, "tx") == 0 ||strcmp(scopeval, "flow") == 0)) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "only 'tx' and 'flow' supported at this time");
+        SCLogError("only 'tx' and 'flow' supported at this time");
         goto error;
     }
     SCLogDebug("scopeval %s", scopeval);
index 4ac802ec783feb4295a2365cd41763a3cfb50436..c4f0a17a3fd25aacec9d427b11123693157cbeb3 100644 (file)
@@ -113,8 +113,7 @@ int DetectContentDataParse(const char *keyword, const char *contentstr,
                 bin_count++;
                 if (bin) {
                     if (binpos > 0) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                                "Incomplete hex code in content - %s. Invalidating signature.",
+                        SCLogError("Incomplete hex code in content - %s. Invalidating signature.",
                                 contentstr);
                         goto error;
                     }
@@ -150,8 +149,9 @@ int DetectContentDataParse(const char *keyword, const char *contentstr,
                         // SCLogDebug("space as part of binary string");
                     }
                     else if (str[i] != ',') {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid hex code in "
-                                    "content - %s, hex %c. Invalidating signature.", str, str[i]);
+                        SCLogError("Invalid hex code in "
+                                   "content - %s, hex %c. Invalidating signature.",
+                                str, str[i]);
                         goto error;
                     }
                 } else if (escape) {
@@ -163,13 +163,13 @@ int DetectContentDataParse(const char *keyword, const char *contentstr,
                         str[x] = str[i];
                         x++;
                     } else {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "'%c' has to be escaped", str[i-1]);
+                        SCLogError("'%c' has to be escaped", str[i - 1]);
                         goto error;
                     }
                     escape = 0;
                     converted = 1;
                 } else if (str[i] == '"') {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid unescaped double quote within content section.");
+                    SCLogError("Invalid unescaped double quote within content section.");
                     goto error;
                 } else {
                     str[x] = str[i];
@@ -179,8 +179,9 @@ int DetectContentDataParse(const char *keyword, const char *contentstr,
         }
 
         if (bin_count % 2 != 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid hex code assembly in "
-                       "%s - %s.  Invalidating signature.", keyword, contentstr);
+            SCLogError("Invalid hex code assembly in "
+                       "%s - %s.  Invalidating signature.",
+                    keyword, contentstr);
             goto error;
         }
 
@@ -350,9 +351,7 @@ int DetectContentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *conten
         const char *tstr;
         if (!DetectEngineBufferTypeValidateTransform(
                     de_ctx, sm_list, cd->content, cd->content_len, &tstr)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "content string \"%s\" incompatible with %s transform",
-                    contentstr, tstr);
+            SCLogError("content string \"%s\" incompatible with %s transform", contentstr, tstr);
             goto error;
         }
     }
@@ -480,8 +479,7 @@ bool DetectContentPMATCHValidateCallback(const Signature *s)
     if (min_dsize_required >= 0) {
         SCLogDebug("min_dsize %d; max_right_edge %d", min_dsize_required, max_right_edge);
         if ((uint32_t)min_dsize_required > max_right_edge) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "signature can't match as required content length %d exceeds dsize value %d",
+            SCLogError("signature can't match as required content length %d exceeds dsize value %d",
                     min_dsize_required, max_right_edge);
             return false;
         }
index cfc3ba35052e508c15493107bcaa0440a5417ff9..c9cc1795938a1420ac2c09afc38c84e8c61655f8 100644 (file)
@@ -176,18 +176,16 @@ 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_EINVAL,
-                            "invalid value for memcap: %s,"
-                            " resetting to default",
+                    SCLogWarning("invalid value for memcap: %s,"
+                                 " resetting to default",
                             val);
                     *memcap = 0;
                 }
             }
             if (strcmp(key, "hashsize") == 0) {
                 if (ParseSizeStringU32(val, hashsize) < 0) {
-                    SCLogWarning(SC_EINVAL,
-                            "invalid value for hashsize: %s,"
-                            " resetting to default",
+                    SCLogWarning("invalid value for hashsize: %s,"
+                                 " resetting to default",
                             val);
                     *hashsize = 0;
                 }
@@ -201,14 +199,12 @@ static int DetectDatarepParse(const char *str, char *cmd, int cmd_len, char *nam
     }
 
     if (strlen(load) > 0 && *type == DATASET_TYPE_NOTSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "if load is used type must be set as well");
+        SCLogError("if load is used type must be set as well");
         return 0;
     }
 
     if (!name_set || !cmd_set || !value_set) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "missing values");
+        SCLogError("missing values");
         return 0;
     }
 
@@ -220,8 +216,7 @@ static int DetectDatarepParse(const char *str, char *cmd, int cmd_len, char *nam
     /* Validate name, spaces are not allowed. */
     for (size_t i = 0; i < strlen(name); i++) {
         if (isblank(name[i])) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "spaces not allowed in dataset names");
+            SCLogError("spaces not allowed in dataset names");
             return 0;
         }
     }
@@ -306,15 +301,13 @@ static int DetectDatarepSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     uint32_t hashsize = 0;
 
     if (DetectBufferGetActiveList(de_ctx, s) == -1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "datarep is only supported for sticky buffers");
+        SCLogError("datarep is only supported for sticky buffers");
         SCReturnInt(-1);
     }
 
     int list = s->init_data->list;
     if (list == DETECT_SM_LIST_NOTSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "datarep is only supported for sticky buffers");
+        SCLogError("datarep is only supported for sticky buffers");
         SCReturnInt(-1);
     }
 
@@ -336,15 +329,13 @@ static int DetectDatarepSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     } else if (strcmp(cmd_str,"==") == 0) {
         op = DATAREP_OP_EQ;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE,
-                "datarep operation \"%s\" is not supported.", cmd_str);
+        SCLogError("datarep operation \"%s\" is not supported.", cmd_str);
         return -1;
     }
 
     Dataset *set = DatasetGet(name, type, /* no save */ NULL, load, memcap, hashsize);
     if (set == NULL) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE,
-                "failed to set up datarep set '%s'.", name);
+        SCLogError("failed to set up datarep set '%s'.", name);
         return -1;
     }
 
index 2384a0758536e1d6122f4d03398e4886996baabe..27792c083b91df6dfba6aaabcbda0a390a54b4b4 100644 (file)
@@ -163,14 +163,13 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
                 } else if (strcmp(val, "ip") == 0) {
                     *type = DATASET_TYPE_IPV6;
                 } else {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "bad type %s", val);
+                    SCLogError("bad type %s", val);
                     return -1;
                 }
 
             } else if (strcmp(key, "save") == 0) {
                 if (save_set) {
-                    SCLogWarning(SC_ERR_INVALID_SIGNATURE,
-                        "'save' can only appear once");
+                    SCLogWarning("'save' can only appear once");
                     return -1;
                 }
                 SCLogDebug("save %s", val);
@@ -178,8 +177,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
                 save_set = true;
             } else if (strcmp(key, "load") == 0) {
                 if (load_set) {
-                    SCLogWarning(SC_ERR_INVALID_SIGNATURE,
-                        "'load' can only appear once");
+                    SCLogWarning("'load' can only appear once");
                     return -1;
                 }
                 SCLogDebug("load %s", val);
@@ -187,8 +185,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
                 load_set = true;
             } else if (strcmp(key, "state") == 0) {
                 if (state_set) {
-                    SCLogWarning(SC_ERR_INVALID_SIGNATURE,
-                        "'state' can only appear once");
+                    SCLogWarning("'state' can only appear once");
                     return -1;
                 }
                 SCLogDebug("state %s", val);
@@ -198,18 +195,16 @@ 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_EINVAL,
-                            "invalid value for memcap: %s,"
-                            " resetting to default",
+                    SCLogWarning("invalid value for memcap: %s,"
+                                 " resetting to default",
                             val);
                     *memcap = 0;
                 }
             }
             if (strcmp(key, "hashsize") == 0) {
                 if (ParseSizeStringU32(val, hashsize) < 0) {
-                    SCLogWarning(SC_EINVAL,
-                            "invalid value for hashsize: %s,"
-                            " resetting to default",
+                    SCLogWarning("invalid value for hashsize: %s,"
+                                 " resetting to default",
                             val);
                     *hashsize = 0;
                 }
@@ -223,8 +218,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
     }
 
     if ((load_set || save_set) && state_set) {
-        SCLogWarning(SC_ERR_INVALID_SIGNATURE,
-                "'state' can not be mixed with 'load' and 'save'");
+        SCLogWarning("'state' can not be mixed with 'load' and 'save'");
         return -1;
     }
 
@@ -236,8 +230,7 @@ static int DetectDatasetParse(const char *str, char *cmd, int cmd_len, char *nam
     /* Validate name, spaces are not allowed. */
     for (size_t i = 0; i < strlen(name); i++) {
         if (isblank(name[i])) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "spaces not allowed in dataset names");
+            SCLogError("spaces not allowed in dataset names");
             return 0;
         }
     }
@@ -341,15 +334,13 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
     char save[PATH_MAX] = "";
 
     if (DetectBufferGetActiveList(de_ctx, s) == -1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "datasets are only supported for sticky buffers");
+        SCLogError("datasets are only supported for sticky buffers");
         SCReturnInt(-1);
     }
 
     int list = s->init_data->list;
     if (list == DETECT_SM_LIST_NOTSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "datasets are only supported for sticky buffers");
+        SCLogError("datasets are only supported for sticky buffers");
         SCReturnInt(-1);
     }
 
@@ -367,8 +358,7 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
     } else if (strcmp(cmd_str,"unset") == 0) {
         cmd = DETECT_DATASET_CMD_UNSET;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE,
-                "dataset action \"%s\" is not supported.", cmd_str);
+        SCLogError("dataset action \"%s\" is not supported.", cmd_str);
         return -1;
     }
 
@@ -394,12 +384,11 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
     SCLogDebug("name '%s' load '%s' save '%s'", name, load, save);
     Dataset *set = DatasetGet(name, type, save, load, memcap, hashsize);
     if (set == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "failed to set up dataset '%s'.", name);
+        SCLogError("failed to set up dataset '%s'.", name);
         return -1;
     }
     if (set->hash && SC_ATOMIC_GET(set->hash->memcap_reached)) {
-        SCLogError(SC_ERR_THASH_INIT, "dataset too large for set memcap");
+        SCLogError("dataset too large for set memcap");
         return -1;
     }
 
index 066f3806e64aa74019b1bd55a835dfb49ee9dbe9..844e7bc1499a756cb1ed5a85a905fcbfb9941aa2 100644 (file)
@@ -149,7 +149,7 @@ static int DetectDceIfaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
     void *did = rs_dcerpc_iface_parse(arg);
     if (did == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Error parsing dce_iface option in "
+        SCLogError("Error parsing dce_iface option in "
                    "signature");
         return -1;
     }
index 6b91cefa85b49880bbaefda5287ebb0a003faa76..d10b175490e31374ffda1ae9341f84eae1e5c666 100644 (file)
@@ -127,7 +127,7 @@ static int DetectDceOpnumMatchRust(DetectEngineThreadCtx *det_ctx,
 static int DetectDceOpnumSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg)
 {
     if (arg == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Error parsing dce_opnum option in "
+        SCLogError("Error parsing dce_opnum option in "
                    "signature, option needs a value");
         return -1;
     }
@@ -137,7 +137,7 @@ static int DetectDceOpnumSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
     void *dod = rs_dcerpc_opnum_parse(arg);
     if (dod == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Error parsing dce_opnum option in "
+        SCLogError("Error parsing dce_opnum option in "
                    "signature");
         return -1;
     }
index 1e82aa1c824566033a8e794aa1b6f8768a2bd327..2783bac72f06be45c33597862f5978102615f190 100644 (file)
@@ -70,7 +70,7 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
     /* retrive the sm to apply the depth against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_DEPTH_MISSING_CONTENT, "depth needs "
+        SCLogError("depth needs "
                    "preceding content, uricontent option, http_client_body, "
                    "http_server_body, http_header option, http_raw_header option, "
                    "http_method option, http_cookie, http_raw_uri, "
@@ -84,31 +84,32 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
     DetectContentData *cd = (DetectContentData *)pm->ctx;
 
     if (cd->flags & DETECT_CONTENT_DEPTH) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple depths for the same content.");
+        SCLogError("can't use multiple depths for the same content.");
         goto end;
     }
     if ((cd->flags & DETECT_CONTENT_WITHIN) || (cd->flags & DETECT_CONTENT_DISTANCE)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a relative "
+        SCLogError("can't use a relative "
                    "keyword like within/distance with a absolute "
                    "relative keyword like depth/offset for the same "
-                   "content." );
+                   "content.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_NEGATED && cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "negated keyword set along with 'fast_pattern'.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "keyword set along with 'fast_pattern:only;'.");
         goto end;
     }
     if (str[0] != '-' && isalpha((unsigned char)str[0])) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(str, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unknown byte_ keyword var "
-                       "seen in depth - %s.", str);
+            SCLogError("unknown byte_ keyword var "
+                       "seen in depth - %s.",
+                    str);
             goto end;
         }
         cd->depth = index;
@@ -116,14 +117,14 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
     } else {
         if (StringParseUint16(&cd->depth, 0, 0, str) < 0)
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                      "invalid value for depth: %s.", str);
+            SCLogError("invalid value for depth: %s.", str);
             goto end;
         }
 
         if (cd->depth < cd->content_len) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "depth:%u smaller than "
-                   "content of len %u.", cd->depth, cd->content_len);
+            SCLogError("depth:%u smaller than "
+                       "content of len %u.",
+                    cd->depth, cd->content_len);
             return -1;
         }
         /* Now update the real limit, as depth is relative to the offset */
@@ -144,7 +145,7 @@ static int DetectStartsWithSetup (DetectEngineCtx *de_ctx, Signature *s, const c
     /* retrieve the sm to apply the depth against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_DEPTH_MISSING_CONTENT, "startswith needs a "
+        SCLogError("startswith needs a "
                    "preceding content option.");
         goto end;
     }
@@ -153,29 +154,29 @@ static int DetectStartsWithSetup (DetectEngineCtx *de_ctx, Signature *s, const c
     DetectContentData *cd = (DetectContentData *)pm->ctx;
 
     if (cd->flags & DETECT_CONTENT_DEPTH) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple "
-                "depth/startswith settings for the same content.");
+        SCLogError("can't use multiple "
+                   "depth/startswith settings for the same content.");
         goto end;
     }
     if ((cd->flags & DETECT_CONTENT_WITHIN) || (cd->flags & DETECT_CONTENT_DISTANCE)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a relative "
+        SCLogError("can't use a relative "
                    "keyword like within/distance with a absolute "
                    "relative keyword like depth/offset for the same "
                    "content.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_NEGATED && cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "negated keyword set along with a 'fast_pattern'.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "keyword set along with 'fast_pattern:only;'.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_OFFSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't mix offset "
+        SCLogError("can't mix offset "
                    "with startswith.");
         goto end;
     }
index b7b15b53e5f7540d6cda70c4510f429eb4a757f1..9ca899e7b467ad966a701f6e2a1c3e82186c727c 100644 (file)
@@ -134,8 +134,7 @@ static DetectThresholdData *DetectDetectionFilterParse(const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 5) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret,
-                rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
@@ -151,7 +150,7 @@ static DetectThresholdData *DetectDetectionFilterParse(const char *rawstr)
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
@@ -180,7 +179,7 @@ static DetectThresholdData *DetectDetectionFilterParse(const char *rawstr)
     }
 
     if (df->count == 0 || df->seconds == 0) {
-        SCLogError(SC_EINVAL, "found an invalid value");
+        SCLogError("found an invalid value");
         goto error;
     }
 
@@ -222,15 +221,13 @@ static int DetectDetectionFilterSetup(DetectEngineCtx *de_ctx, Signature *s, con
     /* checks if there's a previous instance of threshold */
     tmpm = DetectGetLastSMFromLists(s, DETECT_THRESHOLD, -1);
     if (tmpm != NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "\"detection_filter\" and \"threshold\" are not allowed in the same rule");
+        SCLogError("\"detection_filter\" and \"threshold\" are not allowed in the same rule");
         SCReturnInt(-1);
     }
     /* checks there's no previous instance of detection_filter */
     tmpm = DetectGetLastSMFromLists(s, DETECT_DETECTION_FILTER, -1);
     if (tmpm != NULL) {
-        SCLogError(
-                SC_ERR_INVALID_SIGNATURE, "At most one \"detection_filter\" is allowed per rule");
+        SCLogError("At most one \"detection_filter\" is allowed per rule");
         SCReturnInt(-1);
     }
 
@@ -585,4 +582,4 @@ static void DetectDetectionFilterRegisterTests(void)
     UtRegisterTest("DetectDetectionFilterTestSig2", DetectDetectionFilterTestSig2);
     UtRegisterTest("DetectDetectionFilterTestSig3", DetectDetectionFilterTestSig3);
 }
-#endif /* UNITTESTS */
\ No newline at end of file
+#endif /* UNITTESTS */
index 94ce052a454b4963b727a9ce7509516e22aa1bdc..dfa2c193302f9938d7ce990913d1c15b00b0291f 100644 (file)
@@ -86,7 +86,7 @@ static int DetectDHCPLeaseTimeSetup(DetectEngineCtx *de_ctx, Signature *s, const
 
     DetectU64Data *dd = DetectU64Parse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Parsing \'%s\' failed for %s", rawstr,
+        SCLogError("Parsing \'%s\' failed for %s", rawstr,
                 sigmatch_table[DETECT_AL_DHCP_LEASETIME].name);
         return -1;
     }
index c80c6b483e5d44482c11ade8607308547f8f7719..3d63427eacb1aa14fb814f39555a5b2b182cd55e 100644 (file)
@@ -86,7 +86,7 @@ static int DetectDHCPRebindingTimeSetup(DetectEngineCtx *de_ctx, Signature *s, c
 
     DetectU64Data *dd = DetectU64Parse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Parsing \'%s\' failed for %s", rawstr,
+        SCLogError("Parsing \'%s\' failed for %s", rawstr,
                 sigmatch_table[DETECT_AL_DHCP_REBINDING_TIME].name);
         return -1;
     }
index 2dc816a7d8feb071ade5ba286f071f984bce2f0c..9a38555a0d28b6f8ad1269d427325654b746c98a 100644 (file)
@@ -86,7 +86,7 @@ static int DetectDHCPRenewalTimeSetup(DetectEngineCtx *de_ctx, Signature *s, con
 
     DetectU64Data *dd = DetectU64Parse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Parsing \'%s\' failed for %s", rawstr,
+        SCLogError("Parsing \'%s\' failed for %s", rawstr,
                 sigmatch_table[DETECT_AL_DHCP_RENEWAL_TIME].name);
         return -1;
     }
index a93e32e72a5dd71d10c9679f46e33c5e4d2a585d..f1da640e07950edac370a92bd373b0c57b944195 100644 (file)
@@ -76,7 +76,7 @@ static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
     /* retrieve the sm to apply the distance against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_OFFSET_MISSING_CONTENT, "distance needs "
+        SCLogError("distance needs "
                    "preceding content, uricontent option, http_client_body, "
                    "http_server_body, http_header option, http_raw_header option, "
                    "http_method option, http_cookie, http_raw_uri, "
@@ -88,39 +88,39 @@ static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
     /* verify other conditions */
     DetectContentData *cd = (DetectContentData *)pm->ctx;
     if (cd->flags & DETECT_CONTENT_DISTANCE) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple distances for the same content.");
+        SCLogError("can't use multiple distances for the same content.");
         goto end;
     }
     if ((cd->flags & DETECT_CONTENT_DEPTH) || (cd->flags & DETECT_CONTENT_OFFSET)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a relative "
+        SCLogError("can't use a relative "
                    "keyword like within/distance with a absolute "
                    "relative keyword like depth/offset for the same "
-                   "content." );
+                   "content.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_NEGATED && cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "negated keyword set along with a fast_pattern");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "keyword set along with a fast_pattern:only;");
         goto end;
     }
     if (str[0] != '-' && isalpha((unsigned char)str[0])) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(str, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unknown byte_ keyword var "
-                       "seen in distance - %s\n", str);
+            SCLogError("unknown byte_ keyword var "
+                       "seen in distance - %s\n",
+                    str);
             goto end;
         }
         cd->distance = index;
         cd->flags |= DETECT_CONTENT_DISTANCE_VAR;
     } else {
         if (StringParseInt32(&cd->distance, 0, 0, str) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                      "invalid value for distance: %s", str);
+            SCLogError("invalid value for distance: %s", str);
             goto end;
         }
     }
@@ -135,7 +135,7 @@ static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
     if (prev_pm->type == DETECT_CONTENT) {
         DetectContentData *prev_cd = (DetectContentData *)prev_pm->ctx;
         if (prev_cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "previous keyword "
+            SCLogError("previous keyword "
                        "has a fast_pattern:only; set. Can't "
                        "have relative keywords around a fast_pattern "
                        "only content");
index 4e9029422cdac086007311a91d46076301036c7a..8e2e659d51f35e52f220cfd9dcc21f0d33edc427 100644 (file)
@@ -212,8 +212,7 @@ static int DetectDNP3FuncSetup(DetectEngineCtx *de_ctx, Signature *s, const char
         return -1;
 
     if (!DetectDNP3FuncParseFunctionCode(str, &function_code)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-            "Invalid argument \"%s\" supplied to dnp3_func keyword.", str);
+        SCLogError("Invalid argument \"%s\" supplied to dnp3_func keyword.", str);
         return -1;
     }
 
@@ -264,8 +263,7 @@ static int DetectDNP3IndParseByName(const char *str, uint16_t *flags)
         }
 
         if (!found) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "Bad argument \"%s\" supplied to dnp3.ind keyword.", p);
+            SCLogError("Bad argument \"%s\" supplied to dnp3.ind keyword.", p);
             return 0;
         }
     }
@@ -300,8 +298,7 @@ static int DetectDNP3IndSetup(DetectEngineCtx *de_ctx, Signature *s, const char
         return -1;
 
     if (!DetectDNP3IndParse(str, &flags)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-            "Invalid argument \"%s\" supplied to dnp3.ind keyword.", str);
+        SCLogError("Invalid argument \"%s\" supplied to dnp3.ind keyword.", str);
         return -1;
     }
 
index c3e03627d8b28fe1120c89746a4afdd29490d78f..4c69753a83e04b973de1c0f34d44d0124e01dade 100644 (file)
@@ -37,8 +37,7 @@ static int DetectDnsOpcodeSetup(DetectEngineCtx *de_ctx, Signature *s,
 
     void *detect = rs_detect_dns_opcode_parse(str);
     if (detect == NULL) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                "failed to parse dns.opcode: %s", str);
+        SCLogError("failed to parse dns.opcode: %s", str);
         return -1;
     }
 
index ccbd0c0fdcd71ced59707e2ae789748f581bbee9..9d62457fc16fd2b2a14edfc065beeeff7816d352 100644 (file)
@@ -122,7 +122,7 @@ static int DetectDsizeSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
     SigMatch *sm = NULL;
 
     if (DetectGetLastSMFromLists(s, DETECT_DSIZE, -1)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Can't use 2 or more dsizes in "
+        SCLogError("Can't use 2 or more dsizes in "
                    "the same sig.  Invalidating signature.");
         goto error;
     }
@@ -131,7 +131,7 @@ static int DetectDsizeSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
 
     dd = DetectU16Parse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
@@ -139,7 +139,7 @@ static int DetectDsizeSetup (DetectEngineCtx *de_ctx, Signature *s, const char *
      * and put it in the Signature. */
     sm = SigMatchAlloc();
     if (sm == NULL){
-        SCLogError(SC_ENOMEM, "Failed to allocate memory for SigMatch");
+        SCLogError("Failed to allocate memory for SigMatch");
         rs_detect_u16_free(dd);
         goto error;
     }
index ee54b907228f21459e69dbee17d962d03a9b406b..6fb7f25738c81799b1500f96bb3c781df33b8371 100644 (file)
@@ -460,7 +460,7 @@ static int DetectAddressParseString(DetectAddress *dd, const char *str)
                 /* validate netmask */
                 int cidr = CIDRFromMask(netmask);
                 if (cidr < 0) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE,
+                    SCLogError(
                             "netmask \"%s\" is not usable. Only netmasks that are compatible with "
                             "CIDR notation are supported. See ticket #5168.",
                             mask);
@@ -650,8 +650,7 @@ static int DetectAddressSetup(DetectAddressHead *gh, const char *s)
     /* parse the address */
     DetectAddress *ad = DetectAddressParseSingle(s);
     if (ad == NULL) {
-        SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC,
-                "failed to parse address \"%s\"", s);
+        SCLogError("failed to parse address \"%s\"", s);
         return -1;
     }
 
@@ -725,8 +724,8 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
     char *temp_rule_var_address = NULL;
 
     if (++recur > 64) {
-        SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC, "address block recursion "
-                "limit reached (max 64)");
+        SCLogError("address block recursion "
+                   "limit reached (max 64)");
         goto error;
     }
 
@@ -735,10 +734,9 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
     size_t size = strlen(s);
     for (u = 0, x = 0; u < size && x < address_length; u++) {
         if (x == (address_length - 1)) {
-            SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC,
-                    "Hit the address buffer"
-                    " limit for the supplied address.  Invalidating sig.  "
-                    "Please file a bug report on this.");
+            SCLogError("Hit the address buffer"
+                       " limit for the supplied address.  Invalidating sig.  "
+                       "Please file a bug report on this.");
             goto error;
         }
         address[x] = s[u];
@@ -853,10 +851,11 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
                     goto error;
 
                 if (strlen(rule_var_address) == 0) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "variable %s resolved "
-                            "to nothing. This is likely a misconfiguration. "
-                            "Note that a negated address needs to be quoted, "
-                            "\"!$HOME_NET\" instead of !$HOME_NET. See issue #295.", s);
+                    SCLogError("variable %s resolved "
+                               "to nothing. This is likely a misconfiguration. "
+                               "Note that a negated address needs to be quoted, "
+                               "\"!$HOME_NET\" instead of !$HOME_NET. See issue #295.",
+                            s);
                     goto error;
                 }
 
@@ -908,8 +907,8 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
             x = 0;
 
             if (AddVariableToResolveList(var_list, address) == -1) {
-                SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Found a loop in a address "
-                    "groups declaration. This is likely a misconfiguration.");
+                SCLogError("Found a loop in a address "
+                           "groups declaration. This is likely a misconfiguration.");
                 goto error;
             }
 
@@ -920,10 +919,11 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
                     goto error;
 
                 if (strlen(rule_var_address) == 0) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "variable %s resolved "
-                            "to nothing. This is likely a misconfiguration. "
-                            "Note that a negated address needs to be quoted, "
-                            "\"!$HOME_NET\" instead of !$HOME_NET. See issue #295.", s);
+                    SCLogError("variable %s resolved "
+                               "to nothing. This is likely a misconfiguration. "
+                               "Note that a negated address needs to be quoted, "
+                               "\"!$HOME_NET\" instead of !$HOME_NET. See issue #295.",
+                            s);
                     goto error;
                 }
 
@@ -968,14 +968,16 @@ static int DetectAddressParseInternal(const DetectEngineCtx *de_ctx, DetectAddre
         }
     }
     if (depth > 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "not every address block was "
-                "properly closed in \"%s\", %d missing closing brackets (]). "
-                "Note: problem might be in a variable.", s, depth);
+        SCLogError("not every address block was "
+                   "properly closed in \"%s\", %d missing closing brackets (]). "
+                   "Note: problem might be in a variable.",
+                s, depth);
         goto error;
     } else if (depth < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "not every address block was "
-                "properly opened in \"%s\", %d missing opening brackets ([). "
-                "Note: problem might be in a variable.", s, depth*-1);
+        SCLogError("not every address block was "
+                   "properly opened in \"%s\", %d missing opening brackets ([). "
+                   "Note: problem might be in a variable.",
+                s, depth * -1);
         goto error;
     }
 
@@ -1003,8 +1005,8 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx, DetectAddressHead
     if (address_length > (MAX_ADDRESS_LENGTH - 1)) {
         char *address = SCCalloc(1, address_length);
         if (address == NULL) {
-            SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC, "Unable to allocate"
-                                                      " memory for address parsing.");
+            SCLogError("Unable to allocate"
+                       " memory for address parsing.");
             return -1;
         }
         rc = DetectAddressParseInternal(
@@ -1060,7 +1062,7 @@ int DetectAddressMergeNot(DetectAddressHead *gh, DetectAddressHead *ghn)
     /* check if the negated list covers the entire ip space. If so
      * the user screwed up the rules/vars. */
     if (DetectAddressIsCompleteIPSpace(ghn) == 1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Complete IP space negated. "
+        SCLogError("Complete IP space negated. "
                    "Rule address range is NIL. Probably have a !any or "
                    "an address range that supplies a NULL address range");
         goto error;
@@ -1203,8 +1205,9 @@ int DetectAddressMergeNot(DetectAddressHead *gh, DetectAddressHead *ghn)
             cnt++;
 
         if (ipv4_applied != cnt) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "not all IPv4 negations "
-                    "could be applied: %d != %d", cnt, ipv4_applied);
+            SCLogError("not all IPv4 negations "
+                       "could be applied: %d != %d",
+                    cnt, ipv4_applied);
             goto error;
         }
 
@@ -1213,16 +1216,17 @@ int DetectAddressMergeNot(DetectAddressHead *gh, DetectAddressHead *ghn)
             cnt++;
 
         if (ipv6_applied != cnt) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "not all IPv6 negations "
-                    "could be applied: %d != %d", cnt, ipv6_applied);
+            SCLogError("not all IPv6 negations "
+                       "could be applied: %d != %d",
+                    cnt, ipv6_applied);
             goto error;
         }
     }
 
     /* if the result is that we have no addresses we return error */
     if (gh->ipv4_head == NULL && gh->ipv6_head == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "no addresses left after "
-                "merging addresses and negated addresses");
+        SCLogError("no addresses left after "
+                   "merging addresses and negated addresses");
         goto error;
     }
 
@@ -1260,10 +1264,10 @@ int DetectAddressTestConfVars(void)
         }
 
         if (seq_node->val == NULL) {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                       "Address var \"%s\" probably has a sequence(something "
+            SCLogError("Address var \"%s\" probably has a sequence(something "
                        "in brackets) value set without any quotes. Please "
-                       "quote it using \"..\".", seq_node->name);
+                       "quote it using \"..\".",
+                    seq_node->name);
             goto error;
         }
 
@@ -1273,19 +1277,17 @@ int DetectAddressTestConfVars(void)
         CleanVariableResolveList(&var_list);
 
         if (r < 0) {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                    "failed to parse address var \"%s\" with value \"%s\". "
-                    "Please check its syntax",
+            SCLogError("failed to parse address var \"%s\" with value \"%s\". "
+                       "Please check its syntax",
                     seq_node->name, seq_node->val);
             goto error;
         }
 
         if (DetectAddressIsCompleteIPSpace(ghn)) {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                    "address var - \"%s\" has the complete IP space negated "
-                    "with its value \"%s\".  Rule address range is NIL. "
-                    "Probably have a !any or an address range that supplies "
-                    "a NULL address range",
+            SCLogError("address var - \"%s\" has the complete IP space negated "
+                       "with its value \"%s\".  Rule address range is NIL. "
+                       "Probably have a !any or an address range that supplies "
+                       "a NULL address range",
                     seq_node->name, seq_node->val);
             goto error;
         }
index aae6d5a0733e54af5e10949eebddc84fee78f13c..d532e6d4bebc8b9abf679247356c5265e8803e60 100644 (file)
@@ -224,7 +224,7 @@ void AlertQueueInit(DetectEngineThreadCtx *det_ctx)
     det_ctx->alert_queue_size = 0;
     det_ctx->alert_queue = SCCalloc(packet_alert_max, sizeof(PacketAlert));
     if (det_ctx->alert_queue == NULL) {
-        FatalError(SC_ENOMEM, "failed to allocate %" PRIu64 " bytes for the alert queue",
+        FatalError("failed to allocate %" PRIu64 " bytes for the alert queue",
                 (uint64_t)(packet_alert_max * sizeof(PacketAlert)));
     }
     det_ctx->alert_queue_capacity = packet_alert_max;
index 56a7a72f9d935fe61e1398dc4229ce46d47e9b0c..ebf2d0c5e0ab32141d1220397c7960d91d5072cb 100644 (file)
@@ -243,7 +243,7 @@ void EngineAnalysisFP(const DetectEngineCtx *de_ctx, const Signature *s, char *l
     uint16_t patlen = fp_cd->content_len;
     uint8_t *pat = SCMalloc(fp_cd->content_len + 1);
     if (unlikely(pat == NULL)) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memcpy(pat, fp_cd->content, fp_cd->content_len);
     pat[fp_cd->content_len] = '\0';
@@ -303,8 +303,7 @@ int SetupFPAnalyzer(void)
 
     fp_engine_analysis_FD = fopen(log_path, "w");
     if (fp_engine_analysis_FD == NULL) {
-        SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", log_path,
-                   strerror(errno));
+        SCLogError("failed to open %s: %s", log_path, strerror(errno));
         return 0;
     }
 
@@ -352,7 +351,7 @@ int SetupRuleAnalyzer(void)
             snprintf(log_path, sizeof(log_path), "%s/%s", log_dir, "rules_analysis.txt");
             rule_engine_analysis_FD = fopen(log_path, "w");
             if (rule_engine_analysis_FD == NULL) {
-                SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", log_path, strerror(errno));
+                SCLogError("failed to open %s: %s", log_path, strerror(errno));
                 return 0;
             }
 
@@ -444,8 +443,8 @@ int PerCentEncodingSetup ()
     if (percent_re == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE, "Compile of \"%s\" failed at offset %d: %s",
-                DETECT_PERCENT_ENCODING_REGEX, (int)eo, errbuffer);
+        SCLogError("Compile of \"%s\" failed at offset %d: %s", DETECT_PERCENT_ENCODING_REGEX,
+                (int)eo, errbuffer);
         return 0;
     }
 
@@ -469,7 +468,7 @@ static int PerCentEncodingMatch(uint8_t *content, uint16_t content_len)
         return 0;
     }
     else if (ret < -1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Error parsing content - %s; error code is %d", content, ret);
+        SCLogError("Error parsing content - %s; error code is %d", content, ret);
         return -1;
     }
     return ret;
@@ -492,7 +491,7 @@ static void EngineAnalysisRulesPrintFP(const DetectEngineCtx *de_ctx, const Sign
     uint16_t patlen = fp_cd->content_len;
     uint8_t *pat = SCMalloc(fp_cd->content_len + 1);
     if (unlikely(pat == NULL)) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memcpy(pat, fp_cd->content, fp_cd->content_len);
     pat[fp_cd->content_len] = '\0';
@@ -1081,9 +1080,9 @@ static void EngineAnalysisItemsInit(void)
         analyzer_item->item_id = (uint16_t)item_id;
         if (analyzer_item->item_id == -1) {
             /* Mismatch between the analyzer_items array and what's supported */
-            FatalError(SC_ERR_INITIALIZATION,
-                       "unable to initialize engine-analysis table: detect buffer \"%s\" not recognized.",
-                       analyzer_item->item_name);
+            FatalError("unable to initialize engine-analysis table: detect buffer \"%s\" not "
+                       "recognized.",
+                    analyzer_item->item_name);
         }
         analyzer_item->item_seen = false;
 
index bfb46713b03edaf406c6f931976b207cbba36465..3c0e443f80c73e6773b0c7c3d9d6c112d343256c 100644 (file)
@@ -1222,8 +1222,8 @@ static DetectPort *RulesGroupByPorts(DetectEngineCtx *de_ctx, uint8_t ipproto, u
             ((s->flags & (SIG_FLAG_TOSERVER|SIG_FLAG_TOCLIENT)) == (SIG_FLAG_TOSERVER|SIG_FLAG_TOCLIENT)) &&
             (!(s->dp->port == 0 && s->dp->port2 == 65535)))
         {
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: SYN-only to port(s) %u:%u "
-                    "w/o direction specified, disabling for toclient direction",
+            SCLogWarning("rule %u: SYN-only to port(s) %u:%u "
+                         "w/o direction specified, disabling for toclient direction",
                     s->id, s->dp->port, s->dp->port2);
             goto next;
         }
@@ -1970,18 +1970,18 @@ int SigGroupBuild(DetectEngineCtx *de_ctx)
     SigInitStandardMpmFactoryContexts(de_ctx);
 
     if (SigAddressPrepareStage1(de_ctx) != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
 
     if (SigAddressPrepareStage2(de_ctx) != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
 
     if (SigAddressPrepareStage3(de_ctx) != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
     if (SigAddressPrepareStage4(de_ctx) != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
 
     int r = DetectMpmPrepareBuiltinMpms(de_ctx);
@@ -1989,11 +1989,11 @@ int SigGroupBuild(DetectEngineCtx *de_ctx)
     r |= DetectMpmPreparePktMpms(de_ctx);
     r |= DetectMpmPrepareFrameMpms(de_ctx);
     if (r != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
 
     if (SigMatchPrepare(de_ctx) != 0) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
 
 #ifdef PROFILING
index ae8b5cf42167ea8573b1fb667a2d9c4d19646c54..b77b743649491f1f69218ac1a14970564a657c24 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_EINVAL, "Can't modify payload without packet");
+                            SCLogWarning("Can't modify payload without packet");
                         }
                     }
 
index fb9e98b59e52374ddbac424756ab8983ee35f37d..1c13ca39d6299a9aefe8729edb76425011545750 100644 (file)
@@ -127,8 +127,7 @@ static DetectEngineEventData *DetectEngineEventParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32
-                ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
@@ -137,7 +136,7 @@ static DetectEngineEventData *DetectEngineEventParse (const char *rawstr)
     res = pcre2_substring_copy_bynumber(parse_regex.match, 0, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
 
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -149,8 +148,7 @@ static DetectEngineEventData *DetectEngineEventParse (const char *rawstr)
     }
 
     if (found == 0) {
-        SCLogError(SC_ERR_UNKNOWN_DECODE_EVENT, "unknown decode event \"%s\"",
-                copy_str);
+        SCLogError("unknown decode event \"%s\"", copy_str);
         goto error;
     }
 
index 4e5c1481697cee988364d1da168d27da84c44daf..ccfa650acab2059f8e18a9f18b3ee66f70600e63 100644 (file)
@@ -339,8 +339,7 @@ static int IPOnlyCIDRItemSetup(IPOnlyCIDRItem **gh, char *s)
 
     /* parse the address */
     if (IPOnlyCIDRItemParseSingle(gh, s) == -1) {
-        SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC,
-                   "address parsing error \"%s\"", s);
+        SCLogError("address parsing error \"%s\"", s);
         goto error;
     }
 
@@ -549,8 +548,7 @@ static SigNumArray *SigNumArrayNew(DetectEngineCtx *de_ctx,
     SigNumArray *new = SCMalloc(sizeof(SigNumArray));
 
     if (unlikely(new == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SigNumArrayNew. Exiting...");
+        FatalError("Fatal error encountered in SigNumArrayNew. Exiting...");
     }
     memset(new, 0, sizeof(SigNumArray));
 
@@ -580,8 +578,7 @@ static SigNumArray *SigNumArrayCopy(SigNumArray *orig)
     SigNumArray *new = SCMalloc(sizeof(SigNumArray));
 
     if (unlikely(new == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SigNumArrayCopy. Exiting...");
+        FatalError("Fatal error encountered in SigNumArrayCopy. Exiting...");
     }
 
     memset(new, 0, sizeof(SigNumArray));
@@ -783,7 +780,7 @@ static IPOnlyCIDRItem *IPOnlyCIDRListParse2(
     return head;
 
 error:
-    SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC,"Error parsing addresses");
+    SCLogError("Error parsing addresses");
     return head;
 }
 
@@ -863,7 +860,7 @@ int IPOnlySigParseAddress(const DetectEngineCtx *de_ctx,
     return 0;
 
 error:
-    SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC, "failed to parse addresses");
+    SCLogError("failed to parse addresses");
     return -1;
 }
 
@@ -1188,8 +1185,8 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                          sna, src->netmask);
 
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the "
-                                                        "src ipv4 radix tree");
+                        SCLogError("Error inserting in the "
+                                   "src ipv4 radix tree");
                 } else {
                     SCLogDebug("Best match found");
 
@@ -1218,8 +1215,9 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                     if (node == NULL) {
                         char tmpstr[64];
                         PrintInet(src->family, &src->ip[0], tmpstr, sizeof(tmpstr));
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the"
-                                   " src ipv4 radix tree ip %s netmask %"PRIu8, tmpstr, src->netmask);
+                        SCLogError("Error inserting in the"
+                                   " src ipv4 radix tree ip %s netmask %" PRIu8,
+                                tmpstr, src->netmask);
                         //SCRadixPrintTree((de_ctx->io_ctx).tree_ipv4src);
                         exit(-1);
                     }
@@ -1281,7 +1279,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                          (de_ctx->io_ctx).tree_ipv6src,
                                                          sna, src->netmask);
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the src "
+                        SCLogError("Error inserting in the src "
                                    "ipv6 radix tree");
                 } else {
                     /* Found, copy the sig num table, add this signum and insert */
@@ -1305,7 +1303,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                          (de_ctx->io_ctx).tree_ipv6src,
                                                          sna, src->netmask);
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the src "
+                        SCLogError("Error inserting in the src "
                                    "ipv6 radix tree");
                 }
             } else {
@@ -1383,7 +1381,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                          sna, dst->netmask);
 
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the dst "
+                        SCLogError("Error inserting in the dst "
                                    "ipv4 radix tree");
                 } else {
                     SCLogDebug("Best match found");
@@ -1410,7 +1408,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                           sna, dst->netmask);
 
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the dst "
+                        SCLogError("Error inserting in the dst "
                                    "ipv4 radix tree");
                 }
             } else {
@@ -1471,7 +1469,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                           sna, dst->netmask);
 
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the dst "
+                        SCLogError("Error inserting in the dst "
                                    "ipv6 radix tree");
                 } else {
                     /* Found, copy the sig num table, add this signum and insert */
@@ -1496,7 +1494,7 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
                                                          sna, dst->netmask);
 
                     if (node == NULL)
-                        SCLogError(SC_ERR_IPONLY_RADIX, "Error inserting in the dst "
+                        SCLogError("Error inserting in the dst "
                                    "ipv6 radix tree");
                 }
             } else {
index 1451e287516dbc46cf4b36e8bfba4acec93b01fe..22fbf11f6f038b1c84fcebd6d8569d5b29bab1ca 100644 (file)
@@ -65,7 +65,7 @@ char *DetectLoadCompleteSigPath(const DetectEngineCtx *de_ctx, const char *sig_f
     char varname[128];
 
     if (sig_file == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS,"invalid sig_file argument - NULL");
+        SCLogError("invalid sig_file argument - NULL");
         return NULL;
     }
 
@@ -135,8 +135,9 @@ static int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file,
 
     FILE *fp = fopen(sig_file, "r");
     if (fp == NULL) {
-        SCLogError(SC_ERR_OPENING_RULE_FILE, "opening rule file %s:"
-                   " %s.", sig_file, strerror(errno));
+        SCLogError("opening rule file %s:"
+                   " %s.",
+                sig_file, strerror(errno));
         return -1;
     }
 
@@ -188,13 +189,13 @@ static int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file,
             good++;
         } else {
             if (!de_ctx->sigerror_silent) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "error parsing signature \"%s\" from "
-                        "file %s at line %"PRId32"", line, sig_file, lineno - multiline);
+                SCLogError("error parsing signature \"%s\" from "
+                           "file %s at line %" PRId32 "",
+                        line, sig_file, lineno - multiline);
 
                 if (!SigStringAppend(&de_ctx->sig_stat, sig_file, line, de_ctx->sigerror, (lineno - multiline))) {
-                    SCLogError(SC_ENOMEM,
-                            "Error adding sig \"%s\" from "
-                            "file %s at line %" PRId32 "",
+                    SCLogError("Error adding sig \"%s\" from "
+                               "file %s at line %" PRId32 "",
                             line, sig_file, lineno - multiline);
                 }
                 if (de_ctx->sigerror) {
@@ -229,7 +230,7 @@ static int ProcessSigFiles(DetectEngineCtx *de_ctx, char *pattern,
     int r = 0;
 
     if (pattern == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "opening rule file null");
+        SCLogError("opening rule file null");
         return -1;
     }
 
@@ -238,13 +239,12 @@ static int ProcessSigFiles(DetectEngineCtx *de_ctx, char *pattern,
     r = glob(pattern, 0, NULL, &files);
 
     if (r == GLOB_NOMATCH) {
-        SCLogWarning(SC_ERR_NO_RULES, "No rule files match the pattern %s", pattern);
+        SCLogWarning("No rule files match the pattern %s", pattern);
         ++(st->bad_files);
         ++(st->total_files);
         return -1;
     } else if (r != 0) {
-        SCLogError(SC_ERR_OPENING_RULE_FILE, "error expanding template %s: %s",
-                 pattern, strerror(errno));
+        SCLogError("error expanding template %s: %s", pattern, strerror(errno));
         return -1;
     }
 
@@ -310,9 +310,8 @@ int SigLoadSignatures(DetectEngineCtx *de_ctx, char *sig_file, int sig_file_excl
         rule_files = ConfGetNode(varname);
         if (rule_files != NULL) {
             if (!ConfNodeIsSequence(rule_files)) {
-                SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                    "Invalid rule-files configuration section: "
-                    "expected a list of filenames.");
+                SCLogWarning("Invalid rule-files configuration section: "
+                             "expected a list of filenames.");
             }
             else {
                 TAILQ_FOREACH(file, &rule_files->head, next) {
@@ -353,7 +352,8 @@ int SigLoadSignatures(DetectEngineCtx *de_ctx, char *sig_file, int sig_file_excl
     /* now we should have signatures to work with */
     if (sig_stat->good_sigs_total <= 0) {
         if (sig_stat->total_files > 0) {
-           SCLogWarning(SC_ERR_NO_RULES_LOADED, "%d rule files specified, but no rules were loaded!", sig_stat->total_files);
+            SCLogWarning(
+                    "%d rule files specified, but no rules were loaded!", sig_stat->total_files);
         } else {
             SCLogInfo("No signatures supplied.");
             goto end;
@@ -464,7 +464,7 @@ int DetectLoadersSync(void)
 
     }
     if (errors) {
-        SCLogError(SC_ERR_INITIALIZATION, "%d loaders reported errors", errors);
+        SCLogError("%d loaders reported errors", errors);
         return -1;
     }
     SCLogDebug("done");
@@ -484,8 +484,7 @@ void DetectLoadersInit(void)
     (void)ConfGetInt("multi-detect.loaders", &setting);
 
     if (setting < 1 || setting > 1024) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS,
-                "invalid multi-detect.loaders setting %"PRIdMAX, setting);
+        SCLogError("invalid multi-detect.loaders setting %" PRIdMAX, setting);
         exit(EXIT_FAILURE);
     }
     num_loaders = (int32_t)setting;
index c6d33a29e0d29046b43f1290e1e65cc58347ca29..e29ddbe725fa5ec30197bd4c1b08737c613ed916 100644 (file)
@@ -108,8 +108,7 @@ void DetectAppLayerMpmRegister2(const char *name,
     DetectBufferTypeSupportsTransformations(name);
     int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {
-        FatalError(SC_ERR_INITIALIZATION,
-                "MPM engine registration for %s failed", name);
+        FatalError("MPM engine registration for %s failed", name);
     }
 
     DetectBufferMpmRegistery *am = SCCalloc(1, sizeof(*am));
@@ -299,7 +298,7 @@ void DetectFrameMpmRegister(const char *name, int direction, int priority,
     DetectBufferTypeSupportsTransformations(name);
     int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list < 0 || sm_list > UINT16_MAX) {
-        FatalError(SC_ERR_INITIALIZATION, "MPM engine registration for %s failed", name);
+        FatalError("MPM engine registration for %s failed", name);
     }
 
     DetectBufferMpmRegistery *am = SCCalloc(1, sizeof(*am));
@@ -384,7 +383,7 @@ void DetectEngineFrameMpmRegister(DetectEngineCtx *de_ctx, const char *name, int
 
     const int sm_list = DetectEngineBufferTypeRegister(de_ctx, name);
     if (sm_list < 0 || sm_list > UINT16_MAX) {
-        FatalError(SC_ERR_INITIALIZATION, "MPM engine registration for %s failed", name);
+        FatalError("MPM engine registration for %s failed", name);
     }
 
     DetectEngineBufferTypeSupportsMpm(de_ctx, name);
@@ -533,8 +532,7 @@ void DetectPktMpmRegister(const char *name,
     DetectBufferTypeSupportsTransformations(name);
     int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {
-        FatalError(SC_ERR_INITIALIZATION,
-                "MPM engine registration for %s failed", name);
+        FatalError("MPM engine registration for %s failed", name);
     }
 
     DetectBufferMpmRegistery *am = SCCalloc(1, sizeof(*am));
@@ -851,7 +849,7 @@ uint8_t PatternMatchDefaultMatcher(void)
         if (mpm_algo != NULL) {
 #if __BYTE_ORDER == __BIG_ENDIAN
             if (strcmp(mpm_algo, "ac-ks") == 0) {
-                FatalError(SC_ERR_FATAL, "ac-ks does "
+                FatalError("ac-ks does "
                            "not work on big endian systems at this time.");
             }
 #endif
@@ -870,13 +868,14 @@ uint8_t PatternMatchDefaultMatcher(void)
 
 #ifndef BUILD_HYPERSCAN
             if ((strcmp(mpm_algo, "hs") == 0)) {
-                FatalError(SC_EINVAL, "Hyperscan (hs) support for mpm-algo is "
-                                      "not compiled into Suricata.");
+                FatalError("Hyperscan (hs) support for mpm-algo is "
+                           "not compiled into Suricata.");
             }
 #endif
         }
-        FatalError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid mpm algo supplied "
-                "in the yaml conf file: \"%s\"", mpm_algo);
+        FatalError("Invalid mpm algo supplied "
+                   "in the yaml conf file: \"%s\"",
+                mpm_algo);
     }
 
  done:
index 4044b8403a485b1fed94dfe492fbc79e13feccd1..736af14242a0f36adfc9be5d0fad4a49bad39fce 100644 (file)
@@ -757,7 +757,7 @@ static int DetectPortParseInsertString(const DetectEngineCtx *de_ctx,
     /** parse the address */
     ad = PortParse(s);
     if (ad == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT," failed to parse port \"%s\"",s);
+        SCLogError(" failed to parse port \"%s\"", s);
         return -1;
     }
 
@@ -803,7 +803,7 @@ static int DetectPortParseInsertString(const DetectEngineCtx *de_ctx,
     return 0;
 
 error:
-    SCLogError(SC_ERR_PORT_PARSE_INSERT_STRING,"DetectPortParseInsertString error");
+    SCLogError("DetectPortParseInsertString error");
     if (ad != NULL)
         DetectPortCleanupList(de_ctx, ad);
     if (ad_any != NULL)
@@ -849,8 +849,8 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
     int r = 0;
 
     if (recur++ > 64) {
-        SCLogError(SC_ERR_PORT_ENGINE_GENERIC, "port block recursion "
-                "limit reached (max 64)");
+        SCLogError("port block recursion "
+                   "limit reached (max 64)");
         goto error;
     }
 
@@ -864,7 +864,7 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
             range = 1;
 
         if (range == 1 && s[u] == '!') {
-            SCLogError(SC_ERR_NEGATED_VALUE_IN_PORT_RANGE,"Can't have a negated value in a range.");
+            SCLogError("Can't have a negated value in a range.");
             return -1;
         } else if (!o_set && s[u] == '!') {
             SCLogDebug("negation encountered");
@@ -905,10 +905,11 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
                 if (rule_var_port == NULL)
                     goto error;
                 if (strlen(rule_var_port) == 0) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "variable %s resolved "
-                            "to nothing. This is likely a misconfiguration. "
-                            "Note that a negated port needs to be quoted, "
-                            "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.", s);
+                    SCLogError("variable %s resolved "
+                               "to nothing. This is likely a misconfiguration. "
+                               "Note that a negated port needs to be quoted, "
+                               "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
+                            s);
                     goto error;
                 }
                 if (negate == 1 || n_set == 1) {
@@ -960,8 +961,8 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
             SCLogDebug("%s", address);
 
             if (AddVariableToResolveList(var_list, address) == -1) {
-                SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Found a loop in a port "
-                   "groups declaration. This is likely a misconfiguration.");
+                SCLogError("Found a loop in a port "
+                           "groups declaration. This is likely a misconfiguration.");
                 goto error;
             }
 
@@ -975,10 +976,11 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
                 if (rule_var_port == NULL)
                     goto error;
                 if (strlen(rule_var_port) == 0) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "variable %s resolved "
-                            "to nothing. This is likely a misconfiguration. "
-                            "Note that a negated port needs to be quoted, "
-                            "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.", s);
+                    SCLogError("variable %s resolved "
+                               "to nothing. This is likely a misconfiguration. "
+                               "Note that a negated port needs to be quoted, "
+                               "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
+                            s);
                     goto error;
                 }
                 if ((negate + n_set) % 2) {
@@ -1016,14 +1018,16 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
     }
 
     if (depth > 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "not every port block was "
-                "properly closed in \"%s\", %d missing closing brackets (]). "
-                "Note: problem might be in a variable.", s, depth);
+        SCLogError("not every port block was "
+                   "properly closed in \"%s\", %d missing closing brackets (]). "
+                   "Note: problem might be in a variable.",
+                s, depth);
         goto error;
     } else if (depth < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "not every port block was "
-                "properly opened in \"%s\", %d missing opening brackets ([). "
-                "Note: problem might be in a variable.", s, depth*-1);
+        SCLogError("not every port block was "
+                   "properly opened in \"%s\", %d missing opening brackets ([). "
+                   "Note: problem might be in a variable.",
+                s, depth * -1);
         goto error;
     }
 
@@ -1086,7 +1090,7 @@ static int DetectPortParseMergeNotPorts(const DetectEngineCtx *de_ctx,
 
     /** check if the full port space is negated */
     if (DetectPortIsCompletePortSpace(*nhead) == 1) {
-        SCLogError(SC_ERR_COMPLETE_PORT_SPACE_NEGATED,"Complete port space is negated");
+        SCLogError("Complete port space is negated");
         goto error;
     }
 
@@ -1155,7 +1159,7 @@ static int DetectPortParseMergeNotPorts(const DetectEngineCtx *de_ctx,
     }
 
     if (*head == NULL) {
-        SCLogError(SC_ERR_NO_PORTS_LEFT_AFTER_MERGE,"no ports left after merging ports with negated ports");
+        SCLogError("no ports left after merging ports with negated ports");
         goto error;
     }
 
@@ -1188,10 +1192,10 @@ int DetectPortTestConfVars(void)
         DetectPort *ghn = NULL;
 
         if (seq_node->val == NULL) {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                       "Port var \"%s\" probably has a sequence(something "
+            SCLogError("Port var \"%s\" probably has a sequence(something "
                        "in brackets) value set without any quotes. Please "
-                       "quote it using \"..\".", seq_node->name);
+                       "quote it using \"..\".",
+                    seq_node->name);
             DetectPortCleanupList(NULL, gh);
             goto error;
         }
@@ -1203,19 +1207,17 @@ int DetectPortTestConfVars(void)
 
         if (r < 0) {
             DetectPortCleanupList(NULL, gh);
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                    "failed to parse port var \"%s\" with value \"%s\". "
-                    "Please check its syntax",
+            SCLogError("failed to parse port var \"%s\" with value \"%s\". "
+                       "Please check its syntax",
                     seq_node->name, seq_node->val);
             goto error;
         }
 
         if (DetectPortIsCompletePortSpace(ghn)) {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                    "Port var - \"%s\" has the complete Port range negated "
-                    "with its value \"%s\".  Port space range is NIL. "
-                    "Probably have a !any or a port range that supplies "
-                    "a NULL address range",
+            SCLogError("Port var - \"%s\" has the complete Port range negated "
+                       "with its value \"%s\".  Port space range is NIL. "
+                       "Probably have a !any or a port range that supplies "
+                       "a NULL address range",
                     seq_node->name, seq_node->val);
             DetectPortCleanupList(NULL, gh);
             DetectPortCleanupList(NULL, ghn);
index 066098601a9aa2e548cb7cdfbb2bc003e8de52ba..3db303cd1c5528a0404b5b18421c394f693d31e6 100644 (file)
@@ -414,7 +414,7 @@ void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
     int r = PatternMatchPrepareGroup(de_ctx, sgh);
     if (r != 0) {
-        FatalError(SC_ERR_INITIALIZATION, "failed to set up pattern matching");
+        FatalError("failed to set up pattern matching");
     }
 
     /* set up engines if needed - when prefilter is set to auto we run
index 0693823f023218c0d7b06d386ba1f8a26fb491ed..9ab4d3a18ab976789524cc5ea17e816a0a08c3ac 100644 (file)
@@ -707,8 +707,9 @@ void SigTableRegisterTests(void)
                    "registration function.", sigmatch_table[i].name);
 
             if (coverage_unittests)
-                SCLogWarning(SC_WARN_NO_UNITTESTS, "detection plugin %s has no unittest "
-                        "registration function.", sigmatch_table[i].name);
+                SCLogWarning("detection plugin %s has no unittest "
+                             "registration function.",
+                        sigmatch_table[i].name);
         }
     }
 }
index a162d0f8da5ccb73544aaca83d8b2c8e464963ab..819add6d7c1986a53478572465d80c30099d085b 100644 (file)
@@ -98,8 +98,7 @@ static void SCSigRegisterSignatureOrderingFunc(DetectEngineCtx *de_ctx,
     }
 
     if ( (temp = SCMalloc(sizeof(SCSigOrderFunc))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCSigRegisterSignatureOrderingFunc. Exiting...");
+        FatalError("Fatal error encountered in SCSigRegisterSignatureOrderingFunc. Exiting...");
     }
     memset(temp, 0, sizeof(SCSigOrderFunc));
 
index 62c31a86b6f48c9f28a298a73bc334c34c3ca057..8f2a12f062be2ad96a389249c610a7fff8bb70f1 100644 (file)
@@ -55,11 +55,11 @@ void TagInitCtx(void)
 
     host_tag_id = HostStorageRegister("tag", sizeof(void *), NULL, DetectTagDataListFree);
     if (host_tag_id.id == -1) {
-        FatalError(SC_ERR_FATAL, "Can't initiate host storage for tag");
+        FatalError("Can't initiate host storage for tag");
     }
     flow_tag_id = FlowStorageRegister("tag", sizeof(void *), NULL, DetectTagDataListFree);
     if (flow_tag_id.id == -1) {
-        FatalError(SC_ERR_FATAL, "Can't initiate flow storage for tag");
+        FatalError("Can't initiate flow storage for tag");
     }
 }
 
index 1645013fc33198e24b730f39ed35a846c602a5e9..89068814ee9b51823fa867266874c9eb38705603 100644 (file)
@@ -82,13 +82,11 @@ void ThresholdInit(void)
 {
     host_threshold_id = HostStorageRegister("threshold", sizeof(void *), NULL, ThresholdListFree);
     if (host_threshold_id.id == -1) {
-        FatalError(SC_ERR_FATAL,
-                   "Can't initiate host storage for thresholding");
+        FatalError("Can't initiate host storage for thresholding");
     }
     ippair_threshold_id = IPPairStorageRegister("threshold", sizeof(void *), NULL, ThresholdListFree);
     if (ippair_threshold_id.id == -1) {
-        FatalError(SC_ERR_FATAL,
-                   "Can't initiate IP pair storage for thresholding");
+        FatalError("Can't initiate IP pair storage for thresholding");
     }
 }
 
@@ -281,7 +279,7 @@ static int ThresholdHandlePacketSuppress(Packet *p,
             break;
         case TRACK_RULE:
         default:
-            SCLogError(SC_EINVAL, "track mode %d is not supported", td->track);
+            SCLogError("track mode %d is not supported", td->track);
             break;
     }
     if (m == NULL)
@@ -528,7 +526,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
         }
         /* case TYPE_SUPPRESS: is not handled here */
         default:
-            SCLogError(SC_EINVAL, "type %d is not supported", td->type);
+            SCLogError("type %d is not supported", td->type);
     }
     return ret;
 }
@@ -650,8 +648,7 @@ int PacketAlertThreshold(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx
 void ThresholdHashInit(DetectEngineCtx *de_ctx)
 {
     if (SCMutexInit(&de_ctx->ths_ctx.threshold_table_lock, NULL) != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Threshold: Failed to initialize hash table mutex.");
+        FatalError("Threshold: Failed to initialize hash table mutex.");
     }
 }
 
@@ -716,10 +713,9 @@ void ThresholdHashAllocate(DetectEngineCtx *de_ctx)
     de_ctx->ths_ctx.th_size = highest_signum + 1;
     de_ctx->ths_ctx.th_entry = SCCalloc(de_ctx->ths_ctx.th_size, sizeof(DetectThresholdEntry *));
     if (de_ctx->ths_ctx.th_entry == NULL) {
-        FatalError(SC_ENOMEM,
-                "Error allocating memory for rule "
-                "thresholds (tried to allocate %" PRIu32 " th_entrys for "
-                "rule tracking)",
+        FatalError("Error allocating memory for rule "
+                   "thresholds (tried to allocate %" PRIu32 " th_entrys for "
+                   "rule tracking)",
                 de_ctx->ths_ctx.th_size);
     }
 }
index bdaebda10ad988b45c3ad152df5bd103fbfa8435..d0db2ec64c8bc1a6dee2836dd9114dcf12ecbad5 100644 (file)
@@ -140,21 +140,19 @@ void DetectPktInspectEngineRegister(const char *name,
     DetectBufferTypeRegister(name);
     const int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {
-        FatalError(SC_ERR_INITIALIZATION,
-            "failed to register inspect engine %s", name);
+        FatalError("failed to register inspect engine %s", name);
     }
 
     if ((sm_list < DETECT_SM_LIST_MATCH) || (sm_list >= SHRT_MAX) ||
         (Callback == NULL))
     {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid arguments");
+        SCLogError("Invalid arguments");
         BUG_ON(1);
     }
 
     DetectEnginePktInspectionEngine *new_engine = SCCalloc(1, sizeof(*new_engine));
     if (unlikely(new_engine == NULL)) {
-        FatalError(SC_ERR_INITIALIZATION,
-            "failed to register inspect engine %s: %s", name, strerror(errno));
+        FatalError("failed to register inspect engine %s: %s", name, strerror(errno));
     }
     new_engine->sm_list = (uint16_t)sm_list;
     new_engine->sm_list_base = (uint16_t)sm_list;
@@ -182,11 +180,11 @@ void DetectFrameInspectEngineRegister(const char *name, int dir,
     DetectBufferTypeRegister(name);
     const int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {
-        FatalError(SC_ERR_INITIALIZATION, "failed to register inspect engine %s", name);
+        FatalError("failed to register inspect engine %s", name);
     }
 
     if ((sm_list < DETECT_SM_LIST_MATCH) || (sm_list >= SHRT_MAX) || (Callback == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid arguments");
+        SCLogError("Invalid arguments");
         BUG_ON(1);
     }
 
@@ -199,8 +197,7 @@ void DetectFrameInspectEngineRegister(const char *name, int dir,
 
     DetectEngineFrameInspectionEngine *new_engine = SCCalloc(1, sizeof(*new_engine));
     if (unlikely(new_engine == NULL)) {
-        FatalError(SC_ERR_INITIALIZATION, "failed to register inspect engine %s: %s", name,
-                strerror(errno));
+        FatalError("failed to register inspect engine %s: %s", name, strerror(errno));
     }
     new_engine->sm_list = (uint16_t)sm_list;
     new_engine->sm_list_base = (uint16_t)sm_list;
@@ -234,8 +231,7 @@ void DetectAppLayerInspectEngineRegister2(const char *name,
     DetectBufferTypeRegister(name);
     const int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {
-        FatalError(SC_ERR_INITIALIZATION,
-            "failed to register inspect engine %s", name);
+        FatalError("failed to register inspect engine %s", name);
     }
 
     if ((alproto >= ALPROTO_FAILED) ||
@@ -244,11 +240,11 @@ void DetectAppLayerInspectEngineRegister2(const char *name,
         (progress < 0 || progress >= SHRT_MAX) ||
         (Callback2 == NULL))
     {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid arguments");
+        SCLogError("Invalid arguments");
         BUG_ON(1);
     } else if (Callback2 == DetectEngineInspectBufferGeneric && GetData == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid arguments: must register "
-                "GetData with DetectEngineInspectBufferGeneric");
+        SCLogError("Invalid arguments: must register "
+                   "GetData with DetectEngineInspectBufferGeneric");
         BUG_ON(1);
     }
 
@@ -422,11 +418,11 @@ void DetectEngineFrameInspectEngineRegister(DetectEngineCtx *de_ctx, const char
 {
     const int sm_list = DetectEngineBufferTypeRegister(de_ctx, name);
     if (sm_list < 0) {
-        FatalError(SC_ERR_INITIALIZATION, "failed to register inspect engine %s", name);
+        FatalError("failed to register inspect engine %s", name);
     }
 
     if ((sm_list < DETECT_SM_LIST_MATCH) || (sm_list >= SHRT_MAX) || (Callback == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid arguments");
+        SCLogError("Invalid arguments");
         BUG_ON(1);
     }
 
@@ -439,8 +435,7 @@ void DetectEngineFrameInspectEngineRegister(DetectEngineCtx *de_ctx, const char
 
     DetectEngineFrameInspectionEngine *new_engine = SCCalloc(1, sizeof(*new_engine));
     if (unlikely(new_engine == NULL)) {
-        FatalError(SC_ERR_INITIALIZATION, "failed to register inspect engine %s: %s", name,
-                strerror(errno));
+        FatalError("failed to register inspect engine %s: %s", name, strerror(errno));
     }
     new_engine->sm_list = (uint16_t)sm_list;
     new_engine->sm_list_base = (uint16_t)sm_list;
@@ -970,9 +965,8 @@ static void DetectBufferTypeFreeFunc(void *data)
         if (map->transforms.transforms[i].options == NULL)
             continue;
         if (sigmatch_table[map->transforms.transforms[i].transform].Free == NULL) {
-            SCLogError(SC_ERR_UNIMPLEMENTED,
-                       "%s allocates transform option memory but has no free routine",
-                       sigmatch_table[map->transforms.transforms[i].transform].name);
+            SCLogError("%s allocates transform option memory but has no free routine",
+                    sigmatch_table[map->transforms.transforms[i].transform].name);
             continue;
         }
         sigmatch_table[map->transforms.transforms[i].transform].Free(NULL, map->transforms.transforms[i].options);
@@ -1316,9 +1310,9 @@ int DetectBufferGetActiveList(DetectEngineCtx *de_ctx, Signature *s)
     if (s->init_data->list && s->init_data->transforms.cnt) {
         if (s->init_data->list == DETECT_SM_LIST_NOTSET ||
             s->init_data->list < DETECT_SM_LIST_DYNAMIC_START) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "previous transforms not consumed "
-                    "(list: %u, transform_cnt %u)", s->init_data->list,
-                    s->init_data->transforms.cnt);
+            SCLogError("previous transforms not consumed "
+                       "(list: %u, transform_cnt %u)",
+                    s->init_data->list, s->init_data->transforms.cnt);
             SCReturnInt(-1);
         }
 
@@ -1669,8 +1663,7 @@ int DetectEngineBufferTypeGetByIdTransforms(
         return -1;
     }
     if (!base_map->supports_transforms) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "buffer '%s' does not support transformations",
-                base_map->name);
+        SCLogError("buffer '%s' does not support transformations", base_map->name);
         return -1;
     }
 
@@ -2220,7 +2213,7 @@ static int DetectEngineReloadThreads(DetectEngineCtx *new_de_ctx)
 
             new_det_ctx[i] = DetectEngineThreadCtxInitForReload(tv, new_de_ctx, 1);
             if (new_det_ctx[i] == NULL) {
-                SCLogError(SC_ERR_LIVE_RULE_SWAP, "Detect engine thread init "
+                SCLogError("Detect engine thread init "
                            "failure in live rule swap.  Let's get out of here");
                 SCMutexUnlock(&tv_root_lock);
                 goto error;
@@ -2563,9 +2556,8 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
         } else if (strcmp(de_ctx_profile, "custom") == 0) {
             profile = ENGINE_PROFILE_CUSTOM;
         } else {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                    "invalid value for detect.profile: '%s'. "
-                    "Valid options: low, medium, high and custom.",
+            SCLogError("invalid value for detect.profile: '%s'. "
+                       "Valid options: low, medium, high and custom.",
                     de_ctx_profile);
             return -1;
         }
@@ -2595,10 +2587,11 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
         } else if (strcmp(sgh_mpm_context, "full") == 0) {
             de_ctx->sgh_mpm_ctx_cnf = ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL;
         } else {
-           SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "You have supplied an "
-                      "invalid conf value for detect-engine.sgh-mpm-context-"
-                      "%s", sgh_mpm_context);
-           exit(EXIT_FAILURE);
+            SCLogError("You have supplied an "
+                       "invalid conf value for detect-engine.sgh-mpm-context-"
+                       "%s",
+                    sgh_mpm_context);
+            exit(EXIT_FAILURE);
         }
     }
 
@@ -2653,10 +2646,9 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
                             (const char *)max_uniq_toclient_groups_str) <= 0) {
                     de_ctx->max_uniq_toclient_groups = 20;
 
-                    SCLogWarning(SC_ERR_SIZE_PARSE, "parsing '%s' for "
-                            "toclient-groups failed, using %u",
-                            max_uniq_toclient_groups_str,
-                            de_ctx->max_uniq_toclient_groups);
+                    SCLogWarning("parsing '%s' for "
+                                 "toclient-groups failed, using %u",
+                            max_uniq_toclient_groups_str, de_ctx->max_uniq_toclient_groups);
                 }
             } else {
                 de_ctx->max_uniq_toclient_groups = 20;
@@ -2669,10 +2661,9 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
                             (const char *)max_uniq_toserver_groups_str) <= 0) {
                     de_ctx->max_uniq_toserver_groups = 40;
 
-                    SCLogWarning(SC_ERR_SIZE_PARSE, "parsing '%s' for "
-                            "toserver-groups failed, using %u",
-                            max_uniq_toserver_groups_str,
-                            de_ctx->max_uniq_toserver_groups);
+                    SCLogWarning("parsing '%s' for "
+                                 "toserver-groups failed, using %u",
+                            max_uniq_toserver_groups_str, de_ctx->max_uniq_toserver_groups);
                 }
             } else {
                 de_ctx->max_uniq_toserver_groups = 40;
@@ -2709,8 +2700,8 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
 
                 insp_recursion_limit_node = ConfNodeLookupChild(opt, opt->val);
                 if (insp_recursion_limit_node == NULL) {
-                    SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Error retrieving conf "
-                            "entry for detect-engine:inspection-recursion-limit");
+                    SCLogError("Error retrieving conf "
+                               "entry for detect-engine:inspection-recursion-limit");
                     break;
                 }
                 insp_recursion_limit = insp_recursion_limit_node->val;
@@ -2722,10 +2713,9 @@ 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_EINVAL,
-                            "Invalid value for "
-                            "detect-engine.inspection-recursion-limit: %s "
-                            "resetting to %d",
+                    SCLogWarning("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;
@@ -2755,14 +2745,16 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
 
     }
     if (DetectPortParse(de_ctx, &de_ctx->tcp_whitelist, ports) != 0) {
-        SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "'%s' is not a valid value "
-                "for detect.grouping.tcp-whitelist", ports);
+        SCLogWarning("'%s' is not a valid value "
+                     "for detect.grouping.tcp-whitelist",
+                ports);
     }
     DetectPort *x = de_ctx->tcp_whitelist;
     for ( ; x != NULL;  x = x->next) {
         if (x->port != x->port2) {
-            SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "'%s' is not a valid value "
-                "for detect.grouping.tcp-whitelist: only single ports allowed", ports);
+            SCLogWarning("'%s' is not a valid value "
+                         "for detect.grouping.tcp-whitelist: only single ports allowed",
+                    ports);
             DetectPortCleanupList(de_ctx, de_ctx->tcp_whitelist);
             de_ctx->tcp_whitelist = NULL;
             break;
@@ -2779,15 +2771,15 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
 
     }
     if (DetectPortParse(de_ctx, &de_ctx->udp_whitelist, ports) != 0) {
-        SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                "'%s' is not a valid value "
-                "for detect.grouping.udp-whitelist",
+        SCLogWarning("'%s' is not a valid value "
+                     "for detect.grouping.udp-whitelist",
                 ports);
     }
     for (x = de_ctx->udp_whitelist; x != NULL;  x = x->next) {
         if (x->port != x->port2) {
-            SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY, "'%s' is not a valid value "
-                "for detect.grouping.udp-whitelist: only single ports allowed", ports);
+            SCLogWarning("'%s' is not a valid value "
+                         "for detect.grouping.udp-whitelist: only single ports allowed",
+                    ports);
             DetectPortCleanupList(de_ctx, de_ctx->udp_whitelist);
             de_ctx->udp_whitelist = NULL;
             break;
@@ -2837,7 +2829,7 @@ static int DetectEngineThreadCtxInitGlobalKeywords(DetectEngineThreadCtx *det_ct
         // coverity[suspicious_sizeof : FALSE]
         det_ctx->global_keyword_ctxs_array = (void **)SCCalloc(master->keyword_id, sizeof(void *));
         if (det_ctx->global_keyword_ctxs_array == NULL) {
-            SCLogError(SC_ERR_DETECT_PREPARE, "setting up thread local detect ctx");
+            SCLogError("setting up thread local detect ctx");
             return TM_ECODE_FAILED;
         }
         det_ctx->global_keyword_ctxs_size = master->keyword_id;
@@ -2846,8 +2838,9 @@ static int DetectEngineThreadCtxInitGlobalKeywords(DetectEngineThreadCtx *det_ct
         while (item) {
             det_ctx->global_keyword_ctxs_array[item->id] = item->InitFunc(item->data);
             if (det_ctx->global_keyword_ctxs_array[item->id] == NULL) {
-                SCLogError(SC_ERR_DETECT_PREPARE, "setting up thread local detect ctx "
-                        "for keyword \"%s\" failed", item->name);
+                SCLogError("setting up thread local detect ctx "
+                           "for keyword \"%s\" failed",
+                        item->name);
                 return TM_ECODE_FAILED;
             }
             item = item->next;
@@ -2884,7 +2877,7 @@ static int DetectEngineThreadCtxInitKeywords(DetectEngineCtx *de_ctx, DetectEngi
         // coverity[suspicious_sizeof : FALSE]
         det_ctx->keyword_ctxs_array = SCMalloc(de_ctx->keyword_id * sizeof(void *));
         if (det_ctx->keyword_ctxs_array == NULL) {
-            SCLogError(SC_ERR_DETECT_PREPARE, "setting up thread local detect ctx");
+            SCLogError("setting up thread local detect ctx");
             return TM_ECODE_FAILED;
         }
 
@@ -2898,8 +2891,9 @@ static int DetectEngineThreadCtxInitKeywords(DetectEngineCtx *de_ctx, DetectEngi
 
             det_ctx->keyword_ctxs_array[item->id] = item->InitFunc(item->data);
             if (det_ctx->keyword_ctxs_array[item->id] == NULL) {
-                SCLogError(SC_ERR_DETECT_PREPARE, "setting up thread local detect ctx "
-                        "for keyword \"%s\" failed", item->name);
+                SCLogError("setting up thread local detect ctx "
+                           "for keyword \"%s\" failed",
+                        item->name);
                 return TM_ECODE_FAILED;
             }
         }
@@ -2935,8 +2929,8 @@ static TmEcode DetectEngineThreadCtxInitForMT(ThreadVars *tv, DetectEngineThread
     HashTable *mt_det_ctxs_hash = NULL;
 
     if (master->tenant_selector == TENANT_SELECTOR_UNKNOWN) {
-        SCLogError(SC_ERR_MT_NO_SELECTOR, "no tenant selector set: "
-                                          "set using multi-detect.selector");
+        SCLogError("no tenant selector set: "
+                   "set using multi-detect.selector");
         return TM_ECODE_FAILED;
     }
 
@@ -3370,7 +3364,7 @@ TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
     DetectEngineThreadCtx *det_ctx = (DetectEngineThreadCtx *)data;
 
     if (det_ctx == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "argument \"data\" NULL");
+        SCLogWarning("argument \"data\" NULL");
         return TM_ECODE_OK;
     }
 
@@ -3670,28 +3664,27 @@ static int DetectEngineMultiTenantLoadTenant(uint32_t tenant_id, const char *fil
     struct stat st;
     if(stat(filename, &st) != 0) {
 #endif /* OS_WIN32 */
-        SCLogError(SC_ERR_FOPEN, "failed to stat file %s", filename);
+        SCLogError("failed to stat file %s", filename);
         goto error;
     }
 
     de_ctx = DetectEngineGetByTenantId(tenant_id);
     if (de_ctx != NULL) {
-        SCLogError(SC_ERR_MT_DUPLICATE_TENANT, "tenant %u already registered",
-                tenant_id);
+        SCLogError("tenant %u already registered", tenant_id);
         DetectEngineDeReference(&de_ctx);
         goto error;
     }
 
     ConfNode *node = ConfGetNode(prefix);
     if (node == NULL) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to properly setup yaml %s", filename);
+        SCLogError("failed to properly setup yaml %s", filename);
         goto error;
     }
 
     de_ctx = DetectEngineCtxInitWithPrefix(prefix);
     if (de_ctx == NULL) {
-        SCLogError(SC_ERR_INITIALIZATION, "initializing detection engine "
-                "context failed.");
+        SCLogError("initializing detection engine "
+                   "context failed.");
         goto error;
     }
     SCLogDebug("de_ctx %p with prefix %s", de_ctx, de_ctx->config_prefix);
@@ -3701,7 +3694,7 @@ static int DetectEngineMultiTenantLoadTenant(uint32_t tenant_id, const char *fil
     de_ctx->loader_id = loader_id;
 
     if (SigLoadSignatures(de_ctx, NULL, 0) < 0) {
-        SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed.");
+        SCLogError("Loading signatures failed.");
         goto error;
     }
 
@@ -3720,7 +3713,7 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
 {
     DetectEngineCtx *old_de_ctx = DetectEngineGetByTenantId(tenant_id);
     if (old_de_ctx == NULL) {
-        SCLogError(SC_ERR_INITIALIZATION, "tenant detect engine not found");
+        SCLogError("tenant detect engine not found");
         return -1;
     }
 
@@ -3730,20 +3723,20 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
     SCLogDebug("prefix %s", prefix);
 
     if (ConfYamlLoadFileWithPrefix(filename, prefix) != 0) {
-        SCLogError(SC_ERR_INITIALIZATION,"failed to load yaml");
+        SCLogError("failed to load yaml");
         goto error;
     }
 
     ConfNode *node = ConfGetNode(prefix);
     if (node == NULL) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to properly setup yaml %s", filename);
+        SCLogError("failed to properly setup yaml %s", filename);
         goto error;
     }
 
     DetectEngineCtx *new_de_ctx = DetectEngineCtxInitWithPrefix(prefix);
     if (new_de_ctx == NULL) {
-        SCLogError(SC_ERR_INITIALIZATION, "initializing detection engine "
-                "context failed.");
+        SCLogError("initializing detection engine "
+                   "context failed.");
         goto error;
     }
     SCLogDebug("de_ctx %p with prefix %s", new_de_ctx, new_de_ctx->config_prefix);
@@ -3753,7 +3746,7 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
     new_de_ctx->loader_id = old_de_ctx->loader_id;
 
     if (SigLoadSignatures(new_de_ctx, NULL, 0) < 0) {
-        SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed.");
+        SCLogError("Loading signatures failed.");
         goto error;
     }
 
@@ -3878,21 +3871,21 @@ static int DetectEngineMultiTenantSetupLoadLivedevMappings(const ConfNode *mappi
             uint32_t tenant_id = 0;
             if (StringParseUint32(&tenant_id, 10, (uint16_t)strlen(tenant_id_node->val),
                         tenant_id_node->val) < 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "tenant-id  "
-                        "of %s is invalid", tenant_id_node->val);
+                SCLogError("tenant-id  "
+                           "of %s is invalid",
+                        tenant_id_node->val);
                 goto bad_mapping;
             }
 
             const char *dev = device_node->val;
             LiveDevice *ld = LiveGetDevice(dev);
             if (ld == NULL) {
-                SCLogWarning(SC_ERR_MT_NO_MAPPING, "device %s not found", dev);
+                SCLogWarning("device %s not found", dev);
                 goto bad_mapping;
             }
 
             if (ld->tenant_id_set) {
-                SCLogWarning(SC_ERR_MT_NO_MAPPING, "device %s already mapped to tenant-id %u",
-                        dev, ld->tenant_id);
+                SCLogWarning("device %s already mapped to tenant-id %u", dev, ld->tenant_id);
                 goto bad_mapping;
             }
 
@@ -3937,21 +3930,24 @@ static int DetectEngineMultiTenantSetupLoadVlanMappings(const ConfNode *mappings
             uint32_t tenant_id = 0;
             if (StringParseUint32(&tenant_id, 10, (uint16_t)strlen(tenant_id_node->val),
                         tenant_id_node->val) < 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "tenant-id  "
-                        "of %s is invalid", tenant_id_node->val);
+                SCLogError("tenant-id  "
+                           "of %s is invalid",
+                        tenant_id_node->val);
                 goto bad_mapping;
             }
 
             uint16_t vlan_id = 0;
             if (StringParseUint16(
                         &vlan_id, 10, (uint16_t)strlen(vlan_id_node->val), vlan_id_node->val) < 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "vlan-id  "
-                        "of %s is invalid", vlan_id_node->val);
+                SCLogError("vlan-id  "
+                           "of %s is invalid",
+                        vlan_id_node->val);
                 goto bad_mapping;
             }
             if (vlan_id == 0 || vlan_id >= 4095) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "vlan-id  "
-                        "of %s is invalid. Valid range 1-4094.", vlan_id_node->val);
+                SCLogError("vlan-id  "
+                           "of %s is invalid. Valid range 1-4094.",
+                        vlan_id_node->val);
                 goto bad_mapping;
             }
 
@@ -4007,8 +4003,8 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
 
                 int vlanbool = 0;
                 if ((ConfGetBool("vlan.use-for-tracking", &vlanbool)) == 1 && vlanbool == 0) {
-                    SCLogError(SC_EINVAL, "vlan tracking is disabled, "
-                                          "can't use multi-detect selector 'vlan'");
+                    SCLogError("vlan tracking is disabled, "
+                               "can't use multi-detect selector 'vlan'");
                     SCMutexUnlock(&master->lock);
                     goto error;
                 }
@@ -4018,16 +4014,14 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
             } else if (strcmp(handler, "device") == 0) {
                 tenant_selector = master->tenant_selector = TENANT_SELECTOR_LIVEDEV;
                 if (EngineModeIsIPS()) {
-                    SCLogWarning(SC_ERR_MT_NO_MAPPING,
-                            "multi-tenant 'device' mode not supported for IPS");
+                    SCLogWarning("multi-tenant 'device' mode not supported for IPS");
                     SCMutexUnlock(&master->lock);
                     goto error;
                 }
 
             } else {
-                SCLogError(SC_EINVAL,
-                        "unknown value %s "
-                        "multi-detect.selector",
+                SCLogError("unknown value %s "
+                           "multi-detect.selector",
                         handler);
                 SCMutexUnlock(&master->lock);
                 goto error;
@@ -4052,10 +4046,10 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
                             "tenants won't be used until mappings are added");
                 } else {
                     if (failure_fatal) {
-                        SCLogError(SC_ERR_MT_NO_MAPPING, "no multi-detect mappings defined");
+                        SCLogError("no multi-detect mappings defined");
                         goto error;
                     } else {
-                        SCLogWarning(SC_ERR_MT_NO_MAPPING, "no multi-detect mappings defined");
+                        SCLogWarning("no multi-detect mappings defined");
                     }
                 }
             }
@@ -4064,10 +4058,10 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
                     failure_fatal);
             if (mapping_cnt == 0) {
                 if (failure_fatal) {
-                    SCLogError(SC_ERR_MT_NO_MAPPING, "no multi-detect mappings defined");
+                    SCLogError("no multi-detect mappings defined");
                     goto error;
                 } else {
-                    SCLogWarning(SC_ERR_MT_NO_MAPPING, "no multi-detect mappings defined");
+                    SCLogWarning("no multi-detect mappings defined");
                 }
             }
         }
@@ -4090,8 +4084,9 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
                 uint32_t tenant_id = 0;
                 if (StringParseUint32(
                             &tenant_id, 10, (uint16_t)strlen(id_node->val), id_node->val) < 0) {
-                    SCLogError(SC_ERR_INVALID_ARGUMENT, "tenant_id  "
-                            "of %s is invalid", id_node->val);
+                    SCLogError("tenant_id  "
+                               "of %s is invalid",
+                            id_node->val);
                     goto bad_tenant;
                 }
                 SCLogDebug("tenant id: %u, %s", tenant_id, yaml_node->val);
@@ -4101,7 +4096,7 @@ int DetectEngineMultiTenantSetup(const bool unix_socket)
                 char prefix[64];
                 snprintf(prefix, sizeof(prefix), "multi-detect.%u", tenant_id);
                 if (ConfYamlLoadFileWithPrefix(yaml_node->val, prefix) != 0) {
-                    SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to load yaml %s", yaml_node->val);
+                    SCLogError("failed to load yaml %s", yaml_node->val);
                     goto bad_tenant;
                 }
 
@@ -4447,15 +4442,13 @@ int DetectEngineReload(const SCInstance *suri)
     if (suri->conf_filename != NULL) {
         snprintf(prefix, sizeof(prefix), "detect-engine-reloads.%d", reloads++);
         if (ConfYamlLoadFileWithPrefix(suri->conf_filename, prefix) != 0) {
-            SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to load yaml %s",
-                    suri->conf_filename);
+            SCLogError("failed to load yaml %s", suri->conf_filename);
             return -1;
         }
 
         ConfNode *node = ConfGetNode(prefix);
         if (node == NULL) {
-            SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to properly setup yaml %s",
-                    suri->conf_filename);
+            SCLogError("failed to properly setup yaml %s", suri->conf_filename);
             return -1;
         }
 #if 0
@@ -4482,8 +4475,8 @@ int DetectEngineReload(const SCInstance *suri)
     /* get new detection engine */
     new_de_ctx = DetectEngineCtxInitWithPrefix(prefix);
     if (new_de_ctx == NULL) {
-        SCLogError(SC_ERR_INITIALIZATION, "initializing detection engine "
-                "context failed.");
+        SCLogError("initializing detection engine "
+                   "context failed.");
         DetectEngineDeReference(&old_de_ctx);
         return -1;
     }
@@ -4653,8 +4646,9 @@ int DetectEngineGetEventInfo(const char *event_name, int *event_id,
 {
     *event_id = SCMapEnumNameToValue(event_name, det_ctx_event_table);
     if (*event_id == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
-                   "det_ctx's enum map table.",  event_name);
+        SCLogError("event \"%s\" not present in "
+                   "det_ctx's enum map table.",
+                event_name);
         /* this should be treated as fatal */
         return -1;
     }
index a53df30a60f68c630f18f271fcd221b29c33075a..ecd583bbadb09d07d2fe9d0111807e09b2365376 100644 (file)
@@ -155,7 +155,7 @@ void DetectEngineInitializeFastPatternList(DetectEngineCtx *de_ctx)
     for (SCFPSupportSMList *tmp = g_fp_support_smlist_list; tmp != NULL; tmp = tmp->next) {
         SCFPSupportSMList *n = SCCalloc(1, sizeof(*n));
         if (n == NULL) {
-            FatalError(SC_ERR_FATAL, "out of memory: %s", strerror(errno));
+            FatalError("out of memory: %s", strerror(errno));
         }
         n->list_id = tmp->list_id;
         n->priority = tmp->priority;
@@ -221,9 +221,9 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
     SigMatch *pm1 = DetectGetLastSMFromMpmLists(de_ctx, s);
     SigMatch *pm2 = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm1 == NULL && pm2 == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "fast_pattern found inside "
-                "the rule, without a content context. Please use a "
-                "content based keyword before using fast_pattern");
+        SCLogError("fast_pattern found inside "
+                   "the rule, without a content context. Please use a "
+                   "content based keyword before using fast_pattern");
         return -1;
     }
 
@@ -247,15 +247,15 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
          (cd->flags & DETECT_CONTENT_DEPTH))) {
 
         /* we can't have any of these if we are having "only" */
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "fast_pattern; cannot be "
+        SCLogError("fast_pattern; cannot be "
                    "used with negated content, along with relative modifiers");
         goto error;
     }
 
     if (arg == NULL|| strcmp(arg, "") == 0) {
         if (cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple fast_pattern "
-                    "options for the same content");
+            SCLogError("can't use multiple fast_pattern "
+                       "options for the same content");
             goto error;
         }
         else { /*allow only one content to have fast_pattern modifier*/
@@ -266,8 +266,8 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
                     if (sm->type == DETECT_CONTENT) {
                         DetectContentData *tmp_cd = (DetectContentData *)sm->ctx;
                         if (tmp_cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-                            SCLogError(SC_ERR_INVALID_SIGNATURE, "fast_pattern "
-                                        "can be used on only one content in a rule");
+                            SCLogError("fast_pattern "
+                                       "can be used on only one content in a rule");
                             goto error;
                         }
                     }
@@ -289,7 +289,7 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
             (cd->flags & DETECT_CONTENT_DEPTH)) {
 
             /* we can't have any of these if we are having "only" */
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "fast_pattern: only; cannot be "
+            SCLogError("fast_pattern: only; cannot be "
                        "used with negated content or with any of the relative "
                        "modifiers like distance, within, offset, depth");
             goto error;
@@ -302,15 +302,16 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
         res = pcre2_substring_copy_bynumber(
                 parse_regex.match, 2, (PCRE2_UCHAR8 *)arg_substr, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                                  "for fast_pattern offset");
+            SCLogError("pcre2_substring_copy_bynumber failed "
+                       "for fast_pattern offset");
             goto error;
         }
         uint16_t offset;
         if (StringParseUint16(&offset, 10, 0,
                               (const char *)arg_substr) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid fast pattern offset:"
-                       " \"%s\"", arg_substr);
+            SCLogError("Invalid fast pattern offset:"
+                       " \"%s\"",
+                    arg_substr);
             goto error;
         }
 
@@ -318,29 +319,30 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
         res = pcre2_substring_copy_bynumber(
                 parse_regex.match, 3, (PCRE2_UCHAR8 *)arg_substr, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
-                                                  "for fast_pattern offset");
+            SCLogError("pcre2_substring_copy_bynumber failed "
+                       "for fast_pattern offset");
             goto error;
         }
         uint16_t length;
         if (StringParseUint16(&length, 10, 0,
                               (const char *)arg_substr) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid value for fast "
-                       "pattern: \"%s\"", arg_substr);
+            SCLogError("Invalid value for fast "
+                       "pattern: \"%s\"",
+                    arg_substr);
             goto error;
         }
 
         // Avoiding integer overflow
         if (offset > (65535 - length)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Fast pattern (length + offset) "
+            SCLogError("Fast pattern (length + offset) "
                        "exceeds limit pattern length limit");
             goto error;
         }
 
         if (offset + length > cd->content_len) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Fast pattern (length + "
+            SCLogError("Fast pattern (length + "
                        "offset (%u)) exceeds pattern length (%u)",
-                       offset + length, cd->content_len);
+                    offset + length, cd->content_len);
             goto error;
         }
 
@@ -349,8 +351,7 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, const c
         cd->flags |= DETECT_CONTENT_FAST_PATTERN_CHOP;
 
     } else {
-        SCLogError(SC_ERR_PCRE_PARSE, "parse error, ret %" PRId32
-                   ", string %s", ret, arg);
+        SCLogError("parse error, ret %" PRId32 ", string %s", ret, arg);
         goto error;
     }
 
index 9227b5a6ed5f94c714773291f340852ff3a7b961..88394b7f5b60fdacedf49c983b4a675b64fd5691 100644 (file)
@@ -205,14 +205,14 @@ static int DetectFiledataSetup (DetectEngineCtx *de_ctx, Signature *s, const cha
                     s->alproto != ALPROTO_HTTP2 && s->alproto != ALPROTO_FTP &&
                     s->alproto != ALPROTO_FTPDATA && s->alproto != ALPROTO_HTTP &&
                     s->alproto != ALPROTO_NFS)) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting keywords.");
+        SCLogError("rule contains conflicting keywords.");
         return -1;
     }
 
     if (s->alproto == ALPROTO_SMTP && (s->init_data->init_flags & SIG_FLAG_INIT_FLOW) &&
         !(s->flags & SIG_FLAG_TOSERVER) && (s->flags & SIG_FLAG_TOCLIENT)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Can't use file_data with "
-                "flow:to_client or flow:from_server with smtp.");
+        SCLogError("Can't use file_data with "
+                   "flow:to_client or flow:from_server with smtp.");
         return -1;
     }
 
index 5e217b915a442daa1de31ae7a8da7c16cf400dcf..3d35c9de06464a11787f88ddd23b84c2c5cc418f 100644 (file)
@@ -48,8 +48,7 @@ int ReadHashString(uint8_t *hash, const char *string, const char *filename, int
         uint16_t expected_len)
 {
     if (strlen(string) != expected_len) {
-        SCLogError(SC_ERR_INVALID_HASH, "%s:%d hash string not %d characters",
-                filename, line_no, expected_len);
+        SCLogError("%s:%d hash string not %d characters", filename, line_no, expected_len);
         return -1;
     }
 
@@ -63,8 +62,7 @@ int ReadHashString(uint8_t *hash, const char *string, const char *filename, int
         if (value >= 0 && value <= 255)
             hash[x] = (uint8_t)value;
         else {
-            SCLogError(SC_ERR_INVALID_HASH, "%s:%d hash byte out of range %ld",
-                    filename, line_no, value);
+            SCLogError("%s:%d hash byte out of range %ld", filename, line_no, value);
             return -1;
         }
     }
@@ -250,15 +248,14 @@ static DetectFileHashData *DetectFileHashParse (const DetectEngineCtx *de_ctx,
                 snprintf(path, sizeof(path), "%s/%s", dir, str);
                 fp = fopen(path, "r");
                 if (fp == NULL) {
-                    SCLogError(SC_ERR_OPENING_RULE_FILE,
-                            "opening hash file %s: %s", path, strerror(errno));
+                    SCLogError("opening hash file %s: %s", path, strerror(errno));
                     goto error;
                 }
             }
         }
         if (fp == NULL) {
 #endif
-            SCLogError(SC_ERR_OPENING_RULE_FILE, "opening hash file %s: %s", filename, strerror(errno));
+            SCLogError("opening hash file %s: %s", filename, strerror(errno));
             goto error;
 #ifdef HAVE_LIBGEN_H
         }
index 4979f3b62725aff87995cf7662208371bac37776..33fc7ee34f1bb54473b02ee73bfa5536a54fe0c2 100644 (file)
@@ -61,7 +61,7 @@
 
 static int DetectFilemagicSetupNoSupport (DetectEngineCtx *de_ctx, Signature *s, const char *str)
 {
-    SCLogError(SC_ERR_NO_MAGIC_SUPPORT, "no libmagic support built in, needed for filemagic keyword");
+    SCLogError("no libmagic support built in, needed for filemagic keyword");
     return -1;
 }
 
@@ -325,7 +325,7 @@ static void *DetectFilemagicThreadInit(void *data /*@unused@*/)
 {
     DetectFilemagicThreadData *t = SCCalloc(1, sizeof(DetectFilemagicThreadData));
     if (unlikely(t == NULL)) {
-        SCLogError(SC_ENOMEM, "couldn't alloc ctx memory");
+        SCLogError("couldn't alloc ctx memory");
         return NULL;
     }
 
index 4f0593327366055572409f2e8d32870568d38d2a..9a57469a42d08b6814aaf53d68e289a2c0bb4762 100644 (file)
@@ -338,7 +338,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
                        de_ctx->version);
         }
         if (!RequiresFeature(FEATURE_OUTPUT_FILESTORE)) {
-            SCLogWarning(SC_WARN_ALERT_CONFIG, "One or more rule(s) depends on the "
+            SCLogWarning("One or more rule(s) depends on the "
                          "file-store output log which is not enabled. "
                          "Enable the output \"file-store\".");
         }
@@ -354,8 +354,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
 
     /* filestore and bypass keywords can't work together */
     if (s->flags & SIG_FLAG_BYPASS) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                   "filestore can't work with bypass keyword");
+        SCLogError("filestore can't work with bypass keyword");
         return -1;
     }
 
@@ -373,7 +372,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
 
         ret = DetectParsePcreExec(&parse_regex, str, 0, 0);
         if (ret < 1 || ret > 4) {
-            SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 ", string %s", ret, str);
+            SCLogError("parse error, ret %" PRId32 ", string %s", ret, str);
             goto error;
         }
 
@@ -382,7 +381,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 1, (PCRE2_UCHAR8 *)str_0, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 goto error;
             }
             args[0] = (char *)str_0;
@@ -392,7 +391,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
                 res = pcre2_substring_copy_bynumber(
                         parse_regex.match, 2, (PCRE2_UCHAR8 *)str_1, &pcre2len);
                 if (res < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
                 args[1] = (char *)str_1;
@@ -402,7 +401,7 @@ static int DetectFilestoreSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
                 res = pcre2_substring_copy_bynumber(
                         parse_regex.match, 3, (PCRE2_UCHAR8 *)str_2, &pcre2len);
                 if (res < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
                 args[2] = (char *)str_2;
index ae26b05dc0638d6443efd0fafae8e77843b75b81..ce81d581f676f44cd4a2e68ca2d8c6e90dfe0168 100644 (file)
@@ -179,7 +179,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
 
     ret = DetectParsePcreExec(&parse_regex, flowstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 ", string %s", ret, flowstr);
+        SCLogError("parse error, ret %" PRId32 ", string %s", ret, flowstr);
         goto error;
     }
 
@@ -187,7 +187,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
         pcre2len = sizeof(str1);
         res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         args[0] = (char *)str1;
@@ -197,7 +197,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 2, (PCRE2_UCHAR8 *)str2, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 goto error;
             }
             args[1] = (char *)str2;
@@ -207,7 +207,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 3, (PCRE2_UCHAR8 *)str3, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 goto error;
             }
             args[2] = (char *)str3;
@@ -226,87 +226,91 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
             /* inspect our options and set the flags */
             if (strcasecmp(args[i], "established") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_ESTABLISHED) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "DETECT_FLOW_FLAG_ESTABLISHED flag is already set");
+                    SCLogError("DETECT_FLOW_FLAG_ESTABLISHED flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_STATELESS) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "DETECT_FLOW_FLAG_STATELESS already set");
+                    SCLogError("DETECT_FLOW_FLAG_STATELESS already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_ESTABLISHED;
             } else if (strcasecmp(args[i], "not_established") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_NOT_ESTABLISHED) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "DETECT_FLOW_FLAG_NOT_ESTABLISHED flag is already set");
+                    SCLogError("DETECT_FLOW_FLAG_NOT_ESTABLISHED flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_NOT_ESTABLISHED) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set DETECT_FLOW_FLAG_NOT_ESTABLISHED, DETECT_FLOW_FLAG_ESTABLISHED already set");
+                    SCLogError("cannot set DETECT_FLOW_FLAG_NOT_ESTABLISHED, "
+                               "DETECT_FLOW_FLAG_ESTABLISHED already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_NOT_ESTABLISHED;
             } else if (strcasecmp(args[i], "stateless") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_STATELESS) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "DETECT_FLOW_FLAG_STATELESS flag is already set");
+                    SCLogError("DETECT_FLOW_FLAG_STATELESS flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_ESTABLISHED) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set DETECT_FLOW_FLAG_STATELESS, DETECT_FLOW_FLAG_ESTABLISHED already set");
+                    SCLogError("cannot set DETECT_FLOW_FLAG_STATELESS, "
+                               "DETECT_FLOW_FLAG_ESTABLISHED already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_STATELESS;
             } else if (strcasecmp(args[i], "to_client") == 0 || strcasecmp(args[i], "from_server") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_TOCLIENT) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set DETECT_FLOW_FLAG_TOCLIENT flag is already set");
+                    SCLogError("cannot set DETECT_FLOW_FLAG_TOCLIENT flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_TOSERVER) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set to_client, DETECT_FLOW_FLAG_TOSERVER already set");
+                    SCLogError("cannot set to_client, DETECT_FLOW_FLAG_TOSERVER already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_TOCLIENT;
             } else if (strcasecmp(args[i], "to_server") == 0 || strcasecmp(args[i], "from_client") == 0){
                 if (fd->flags & DETECT_FLOW_FLAG_TOSERVER) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set DETECT_FLOW_FLAG_TOSERVER flag is already set");
+                    SCLogError("cannot set DETECT_FLOW_FLAG_TOSERVER flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_TOCLIENT) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set to_server, DETECT_FLOW_FLAG_TO_CLIENT flag already set");
+                    SCLogError("cannot set to_server, DETECT_FLOW_FLAG_TO_CLIENT flag already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_TOSERVER;
             } else if (strcasecmp(args[i], "only_stream") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_ONLYSTREAM) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set only_stream flag is already set");
+                    SCLogError("cannot set only_stream flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_NOSTREAM) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set only_stream flag, DETECT_FLOW_FLAG_NOSTREAM already set");
+                    SCLogError(
+                            "cannot set only_stream flag, DETECT_FLOW_FLAG_NOSTREAM already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_ONLYSTREAM;
             } else if (strcasecmp(args[i], "no_stream") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_NOSTREAM) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set no_stream flag is already set");
+                    SCLogError("cannot set no_stream flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_ONLYSTREAM) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set no_stream flag, DETECT_FLOW_FLAG_ONLYSTREAM already set");
+                    SCLogError(
+                            "cannot set no_stream flag, DETECT_FLOW_FLAG_ONLYSTREAM already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_NOSTREAM;
             } else if (strcasecmp(args[i], "no_frag") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_NO_FRAG) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set no_frag flag is already set");
+                    SCLogError("cannot set no_frag flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_ONLY_FRAG) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set no_frag flag, only_frag already set");
+                    SCLogError("cannot set no_frag flag, only_frag already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_NO_FRAG;
             } else if (strcasecmp(args[i], "only_frag") == 0) {
                 if (fd->flags & DETECT_FLOW_FLAG_ONLY_FRAG) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set only_frag flag is already set");
+                    SCLogError("cannot set only_frag flag is already set");
                     goto error;
                 } else if (fd->flags & DETECT_FLOW_FLAG_NO_FRAG) {
-                    SCLogError(SC_ERR_FLAGS_MODIFIER, "cannot set only_frag flag, no_frag already set");
+                    SCLogError("cannot set only_frag flag, no_frag already set");
                     goto error;
                 }
                 fd->flags |= DETECT_FLOW_FLAG_ONLY_FRAG;
             } else {
-                SCLogError(SC_EINVAL, "invalid flow option \"%s\"", args[i]);
+                SCLogError("invalid flow option \"%s\"", args[i]);
                 goto error;
             }
 
@@ -368,7 +372,7 @@ int DetectFlowSetup (DetectEngineCtx *de_ctx, Signature *s, const char *flowstr)
 {
     /* ensure only one flow option */
     if (s->init_data->init_flags & SIG_FLAG_INIT_FLOW) {
-        SCLogError (SC_ERR_INVALID_SIGNATURE, "A signature may have only one flow option.");
+        SCLogError("A signature may have only one flow option.");
         return -1;
     }
 
index 839753fce6e9115791fd6a80ef82bfbd917c5664..75c6c9603f2abf2c70cda85ac6701dc8f044d81c 100644 (file)
@@ -97,13 +97,14 @@ static int FlowbitOrAddData(DetectEngineCtx *de_ctx, DetectFlowbitsData *cd, cha
 
         // Check for spaces in between the flowbit names
         if (strchr(token, ' ') != NULL) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Spaces are not allowed in flowbit names.");
+            SCLogError("Spaces are not allowed in flowbit names.");
             return -1;
         }
 
         if (i == MAX_TOKENS) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Number of flowbits exceeds "
-                       "maximum allowed: %d.", MAX_TOKENS);
+            SCLogError("Number of flowbits exceeds "
+                       "maximum allowed: %d.",
+                    MAX_TOKENS);
             return -1;
         }
         strarr[i++] = token;
@@ -207,7 +208,7 @@ int DetectFlowbitMatch (DetectEngineThreadCtx *det_ctx, Packet *p,
         case DETECT_FLOWBITS_CMD_TOGGLE:
             return DetectFlowbitMatchToggle(p,fd);
         default:
-            SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown cmd %" PRIu32 "", fd->cmd);
+            SCLogError("unknown cmd %" PRIu32 "", fd->cmd);
             return 0;
     }
 
@@ -222,15 +223,14 @@ static int DetectFlowbitParse(const char *str, char *cmd, int cmd_len, char *nam
 
     count = DetectParsePcreExec(&parse_regex, str, 0, 0);
     if (count != 2 && count != 3) {
-        SCLogError(SC_ERR_PCRE_MATCH,
-            "\"%s\" is not a valid setting for flowbits.", str);
+        SCLogError("\"%s\" is not a valid setting for flowbits.", str);
         return 0;
     }
 
     pcre2len = cmd_len;
     rc = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)cmd, &pcre2len);
     if (rc < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return 0;
     }
 
@@ -238,7 +238,7 @@ static int DetectFlowbitParse(const char *str, char *cmd, int cmd_len, char *nam
         pcre2len = name_len;
         rc = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)name, &pcre2len);
         if (rc < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             return 0;
         }
 
@@ -251,8 +251,7 @@ static int DetectFlowbitParse(const char *str, char *cmd, int cmd_len, char *nam
             /* Validate name, spaces are not allowed. */
             for (size_t i = 0; i < strlen(name); i++) {
                 if (isblank(name[i])) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE,
-                        "spaces not allowed in flowbit names");
+                    SCLogError("spaces not allowed in flowbit names");
                     return 0;
                 }
             }
@@ -287,7 +286,7 @@ int DetectFlowbitSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
     } else if (strcmp(fb_cmd_str,"toggle") == 0) {
         fb_cmd = DETECT_FLOWBITS_CMD_TOGGLE;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "ERROR: flowbits action \"%s\" is not supported.", fb_cmd_str);
+        SCLogError("ERROR: flowbits action \"%s\" is not supported.", fb_cmd_str);
         goto error;
     }
 
@@ -417,7 +416,7 @@ int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
     struct FBAnalyze *array = SCCalloc(array_size, sizeof(struct FBAnalyze));
 
     if (array == NULL) {
-        SCLogError(SC_ENOMEM, "Unable to allocate flowbit analyze array");
+        SCLogError("Unable to allocate flowbit analyze array");
         return -1;
     }
 
@@ -587,8 +586,8 @@ int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
             array[i].cnts[DETECT_FLOWBITS_CMD_SET] == 0) {
 
             const Signature *s = de_ctx->sig_array[array[i].isset_sids[0]];
-            SCLogWarning(SC_WARN_FLOWBIT, "flowbit '%s' is checked but not "
-                    "set. Checked in %u and %u other sigs",
+            SCLogWarning("flowbit '%s' is checked but not "
+                         "set. Checked in %u and %u other sigs",
                     varname, s->id, array[i].isset_sids_idx - 1);
         }
         if (array[i].state_cnts[DETECT_FLOWBITS_CMD_ISSET] &&
index faf4a2bb29dc00d760980833b7fdec412c0c7943..7c606ca17e99c4dbaea856f3c8efaeb0421e05d1 100644 (file)
@@ -238,21 +238,21 @@ static DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, const char
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 3 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "\"%s\" is not a valid setting for flowint(ret = %d).", rawstr, ret);
+        SCLogError("\"%s\" is not a valid setting for flowint(ret = %d).", rawstr, ret);
         return NULL;
     }
 
     /* Get our flowint varname */
     res = pcre2_substring_get_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0 || str_ptr == NULL) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
     varname = (char *)str_ptr;
 
     res = pcre2_substring_get_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0 || str_ptr == NULL) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
     modstr = (char *)str_ptr;
@@ -283,7 +283,7 @@ static DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, const char
         modifier = FLOWINT_MODIFIER_NOTSET;
 
     if (modifier == FLOWINT_MODIFIER_UNKNOWN) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "Unknown modifier");
+        SCLogError("Unknown modifier");
         goto error;
     }
 
@@ -300,7 +300,7 @@ static DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, const char
                 parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         varval = (char *)str_ptr;
         if (res < 0 || varval == NULL || strcmp(varval, "") == 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
@@ -317,7 +317,7 @@ static DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, const char
             sfd->targettype = FLOWINT_TARGET_VAR;
             sfd->target.tvar.name = SCStrdup(varval);
             if (unlikely(sfd->target.tvar.name == NULL)) {
-                SCLogError(SC_ENOMEM, "malloc from strdup failed");
+                SCLogError("malloc from strdup failed");
                 goto error;
             }
         }
@@ -328,7 +328,7 @@ static DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, const char
     /* Set the name of the origin var to modify/compared with the target */
     sfd->name = SCStrdup(varname);
     if (unlikely(sfd->name == NULL)) {
-        SCLogError(SC_ENOMEM, "malloc from strdup failed");
+        SCLogError("malloc from strdup failed");
         goto error;
     }
     sfd->idx = VarNameStoreSetupAdd(varname, VAR_TYPE_FLOW_INT);
index 751e48ac72659f993db50c32ff7758786f7a1959..0d85f1c6d1a0499409864e6c15e6005fefd9d68a 100644 (file)
@@ -124,14 +124,14 @@ static int DetectFlowvarSetup (DetectEngineCtx *de_ctx, Signature *s, const char
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret != 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "\"%s\" is not a valid setting for flowvar.", rawstr);
+        SCLogError("\"%s\" is not a valid setting for flowvar.", rawstr);
         return -1;
     }
 
     pcre2len = sizeof(varname);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)varname, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
@@ -139,7 +139,7 @@ static int DetectFlowvarSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 2, (PCRE2_UCHAR8 *)varcontent, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
index 248364849586af710f6a1a8d5b0071e5cca30d32..2bc29b8f453b38fc2de2c29592b9fe2bb21956b0 100644 (file)
@@ -178,14 +178,14 @@ static DetectFragBitsData *DetectFragBitsParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
     for (i = 0; i < (ret - 1); i++) {
         res = SC_Pcre2SubstringGet(parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed %d", res);
+            SCLogError("pcre2_substring_get_bynumber failed %d", res);
             goto error;
         }
 
@@ -193,7 +193,7 @@ static DetectFragBitsData *DetectFragBitsParse (const char *rawstr)
     }
 
     if (args[1] == NULL) {
-        SCLogError(SC_EINVAL, "invalid value");
+        SCLogError("invalid value");
         goto error;
     }
 
index eae71242891eee62ad99764ab2e2bdddaf1a2e56..1a0036b68284e64f4754ee36fc775c5ec8d44afb 100644 (file)
@@ -151,14 +151,14 @@ static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, con
 
     ret = DetectParsePcreExec(&parse_regex, fragoffsetstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH,"Parse error %s", fragoffsetstr);
+        SCLogError("Parse error %s", fragoffsetstr);
         goto error;
     }
 
     for (i = 1; i < ret; i++) {
         res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         substr[i-1] = (char *)str_ptr;
@@ -189,8 +189,9 @@ static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, con
     }
 
     if (StringParseUint16(&fragoff->frag_off, 10, 0, substr[1]) < 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "specified frag offset %s is not "
-                                        "valid", substr[1]);
+        SCLogError("specified frag offset %s is not "
+                   "valid",
+                substr[1]);
         goto error;
     }
 
index 652a73cd0c3ce997e9f8c1c7ddb911aadc455dbf..584636993e2097cbd47c6de97f836d58b47f0abc 100644 (file)
@@ -67,7 +67,7 @@ static int DetectFrameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *s
     const bool is_tcp = DetectProtoContainsProto(&s->proto, IPPROTO_TCP);
     const bool is_udp = DetectProtoContainsProto(&s->proto, IPPROTO_UDP);
     if (!(is_tcp || is_udp)) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "'frame' keyword only supported for TCP and UDP");
+        SCLogError("'frame' keyword only supported for TCP and UDP");
         return -1;
     }
 
@@ -93,15 +93,13 @@ static int DetectFrameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *s
     }
 
     if (is_short && rule_alproto == ALPROTO_UNKNOWN) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                "rule protocol unknown, can't use shorthand notation for frame '%s'", str);
+        SCLogError("rule protocol unknown, can't use shorthand notation for frame '%s'", str);
         return -1;
     } else if (rule_alproto == ALPROTO_UNKNOWN) {
         if (DetectSignatureSetAppProto(s, keyword_alproto) < 0)
             return -1;
     } else if (!AppProtoEquals(rule_alproto, keyword_alproto)) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,
-                "frame '%s' protocol '%s' mismatch with rule protocol '%s'", str,
+        SCLogError("frame '%s' protocol '%s' mismatch with rule protocol '%s'", str,
                 AppProtoToString(keyword_alproto), AppProtoToString(s->alproto));
         return -1;
     }
@@ -113,8 +111,7 @@ static int DetectFrameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *s
     if (is_udp && raw_frame_type < 0)
         raw_frame_type = AppLayerParserGetFrameIdByName(IPPROTO_UDP, keyword_alproto, frame_str);
     if (raw_frame_type < 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "unknown frame '%s' for protocol '%s'", frame_str,
-                proto);
+        SCLogError("unknown frame '%s' for protocol '%s'", frame_str, proto);
         return -1;
     }
     BUG_ON(raw_frame_type >= UINT8_MAX);
index d914071ca17dd6669d01127a1273df9acc537041..0bd22d14b2ad9f67ea968d677a7d629b205c04a6 100644 (file)
@@ -134,14 +134,14 @@ static DetectFtpdataData *DetectFtpdataParse(const char *ftpcommandstr)
 
     int ret = DetectParsePcreExec(&parse_regex, ftpcommandstr, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 "", ret);
+        SCLogError("parse error, ret %" PRId32 "", ret);
         goto error;
     }
 
     pcre2len = sizeof(arg1);
     int res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
     SCLogDebug("Arg1 \"%s\"", arg1);
@@ -154,7 +154,7 @@ static DetectFtpdataData *DetectFtpdataParse(const char *ftpcommandstr)
     } else if (!strcmp(arg1, "retr")) {
         ftpcommandd->command = FTP_COMMAND_RETR;
     } else {
-        SCLogError(SC_ERR_NOT_SUPPORTED, "Invalid command value");
+        SCLogError("Invalid command value");
         goto error;
     }
 
index ee70f6bac7baebd04459ff70c8c7b49c47463a05..6540fbb39a30cba5b37478b08ed74b8dd08b8784 100644 (file)
@@ -43,7 +43,7 @@
 
 static int DetectGeoipSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
 {
-    SCLogError(SC_ERR_NO_GEOIP_SUPPORT, "no GeoIP support built in, needed for geoip keyword");
+    SCLogError("no GeoIP support built in, needed for geoip keyword");
     return -1;
 }
 
@@ -103,7 +103,7 @@ static bool InitGeolocationEngine(DetectGeoipData *geoipdata)
     (void)ConfGet("geoip-database", &filename);
 
     if (filename == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Unable to locate a GeoIP2"
+        SCLogWarning("Unable to locate a GeoIP2"
                      "database filename in YAML conf.  GeoIP rule matching "
                      "is disabled.");
         geoipdata->mmdb_status = MMDB_FILE_OPEN_ERROR;
@@ -118,9 +118,9 @@ static bool InitGeolocationEngine(DetectGeoipData *geoipdata)
         return true;
     }
 
-    SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Failed to open GeoIP2 database: %s. "
-                 "Error was: %s.  GeoIP rule matching is disabled.", filename,
-                 MMDB_strerror(status));
+    SCLogWarning("Failed to open GeoIP2 database: %s. "
+                 "Error was: %s.  GeoIP rule matching is disabled.",
+            filename, MMDB_strerror(status));
     geoipdata->mmdb_status = status;
     return false;
 }
@@ -351,7 +351,7 @@ static DetectGeoipData *DetectGeoipDataParse (DetectEngineCtx *de_ctx, const cha
                 }
 
                 if (geoipdata->nlocations >= GEOOPTION_MAXLOCATIONS) {
-                    SCLogError(SC_ERR_INVALID_ARGUMENT, "too many arguements for geoip keyword");
+                    SCLogError("too many arguements for geoip keyword");
                     goto error;
                 }
 
index 6a37c1ad3e5d72728ea446e8a46189a235c6ce40..a278edbc2666d0d3ff048864425a060195d7dea3 100644 (file)
@@ -75,12 +75,12 @@ static int DetectGidSetup (DetectEngineCtx *de_ctx, Signature *s, const char *ra
     char *endptr = NULL;
     gid = strtoul(rawstr, &endptr, 10);
     if (endptr == NULL || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid character as arg "
+        SCLogError("invalid character as arg "
                    "to gid keyword");
         goto error;
     }
     if (gid >= UINT_MAX) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "gid value to high, max %u", UINT_MAX);
+        SCLogError("gid value to high, max %u", UINT_MAX);
         goto error;
     }
 
index cb3747aeb893ce9ec1c2ca2bbaf9fa9518ecbee4..5944560abad40e2d2e376aeb3f03f766018c05b0 100644 (file)
@@ -257,7 +257,7 @@ int DetectXbitMatchHost(Packet *p, const DetectXbitsData *xd)
         case DETECT_XBITS_CMD_TOGGLE:
             return DetectHostbitMatchToggle(p,xd);
         default:
-            SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown cmd %" PRIu32 "", xd->cmd);
+            SCLogError("unknown cmd %" PRIu32 "", xd->cmd);
             return 0;
     }
 
@@ -288,15 +288,14 @@ static int DetectHostbitParse(const char *str, char *cmd, int cmd_len,
 
     count = DetectParsePcreExec(&parse_regex, str, 0, 0);
     if (count != 2 && count != 3 && count != 4) {
-        SCLogError(SC_ERR_PCRE_MATCH,
-            "\"%s\" is not a valid setting for hostbits.", str);
+        SCLogError("\"%s\" is not a valid setting for hostbits.", str);
         return 0;
     }
 
     pcre2len = cmd_len;
     rc = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)cmd, &pcre2len);
     if (rc < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return 0;
     }
 
@@ -304,7 +303,7 @@ static int DetectHostbitParse(const char *str, char *cmd, int cmd_len,
         pcre2len = name_len;
         rc = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)name, &pcre2len);
         if (rc < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             return 0;
         }
         if (count >= 4) {
@@ -312,7 +311,7 @@ static int DetectHostbitParse(const char *str, char *cmd, int cmd_len,
             rc = pcre2_substring_copy_bynumber(
                     parse_regex.match, 3, (PCRE2_UCHAR8 *)dir, &pcre2len);
             if (rc < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 return 0;
             }
         }
@@ -342,7 +341,7 @@ int DetectHostbitSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
             hb_dir = DETECT_XBITS_TRACK_IPDST;
         else if (strcmp(hb_dir_str, "both") == 0) {
             //hb_dir = DETECT_XBITS_TRACK_IPBOTH;
-            SCLogError(SC_ERR_UNIMPLEMENTED, "'both' not implemented");
+            SCLogError("'both' not implemented");
             goto error;
         } else {
             // TODO
@@ -363,7 +362,7 @@ int DetectHostbitSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
     } else if (strcmp(fb_cmd_str,"toggle") == 0) {
         fb_cmd = DETECT_XBITS_CMD_TOGGLE;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "ERROR: flowbits action \"%s\" is not supported.", fb_cmd_str);
+        SCLogError("ERROR: flowbits action \"%s\" is not supported.", fb_cmd_str);
         goto error;
     }
 
index c2385ec662deaf8fd0bf81d83b84f28ffade90c3..982d2327f2685879767cb53c287641337e57f49c 100644 (file)
@@ -189,7 +189,7 @@ static bool DetectHttpHostValidateCallback(const Signature *s, const char **sige
                             "The hostname buffer is normalized "
                             "to lowercase, specifying "
                             "nocase is redundant.";
-                SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+                SCLogWarning("rule %u: %s", s->id, *sigerror);
                 return false;
             } else {
                 uint32_t u;
@@ -202,7 +202,7 @@ static bool DetectHttpHostValidateCallback(const Signature *s, const char **sige
                                 "uppercase characters detected for http.host. "
                                 "The hostname buffer is normalized to lowercase, "
                                 "please specify a lowercase pattern.";
-                    SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+                    SCLogWarning("rule %u: %s", s->id, *sigerror);
                     return false;
                 }
             }
index daadfe7ad7d7651ae64347f278042d1910a98185..7eb9ac7f5e4abc19578241e46022cf769777bb5f 100644 (file)
@@ -171,19 +171,19 @@ static bool DetectHttpMethodValidateCallback(const Signature *s, const char **si
         if (cd->content && cd->content_len) {
             if (cd->content[cd->content_len-1] == 0x20) {
                 *sigerror = "http_method pattern with trailing space";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return false;
             } else if (cd->content[0] == 0x20) {
                 *sigerror = "http_method pattern with leading space";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return false;
             } else if (cd->content[cd->content_len-1] == 0x09) {
                 *sigerror = "http_method pattern with trailing tab";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return false;
             } else if (cd->content[0] == 0x09) {
                 *sigerror = "http_method pattern with leading tab";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return false;
             }
         }
index df1e87304fe843bd466d04bc89642421846ad70a..78e31b134293319306c3e20618bb425c5fe4ae88 100644 (file)
@@ -173,7 +173,7 @@ static bool DetectHttpRawHeaderValidateCallback(const Signature *s, const char *
                 "inspecting request headers or flow:to_client for "
                 "inspecting response headers.";
 
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+        SCLogError("%s", *sigerror);
         SCReturnInt(false);
     }
     return true;
index 3d4fd52f7e618ace7401f7d8e02dc91db11232f0..61be7c6a5d32584a4c26e9c73be2bbd3aa965666 100644 (file)
@@ -290,8 +290,7 @@ static int DetectHTTP2frametypeSetup (DetectEngineCtx *de_ctx, Signature *s, con
         return -1;
 
     if (!DetectHTTP2FuncParseFrameType(str, &frame_type)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                   "Invalid argument \"%s\" supplied to http2.frametype keyword.", str);
+        SCLogError("Invalid argument \"%s\" supplied to http2.frametype keyword.", str);
         return -1;
     }
 
@@ -376,8 +375,7 @@ static int DetectHTTP2errorcodeSetup (DetectEngineCtx *de_ctx, Signature *s, con
         return -1;
 
     if (!DetectHTTP2FuncParseErrorCode(str, &error_code)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                   "Invalid argument \"%s\" supplied to http2.errorcode keyword.", str);
+        SCLogError("Invalid argument \"%s\" supplied to http2.errorcode keyword.", str);
         return -1;
     }
 
@@ -933,7 +931,7 @@ static bool DetectHttp2HeaderValidateCallback(const Signature *s, const char **s
                         *sigerror = "Invalid http2.header string : "
                         "': ' is a special sequence for separation between name and value "
                         " and thus can only be present once";
-                        SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+                        SCLogWarning("rule %u: %s", s->id, *sigerror);
                         return false;
                     }
                     namevaluesep = true;
@@ -941,7 +939,7 @@ static bool DetectHttp2HeaderValidateCallback(const Signature *s, const char **s
                     *sigerror = "Invalid http2.header string : "
                                 "':' is an escaping character for itself, "
                                 "or space for the separation between name and value";
-                    SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+                    SCLogWarning("rule %u: %s", s->id, *sigerror);
                     return false;
                 }
                 escaped = false;
@@ -953,7 +951,7 @@ static bool DetectHttp2HeaderValidateCallback(const Signature *s, const char **s
             *sigerror = "Invalid http2.header string : "
             "':' is an escaping character for itself, "
             "or space for the separation between name and value";
-            SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return false;
         }
     }
index 613cbccc7fcdb1ea3a6250fd43bdc8ec5aa07c81..713ca33f3cd36e82b3b15470868260f6586622b7 100644 (file)
@@ -166,7 +166,7 @@ static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char
 
     ret = DetectParsePcreExec(&parse_regex, icmpidstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Parse error %s", icmpidstr);
+        SCLogError("Parse error %s", icmpidstr);
         goto error;
     }
 
@@ -175,7 +175,7 @@ static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char
     for (i = 1; i < ret; i++) {
         res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         substr[i-1] = (char *)str_ptr;
@@ -188,20 +188,21 @@ static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char
 
     if (substr[0]!= NULL && strlen(substr[0]) != 0) {
         if (substr[2] == NULL) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Missing close quote in input");
+            SCLogError("Missing close quote in input");
             goto error;
         }
     } else {
         if (substr[2] != NULL) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Missing open quote in input");
+            SCLogError("Missing open quote in input");
             goto error;
         }
     }
 
     uint16_t id = 0;
     if (StringParseUint16(&id, 10, 0, substr[1]) < 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "specified icmp id %s is not "
-                                        "valid", substr[1]);
+        SCLogError("specified icmp id %s is not "
+                   "valid",
+                substr[1]);
         goto error;
     }
     iid->id = htons(id);
index 87bfda3ebfa65aaffb902f5a586ae05dfe4b7b99..345f5d0129077c76040aee4b6f87466f67e3378a 100644 (file)
@@ -169,14 +169,14 @@ static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const cha
 
     ret = DetectParsePcreExec(&parse_regex, icmpseqstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH,"Parse error %s", icmpseqstr);
+        SCLogError("Parse error %s", icmpseqstr);
         goto error;
     }
 
     for (i = 1; i < ret; i++) {
         res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         substr[i-1] = (char *)str_ptr;
@@ -190,20 +190,21 @@ static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const cha
 
     if (substr[0] != NULL && strlen(substr[0]) != 0) {
         if (substr[2] == NULL) {
-            SCLogError(SC_ERR_MISSING_QUOTE,"Missing quote in input");
+            SCLogError("Missing quote in input");
             goto error;
         }
     } else {
         if (substr[2] != NULL) {
-            SCLogError(SC_ERR_MISSING_QUOTE,"Missing quote in input");
+            SCLogError("Missing quote in input");
             goto error;
         }
     }
 
     uint16_t seq = 0;
     if (StringParseUint16(&seq, 10, 0, substr[1]) < 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "specified icmp seq %s is not "
-                                        "valid", substr[1]);
+        SCLogError("specified icmp seq %s is not "
+                   "valid",
+                substr[1]);
         goto error;
     }
     iseq->seq = htons(seq);
index 3a086c2bcc9c95f18c49ef721da6c5ad45f93227..dd1717db7192750cdbd265349e7987ac4cee18e9 100644 (file)
@@ -129,9 +129,8 @@ static DetectIdData *DetectIdParse (const char *idstr)
     ret = DetectParsePcreExec(&parse_regex, idstr, 0, 0);
 
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_EINVAL,
-                "invalid id option '%s'. The id option "
-                "value must be in the range %u - %u",
+        SCLogError("invalid id option '%s'. The id option "
+                   "value must be in the range %u - %u",
                 idstr, DETECT_IPID_MIN, DETECT_IPID_MAX);
         return NULL;
     }
@@ -141,7 +140,7 @@ static DetectIdData *DetectIdParse (const char *idstr)
     pcre2len = sizeof(copy_str);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return NULL;
     }
     tmp_str = copy_str;
@@ -155,7 +154,7 @@ static DetectIdData *DetectIdParse (const char *idstr)
 
     /* ok, fill the id data */
     if (StringParseUint16(&temp, 10, 0, (const char *)tmp_str) < 0) {
-        SCLogError(SC_EINVAL, "invalid id option '%s'", tmp_str);
+        SCLogError("invalid id option '%s'", tmp_str);
         return NULL;
     }
 
index 2ab9fbec0ba5ad3a63af933ae3a8985125560c9f..b0454c3d126a5b1c140f337782354d9958b5c6cc 100644 (file)
@@ -137,7 +137,7 @@ static DetectIkeChosenSaData *DetectIkeChosenSaParse(const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 3 || ret > 5) {
-        SCLogError(SC_ERR_PCRE_MATCH,
+        SCLogError(
                 "pcre match for ike.chosen_sa_attribute failed, should be: <sa_attribute>=<type>, "
                 "but was: %s; error code %d",
                 rawstr, ret);
@@ -147,14 +147,14 @@ static DetectIkeChosenSaData *DetectIkeChosenSaParse(const char *rawstr)
     pcre2len = sizeof(attribute);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)attribute, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     pcre2len = sizeof(value);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)value, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -167,8 +167,8 @@ static DetectIkeChosenSaData *DetectIkeChosenSaParse(const char *rawstr)
         goto error;
 
     if (ByteExtractStringUint32(&dd->sa_value, 10, strlen(value), value) <= 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid input as arg "
-                                             "to ike.chosen_sa_attribute keyword");
+        SCLogError("invalid input as arg "
+                   "to ike.chosen_sa_attribute keyword");
         goto error;
     }
 
@@ -200,7 +200,7 @@ static int DetectIkeChosenSaSetup(DetectEngineCtx *de_ctx, Signature *s, const c
 
     DetectIkeChosenSaData *dd = DetectIkeChosenSaParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index 944e1b16d2a8b1ea0fbfe11c0de6776bbfe1d446..ae6a6ed3ab086cf9e5eb2c55c8a54a10f388b498 100644 (file)
@@ -164,7 +164,7 @@ static DetectIpOptsData *DetectIpOptsParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
index 4b6ca45abfac94d6536dbecb99c1192808906dbc..04582384a055e8664fcd616d5dcb80115bafec6b 100644 (file)
@@ -93,8 +93,9 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
     /* Execute the regex and populate args with captures. */
     ret = DetectParsePcreExec(&parse_regex, optstr, 0, 0);
     if (ret != 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret"
-                   "%" PRId32 ", string %s", ret, optstr);
+        SCLogError("pcre_exec parse error, ret"
+                   "%" PRId32 ", string %s",
+                ret, optstr);
         goto error;
     }
 
@@ -102,7 +103,7 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         args[i] = (char *)str_ptr;
@@ -124,14 +125,14 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
     if (!isdigit((unsigned char)*(args[1]))) {
         uint8_t proto;
         if (!SCGetProtoByName(args[1], &proto)) {
-            SCLogError(SC_EINVAL, "Unknown protocol name: \"%s\"", str_ptr);
+            SCLogError("Unknown protocol name: \"%s\"", str_ptr);
             goto error;
         }
         data->proto = proto;
     }
     else {
         if (StringParseUint8(&data->proto, 10, 0, args[1]) <= 0) {
-            SCLogError(SC_EINVAL, "Malformed protocol number: %s", str_ptr);
+            SCLogError("Malformed protocol number: %s", str_ptr);
             goto error;
         }
     }
@@ -208,7 +209,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
          * not true we error out on the sig.  And hence the init_flag to
          * indicate this. */
         if (!(s->init_data->init_flags & SIG_FLAG_INIT_FIRST_IPPROTO_SEEN)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Signature can use "
+            SCLogError("Signature can use "
                        "ip_proto keyword only when we use alert ip, "
                        "in which case the _ANY flag is set on the sig "
                        "and the if condition should match.");
@@ -224,7 +225,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     switch (data->op) {
         case DETECT_IPPROTO_OP_EQ:
             if (eq_set || gt_set || lt_set || not_set) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a eq "
+                SCLogError("can't use a eq "
                            "ipproto without any operators attached to "
                            "them in the same sig");
                 goto error;
@@ -234,7 +235,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
         case DETECT_IPPROTO_OP_GT:
             if (eq_set || gt_set) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a eq or gt "
+                SCLogError("can't use a eq or gt "
                            "ipproto along with a greater than ipproto in the "
                            "same sig ");
                 goto error;
@@ -255,9 +256,9 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
                 if (temp_sm != NULL) {
                   DetectIPProtoData *data_temp = (DetectIPProtoData *)temp_sm->ctx;
                     if (data_temp->proto <= data->proto) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have "
-                                "both gt and lt ipprotos, with the lt being "
-                                "lower than gt value");
+                        SCLogError("can't have "
+                                   "both gt and lt ipprotos, with the lt being "
+                                   "lower than gt value");
                         goto error;
                     } else {
                         for (i = 0; i < (data->proto / 8); i++) {
@@ -290,9 +291,9 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
                 if (temp_sm != NULL) {
                     data_temp = (DetectIPProtoData *)temp_sm->ctx;
                     if (data_temp->proto <= data->proto) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have "
-                                "both gt and lt ipprotos, with the lt being "
-                                "lower than gt value");
+                        SCLogError("can't have "
+                                   "both gt and lt ipprotos, with the lt being "
+                                   "lower than gt value");
                         goto error;
                     } else {
                         for (i = 0; i < (data->proto / 8); i++) {
@@ -309,7 +310,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
         case DETECT_IPPROTO_OP_LT:
             if (eq_set || lt_set) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a eq or lt "
+                SCLogError("can't use a eq or lt "
                            "ipproto along with a less than ipproto in the "
                            "same sig ");
                 goto error;
@@ -330,9 +331,9 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
                 if (temp_sm != NULL) {
                   DetectIPProtoData *data_temp = (DetectIPProtoData *)temp_sm->ctx;
                     if (data_temp->proto >= data->proto) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a have "
-                                "both gt and lt ipprotos, with the lt being "
-                                "lower than gt value");
+                        SCLogError("can't use a have "
+                                   "both gt and lt ipprotos, with the lt being "
+                                   "lower than gt value");
                         goto error;
                     } else {
                         for (i = 0; i < (data->proto / 8); i++) {
@@ -365,9 +366,9 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
                 if (temp_sm != NULL) {
                   data_temp = (DetectIPProtoData *)temp_sm->ctx;
                     if (data_temp->proto >= data->proto) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have "
-                                "both gt and lt ipprotos, with the lt being "
-                                "lower than gt value");
+                        SCLogError("can't have "
+                                   "both gt and lt ipprotos, with the lt being "
+                                   "lower than gt value");
                         goto error;
                     } else {
                         for (i = 0; i < (data->proto / 8); i++) {
@@ -384,7 +385,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
 
         case DETECT_IPPROTO_OP_NOT:
             if (eq_set) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a eq "
+                SCLogError("can't use a eq "
                            "ipproto along with a not ipproto in the "
                            "same sig ");
                 goto error;
index f78c1a3e28cdafc849784a3ee81a4685e7e9d510..cc3d9a04c9bc1ea4604f0be40a8612f040172a2d 100644 (file)
@@ -217,7 +217,7 @@ int DetectIPRepSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawstr)
 
     DetectIPRepData *cd = rs_detect_iprep_parse(rawstr);
     if (cd == NULL) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "\"%s\" is not a valid setting for iprep", rawstr);
+        SCLogError("\"%s\" is not a valid setting for iprep", rawstr);
         goto error;
     }
 
index faf4c43aa8f39769db3659c85f5166646804c64e..748d84b5e2cd8148e767d6e35ed6e48154eb056e 100644 (file)
@@ -104,7 +104,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
 
     ret = DetectParsePcreExec(&parse_regex, isdataatstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, isdataatstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, isdataatstr);
         goto error;
     }
 
@@ -113,7 +113,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         args[0] = (char *)str_ptr;
@@ -123,7 +123,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
             res = pcre2_substring_get_bynumber(
                     parse_regex.match, 2, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                SCLogError("pcre2_substring_get_bynumber failed");
                 goto error;
             }
             args[1] = (char *)str_ptr;
@@ -132,7 +132,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
             res = pcre2_substring_get_bynumber(
                     parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                SCLogError("pcre2_substring_get_bynumber failed");
                 goto error;
             }
             args[2] = (char *)str_ptr;
@@ -147,7 +147,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c
 
         if (args[0][0] != '-' && isalpha((unsigned char)args[0][0])) {
             if (offset == NULL) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "isdataat supplied with "
+                SCLogError("isdataat supplied with "
                            "var name for offset.  \"offset\" argument supplied to "
                            "this function has to be non-NULL");
                 goto error;
@@ -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_EINVAL, "isdataat out of range");
+                SCLogError("isdataat out of range");
                 SCFree(idad);
                 idad = NULL;
                 goto error;
@@ -247,8 +247,9 @@ int DetectIsdataatSetup (DetectEngineCtx *de_ctx, Signature *s, const char *isda
     if (offset != NULL) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(offset, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Unknown byte_extract var "
-                       "seen in isdataat - %s\n", offset);
+            SCLogError("Unknown byte_extract var "
+                       "seen in isdataat - %s\n",
+                    offset);
             goto end;
         }
         idad->dataat = index;
@@ -324,7 +325,7 @@ static int DetectEndsWithSetup (DetectEngineCtx *de_ctx, Signature *s, const cha
     /* retrieve the sm to apply the depth against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_DEPTH_MISSING_CONTENT, "endswith needs a "
+        SCLogError("endswith needs a "
                    "preceding content option");
         goto end;
     }
index 62d498bf1b41ab3dfaef06963ba0061139b8631e..ff5c2d48beab3c1e54355e97756aaf06cb48b43f 100644 (file)
@@ -131,14 +131,14 @@ static DetectKrb5ErrCodeData *DetectKrb5ErrCodeParse (const char *krb5str)
 
     ret = DetectParsePcreExec(&parse_regex, krb5str, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 "", ret);
+        SCLogError("parse error, ret %" PRId32 "", ret);
         goto error;
     }
 
     pcre2len = sizeof(arg1);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
index 7850d344a3434d146dbd4620033e78966b96114c..12e3eeeb5b303c274f27b9665f65a403b3e0b202 100644 (file)
@@ -128,14 +128,14 @@ static DetectKrb5MsgTypeData *DetectKrb5MsgTypeParse (const char *krb5str)
 
     ret = DetectParsePcreExec(&parse_regex, krb5str, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 "", ret);
+        SCLogError("parse error, ret %" PRId32 "", ret);
         goto error;
     }
 
     pcre2len = sizeof(arg1);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
index 837a55744913ba23e06423cf8fbc1a17af588c03..355e52dfbb966462bd499e9dcf2292ad51aaee3b 100644 (file)
@@ -84,7 +84,7 @@ static int DetectL3ProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     if (strcasecmp(str,"ipv4") == 0 ||
             strcasecmp(str,"ip4") == 0 ) {
         if (s->proto.flags & DETECT_PROTO_IPV6) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Conflicting l3 proto specified");
+            SCLogError("Conflicting l3 proto specified");
             goto error;
         }
         s->proto.flags |= DETECT_PROTO_IPV4;
@@ -92,13 +92,13 @@ static int DetectL3ProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     } else if (strcasecmp(str,"ipv6") == 0 ||
             strcasecmp(str,"ip6") == 0 ) {
         if (s->proto.flags & DETECT_PROTO_IPV6) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Conflicting l3 proto specified");
+            SCLogError("Conflicting l3 proto specified");
             goto error;
         }
         s->proto.flags |= DETECT_PROTO_IPV6;
         SCLogDebug("IPv6 protocol detected");
     } else {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid l3 proto: \"%s\"", str);
+        SCLogError("Invalid l3 proto: \"%s\"", str);
         goto error;
     }
 
index 8196c546a6ffc8da8652ee5c754196ead37ac9e8..c014c9e12d391a1ce7a808f2e8f315b6d56d13e7 100644 (file)
@@ -67,7 +67,7 @@
 
 static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
 {
-    SCLogError(SC_ERR_NO_LUA_SUPPORT, "no Lua support built in, needed for lua/luajit keyword");
+    SCLogError("no Lua support built in, needed for lua/luajit keyword");
     return -1;
 }
 
@@ -268,9 +268,8 @@ int DetectLuaMatchBuffer(DetectEngineThreadCtx *det_ctx,
                 if (strcmp(k, "retval") == 0) {
                     int val;
                     if (StringParseInt32(&val, 10, 0, (const char *)v) < 0) {
-                        SCLogError(SC_EINVAL,
-                                "Invalid value "
-                                "for \"retval\" from LUA return table: '%s'",
+                        SCLogError("Invalid value "
+                                   "for \"retval\" from LUA return table: '%s'",
                                 v);
                         ret = 0;
                     }
@@ -425,9 +424,8 @@ static int DetectLuaMatch (DetectEngineThreadCtx *det_ctx,
                     int val;
                     if (StringParseInt32(&val, 10, 0,
                                          (const char *)v) < 0) {
-                        SCLogError(SC_EINVAL,
-                                "Invalid value "
-                                "for \"retval\" from LUA return table: '%s'",
+                        SCLogError("Invalid value "
+                                   "for \"retval\" from LUA return table: '%s'",
                                 v);
                         ret = 0;
                     }
@@ -536,9 +534,8 @@ static int DetectLuaAppMatchCommon (DetectEngineThreadCtx *det_ctx,
                     int val;
                     if (StringParseInt32(&val, 10, 0,
                                          (const char *)v) < 0) {
-                        SCLogError(SC_EINVAL,
-                                "Invalid value "
-                                "for \"retval\" from LUA return table: '%s'",
+                        SCLogError("Invalid value "
+                                   "for \"retval\" from LUA return table: '%s'",
                                 v);
                         ret = 0;
                     }
@@ -601,7 +598,7 @@ static void *DetectLuaThreadInit(void *data)
 
     DetectLuaThreadData *t = SCMalloc(sizeof(DetectLuaThreadData));
     if (unlikely(t == NULL)) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't alloc ctx memory");
+        SCLogError("couldn't alloc ctx memory");
         return NULL;
     }
     memset(t, 0x00, sizeof(DetectLuaThreadData));
@@ -611,7 +608,7 @@ static void *DetectLuaThreadInit(void *data)
 
     t->luastate = LuaGetState();
     if (t->luastate == NULL) {
-        SCLogError(SC_ERR_LUA_ERROR, "luastate pool depleted");
+        SCLogError("luastate pool depleted");
         goto error;
     }
 
@@ -631,14 +628,14 @@ static void *DetectLuaThreadInit(void *data)
     if (ut_script != NULL) {
         status = luaL_loadbuffer(t->luastate, ut_script, strlen(ut_script), "unittest");
         if (status) {
-            SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(t->luastate, -1));
+            SCLogError("couldn't load file: %s", lua_tostring(t->luastate, -1));
             goto error;
         }
     } else {
 #endif
         status = luaL_loadfile(t->luastate, lua->filename);
         if (status) {
-            SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(t->luastate, -1));
+            SCLogError("couldn't load file: %s", lua_tostring(t->luastate, -1));
             goto error;
         }
 #ifdef UNITTESTS
@@ -647,7 +644,7 @@ static void *DetectLuaThreadInit(void *data)
 
     /* prime the script (or something) */
     if (lua_pcall(t->luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't prime file: %s", lua_tostring(t->luastate, -1));
+        SCLogError("couldn't prime file: %s", lua_tostring(t->luastate, -1));
         goto error;
     }
 
@@ -723,14 +720,14 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
     if (ut_script != NULL) {
         status = luaL_loadbuffer(luastate, ut_script, strlen(ut_script), "unittest");
         if (status) {
-            SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(luastate, -1));
+            SCLogError("couldn't load file: %s", lua_tostring(luastate, -1));
             goto error;
         }
     } else {
 #endif
         status = luaL_loadfile(luastate, ld->filename);
         if (status) {
-            SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(luastate, -1));
+            SCLogError("couldn't load file: %s", lua_tostring(luastate, -1));
             goto error;
         }
 #ifdef UNITTESTS
@@ -739,19 +736,19 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
 
     /* prime the script (or something) */
     if (lua_pcall(luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't prime file: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't prime file: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     lua_getglobal(luastate, "init");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no init function in script");
+        SCLogError("no init function in script");
         goto error;
     }
 
     lua_newtable(luastate); /* stack at -1 */
     if (lua_gettop(luastate) == 0 || lua_type(luastate, 2) != LUA_TTABLE) {
-        SCLogError(SC_ERR_LUA_ERROR, "no table setup");
+        SCLogError("no table setup");
         goto error;
     }
 
@@ -760,17 +757,17 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
     lua_settable(luastate, -3);
 
     if (lua_pcall(luastate, 1, 1, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't run script 'init' function: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't run script 'init' function: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     /* process returns from script */
     if (lua_gettop(luastate) == 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "init function in script should return table, nothing returned");
+        SCLogError("init function in script should return table, nothing returned");
         goto error;
     }
     if (lua_type(luastate, 1) != LUA_TTABLE) {
-        SCLogError(SC_ERR_LUA_ERROR, "init function in script should return table, returned is not table");
+        SCLogError("init function in script should return table, returned is not table");
         goto error;
     }
 
@@ -793,7 +790,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
                     lua_pop(luastate, 1);
 
                     if (ld->flowvars == DETECT_LUAJIT_MAX_FLOWVARS) {
-                        SCLogError(SC_ERR_LUA_ERROR, "too many flowvars registered");
+                        SCLogError("too many flowvars registered");
                         goto error;
                     }
 
@@ -815,7 +812,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
                     lua_pop(luastate, 1);
 
                     if (ld->flowints == DETECT_LUAJIT_MAX_FLOWINTS) {
-                        SCLogError(SC_ERR_LUA_ERROR, "too many flowints registered");
+                        SCLogError("too many flowints registered");
                         goto error;
                     }
 
@@ -837,15 +834,14 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
                     lua_pop(luastate, 1);
 
                     if (ld->bytevars == DETECT_LUAJIT_MAX_BYTEVARS) {
-                        SCLogError(SC_ERR_LUA_ERROR, "too many bytevars registered");
+                        SCLogError("too many bytevars registered");
                         goto error;
                     }
 
                     DetectByteIndexType idx;
                     if (!DetectByteRetrieveSMVar(value, s, &idx)) {
-                        SCLogError(SC_ERR_LUA_ERROR,
-                                "Unknown byte_extract or byte_math var "
-                                "requested by lua script - %s",
+                        SCLogError("Unknown byte_extract or byte_math var "
+                                   "requested by lua script - %s",
                                 value);
                         goto error;
                     }
@@ -872,7 +868,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
 
             ld->buffername = SCStrdup("buffer");
             if (ld->buffername == NULL) {
-                SCLogError(SC_ERR_LUA_ERROR, "alloc error");
+                SCLogError("alloc error");
                 goto error;
             }
         } else if (strcmp(k, "stream") == 0 && strcmp(v, "true") == 0) {
@@ -880,17 +876,18 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
 
             ld->buffername = SCStrdup("stream");
             if (ld->buffername == NULL) {
-                SCLogError(SC_ERR_LUA_ERROR, "alloc error");
+                SCLogError("alloc error");
                 goto error;
             }
 
         } else if (strncmp(k, "http", 4) == 0 && strcmp(v, "true") == 0) {
             if (ld->alproto != ALPROTO_UNKNOWN && ld->alproto != ALPROTO_HTTP1) {
-                SCLogError(SC_ERR_LUA_ERROR, "can just inspect script against one app layer proto like HTTP at a time");
+                SCLogError(
+                        "can just inspect script against one app layer proto like HTTP at a time");
                 goto error;
             }
             if (ld->flags != 0) {
-                SCLogError(SC_ERR_LUA_ERROR, "when inspecting HTTP buffers only a single buffer can be inspected");
+                SCLogError("when inspecting HTTP buffers only a single buffer can be inspected");
                 goto error;
             }
 
@@ -934,13 +931,13 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
                 ld->flags |= DATATYPE_HTTP_RESPONSE_HEADERS_RAW;
 
             else {
-                SCLogError(SC_ERR_LUA_ERROR, "unsupported http data type %s", k);
+                SCLogError("unsupported http data type %s", k);
                 goto error;
             }
 
             ld->buffername = SCStrdup(k);
             if (ld->buffername == NULL) {
-                SCLogError(SC_ERR_LUA_ERROR, "alloc error");
+                SCLogError("alloc error");
                 goto error;
             }
         } else if (strncmp(k, "dns", 3) == 0 && strcmp(v, "true") == 0) {
@@ -955,12 +952,12 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
                 ld->flags |= DATATYPE_DNS_RESPONSE;
 
             else {
-                SCLogError(SC_ERR_LUA_ERROR, "unsupported dns data type %s", k);
+                SCLogError("unsupported dns data type %s", k);
                 goto error;
             }
             ld->buffername = SCStrdup(k);
             if (ld->buffername == NULL) {
-                SCLogError(SC_ERR_LUA_ERROR, "alloc error");
+                SCLogError("alloc error");
                 goto error;
             }
         } else if (strncmp(k, "tls", 3) == 0 && strcmp(v, "true") == 0) {
@@ -988,7 +985,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
             ld->flags |= DATATYPE_DNP3;
 
         } else {
-            SCLogError(SC_ERR_LUA_ERROR, "unsupported data type %s", k);
+            SCLogError("unsupported data type %s", k);
             goto error;
         }
     }
@@ -1057,7 +1054,7 @@ static int DetectLuaSetup (DetectEngineCtx *de_ctx, Signature *s, const char *st
                 if (DetectBufferGetActiveList(de_ctx, s) != -1) {
                     list = s->init_data->list;
                 } else {
-                    SCLogError(SC_ERR_LUA_ERROR, "Lua and sticky buffer failure");
+                    SCLogError("Lua and sticky buffer failure");
                     goto error;
                 }
             } else
@@ -1103,14 +1100,12 @@ static int DetectLuaSetup (DetectEngineCtx *de_ctx, Signature *s, const char *st
     } else if (lua->alproto == ALPROTO_DNP3) {
         list = DetectBufferTypeGetByName("dnp3");
     } else {
-        SCLogError(SC_ERR_LUA_ERROR, "lua can't be used with protocol %s",
-                   AppLayerGetProtoName(lua->alproto));
+        SCLogError("lua can't be used with protocol %s", AppLayerGetProtoName(lua->alproto));
         goto error;
     }
 
     if (list == -1) {
-        SCLogError(SC_ERR_LUA_ERROR, "lua can't be used with protocol %s",
-                   AppLayerGetProtoName(lua->alproto));
+        SCLogError("lua can't be used with protocol %s", AppLayerGetProtoName(lua->alproto));
         goto error;
     }
 
index f058ffeaaec53294a0817c670ceae0fb5b60fb31..d12bc48ad74012ceab1d5435b061b628c1a21934 100644 (file)
@@ -88,13 +88,13 @@ static void * DetectMarkParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         return NULL;
     }
 
     res = pcre2_substring_get_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         return NULL;
     }
 
@@ -106,24 +106,24 @@ static void * DetectMarkParse (const char *rawstr)
     errno = 0;
     mark = strtoul(ptr, &endptr, 0);
     if (errno == ERANGE) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range");
+        SCLogError("Numeric value out of range");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     }     /* If there is no numeric value in the given string then strtoull(), makes
              endptr equals to ptr and return 0 as result */
     else if (endptr == ptr && mark == 0) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "No numeric value");
+        SCLogError("No numeric value");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     } else if (endptr == ptr) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Invalid numeric value");
+        SCLogError("Invalid numeric value");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     }
 
     res = pcre2_substring_get_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         return NULL;
     }
 
@@ -143,18 +143,18 @@ static void * DetectMarkParse (const char *rawstr)
     errno = 0;
     mask = strtoul(ptr, &endptr, 0);
     if (errno == ERANGE) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range");
+        SCLogError("Numeric value out of range");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     }     /* If there is no numeric value in the given string then strtoull(), makes
              endptr equals to ptr and return 0 as result */
     else if (endptr == ptr && mask == 0) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "No numeric value");
+        SCLogError("No numeric value");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     }
     else if (endptr == ptr) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Invalid numeric value");
+        SCLogError("Invalid numeric value");
         pcre2_substring_free((PCRE2_UCHAR8 *)ptr);
         return NULL;
     }
index de21328d037b4ca59eb8f8ba734b47be6b2041d2..316241f36ba7bd5ad64ae7b2078a249fccb5112a 100644 (file)
@@ -207,13 +207,13 @@ static int DetectMetadataParse(DetectEngineCtx *de_ctx, Signature *s, const char
 
         const char *hkey = DetectMedatataHashAdd(de_ctx, key);
         if (hkey == NULL) {
-            SCLogError(SC_ENOMEM, "can't create metadata key");
+            SCLogError("can't create metadata key");
             continue;
         }
 
         const char *hval = DetectMedatataHashAdd(de_ctx, val);
         if (hval == NULL) {
-            SCLogError(SC_ENOMEM, "can't create metadata value");
+            SCLogError("can't create metadata value");
             goto next;
         }
 
index 964defd6dcd16cd463b1e9eb2f46297adf101f8f..b010500a143c6dae35dd2fca76307ae186f0b100 100644 (file)
@@ -91,7 +91,7 @@ static int DetectModbusSetup(DetectEngineCtx *de_ctx, Signature *s, const char *
         return -1;
 
     if ((modbus = rs_modbus_parse(str)) == NULL) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid modbus option");
+        SCLogError("invalid modbus option");
         goto error;
     }
 
index 271d2a9ac49a98f4407306af9ca217de3132fec3..7ec902f1172cc1e3d6ddf4e86e715b3720ec08b6 100644 (file)
@@ -130,7 +130,7 @@ static bool *DetectMQTTConnackSessionPresentParse(const char *rawstr)
     } else if (strcmp(rawstr, "false") == 0) {
         *de = false;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "invalid session_present flag definition: %s", rawstr);
+        SCLogError("invalid session_present flag definition: %s", rawstr);
         goto error;
     }
 
index e2119a82aac8446404f0c69171005490b5550366..d7aa8eb4bda67a6fc2bdaa41a36d79302da4ae3d 100644 (file)
@@ -121,7 +121,7 @@ static DetectMQTTConnectFlagsData *DetectMQTTConnectFlagsParse(const char *rawst
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid flag definition: %s", rawstr);
+        SCLogError("invalid flag definition: %s", rawstr);
         return NULL;
     }
 
@@ -140,7 +140,7 @@ static DetectMQTTConnectFlagsData *DetectMQTTConnectFlagsParse(const char *rawst
             flagv++;
         }
         if (strlen(flagv) < 2) {
-            SCLogError(SC_ERR_UNKNOWN_VALUE, "malformed flag value: %s", flagv);
+            SCLogError("malformed flag value: %s", flagv);
             goto error;
         }  else {
             int offset = 0;
@@ -152,36 +152,36 @@ static DetectMQTTConnectFlagsData *DetectMQTTConnectFlagsParse(const char *rawst
             }
             if (strcmp(flagv+offset, "username") == 0) {
                 if (de->username != MQTT_DONT_CARE) {
-                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("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_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("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_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("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_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("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_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->clean_session = fs_to_set;
             } else {
-                SCLogError(SC_ERR_UNKNOWN_VALUE, "invalid flag definition: %s", flagv);
+                SCLogError("invalid flag definition: %s", flagv);
                 goto error;
             }
         }
index 33e470e92a1256b64dd62d08e789bd251067c0bb..a77ebff19070c6ff8aa5c617de085640281224f0 100644 (file)
@@ -116,7 +116,7 @@ static DetectMQTTFlagsData *DetectMQTTFlagsParse(const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid flag definition: %s", rawstr);
+        SCLogError("invalid flag definition: %s", rawstr);
         return NULL;
     }
 
@@ -138,7 +138,7 @@ static DetectMQTTFlagsData *DetectMQTTFlagsParse(const char *rawstr)
         }
         if (strlen(flagv) < 2) {
             /* flags have a minimum length */
-            SCLogError(SC_ERR_UNKNOWN_VALUE, "malformed flag value: %s", flagv);
+            SCLogError("malformed flag value: %s", flagv);
             goto error;
         }  else {
             int offset = 0;
@@ -150,18 +150,18 @@ static DetectMQTTFlagsData *DetectMQTTFlagsParse(const char *rawstr)
             }
             if (strcmp(flagv+offset, "dup") == 0) {
                 if (de->dup != MQTT_DONT_CARE) {
-                    SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("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_EINVAL, "duplicate flag definition: %s", flagv);
+                    SCLogError("duplicate flag definition: %s", flagv);
                     goto error;
                 }
                 de->retain = fs_to_set;
             } else {
-                SCLogError(SC_ERR_UNKNOWN_VALUE, "invalid flag definition: %s", flagv);
+                SCLogError("invalid flag definition: %s", flagv);
                 goto error;
             }
         }
index c6fed65892c84f8a3473da3a8fe4f2e77f1052d4..07aa834dc20d0c0cf4d10dcd5e13b3ebc6060404 100644 (file)
@@ -109,7 +109,7 @@ static uint8_t *DetectMQTTQosParse(const char *rawstr)
 
     ret = StringParseU8RangeCheck(&val, 10, 0, rawstr, 0, 2);
     if (ret < 0) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "invalid MQTT QOS level: %s", rawstr);
+        SCLogError("invalid MQTT QOS level: %s", rawstr);
         return NULL;
     }
 
index 50553aa63de9a8aa546a680ed97a7b942b702dab..085c9c047c9fcf20d751bcb4661dda4ab433ceb6 100644 (file)
@@ -125,7 +125,7 @@ static uint8_t *DetectMQTTReasonCodeParse(const char *rawstr)
 
     ret = StringParseUint8(&val, 10, 0, rawstr);
     if (ret < 0) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "invalid MQTT reason code: %s", rawstr);
+        SCLogError("invalid MQTT reason code: %s", rawstr);
         return NULL;
     }
 
index 5d5a32ed58f4164bbe646e77e3e425aef51db231..3bc7f1e4f5936f94dcdd2d51952a0337110fc79a 100644 (file)
@@ -108,7 +108,7 @@ static uint8_t *DetectMQTTTypeParse(const char *rawstr)
     ret = rs_mqtt_cstr_message_code(rawstr);
     // negative value denotes invalid input
     if(ret < 0) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown mqtt.type value %s", rawstr);
+        SCLogError("unknown mqtt.type value %s", rawstr);
         goto error;
     }
 
index bdc21ef295f4f63f40344bd0b272203ffb9d0d95..76437b1ada5b30d8d9cacd7161e1700c0487b24d 100644 (file)
@@ -108,7 +108,7 @@ static int DetectMsgSetup (DetectEngineCtx *de_ctx, Signature *s, const char *ms
     }
 
     if (s->msg != NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "duplicated 'msg' keyword detected");
+        SCLogError("duplicated 'msg' keyword detected");
         goto error;
     }
     s->msg = SCStrdup(str);
index f3746469bae260bc37ad5b5b0a24a71b91d0293f..08d69f7d6371a9a7112488c6f8b97323f1e401b4 100644 (file)
@@ -162,7 +162,7 @@ static int DetectNfsProcedureSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = DetectNfsProcedureParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index 160b449e9fea2d0d6008e95c6adc7a99b7ce254a..5b4f3b82def839f2f75a9445cb7dcbd7b53dfcce 100644 (file)
@@ -146,7 +146,7 @@ static int DetectNfsVersionSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     DetectU32Data *dd = DetectNfsVersionParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         return -1;
     }
 
index 9ca2d29a44fc1d5ceeaefaf276f4c1ed607a11e7..dda060a4f0694dec190b3ea7ab6ba25805a4edc6 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_EINVAL, "nocase has no value");
+        SCLogError("nocase has no value");
         return -1;
     }
 
index a8d67fb7119bc2ff18127b69208717c3dceca695..a0055bfcfe69c41b30bdff2a55650ee9cf9f80f8 100644 (file)
@@ -62,14 +62,14 @@ static int DetectNocaseSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     int ret = -1;
 
     if (nullstr != NULL) {
-        SCLogError(SC_EINVAL, "nocase has value");
+        SCLogError("nocase has value");
         goto end;
     }
 
     /* retrive the sm to apply the nocase against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_NOCASE_MISSING_PATTERN, "nocase needs "
+        SCLogError("nocase needs "
                    "preceding content option");
         goto end;
     }
@@ -78,7 +78,7 @@ static int DetectNocaseSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     DetectContentData *cd = (DetectContentData *)pm->ctx;;
 
     if (cd->flags & DETECT_CONTENT_NOCASE) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple nocase modifiers with the same content");
+        SCLogError("can't use multiple nocase modifiers with the same content");
         goto end;
     }
 
index 67dbb5ec963ce2f8b58076bd90c53be508805e3d..717545d768fab0d9d70710703c1db4818ec24dfe 100644 (file)
@@ -60,7 +60,7 @@ int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *offset
     /* retrive the sm to apply the offset against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_OFFSET_MISSING_CONTENT, "offset needs "
+        SCLogError("offset needs "
                    "preceding content option.");
         goto end;
     }
@@ -69,35 +69,36 @@ int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *offset
     DetectContentData *cd = (DetectContentData *)pm->ctx;
 
     if (cd->flags & DETECT_CONTENT_STARTS_WITH) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use offset with startswith.");
+        SCLogError("can't use offset with startswith.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_OFFSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple offsets for the same content.");
+        SCLogError("can't use multiple offsets for the same content.");
         goto end;
     }
     if ((cd->flags & DETECT_CONTENT_WITHIN) || (cd->flags & DETECT_CONTENT_DISTANCE)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a relative "
+        SCLogError("can't use a relative "
                    "keyword like within/distance with a absolute "
                    "relative keyword like depth/offset for the same "
-                   "content." );
+                   "content.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_NEGATED && cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "negated keyword set along with 'fast_pattern'.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "keyword set along with 'fast_pattern:only;'.");
         goto end;
     }
     if (str[0] != '-' && isalpha((unsigned char)str[0])) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(str, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unknown byte_ keyword var "
-                       "seen in offset - %s.", str);
+            SCLogError("unknown byte_ keyword var "
+                       "seen in offset - %s.",
+                    str);
             goto end;
         }
         cd->offset = index;
@@ -105,7 +106,7 @@ int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *offset
     } else {
         if (StringParseUint16(&cd->offset, 0, 0, str) < 0)
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid value for offset: %s.", str);
+            SCLogError("invalid value for offset: %s.", str);
             goto end;
         }
         if (cd->depth != 0) {
index e218438fb93cbccd5f76d95a2d01123b773ce79f..d8834f02b952a11531163b6b266b74711c0dabec 100644 (file)
@@ -154,20 +154,21 @@ int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx,
     int ret = -1;
 
     if (arg != NULL && strcmp(arg, "") != 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "%s shouldn't be supplied "
-                   "with an argument", sigmatch_table[sm_type].name);
+        SCLogError("%s shouldn't be supplied "
+                   "with an argument",
+                sigmatch_table[sm_type].name);
         goto end;
     }
 
     if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "\"%s\" keyword seen "
+        SCLogError("\"%s\" keyword seen "
                    "with a sticky buffer still set.  Reset sticky buffer "
                    "with pkt_data before using the modifier.",
-                   sigmatch_table[sm_type].name);
+                sigmatch_table[sm_type].name);
         goto end;
     }
     if (s->alproto != ALPROTO_UNKNOWN && !AppProtoEquals(s->alproto, alproto)) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting "
+        SCLogError("rule contains conflicting "
                    "alprotos set");
         goto end;
     }
@@ -175,24 +176,24 @@ int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx,
     sm = DetectGetLastSMByListId(s,
             DETECT_SM_LIST_PMATCH, DETECT_CONTENT, -1);
     if (sm == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "\"%s\" keyword "
+        SCLogError("\"%s\" keyword "
                    "found inside the rule without a content context.  "
                    "Please use a \"content\" keyword before using the "
-                   "\"%s\" keyword", sigmatch_table[sm_type].name,
-                   sigmatch_table[sm_type].name);
+                   "\"%s\" keyword",
+                sigmatch_table[sm_type].name, sigmatch_table[sm_type].name);
         goto end;
     }
     DetectContentData *cd = (DetectContentData *)sm->ctx;
     if (cd->flags & DETECT_CONTENT_RAWBYTES) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "%s rule can not "
+        SCLogError("%s rule can not "
                    "be used with the rawbytes rule keyword",
-                   sigmatch_table[sm_type].name);
+                sigmatch_table[sm_type].name);
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_REPLACE) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "%s rule can not "
+        SCLogError("%s rule can not "
                    "be used with the replace rule keyword",
-                   sigmatch_table[sm_type].name);
+                sigmatch_table[sm_type].name);
         goto end;
     }
     if (cd->flags & (DETECT_CONTENT_WITHIN | DETECT_CONTENT_DISTANCE)) {
@@ -324,7 +325,7 @@ void SigTableApplyStrictCommandlineOption(const char *str)
 
     char *copy = SCStrdup(str);
     if (copy == NULL)
-        FatalError(SC_ENOMEM, "could not duplicate opt string");
+        FatalError("could not duplicate opt string");
 
     char *xsaveptr = NULL;
     char *key = strtok_r(copy, ",", &xsaveptr);
@@ -333,8 +334,9 @@ void SigTableApplyStrictCommandlineOption(const char *str)
         if (st != NULL) {
             st->flags |= SIGMATCH_STRICT_PARSING;
         } else {
-            SCLogWarning(SC_ERR_CMD_LINE, "'strict' command line "
-                    "argument '%s' not found", key);
+            SCLogWarning("'strict' command line "
+                         "argument '%s' not found",
+                    key);
         }
         key = strtok_r(NULL, ",", &xsaveptr);
     }
@@ -640,7 +642,7 @@ int SigMatchListSMBelongsTo(const Signature *s, const SigMatch *key_sm)
         }
     }
 
-    SCLogError(SC_ERR_INVALID_SIGNATURE, "Unable to find the sm in any of the "
+    SCLogError("Unable to find the sm in any of the "
                "sm lists");
     return -1;
 }
@@ -661,7 +663,7 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
     for (;;) {
         optend = strchr(optend, ';');
         if (optend == NULL) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "no terminating \";\" found");
+            SCLogError("no terminating \";\" found");
             goto error;
         }
         else if (optend > optstr && *(optend -1 ) == '\\') {
@@ -702,20 +704,19 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
     /* Call option parsing */
     st = SigTableGet(optname);
     if (st == NULL || st->Setup == NULL) {
-        SCLogError(SC_ERR_RULE_KEYWORD_UNKNOWN, "unknown rule keyword '%s'.", optname);
+        SCLogError("unknown rule keyword '%s'.", optname);
         goto error;
     }
 
     if (!(st->flags & (SIGMATCH_NOOPT|SIGMATCH_OPTIONAL_OPT))) {
         if (optvalue == NULL || strlen(optvalue) == 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
+            SCLogError(
                     "invalid formatting or malformed option to %s keyword: '%s'", optname, optstr);
             goto error;
         }
     } else if (st->flags & SIGMATCH_NOOPT) {
         if (optvalue && strlen(optvalue)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unexpected option to %s keyword: '%s'", optname,
-                    optstr);
+            SCLogError("unexpected option to %s keyword: '%s'", optname, optstr);
             goto error;
         }
     }
@@ -724,12 +725,14 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
     if (st->flags & SIGMATCH_INFO_DEPRECATED) {
 #define URL "https://suricata.io/our-story/deprecation-policy/"
         if (st->alternative == 0)
-            SCLogWarning(SC_WARN_DEPRECATED, "keyword '%s' is deprecated "
-                    "and will be removed soon. See %s", st->name, URL);
+            SCLogWarning("keyword '%s' is deprecated "
+                         "and will be removed soon. See %s",
+                    st->name, URL);
         else
-            SCLogWarning(SC_WARN_DEPRECATED, "keyword '%s' is deprecated "
-                    "and will be removed soon. Use '%s' instead. "
-                    "See %s", st->name, sigmatch_table[st->alternative].name, URL);
+            SCLogWarning("keyword '%s' is deprecated "
+                         "and will be removed soon. Use '%s' instead. "
+                         "See %s",
+                    st->name, sigmatch_table[st->alternative].name, URL);
 #undef URL
     }
 
@@ -748,8 +751,8 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
             ovlen--;
         }
         if (ovlen == 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid formatting or malformed option to %s keyword: \'%s\'",
-                    optname, optstr);
+            SCLogError("invalid formatting or malformed option to %s keyword: \'%s\'", optname,
+                    optstr);
             goto error;
         }
 
@@ -767,14 +770,15 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
             ovlen--;
         }
         if (ovlen == 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid formatting or malformed option to %s keyword: \'%s\'",
-                    optname, optstr);
+            SCLogError("invalid formatting or malformed option to %s keyword: \'%s\'", optname,
+                    optstr);
             goto error;
         }
         /* if quoting is mandatory, enforce it */
         if (st->flags & SIGMATCH_QUOTES_MANDATORY && ovlen && *ptr != '"') {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid formatting to %s keyword: "
-                    "value must be double quoted \'%s\'", optname, optstr);
+            SCLogError("invalid formatting to %s keyword: "
+                       "value must be double quoted \'%s\'",
+                    optname, optstr);
             goto error;
         }
 
@@ -789,9 +793,9 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
                 }
             }
             if (ovlen && ptr[ovlen - 1] != '"') {
-                SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "bad option value formatting (possible missing semicolon) "
-                    "for keyword %s: \'%s\'", optname, optvalue);
+                SCLogError("bad option value formatting (possible missing semicolon) "
+                           "for keyword %s: \'%s\'",
+                        optname, optvalue);
                 goto error;
             }
             if (ovlen > 1) {
@@ -802,15 +806,15 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
                 ovlen--;
             }
             if (ovlen == 0) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "bad input "
-                    "for keyword %s: \'%s\'", optname, optvalue);
+                SCLogError("bad input "
+                           "for keyword %s: \'%s\'",
+                        optname, optvalue);
                 goto error;
             }
         } else {
             if (*ptr == '"') {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "quotes on %s keyword that doesn't support them: \'%s\'",
-                        optname, optstr);
+                SCLogError(
+                        "quotes on %s keyword that doesn't support them: \'%s\'", optname, optstr);
                 goto error;
             }
         }
@@ -907,12 +911,12 @@ static int SigParseProto(Signature *s, const char *protostr)
             AppLayerProtoDetectSupportedIpprotos(s->alproto, s->proto.proto);
         }
         else {
-            SCLogError(SC_ERR_UNKNOWN_PROTOCOL, "protocol \"%s\" cannot be used "
+            SCLogError("protocol \"%s\" cannot be used "
                        "in a signature.  Either detection for this protocol "
                        "is not yet supported OR detection has been disabled for "
                        "protocol through the yaml option "
-                       "app-layer.protocols.%s.detection-enabled", protostr,
-                       protostr);
+                       "app-layer.protocols.%s.detection-enabled",
+                    protostr, protostr);
             SCReturnInt(-1);
         }
     }
@@ -975,15 +979,15 @@ static int SigParseActionRejectValidate(const char *action)
 #ifdef HAVE_LIBNET11
 #if defined HAVE_LIBCAP_NG && !defined HAVE_LIBNET_CAPABILITIES
     if (sc_set_caps == TRUE) {
-        SCLogError(SC_ERR_LIBNET11_INCOMPATIBLE_WITH_LIBCAP_NG, "Libnet 1.1 is "
-            "incompatible with POSIX based capabilities with privs dropping. "
-            "For rejects to work, run as root/super user.");
+        SCLogError("Libnet 1.1 is "
+                   "incompatible with POSIX based capabilities with privs dropping. "
+                   "For rejects to work, run as root/super user.");
         return 0;
     }
 #endif
 #else /* no libnet 1.1 */
-    SCLogError(SC_ERR_LIBNET_REQUIRED_FOR_ACTION, "Libnet 1.1.x is "
-            "required for action \"%s\" but is not compiled into Suricata",
+    SCLogError("Libnet 1.1.x is "
+               "required for action \"%s\" but is not compiled into Suricata",
             action);
     return 0;
 #endif
@@ -1027,7 +1031,7 @@ static int SigParseAction(Signature *s, const char *action)
         s->action = ACTION_CONFIG;
         s->flags |= SIG_FLAG_NOALERT;
     } else {
-        SCLogError(SC_ERR_INVALID_ACTION,"An invalid action \"%s\" was given",action);
+        SCLogError("An invalid action \"%s\" was given", action);
         return -1;
     }
     return 0;
@@ -1153,7 +1157,7 @@ static int SigParseBasics(DetectEngineCtx *de_ctx,
 
     /* Options. */
     if (index == NULL) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "no rule options.");
+        SCLogError("no rule options.");
         goto error;
     }
     while (isspace(*index) || *index == '(') {
@@ -1178,9 +1182,9 @@ static int SigParseBasics(DetectEngineCtx *de_ctx,
     if (strcmp(parser->direction, "<>") == 0) {
         s->init_data->init_flags |= SIG_FLAG_INIT_BIDIREC;
     } else if (strcmp(parser->direction, "->") != 0) {
-        SCLogError(SC_ERR_INVALID_DIRECTION,
-                "\"%s\" is not a valid direction modifier, "
-                "\"->\" and \"<>\" are supported.", parser->direction);
+        SCLogError("\"%s\" is not a valid direction modifier, "
+                   "\"->\" and \"<>\" are supported.",
+                parser->direction);
         goto error;
     }
 
@@ -1223,7 +1227,7 @@ static int SigParse(DetectEngineCtx *de_ctx, Signature *s,
     SCEnter();
 
     if (!rs_check_utf8(sigstr)) {
-        SCLogError(SC_ERR_RULE_INVALID_UTF8, "rule is not valid UTF-8");
+        SCLogError("rule is not valid UTF-8");
         SCReturnInt(-1);
     }
 
@@ -1472,7 +1476,7 @@ int DetectSignatureAddTransform(Signature *s, int transform, void *options)
         SCReturnInt(-1);
     }
     if (!s->init_data->list_set) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "transforms must directly follow stickybuffers");
+        SCLogError("transforms must directly follow stickybuffers");
         SCReturnInt(-1);
     }
     if (s->init_data->transforms.cnt >= DETECT_TRANSFORMS_MAX) {
@@ -1494,15 +1498,14 @@ int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
 {
     if (alproto == ALPROTO_UNKNOWN ||
         alproto >= ALPROTO_FAILED) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid alproto %u", alproto);
+        SCLogError("invalid alproto %u", alproto);
         return -1;
     }
 
     /* since AppProtoEquals is quite permissive wrt dcerpc and smb, make sure
      * we refuse `alert dcerpc ... smb.share; content...` explicitly. */
     if (alproto == ALPROTO_SMB && s->alproto == ALPROTO_DCERPC) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                "can't set rule app proto to %s: already set to %s", AppProtoToString(alproto),
+        SCLogError("can't set rule app proto to %s: already set to %s", AppProtoToString(alproto),
                 AppProtoToString(s->alproto));
         return -1;
     }
@@ -1513,16 +1516,14 @@ int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
             // in this case, we must keep the most restrictive HTTP1
             alproto = s->alproto;
         } else {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                    "can't set rule app proto to %s: already set to %s", AppProtoToString(alproto),
-                    AppProtoToString(s->alproto));
+            SCLogError("can't set rule app proto to %s: already set to %s",
+                    AppProtoToString(alproto), AppProtoToString(s->alproto));
             return -1;
         }
     }
 
     if (AppLayerProtoDetectGetProtoName(alproto) == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "disabled alproto %s, rule can never match",
-                AppProtoToString(alproto));
+        SCLogError("disabled alproto %s, rule can never match", AppProtoToString(alproto));
         return -1;
     }
     s->alproto = alproto;
@@ -1655,7 +1656,7 @@ SigMatchData* SigMatchList2DataArray(SigMatch *head)
 
     SigMatchData *smd = (SigMatchData *)SCCalloc(len, sizeof(SigMatchData));
     if (smd == NULL) {
-        FatalError(SC_ERR_FATAL, "initializing the detection engine failed");
+        FatalError("initializing the detection engine failed");
     }
     SigMatchData *out = smd;
 
@@ -1692,8 +1693,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
     if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
         if (s->init_data->list >= (int)s->init_data->smlists_array_size ||
                 s->init_data->smlists[s->init_data->list] == NULL) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "rule %u setup buffer %s but didn't add matches to it", s->id,
+            SCLogError("rule %u setup buffer %s but didn't add matches to it", s->id,
                     DetectEngineBufferTypeGetNameById(de_ctx, s->init_data->list));
             SCReturnInt(0);
         }
@@ -1751,18 +1751,18 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
                 bufdir[x].tc);
     }
     if (ts_excl && tc_excl) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "rule %u mixes keywords with conflicting directions", s->id);
+        SCLogError("rule %u mixes keywords with conflicting directions", s->id);
         SCReturnInt(0);
     } else if (ts_excl) {
         SCLogDebug("%u: implied rule direction is toserver", s->id);
         if (DetectFlowSetupImplicit(s, SIG_FLAG_TOSERVER) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "rule %u mixes keywords with conflicting directions", s->id);
+            SCLogError("rule %u mixes keywords with conflicting directions", s->id);
             SCReturnInt(0);
         }
     } else if (tc_excl) {
         SCLogDebug("%u: implied rule direction is toclient", s->id);
         if (DetectFlowSetupImplicit(s, SIG_FLAG_TOCLIENT) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "rule %u mixes keywords with conflicting directions", s->id);
+            SCLogError("rule %u mixes keywords with conflicting directions", s->id);
             SCReturnInt(0);
         }
     } else if (dir_amb) {
@@ -1771,7 +1771,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
 
     if ((s->flags & SIG_FLAG_REQUIRE_PACKET) &&
         (s->flags & SIG_FLAG_REQUIRE_STREAM)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't mix packet keywords with "
+        SCLogError("can't mix packet keywords with "
                    "tcp-stream or flow:only_stream.  Invalidating signature.");
         SCReturnInt(0);
     }
@@ -1795,7 +1795,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
     }
 #endif
     if ((sig_flags & (SIG_FLAG_TOCLIENT | SIG_FLAG_TOSERVER)) == (SIG_FLAG_TOCLIENT | SIG_FLAG_TOSERVER)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,"You seem to have mixed keywords "
+        SCLogError("You seem to have mixed keywords "
                    "that require inspection in both directions.  Atm we only "
                    "support keywords in one direction within a rule.");
         SCReturnInt(0);
@@ -1820,15 +1820,15 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
         has_pkt |= b->packet;
     }
     if (has_pmatch && has_frame) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't mix pure content and frame inspection");
+        SCLogError("can't mix pure content and frame inspection");
         SCReturnInt(0);
     }
     if (has_app && has_frame) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't mix app-layer buffer and frame inspection");
+        SCLogError("can't mix app-layer buffer and frame inspection");
         SCReturnInt(0);
     }
     if (has_pkt && has_frame) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't mix pkt buffer and frame inspection");
+        SCLogError("can't mix pkt buffer and frame inspection");
         SCReturnInt(0);
     }
 
@@ -1840,10 +1840,10 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
                 continue;
 
             if (!(DetectEngineBufferTypeSupportsPacketGetById(de_ctx, i))) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "Signature combines packet "
-                        "specific matches (like dsize, flags, ttl) with stream / "
-                        "state matching by matching on app layer proto (like using "
-                        "http_* keywords).");
+                SCLogError("Signature combines packet "
+                           "specific matches (like dsize, flags, ttl) with stream / "
+                           "state matching by matching on app layer proto (like using "
+                           "http_* keywords).");
                 SCReturnInt(0);
             }
         }
@@ -1895,8 +1895,8 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
             if (list != DETECT_SM_LIST_BASE64_DATA &&
                 s->init_data->smlists[list] != NULL) {
                 if (s->init_data->smlists[list]->idx > idx) {
-                    SCLogError(SC_ERR_INVALID_SIGNATURE, "Rule buffer "
-                        "cannot be reset after base64_data.");
+                    SCLogError("Rule buffer "
+                               "cannot be reset after base64_data.");
                     SCReturnInt(0);
                 }
             }
@@ -1921,8 +1921,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
 
     if (s->init_data->init_flags & SIG_FLAG_INIT_JA3 && s->alproto != ALPROTO_UNKNOWN &&
             s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Cannot have ja3 with protocol %s.",
-                AppProtoToString(s->alproto));
+        SCLogError("Cannot have ja3 with protocol %s.", AppProtoToString(s->alproto));
         SCReturnInt(0);
     }
     if ((s->flags & SIG_FLAG_FILESTORE) || s->file_flags != 0 ||
@@ -1930,13 +1929,13 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
         if (s->alproto != ALPROTO_UNKNOWN &&
                 !AppLayerParserSupportsFiles(IPPROTO_TCP, s->alproto))
         {
-            SCLogError(SC_ERR_NO_FILES_FOR_PROTOCOL, "protocol %s doesn't "
-                    "support file matching", AppProtoToString(s->alproto));
+            SCLogError("protocol %s doesn't "
+                       "support file matching",
+                    AppProtoToString(s->alproto));
             SCReturnInt(0);
         }
         if (s->alproto == ALPROTO_HTTP2 && (s->file_flags & FILE_SIG_NEED_FILENAME)) {
-            SCLogError(SC_ERR_NO_FILES_FOR_PROTOCOL,
-                    "protocol HTTP2 doesn't support file name matching");
+            SCLogError("protocol HTTP2 doesn't support file name matching");
             SCReturnInt(0);
         }
 
@@ -1945,7 +1944,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
         }
     }
     if (s->id == 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Signature missing required value \"sid\".");
+        SCLogError("Signature missing required value \"sid\".");
         SCReturnInt(0);
     }
     SCReturnInt(1);
@@ -2443,11 +2442,11 @@ Signature *DetectEngineAppendSig(DetectEngineCtx *de_ctx, const char *sigstr)
     /* a duplicate signature that should be chucked out.  Check the previously
      * called function details to understand the different return values */
     if (dup_sig == 1) {
-        SCLogError(SC_ERR_DUPLICATE_SIG, "Duplicate signature \"%s\"", sigstr);
+        SCLogError("Duplicate signature \"%s\"", sigstr);
         goto error;
     } else if (dup_sig == 2) {
-        SCLogWarning(SC_ERR_DUPLICATE_SIG, "Signature with newer revision,"
-                " so the older sig replaced by this new signature \"%s\"",
+        SCLogWarning("Signature with newer revision,"
+                     " so the older sig replaced by this new signature \"%s\"",
                 sigstr);
     }
 
@@ -2525,7 +2524,7 @@ void DetectParseRegexAddToFreeList(DetectParseRegex *detect_parse)
 {
     DetectParseRegex *r = SCCalloc(1, sizeof(*r));
     if (r == NULL) {
-        FatalError(SC_ENOMEM, "failed to alloc memory for pcre free list");
+        FatalError("failed to alloc memory for pcre free list");
     }
     r->regex = detect_parse->regex;
     r->match = detect_parse->match;
@@ -2543,9 +2542,8 @@ bool DetectSetupParseRegexesOpts(const char *parse_str, DetectParseRegex *detect
     if (detect_parse->regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre compile of \"%s\" failed at "
+                   "offset %d: %s",
                 parse_str, en, errbuffer);
         return false;
     }
@@ -2570,9 +2568,8 @@ DetectParseRegex *DetectSetupPCRE2(const char *parse_str, int opts)
     if (detect_parse->regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 parse_str, (int)eo, errbuffer);
         SCFree(detect_parse);
         return NULL;
@@ -2611,7 +2608,7 @@ int SC_Pcre2SubstringGet(
 void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
 {
     if (!DetectSetupParseRegexesOpts(parse_str, detect_parse, 0)) {
-        FatalError(SC_ERR_PCRE_COMPILE, "pcre compile and study failed");
+        FatalError("pcre compile and study failed");
     }
 }
 
index f55ac998a67477ad4cc19de74e3e1ec8ba897b11..1cf85e5e946b7288ce5f674c063e466be9dcca8e 100644 (file)
@@ -138,14 +138,14 @@ void DetectPcreRegister (void)
 
     parse_regex = DetectSetupPCRE2(PARSE_REGEX, 0);
     if (parse_regex == NULL) {
-        FatalError(SC_ERR_PCRE_COMPILE, "pcre2 compile failed for parse_regex");
+        FatalError("pcre2 compile failed for parse_regex");
     }
 
     /* setup the capture regex, as it needs PCRE2_UNGREEDY we do it manually */
     /* pkt_http_ua should be pkt, http_ua, for this reason the UNGREEDY */
     parse_capture_regex = DetectSetupPCRE2(PARSE_CAPTURE_REGEX, PCRE2_UNGREEDY);
     if (parse_capture_regex == NULL) {
-        FatalError(SC_ERR_PCRE_COMPILE, "pcre2 compile failed for parse_capture_regex");
+        FatalError("pcre2 compile failed for parse_capture_regex");
     }
 
 #ifdef PCRE2_HAVE_JIT
@@ -307,7 +307,7 @@ int DetectPcrePayloadMatch(DetectEngineThreadCtx *det_ctx, const Signature *s,
 static int DetectPcreSetList(int list, int set)
 {
     if (list != DETECT_SM_LIST_NOTSET) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "only one pcre option to specify a buffer type is allowed");
+        SCLogError("only one pcre option to specify a buffer type is allowed");
         return -1;
     }
     return set;
@@ -406,13 +406,13 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
     ret = pcre2_match(
             parse_regex->regex, (PCRE2_SPTR8)regexstr, slen, 0, 0, parse_regex->match, NULL);
     if (ret <= 0) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre parse error: %s", regexstr);
+        SCLogError("pcre parse error: %s", regexstr);
         goto error;
     }
 
     res = pcre2_substring_copy_bynumber(parse_regex->match, 1, (PCRE2_UCHAR8 *)re, &slen);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return NULL;
     }
 
@@ -421,7 +421,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
         res = pcre2_substring_copy_bynumber(
                 parse_regex->match, 2, (PCRE2_UCHAR8 *)op_str, &copylen);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             return NULL;
         }
         op = op_str;
@@ -470,7 +470,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
 
                 case 'B': /* snort's option */
                     if (*sm_list != DETECT_SM_LIST_NOTSET) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'B' inconsistent with chosen buffer");
+                        SCLogError("regex modifier 'B' inconsistent with chosen buffer");
                         goto error;
                     }
                     pd->flags |= DETECT_PCRE_RAWBYTES;
@@ -483,7 +483,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
 
                 case 'U': { /* snort's option */
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'U' inconsistent with 'B'");
+                        SCLogError("regex modifier 'U' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_uri");
@@ -493,7 +493,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'V': {
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'V' inconsistent with 'B'");
+                        SCLogError("regex modifier 'V' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_user_agent");
@@ -503,7 +503,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'W': {
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'W' inconsistent with 'B'");
+                        SCLogError("regex modifier 'W' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_host");
@@ -514,7 +514,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'Z': {
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'Z' inconsistent with 'B'");
+                        SCLogError("regex modifier 'Z' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_raw_host");
@@ -524,7 +524,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'H': { /* snort's option */
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'H' inconsistent with 'B'");
+                        SCLogError("regex modifier 'H' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_header");
@@ -533,7 +533,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                     break;
                 } case 'I': { /* snort's option */
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'I' inconsistent with 'B'");
+                        SCLogError("regex modifier 'I' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_raw_uri");
@@ -549,7 +549,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'M': { /* snort's option */
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'M' inconsistent with 'B'");
+                        SCLogError("regex modifier 'M' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_method");
@@ -559,7 +559,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                 }
                 case 'C': { /* snort's option */
                     if (pd->flags & DETECT_PCRE_RAWBYTES) {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "regex modifier 'C' inconsistent with 'B'");
+                        SCLogError("regex modifier 'C' inconsistent with 'B'");
                         goto error;
                     }
                     int list = DetectBufferTypeGetByName("http_cookie");
@@ -596,7 +596,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                     break;
                 }
                 default:
-                    SCLogError(SC_ERR_UNKNOWN_REGEX_MOD, "unknown regex modifier '%c'", *op);
+                    SCLogError("unknown regex modifier '%c'", *op);
                     goto error;
             }
             op++;
@@ -610,18 +610,18 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
     /* host header */
     if (check_host_header) {
         if (pd->flags & DETECT_PCRE_CASELESS) {
-            SCLogWarning(SC_ERR_INVALID_SIGNATURE, "http host pcre(\"W\") "
+            SCLogWarning("http host pcre(\"W\") "
                          "specified along with \"i(caseless)\" modifier.  "
                          "Since the hostname buffer we match against "
                          "is actually lowercase, having a "
                          "nocase is redundant.");
         }
         else if (DetectPcreHasUpperCase(re)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "pcre host(\"W\") "
-                "specified has an uppercase char.  "
-                "Since the hostname buffer we match against "
-                "is actually lowercase, please specify an "
-                "all lowercase based pcre.");
+            SCLogError("pcre host(\"W\") "
+                       "specified has an uppercase char.  "
+                       "Since the hostname buffer we match against "
+                       "is actually lowercase, please specify an "
+                       "all lowercase based pcre.");
             goto error;
         }
     }
@@ -644,9 +644,8 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
     if (pd->parse_regex.regex == NULL)  {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 regexstr, (int)eo2, errbuffer);
         goto error;
     }
@@ -667,7 +666,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
 
     pd->parse_regex.context = pcre2_match_context_create(NULL);
     if (pd->parse_regex.context == NULL) {
-        SCLogError(SC_ERR_PCRE_COMPILE, "pcre2 could not create match context");
+        SCLogError("pcre2 could not create match context");
         goto error;
     }
     pd->parse_regex.match = pcre2_match_data_create_from_pattern(pd->parse_regex.regex, NULL);
@@ -715,8 +714,8 @@ static int DetectPcreParseCapture(const char *regexstr, DetectEngineCtx *de_ctx,
         char *ptr = NULL;
         while ((name_array[name_idx] = strtok_r(name_idx == 0 ? capture_names : NULL, " ,", &ptr))){
             if (name_idx > (capture_cnt - 1)) {
-                SCLogError(SC_ERR_VAR_LIMIT, "more pkt/flow "
-                        "var capture names than capturing substrings");
+                SCLogError("more pkt/flow "
+                           "var capture names than capturing substrings");
                 return -1;
             }
             SCLogDebug("name '%s'", name_array[name_idx]);
@@ -751,8 +750,8 @@ static int DetectPcreParseCapture(const char *regexstr, DetectEngineCtx *de_ctx,
                 pd->idx++;
 
             } else {
-                SCLogError(SC_ERR_VAR_LIMIT, " pkt/flow "
-                        "var capture names must start with 'pkt:' or 'flow:'");
+                SCLogError(" pkt/flow "
+                           "var capture names must start with 'pkt:' or 'flow:'");
                 return -1;
             }
 
@@ -783,14 +782,14 @@ static int DetectPcreParseCapture(const char *regexstr, DetectEngineCtx *de_ctx,
         res = pcre2_substring_copy_bynumber(
                 parse_capture_regex->match, 1, (PCRE2_UCHAR8 *)type_str, &copylen);
         if (res != 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         cap_buffer_len = strlen(regexstr) + 1;
         res = pcre2_substring_copy_bynumber(
                 parse_capture_regex->match, 2, (PCRE2_UCHAR8 *)capture_str, &cap_buffer_len);
         if (res != 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         if (strlen(capture_str) == 0 || strlen(type_str) == 0) {
@@ -801,8 +800,9 @@ static int DetectPcreParseCapture(const char *regexstr, DetectEngineCtx *de_ctx,
         SCLogDebug("capture \'%s\'", capture_str);
 
         if (pd->idx >= DETECT_PCRE_CAPTURE_MAX) {
-            SCLogError(SC_ERR_VAR_LIMIT, "rule can have maximally %d pkt/flow "
-                    "var captures", DETECT_PCRE_CAPTURE_MAX);
+            SCLogError("rule can have maximally %d pkt/flow "
+                       "var captures",
+                    DETECT_PCRE_CAPTURE_MAX);
             return -1;
         }
 
@@ -870,9 +870,8 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, const char *r
     int sm_list = -1;
     if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
         if (parsed_sm_list != DETECT_SM_LIST_NOTSET && parsed_sm_list != s->init_data->list) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "Expression seen with a sticky buffer still set; either (1) reset sticky "
-                    "buffer with pkt_data or (2) use a sticky buffer providing \"%s\".",
+            SCLogError("Expression seen with a sticky buffer still set; either (1) reset sticky "
+                       "buffer with pkt_data or (2) use a sticky buffer providing \"%s\".",
                     DetectEngineBufferTypeGetDescriptionById(de_ctx, parsed_sm_list));
             goto error;
         }
@@ -924,8 +923,8 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, const char *r
     SigMatch *prev_pm = DetectGetLastSMByListPtr(s, sm->prev,
             DETECT_CONTENT, DETECT_PCRE, -1);
     if (s->init_data->list == DETECT_SM_LIST_NOTSET && prev_pm == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "pcre with /R (relative) needs "
-                "preceding match in the same buffer");
+        SCLogError("pcre with /R (relative) needs "
+                   "preceding match in the same buffer");
         goto error_nofree;
     /* null is allowed when we use a sticky buffer */
     } else if (prev_pm == NULL) {
index b486ca9502c89ab73ba9df919bf7c8e53f874ba1..4b20b31a62d831a9675b4fc68034f23089c1a802 100644 (file)
@@ -75,8 +75,7 @@ static int DetectPktDataSetup (DetectEngineCtx *de_ctx, Signature *s, const char
 {
     SCEnter();
     if (s->init_data->transforms.cnt) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "previous transforms not consumed before 'pkt_data'");
+        SCLogError("previous transforms not consumed before 'pkt_data'");
         SCReturnInt(-1);
     }
     s->init_data->list = DETECT_SM_LIST_NOTSET;
index 2b3abac1d7818dd940a61ac332c227bc56c8ef5e..4d366430edcbc4ebf1190a9cb4a174762068a171 100644 (file)
@@ -96,14 +96,14 @@ static int DetectPktvarSetup (DetectEngineCtx *de_ctx, Signature *s, const char
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret != 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "\"%s\" is not a valid setting for pktvar.", rawstr);
+        SCLogError("\"%s\" is not a valid setting for pktvar.", rawstr);
         return -1;
     }
 
     const char *str_ptr;
     res = pcre2_substring_get_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         return -1;
     }
     varname = (char *)str_ptr;
@@ -111,7 +111,7 @@ static int DetectPktvarSetup (DetectEngineCtx *de_ctx, Signature *s, const char
     res = pcre2_substring_get_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
         pcre2_substring_free((PCRE2_UCHAR8 *)varname);
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         return -1;
     }
     varcontent = (char *)str_ptr;
index a348022b869cddefc95bf4b8dbe46f9b001e2287..f38b56bf8b9ccf68fba1bf8d6397c713658793eb 100644 (file)
@@ -57,18 +57,18 @@ static int DetectPrefilterSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
     SCEnter();
 
     if (nullstr != NULL) {
-        SCLogError(SC_EINVAL, "prefilter has value");
+        SCLogError("prefilter has value");
         SCReturnInt(-1);
     }
 
     if (s->flags & SIG_FLAG_PREFILTER) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter already set");
+        SCLogError("prefilter already set");
         SCReturnInt(-1);
     }
 
     SigMatch *sm = DetectGetLastSM(s);
     if (sm == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter needs preceding match");
+        SCLogError("prefilter needs preceding match");
         SCReturnInt(-1);
     }
 
@@ -82,15 +82,14 @@ static int DetectPrefilterSetup (DetectEngineCtx *de_ctx, Signature *s, const ch
                  (cd->flags & DETECT_CONTENT_OFFSET) ||
                  (cd->flags & DETECT_CONTENT_DEPTH)))
         {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter; cannot be "
-                    "used with negated content, along with relative modifiers");
+            SCLogError("prefilter; cannot be "
+                       "used with negated content, along with relative modifiers");
             SCReturnInt(-1);
         }
         cd->flags |= DETECT_CONTENT_FAST_PATTERN;
     } else {
         if (sigmatch_table[sm->type].SupportsPrefilter == NULL) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter is not supported for %s",
-                    sigmatch_table[sm->type].name);
+            SCLogError("prefilter is not supported for %s", sigmatch_table[sm->type].name);
             SCReturnInt(-1);
         }
         s->flags |= SIG_FLAG_PREFILTER;
index ce72a19e4667526e66950d31e2ae8ad5b9fa7739..2808be90c159fdd80accdd9ad2c8f4c869a9524a 100644 (file)
@@ -67,15 +67,16 @@ static int DetectPrioritySetup (DetectEngineCtx *de_ctx, Signature *s, const cha
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Invalid Priority in Signature "
-                     "- %s", rawstr);
+        SCLogError("Invalid Priority in Signature "
+                   "- %s",
+                rawstr);
         return -1;
     }
 
     pcre2len = sizeof(copy_str);
     ret = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
@@ -83,14 +84,14 @@ static int DetectPrioritySetup (DetectEngineCtx *de_ctx, Signature *s, const cha
     char *endptr = NULL;
     prio = strtol(copy_str, &endptr, 10);
     if (endptr == NULL || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Saw an invalid character as arg "
+        SCLogError("Saw an invalid character as arg "
                    "to priority keyword");
         return -1;
     }
 
     if (s->init_data->init_flags & SIG_FLAG_INIT_PRIO_EXPLICT) {
-        SCLogWarning(SC_ERR_CONFLICTING_RULE_KEYWORDS, "duplicate priority "
-                "keyword. Using highest priority in the rule");
+        SCLogWarning("duplicate priority "
+                     "keyword. Using highest priority in the rule");
         s->prio = MIN(s->prio, prio);
     } else {
         s->prio = prio;
index 33f8aa54098ebdb45130ae614f3ac2e67e243409..f5ae1bcd76791171528092d253f850eb9a14c6b6 100644 (file)
@@ -195,14 +195,14 @@ static bool DetectQuicHashValidateCallback(const Signature *s, const char **sige
             *sigerror = BUFFER_NAME " should not be used together with "
                                     "nocase, since the rule is automatically "
                                     "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         if (cd->content_len != 32) {
             *sigerror = "Invalid length of the specified" BUFFER_NAME " (should "
                         "be 32 characters long). This rule will therefore "
                         "never match.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return FALSE;
         }
         for (size_t i = 0; i < cd->content_len; ++i) {
@@ -210,7 +210,7 @@ static bool DetectQuicHashValidateCallback(const Signature *s, const char **sige
                 *sigerror = "Invalid " BUFFER_NAME
                             " string (should be string of hexadecimal characters)."
                             "This rule will therefore never match.";
-                SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+                SCLogWarning("rule %u: %s", s->id, *sigerror);
                 return FALSE;
             }
         }
index e28a1f51c8097aaefc84f7d63dd7952ae1e4c6bc..1047e1340ba450f3837708ee7b5c973273957993 100644 (file)
@@ -55,22 +55,20 @@ static int DetectRawbytesSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     SCEnter();
 
     if (nullstr != NULL) {
-        SCLogError(SC_EINVAL, "rawbytes has no value");
+        SCLogError("rawbytes has no value");
         SCReturnInt(-1);
     }
 
     if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
-        SCLogError(SC_ERR_RAWBYTES_BUFFER,
-                "\"rawbytes\" cannot be combined "
-                "with the \"%s\" sticky buffer",
+        SCLogError("\"rawbytes\" cannot be combined "
+                   "with the \"%s\" sticky buffer",
                 DetectEngineBufferTypeGetNameById(de_ctx, s->init_data->list));
         SCReturnInt(-1);
     }
 
     SigMatch *pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(
-                SC_ERR_RAWBYTES_MISSING_CONTENT, "\"rawbytes\" needs a preceding content option");
+        SCLogError("\"rawbytes\" needs a preceding content option");
         SCReturnInt(-1);
     }
 
@@ -78,16 +76,14 @@ static int DetectRawbytesSetup(DetectEngineCtx *de_ctx, Signature *s, const char
         case DETECT_CONTENT: {
             DetectContentData *cd = (DetectContentData *)pm->ctx;
             if (cd->flags & DETECT_CONTENT_RAWBYTES) {
-                SCLogError(SC_ERR_INVALID_SIGNATURE,
-                        "can't use multiple rawbytes modifiers for the same content. ");
+                SCLogError("can't use multiple rawbytes modifiers for the same content. ");
                 SCReturnInt(-1);
             }
             cd->flags |= DETECT_CONTENT_RAWBYTES;
             break;
         }
         default:
-            SCLogError(SC_ERR_RAWBYTES_MISSING_CONTENT,
-                    "\"rawbytes\" needs a preceding content option");
+            SCLogError("\"rawbytes\" needs a preceding content option");
             SCReturnInt(-1);
     }
 
index 458b4ddc2a52c86924671d0da75291338a30a12a..381542d97d71368a611c19a3da7a5f40f19a4034 100644 (file)
@@ -102,8 +102,9 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 2) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Unable to parse \"reference\" "
-                   "keyword argument - \"%s\".   Invalid argument.", rawstr);
+        SCLogError("Unable to parse \"reference\" "
+                   "keyword argument - \"%s\".   Invalid argument.",
+                rawstr);
         return NULL;
     }
 
@@ -115,14 +116,14 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx
     pcre2len = sizeof(key);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)key, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     pcre2len = sizeof(content);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)content, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -134,13 +135,11 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx
         ref->key = lookup_ref_conf->url;
     } else {
         if (SigMatchStrictEnabled(DETECT_REFERENCE)) {
-            SCLogError(SC_ERR_REFERENCE_UNKNOWN,
-                    "unknown reference key \"%s\"", key);
+            SCLogError("unknown reference key \"%s\"", key);
             goto error;
         }
 
-        SCLogWarning(SC_ERR_REFERENCE_UNKNOWN,
-                "unknown reference key \"%s\"", key);
+        SCLogWarning("unknown reference key \"%s\"", key);
 
         char str[2048];
         snprintf(str, sizeof(str), "config reference: %s undefined\n", key);
@@ -155,7 +154,7 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx
     /* make a copy so we can free pcre's substring */
     ref->reference = SCStrdup(content);
     if (ref->reference == NULL) {
-        SCLogError(SC_ENOMEM, "strdup failed: %s", strerror(errno));
+        SCLogError("strdup failed: %s", strerror(errno));
         goto error;
     }
 
index 72d547ea6ff07197fce4367bcc6f6f28709c26bd..63fb36cccff39f27b352bbc138277fd1a37fc1f1 100644 (file)
@@ -96,7 +96,7 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
     uint16_t len = 0;
 
     if (s->init_data->negated) {
-        SCLogError(SC_EINVAL, "Can't negate replacement string: %s", replacestr);
+        SCLogError("Can't negate replacement string: %s", replacestr);
         return -1;
     }
 
@@ -105,9 +105,7 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
         case RUNMODE_IPFW:
             break;
         default:
-            SCLogWarning(SC_ERR_RUNMODE,
-                         "Can't use 'replace' keyword in non IPS mode: %s",
-                         s->sig_str);
+            SCLogWarning("Can't use 'replace' keyword in non IPS mode: %s", s->sig_str);
             /* this is a success, having the alert is interesting */
             return 0;
     }
@@ -120,8 +118,8 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
     const SigMatch *pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH,
             DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_WITHIN_MISSING_CONTENT, "replace needs"
-                "preceding content option for raw sig");
+        SCLogError("replace needs"
+                   "preceding content option for raw sig");
         SCFree(content);
         return -1;
     }
@@ -129,18 +127,18 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
     /* we can remove this switch now with the unified structure */
     DetectContentData *ud = (DetectContentData *)pm->ctx;
     if (ud == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid argument");
+        SCLogError("invalid argument");
         SCFree(content);
         return -1;
     }
     if (ud->flags & DETECT_CONTENT_NEGATED) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
-                "negated keyword set along with a replacement");
+        SCLogError("can't have a relative "
+                   "negated keyword set along with a replacement");
         goto error;
     }
     if (ud->content_len != len) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a content "
-                "length different from replace length");
+        SCLogError("can't have a content "
+                   "length different from replace length");
         goto error;
     }
 
index fb3def8d102886110d6677d9ba6e95984f1cef31..dda513cc0a9fe3b1870431764e3814baac2b4739 100644 (file)
@@ -45,20 +45,20 @@ static int DetectRevSetup (DetectEngineCtx *de_ctx, Signature *s, const char *ra
     char *endptr = NULL;
     rev = strtoul(rawstr, &endptr, 10);
     if (endptr == NULL || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid character as arg "
+        SCLogError("invalid character as arg "
                    "to rev keyword");
         goto error;
     }
     if (rev >= UINT_MAX) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "rev value to high, max %u", UINT_MAX);
+        SCLogError("rev value to high, max %u", UINT_MAX);
         goto error;
     }
     if (rev == 0) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "rev value 0 is invalid");
+        SCLogError("rev value 0 is invalid");
         goto error;
     }
     if (s->rev > 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "duplicated 'rev' keyword detected");
+        SCLogError("duplicated 'rev' keyword detected");
         goto error;
     }
 
index 1e5236811ce1f2217dd49ed5135b855fa7f2b5f6..4983982ad846b647c449f908dd69d7c388f1799d 100644 (file)
@@ -162,7 +162,7 @@ static DetectRfbSecresultData *DetectRfbSecresultParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
@@ -174,7 +174,7 @@ static DetectRfbSecresultData *DetectRfbSecresultParse (const char *rawstr)
     }
 
     if(found == 0) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown secresult value %s", rawstr);
+        SCLogError("unknown secresult value %s", rawstr);
         goto error;
     }
 
index 5b53287b49e6466977b4c112ab97ab62eb1a08ec..400ee5cb087c7b51e54ead7fe6bed13fe26db72f 100644 (file)
@@ -121,7 +121,7 @@ static int DetectRfbSectypeSetup (DetectEngineCtx *de_ctx, Signature *s, const c
 
     DetectU32Data *dd = DetectRfbSectypeParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index 95ef8f08c8577d10917fc708029533c9a17f33af..0fee3fc1d12fec34f4e55a67748db4a32da7ae16 100644 (file)
@@ -154,7 +154,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
 
     ret = DetectParsePcreExec(&parse_regex, rpcstr, 0, 0);
     if (ret < 1 || ret > 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 ", string %s", ret, rpcstr);
+        SCLogError("parse error, ret %" PRId32 ", string %s", ret, rpcstr);
         goto error;
     }
 
@@ -163,7 +163,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
         args[0] = (char *)str_ptr;
@@ -172,7 +172,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
             res = pcre2_substring_get_bynumber(
                     parse_regex.match, 2, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                SCLogError("pcre2_substring_get_bynumber failed");
                 goto error;
             }
             args[1] = (char *)str_ptr;
@@ -181,7 +181,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
             res = pcre2_substring_get_bynumber(
                     parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                SCLogError("pcre2_substring_get_bynumber failed");
                 goto error;
             }
             args[2] = (char *)str_ptr;
@@ -202,7 +202,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
             switch (i) {
                 case 0:
                     if (StringParseUint32(&rd->program, 10, strlen(args[i]), args[i]) <= 0) {
-                        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid size specified for the rpc program:\"%s\"", args[i]);
+                        SCLogError("Invalid size specified for the rpc program:\"%s\"", args[i]);
                         goto error;
                     }
                     rd->flags |= DETECT_RPC_CHECK_PROGRAM;
@@ -210,7 +210,8 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
                 case 1:
                     if (args[i][0] != '*') {
                         if (StringParseUint32(&rd->program_version, 10, strlen(args[i]), args[i]) <= 0) {
-                            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid size specified for the rpc version:\"%s\"", args[i]);
+                            SCLogError(
+                                    "Invalid size specified for the rpc version:\"%s\"", args[i]);
                             goto error;
                         }
                         rd->flags |= DETECT_RPC_CHECK_VERSION;
@@ -219,7 +220,8 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
                 case 2:
                     if (args[i][0] != '*') {
                         if (StringParseUint32(&rd->procedure, 10, strlen(args[i]), args[i]) <= 0) {
-                            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid size specified for the rpc procedure:\"%s\"", args[i]);
+                            SCLogError(
+                                    "Invalid size specified for the rpc procedure:\"%s\"", args[i]);
                             goto error;
                         }
                         rd->flags |= DETECT_RPC_CHECK_PROCEDURE;
@@ -227,7 +229,7 @@ static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcst
                 break;
             }
         } else {
-            SCLogError(SC_EINVAL, "invalid rpc option %s", rpcstr);
+            SCLogError("invalid rpc option %s", rpcstr);
             goto error;
         }
     }
index 2333e0589fbd03801292c4173828c1424bbf7722..0002e1066384837839ce00ac386e4d9f76752e93 100644 (file)
@@ -55,20 +55,20 @@ static int DetectSidSetup (DetectEngineCtx *de_ctx, Signature *s, const char *si
     char *endptr = NULL;
     id = strtoul(sidstr, &endptr, 10);
     if (endptr == NULL || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid character as arg "
+        SCLogError("invalid character as arg "
                    "to sid keyword");
         goto error;
     }
     if (id >= UINT_MAX) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "sid value too high, max %u", UINT_MAX);
+        SCLogError("sid value too high, max %u", UINT_MAX);
         goto error;
     }
     if (id == 0) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "sid value 0 is invalid");
+        SCLogError("sid value 0 is invalid");
         goto error;
     }
     if (s->id > 0) {
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT, "duplicated 'sid' keyword detected");
+        SCLogError("duplicated 'sid' keyword detected");
         goto error;
     }
 
index 4134d8e323253c81f8a89a4c1d27b46878e77005..98bd2cd5a4c748b96a8c7c2edfff59b88cac1e5b 100644 (file)
@@ -80,19 +80,19 @@ static bool DetectSipMethodValidateCallback(const Signature *s, const char **sig
         if (cd->content && cd->content_len) {
             if (cd->content[cd->content_len-1] == 0x20) {
                 *sigerror = "sip.method pattern with trailing space";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return true;
             } else if (cd->content[0] == 0x20) {
                 *sigerror = "sip.method pattern with leading space";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return true;
             } else if (cd->content[cd->content_len-1] == 0x09) {
                 *sigerror = "sip.method pattern with trailing tab";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return true;
             } else if (cd->content[0] == 0x09) {
                 *sigerror = "sip.method pattern with leading tab";
-                SCLogError(SC_ERR_INVALID_SIGNATURE, "%s", *sigerror);
+                SCLogError("%s", *sigerror);
                 return true;
             }
         }
index f5169448fea496837b2615d9a8cee93d82e10650..0f5edd58d501167c960457e303160218fe984857 100644 (file)
@@ -129,14 +129,14 @@ static DetectSNMPPduTypeData *DetectSNMPPduTypeParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Parse error %s", rawstr);
+        SCLogError("Parse error %s", rawstr);
         goto error;
     }
 
     pcre2len = sizeof(value1);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)value1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -147,7 +147,7 @@ static DetectSNMPPduTypeData *DetectSNMPPduTypeParse (const char *rawstr)
     /* set the value */
     dd->pdu_type = strtoul(value1, &endptr, 10);
     if (endptr == NULL || *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid character as arg "
+        SCLogError("invalid character as arg "
                    "to snmp.pdu_type keyword");
         goto error;
     }
@@ -182,7 +182,7 @@ static int DetectSNMPPduTypeSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = DetectSNMPPduTypeParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index f7ff2b6dd22555951987e9162fdf75a73341ee7a..57359c091bd6bd5ca4d570f77e96711356004d2e 100644 (file)
@@ -139,7 +139,7 @@ static int DetectSNMPVersionSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = DetectSNMPVersionParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index ff7c0e9897447179900ffd38b3049856c64f9321..0afe683ba49cd083a6893792c8beee84f8771893 100644 (file)
@@ -108,7 +108,7 @@ static int DetectSshHasshServerStringSetup(DetectEngineCtx *de_ctx, Signature *s
     /* Check if Hassh is disabled */
     if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_SSH_HASSH_SERVER_STRING)) {
-            SCLogError(SC_WARN_HASSH_DISABLED, "hassh support is not enabled");
+            SCLogError("hassh support is not enabled");
         }
         return -2;
     }
index c71cfd4d6db53f3fe8e54e0a38db0000fcaa0e13..30ed206b508bfa003b6f8262e71a4de3fe80f43c 100644 (file)
@@ -109,7 +109,7 @@ static int DetectSshHasshServerSetup(DetectEngineCtx *de_ctx, Signature *s, cons
     /* Check if Hassh is disabled */
     if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_SSH_HASSH_SERVER)) {
-            SCLogError(SC_WARN_HASSH_DISABLED, "hassh support is not enabled");
+            SCLogError("hassh support is not enabled");
         }
         return -2;
     }
@@ -132,7 +132,7 @@ static bool DetectSshHasshServerHashValidateCallback(const Signature *s, const c
             *sigerror = "ssh.hassh.server should not be used together with "
                         "nocase, since the rule is automatically "
                         "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         if (cd->content_len != 32)
@@ -140,7 +140,7 @@ static bool DetectSshHasshServerHashValidateCallback(const Signature *s, const c
             *sigerror = "Invalid length of the specified ssh.hassh.server (should "
                         "be 32 characters long). This rule will therefore "
                         "never match.";
-            SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return false;
         }
         for (size_t i = 0; i < cd->content_len; ++i)
@@ -149,7 +149,7 @@ static bool DetectSshHasshServerHashValidateCallback(const Signature *s, const c
             {
                 *sigerror = "Invalid ssh.hassh.server string (should be string of hexademical characters)."
                             "This rule will therefore never match.";
-                SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+                SCLogWarning("rule %u: %s", s->id, *sigerror);
                 return false;
             }
         }
index 3145781f94b998f4ce31dd860683627cc0670f27..64cf45182b7eea1dc7fe5e272308bfed1cb4bf6b 100644 (file)
@@ -108,7 +108,7 @@ static int DetectSshHasshStringSetup(DetectEngineCtx *de_ctx, Signature *s, cons
     /* Check if Hassh is disabled */
     if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_SSH_HASSH_STRING)) {
-            SCLogError(SC_WARN_HASSH_DISABLED, "hassh support is not enabled");
+            SCLogError("hassh support is not enabled");
         }
         return -2;
     }
index d12c750b23a5da948c848abdd1ad30327c8ad1ae..5c87fe1904e1910068f4f97a14446509d41d7b0d 100644 (file)
@@ -109,7 +109,7 @@ static int DetectSshHasshSetup(DetectEngineCtx *de_ctx, Signature *s, const char
     /* Check if Hassh is disabled */
     if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_SSH_HASSH)) {
-            SCLogError(SC_WARN_HASSH_DISABLED, "hassh support is not enabled");
+            SCLogError("hassh support is not enabled");
         }
         return -2;
     }
@@ -134,7 +134,7 @@ static bool DetectSshHasshHashValidateCallback(const Signature *s,
             *sigerror = "ssh.hassh should not be used together with "
                         "nocase, since the rule is automatically "
                         "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         if (cd->content_len != 32)
@@ -142,7 +142,7 @@ static bool DetectSshHasshHashValidateCallback(const Signature *s,
             *sigerror = "Invalid length of the specified ssh.hassh (should "
                         "be 32 characters long). This rule will therefore "
                         "never match.";
-            SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return false;
         }
         for (size_t i = 0; i < cd->content_len; ++i)
@@ -151,7 +151,7 @@ static bool DetectSshHasshHashValidateCallback(const Signature *s,
             {
                 *sigerror = "Invalid ssh.hassh string (should be string of hexademical characters)."
                             "This rule will therefore never match.";
-                SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+                SCLogWarning("rule %u: %s", s->id, *sigerror);
                 return false;
             }
         }
index 1f15f32fa81484ce4f1e96aae3e1c034e18b27b9..65f779c16532eb56886171c9283a8a6afd7bf976 100644 (file)
@@ -165,7 +165,7 @@ static DetectSshVersionData *DetectSshVersionParse (DetectEngineCtx *de_ctx, con
 
     ret = DetectParsePcreExec(&parse_regex, str, 0, 0);
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid ssh.protoversion option");
+        SCLogError("invalid ssh.protoversion option");
         goto error;
     }
 
@@ -174,7 +174,7 @@ static DetectSshVersionData *DetectSshVersionParse (DetectEngineCtx *de_ctx, con
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
index 849c01e0eb60c166662d5fff391fe018abaa29ce..3048a81dec209f92d5ad13682b4d3f8fba125e41 100644 (file)
@@ -162,7 +162,7 @@ static DetectSshSoftwareVersionData *DetectSshSoftwareVersionParse (DetectEngine
     ret = DetectParsePcreExec(&parse_regex, str, 0, 0);
 
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid ssh.softwareversion option");
+        SCLogError("invalid ssh.softwareversion option");
         goto error;
     }
 
@@ -171,7 +171,7 @@ static DetectSshSoftwareVersionData *DetectSshSoftwareVersionParse (DetectEngine
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
index 1d02d3bb6e7272fcedb55feca197cb22b9a02e97..b9b6d521567589a452c9ce55f66ec986a27a5cea 100644 (file)
@@ -150,15 +150,16 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
 
     ret = DetectParsePcreExec(&parse_regex1, arg, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid arg \"%s\" supplied to "
-                   "ssl_state keyword.", arg);
+        SCLogError("Invalid arg \"%s\" supplied to "
+                   "ssl_state keyword.",
+                arg);
         goto error;
     }
 
     pcre2len = sizeof(str1);
     res = pcre2_substring_copy_bynumber(parse_regex1.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
     negate = !strcmp("!", str1);
@@ -166,7 +167,7 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
     pcre2len = sizeof(str1);
     res = pcre2_substring_copy_bynumber(parse_regex1.match, 2, (PCRE2_UCHAR8 *)str1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -191,29 +192,31 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
         if (negate)
             mask |= DETECT_SSL_STATE_UNKNOWN;
     } else {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Found invalid option \"%s\" "
-                   "in ssl_state keyword.", str1);
+        SCLogError("Found invalid option \"%s\" "
+                   "in ssl_state keyword.",
+                str1);
         goto error;
     }
 
     pcre2len = sizeof(str1);
     res = pcre2_substring_copy_bynumber(parse_regex1.match, 3, (PCRE2_UCHAR8 *)str1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
     while (res >= 0 && strlen(str1) > 0) {
         ret = DetectParsePcreExec(&parse_regex2, str1, 0, 0);
         if (ret < 1) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid arg \"%s\" supplied to "
-                       "ssl_state keyword.", arg);
+            SCLogError("Invalid arg \"%s\" supplied to "
+                       "ssl_state keyword.",
+                    arg);
             goto error;
         }
 
         pcre2len = sizeof(str2);
         res = pcre2_substring_copy_bynumber(parse_regex2.match, 1, (PCRE2_UCHAR8 *)str2, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         negate = !strcmp("!", str2);
@@ -221,7 +224,7 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
         pcre2len = sizeof(str2);
         res = pcre2_substring_copy_bynumber(parse_regex2.match, 2, (PCRE2_UCHAR8 *)str2, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         if (strcmp("client_hello", str2) == 0) {
@@ -245,15 +248,16 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
             if (negate)
                 mask |= DETECT_SSL_STATE_UNKNOWN;
         } else {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "Found invalid option \"%s\" "
-                       "in ssl_state keyword.", str2);
+            SCLogError("Found invalid option \"%s\" "
+                       "in ssl_state keyword.",
+                    str2);
             goto error;
         }
 
         pcre2len = sizeof(str2);
         res = pcre2_substring_copy_bynumber(parse_regex2.match, 3, (PCRE2_UCHAR8 *)str2, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
 
index e91d092393e321a27d7eb41410bd5cf49e87a4f5..b4e142bd7389507ad9d7657e9bee9db0a7c3c1cb 100644 (file)
@@ -215,7 +215,7 @@ static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, cons
         tmp_str++;
     }
     if (tmp_str[0] == 0) {
-        SCLogError(SC_EINVAL, "Invalid empty value");
+        SCLogError("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_EINVAL, "Invalid duplicate value");
+                    SCLogError("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_EINVAL, "Invalid unknown value");
+            SCLogError("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_EINVAL, "Invalid value mixing negative and positive forms");
+            SCLogError("Invalid value mixing negative and positive forms");
             goto error;
         }
 
index 0a3e64d4f89996015082302e5a14174e4eb7d68b..a17b380a03cc3daede9d458e94997b34d88ca1f1 100644 (file)
@@ -162,13 +162,13 @@ static DetectTagData *DetectTagParse(const char *tagstr)
 
     ret = DetectParsePcreExec(&parse_regex, tagstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 ", string %s", ret, tagstr);
+        SCLogError("parse error, ret %" PRId32 ", string %s", ret, tagstr);
         goto error;
     }
 
     res = pcre2_substring_get_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0 || str_ptr == NULL) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
 
@@ -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_EINVAL, "Invalid argument type. Must be session or host (%s)", tagstr);
+        SCLogError("Invalid argument type. Must be session or host (%s)", tagstr);
         goto error;
     }
     pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
@@ -193,16 +193,15 @@ static DetectTagData *DetectTagParse(const char *tagstr)
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0 || str_ptr == NULL) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
         /* count */
         if (StringParseUint32(&td.count, 10, strlen(str_ptr),
                     str_ptr) <= 0) {
-            SCLogError(SC_EINVAL,
-                    "Invalid argument for count. Must be a value in the range of 0 to %" PRIu32
-                    " (%s)",
+            SCLogError("Invalid argument for count. Must be a value in the range of 0 to %" PRIu32
+                       " (%s)",
                     UINT32_MAX, tagstr);
             goto error;
         }
@@ -213,7 +212,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
         res = pcre2_substring_get_bynumber(
                 parse_regex.match, 4, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0 || str_ptr == NULL) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
@@ -228,7 +227,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
         } else if (strcasecmp("bytes", str_ptr) == 0) {
             td.metric = DETECT_TAG_METRIC_BYTES;
         } else {
-            SCLogError(SC_EINVAL,
+            SCLogError(
                     "Invalid argument metric. Must be one of \"seconds\", \"packets\" or \"bytes\" "
                     "(%s)",
                     tagstr);
@@ -243,7 +242,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
             res = pcre2_substring_get_bynumber(
                     parse_regex.match, 6, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0 || str_ptr == NULL) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                SCLogError("pcre2_substring_get_bynumber failed");
                 goto error;
             }
 
@@ -253,7 +252,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
             } else if (strcasecmp("dst", str_ptr) == 0) {
                 td.direction = DETECT_TAG_DIR_DST;
             } else {
-                SCLogError(SC_EINVAL,
+                SCLogError(
                         "Invalid argument direction. Must be one of \"src\" or \"dst\" (only valid "
                         "for tag host type, not sessions) (%s)",
                         tagstr);
@@ -261,7 +260,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
             }
 
             if (td.type != DETECT_TAG_TYPE_HOST) {
-                SCLogWarning(SC_EINVAL,
+                SCLogWarning(
                         "Argument direction doesn't make sense for type \"session\" (%s [%" PRIu8
                         "])",
                         tagstr, td.type);
@@ -274,7 +273,7 @@ static DetectTagData *DetectTagParse(const char *tagstr)
 
     DetectTagData *real_td = SCMalloc(sizeof(DetectTagData));
     if (unlikely(real_td == NULL)) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
         goto error;
     }
 
index 10e182de1384a97ba5642751c85df5d5c671b89e..f7ce19794e2a1959a6f04ba2ed5f56985a7864aa 100644 (file)
@@ -87,34 +87,32 @@ static int DetectTargetParse(Signature *s, const char *targetstr)
 
     ret = DetectParsePcreExec(&parse_regex, targetstr, 0, 0);
     if (ret < 1) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, targetstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, targetstr);
         return -1;
     }
 
     pcre2len = sizeof(value);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)value, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
     /* now check key value */
     if (!strcmp(value, "src_ip")) {
         if (s->flags & SIG_FLAG_DEST_IS_TARGET) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                       "Conflicting values of target keyword");
+            SCLogError("Conflicting values of target keyword");
             return -1;
         }
         s->flags |= SIG_FLAG_SRC_IS_TARGET;
     } else if (!strcmp(value, "dest_ip")) {
         if (s->flags & SIG_FLAG_SRC_IS_TARGET) {
-            SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
-                       "Conflicting values of target keyword");
+            SCLogError("Conflicting values of target keyword");
             return -1;
         }
         s->flags |= SIG_FLAG_DEST_IS_TARGET;
     } else {
-        SCLogError(SC_EINVAL, "only 'src_ip' and 'dest_ip' are supported as target value");
+        SCLogError("only 'src_ip' and 'dest_ip' are supported as target value");
         return -1;
     }
     return 0;
index fd0ff100e6f7eb848679bccb1554e038002e60b9..4aff76d079be60b533bc64bd2ca64be40999e7b2 100644 (file)
@@ -184,21 +184,21 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     SCLogDebug("input '%s', pcre said %d", rawstr, ret);
     if (ret < 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre match failed");
+        SCLogError("pcre match failed");
         SCReturnPtr(NULL, "DetectFlagsData");
     }
 
     pcre2len = sizeof(arg1);
     res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         SCReturnPtr(NULL, "DetectFlagsData");
     }
     if (ret >= 2) {
         pcre2len = sizeof(arg2);
         res = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)arg2, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             SCReturnPtr(NULL, "DetectFlagsData");
         }
     }
@@ -206,7 +206,7 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
         pcre2len = sizeof(arg3);
         res = SC_Pcre2SubstringCopy(parse_regex.match, 3, (PCRE2_UCHAR8 *)arg3, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             SCReturnPtr(NULL, "DetectFlagsData");
         }
     }
@@ -347,8 +347,8 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
 
                 case '!':
                     if (de->modifier != 0) {
-                        SCLogError(SC_ERR_FLAGS_MODIFIER, "\"flags\" supports only"
-                                " one modifier at a time");
+                        SCLogError("\"flags\" supports only"
+                                   " one modifier at a time");
                         goto error;
                     }
                     de->modifier = MODIFIER_NOT;
@@ -356,8 +356,8 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
                     break;
                 case '+':
                     if (de->modifier != 0) {
-                        SCLogError(SC_ERR_FLAGS_MODIFIER, "\"flags\" supports only"
-                                " one modifier at a time");
+                        SCLogError("\"flags\" supports only"
+                                   " one modifier at a time");
                         goto error;
                     }
                     de->modifier = MODIFIER_PLUS;
@@ -365,8 +365,8 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
                     break;
                 case '*':
                     if (de->modifier != 0) {
-                        SCLogError(SC_ERR_FLAGS_MODIFIER, "\"flags\" supports only"
-                                " one modifier at a time");
+                        SCLogError("\"flags\" supports only"
+                                   " one modifier at a time");
                         goto error;
                     }
                     de->modifier = MODIFIER_ANY;
index 6190f15cd7c686d48382fe0c5c83e7dfd97c8ebd..c68c0105d7b1b532500da8190022b7e928998497 100644 (file)
@@ -115,7 +115,7 @@ static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char *
 
     ret = DetectParsePcreExec(&parse_regex, windowstr, 0, 0);
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, windowstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, windowstr);
         goto error;
     }
 
@@ -128,7 +128,7 @@ static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char *
         pcre2len = sizeof(copy_str);
         res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
 
@@ -143,7 +143,7 @@ static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char *
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 2, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 goto error;
             }
 
index ae04da95a13344fb6d48077ba36e2a96f25b59d8..e43b045f91e6f0666a52fdd40ccf101de629a903 100644 (file)
@@ -133,14 +133,14 @@ static DetectTemplateData *DetectTemplateParse (const char *templatestr)
 
     int ret = DetectParsePcreExec(&parse_regex, templatestr, 0, 0);
     if (ret != 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error, ret %" PRId32 "", ret);
+        SCLogError("parse error, ret %" PRId32 "", ret);
         return NULL;
     }
 
     pcre2len = sizeof(arg1);
     ret = pcre2_substring_copy_bynumber(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return NULL;
     }
     SCLogDebug("Arg1 \"%s\"", arg1);
@@ -148,7 +148,7 @@ static DetectTemplateData *DetectTemplateParse (const char *templatestr)
     pcre2len = sizeof(arg2);
     ret = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)arg2, &pcre2len);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return NULL;
     }
     SCLogDebug("Arg2 \"%s\"", arg2);
index 7d732e30371255aa79baf1f12c8a5e5599a0bc93..007f173c15cc07766c0bc687594fb1fe5565bd40 100644 (file)
@@ -149,7 +149,7 @@ static DetectThresholdData *DetectThresholdParse(const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 5) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
+        SCLogError("pcre_exec parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
@@ -165,7 +165,7 @@ static DetectThresholdData *DetectThresholdParse(const char *rawstr)
                 parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
 
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+            SCLogError("pcre2_substring_get_bynumber failed");
             goto error;
         }
 
@@ -242,11 +242,11 @@ static int DetectThresholdSetup(DetectEngineCtx *de_ctx, Signature *s, const cha
     tmpm = DetectGetLastSMFromLists(s, DETECT_THRESHOLD, DETECT_DETECTION_FILTER, -1);
     if (tmpm != NULL) {
         if (tmpm->type == DETECT_DETECTION_FILTER) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "\"detection_filter\" and "
-                    "\"threshold\" are not allowed in the same rule");
+            SCLogError("\"detection_filter\" and "
+                       "\"threshold\" are not allowed in the same rule");
         } else {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "multiple \"threshold\" "
-                    "options are not allowed in the same rule");
+            SCLogError("multiple \"threshold\" "
+                       "options are not allowed in the same rule");
         }
         SCReturnInt(-1);
     }
index 6364696e5ee22525b7f1fb76e18b0c7df3314bbe..49ffc930a25b2d313a6bf5614821dbb0b20ca290 100644 (file)
@@ -161,7 +161,7 @@ static bool DetectTlsFingerprintValidateCallback(const Signature *s,
         if (cd->content_len != 59) {
             *sigerror = "Invalid length of the specified fingerprint. "
                         "This rule will therefore never match.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return false;
         }
 
@@ -179,7 +179,7 @@ static bool DetectTlsFingerprintValidateCallback(const Signature *s,
             *sigerror = "No colon delimiters ':' detected in content after "
                         "tls.cert_fingerprint. This rule will therefore "
                         "never match.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
             return false;
         }
 
@@ -187,7 +187,7 @@ static bool DetectTlsFingerprintValidateCallback(const Signature *s,
             *sigerror = "tls.cert_fingerprint should not be used together "
                         "with nocase, since the rule is automatically "
                         "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
     }
 
index 72ba6ad9efae3d168cd3aa49f5726aba85c37f24..816f7e4db99c8b74a40f5edd0d2ddcbc747f8985 100644 (file)
@@ -161,7 +161,7 @@ static bool DetectTlsSerialValidateCallback(const Signature *s,
             *sigerror = "tls.cert_serial should not be used together "
                         "with nocase, since the rule is automatically "
                         "uppercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         /* no need to worry about this if the content is short enough */
@@ -176,7 +176,7 @@ static bool DetectTlsSerialValidateCallback(const Signature *s,
         *sigerror = "No colon delimiters ':' detected in content after "
                     "tls.cert_serial. This rule will therefore never "
                     "match.";
-        SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+        SCLogWarning("rule %u: %s", s->id, *sigerror);
 
         return false;
     }
index 6f9af3abb333198177c80b20fae0327eda5e5f33..a27d1ba34482b3e40c49eb0d4d61cc9cef821674 100644 (file)
@@ -301,14 +301,14 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret < 3 || ret > 5) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Parse error %s", rawstr);
+        SCLogError("Parse error %s", rawstr);
         goto error;
     }
 
     pcre2len = sizeof(mode);
     res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
     SCLogDebug("mode \"%s\"", mode);
@@ -316,7 +316,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
     pcre2len = sizeof(value1);
     res = pcre2_substring_copy_bynumber(parse_regex.match, 2, (PCRE2_UCHAR8 *)value1, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
     SCLogDebug("value1 \"%s\"", value1);
@@ -325,7 +325,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
         pcre2len = sizeof(range);
         res = pcre2_substring_copy_bynumber(parse_regex.match, 3, (PCRE2_UCHAR8 *)range, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
         SCLogDebug("range \"%s\"", range);
@@ -335,7 +335,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 4, (PCRE2_UCHAR8 *)value2, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 goto error;
             }
             SCLogDebug("value2 \"%s\"", value2);
@@ -363,8 +363,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
     }
 
     if (strlen(range) != 0 && strlen(mode) != 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "Range specified but mode also set");
+        SCLogError("Range specified but mode also set");
         goto error;
     }
 
@@ -380,8 +379,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
     /* set the second value if specified */
     if (strlen(value2) > 0) {
         if (!(dd->mode & DETECT_TLS_VALIDITY_RA)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                "Multiple tls validity values specified but mode is not range");
+            SCLogError("Multiple tls validity values specified but mode is not range");
             goto error;
         }
 
@@ -390,8 +388,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
             goto error;
 
         if (dd->epoch2 <= dd->epoch) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                "Second value in range must not be smaller than the first");
+            SCLogError("Second value in range must not be smaller than the first");
             goto error;
         }
     }
@@ -426,7 +423,7 @@ static int DetectTlsExpiredSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = SCCalloc(1, sizeof(DetectTlsValidityData));
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Allocation \'%s\' failed", rawstr);
+        SCLogError("Allocation \'%s\' failed", rawstr);
         goto error;
     }
 
@@ -477,7 +474,7 @@ static int DetectTlsValidSetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = SCCalloc(1, sizeof(DetectTlsValidityData));
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Allocation \'%s\' failed", rawstr);
+        SCLogError("Allocation \'%s\' failed", rawstr);
         goto error;
     }
 
@@ -567,7 +564,7 @@ static int DetectTlsValiditySetup (DetectEngineCtx *de_ctx, Signature *s,
 
     dd = DetectTlsValidityParse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Parsing \'%s\' failed", rawstr);
+        SCLogError("Parsing \'%s\' failed", rawstr);
         goto error;
     }
 
index a9e6a6119b0a103c931d0cf4553044dbdb3b7047..7c028f10378de6bb83a8ed6aea6c575997b7f191 100644 (file)
@@ -323,8 +323,7 @@ static int DetectTLSCertChainLenSetup(DetectEngineCtx *de_ctx, Signature *s, con
 
     DetectU32Data *dd = DetectU32Parse(rawstr);
     if (dd == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Parsing \'%s\' failed for %s", rawstr,
-                sigmatch_table[KEYWORD_ID].name);
+        SCLogError("Parsing \'%s\' failed for %s", rawstr, sigmatch_table[KEYWORD_ID].name);
         return -1;
     }
 
index 625c75f3c6018de1f7a7906a6d094a1acdd7258d..8b9ce947fe7b479ae5d64ec0dce0d0ed8aae7ec3 100644 (file)
@@ -120,7 +120,7 @@ static int DetectTlsJa3HashSetup(DetectEngineCtx *de_ctx, Signature *s, const ch
         return -1;
 
     if (s->alproto != ALPROTO_UNKNOWN && s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting protocols.");
+        SCLogError("rule contains conflicting protocols.");
         return -1;
     }
 
@@ -130,7 +130,7 @@ static int DetectTlsJa3HashSetup(DetectEngineCtx *de_ctx, Signature *s, const ch
     /* Check if JA3 is disabled */
     if (!RunmodeIsUnittests() && Ja3IsDisabled("rule")) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_TLS_JA3_HASH)) {
-            SCLogError(SC_WARN_JA3_DISABLED, "ja3 support is not enabled");
+            SCLogError("ja3 support is not enabled");
         }
         return -2;
     }
@@ -176,7 +176,7 @@ static bool DetectTlsJa3HashValidateCallback(const Signature *s,
             *sigerror = "ja3.hash should not be used together with "
                         "nocase, since the rule is automatically "
                         "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         if (cd->content_len == SC_MD5_HEX_LEN)
@@ -185,7 +185,7 @@ static bool DetectTlsJa3HashValidateCallback(const Signature *s,
         *sigerror = "Invalid length of the specified JA3 hash (should "
                     "be 32 characters long). This rule will therefore "
                     "never match.";
-        SCLogWarning(SC_WARN_POOR_RULE,  "rule %u: %s", s->id, *sigerror);
+        SCLogWarning("rule %u: %s", s->id, *sigerror);
         return false;
     }
 
index 82b6eb5bccb371bcc67fe1281f60eaa156218245..85df0706594d3978bfeb17f117d2bbd9c714679f 100644 (file)
@@ -109,7 +109,7 @@ static int DetectTlsJa3StringSetup(DetectEngineCtx *de_ctx, Signature *s, const
         return -1;
 
     if (s->alproto != ALPROTO_UNKNOWN && s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting protocols.");
+        SCLogError("rule contains conflicting protocols.");
         return -1;
     }
 
@@ -119,7 +119,7 @@ static int DetectTlsJa3StringSetup(DetectEngineCtx *de_ctx, Signature *s, const
     /* Check if JA3 is disabled */
     if (!RunmodeIsUnittests() && Ja3IsDisabled("rule")) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_TLS_JA3_STRING)) {
-            SCLogError(SC_WARN_JA3_DISABLED, "ja3(s) support is not enabled");
+            SCLogError("ja3(s) support is not enabled");
         }
         return -2;
     }
index 38f8efc042a65122b69acdee9e78a6c36a7221f1..68be626aa1168881d25ad306debc2b333af17d03 100644 (file)
@@ -118,7 +118,7 @@ static int DetectTlsJa3SHashSetup(DetectEngineCtx *de_ctx, Signature *s, const c
         return -1;
 
     if (s->alproto != ALPROTO_UNKNOWN && s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting protocols.");
+        SCLogError("rule contains conflicting protocols.");
         return -1;
     }
 
@@ -128,7 +128,7 @@ static int DetectTlsJa3SHashSetup(DetectEngineCtx *de_ctx, Signature *s, const c
     /* Check if JA3 is disabled */
     if (!RunmodeIsUnittests() && Ja3IsDisabled("rule")) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_TLS_JA3S_HASH)) {
-            SCLogError(SC_WARN_JA3_DISABLED, "ja3(s) support is not enabled");
+            SCLogError("ja3(s) support is not enabled");
         }
         return -2;
     }
@@ -174,7 +174,7 @@ static bool DetectTlsJa3SHashValidateCallback(const Signature *s,
             *sigerror = "ja3s.hash should not be used together with "
                         "nocase, since the rule is automatically "
                         "lowercased anyway which makes nocase redundant.";
-            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+            SCLogWarning("rule %u: %s", s->id, *sigerror);
         }
 
         if (cd->content_len == SC_MD5_HEX_LEN)
@@ -183,7 +183,7 @@ static bool DetectTlsJa3SHashValidateCallback(const Signature *s,
         *sigerror = "Invalid length of the specified JA3S hash (should "
                     "be 32 characters long). This rule will therefore "
                     "never match.";
-        SCLogError(SC_ERR_INVALID_RULE_ARGUMENT,  "rule %u: %s", s->id, *sigerror);
+        SCLogError("rule %u: %s", s->id, *sigerror);
         return false;
     }
 
index 8e454dde0c138876d399800938bc00427869527a..db9ba3f1016120e7ed7613eac56173e266df5bef 100644 (file)
@@ -109,7 +109,7 @@ static int DetectTlsJa3SStringSetup(DetectEngineCtx *de_ctx, Signature *s, const
         return -1;
 
     if (s->alproto != ALPROTO_UNKNOWN && s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting protocols.");
+        SCLogError("rule contains conflicting protocols.");
         return -1;
     }
 
@@ -119,7 +119,7 @@ static int DetectTlsJa3SStringSetup(DetectEngineCtx *de_ctx, Signature *s, const
     /* Check if JA3 is disabled */
     if (!RunmodeIsUnittests() && Ja3IsDisabled("rule")) {
         if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_AL_TLS_JA3S_STRING)) {
-            SCLogError(SC_WARN_JA3_DISABLED, "ja3(s) support is not enabled");
+            SCLogError("ja3(s) support is not enabled");
         }
         return -2;
     }
index 6bc0259f847d2f49a5650b903c9a4d35d2bd5037..ac663c1fea9591aaf251dd270d774756f4154046 100644 (file)
@@ -155,7 +155,7 @@ static DetectTlsVersionData *DetectTlsVersionParse (DetectEngineCtx *de_ctx, con
 
     ret = DetectParsePcreExec(&parse_regex, str, 0, 0);
     if (ret < 1 || ret > 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid tls.version option");
+        SCLogError("invalid tls.version option");
         goto error;
     }
 
@@ -166,7 +166,7 @@ static DetectTlsVersionData *DetectTlsVersionParse (DetectEngineCtx *de_ctx, con
         res = pcre2_substring_copy_bynumber(
                 parse_regex.match, 1, (PCRE2_UCHAR8 *)ver_ptr, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             goto error;
         }
 
@@ -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_EINVAL, "Invalid value");
+            SCLogError("Invalid value");
             goto error;
         }
 
index 1bce2964dd874032849b20477e5e9b632e670fa4..c9a1c259c7594bb58a77792a8087db2bf335645f 100644 (file)
@@ -223,7 +223,7 @@ static DetectTlsData *DetectTlsSubjectParse (DetectEngineCtx *de_ctx, const char
 
     ret = DetectParsePcreExec(&subject_parse_regex, str, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid tls.subject option");
+        SCLogError("invalid tls.subject option");
         goto error;
     }
 
@@ -233,7 +233,7 @@ static DetectTlsData *DetectTlsSubjectParse (DetectEngineCtx *de_ctx, const char
     res = pcre2_substring_get_bynumber(
             subject_parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
 
@@ -415,7 +415,7 @@ static DetectTlsData *DetectTlsIssuerDNParse(DetectEngineCtx *de_ctx, const char
 
     ret = DetectParsePcreExec(&issuerdn_parse_regex, str, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid tls.issuerdn option");
+        SCLogError("invalid tls.issuerdn option");
         goto error;
     }
 
@@ -425,7 +425,7 @@ static DetectTlsData *DetectTlsIssuerDNParse(DetectEngineCtx *de_ctx, const char
     res = pcre2_substring_get_bynumber(
             issuerdn_parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
 
index a71aa969a2d3e56b1131124ccbbe265af7760223..422882f1f9a8832e9e1495a2a6e81fed4f4ce4de 100644 (file)
@@ -116,9 +116,10 @@ static DetectTosData *DetectTosParse(const char *arg, bool negate)
 
     ret = DetectParsePcreExec(&parse_regex, arg, 0, 0);
     if (ret != 2) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid tos option - %s. "
+        SCLogError("invalid tos option - %s. "
                    "The tos option value must be in the range "
-                   "%u - %u", arg, DETECT_IPTOS_MIN, DETECT_IPTOS_MAX);
+                   "%u - %u",
+                arg, DETECT_IPTOS_MIN, DETECT_IPTOS_MAX);
         goto error;
     }
 
@@ -128,7 +129,7 @@ static DetectTosData *DetectTosParse(const char *arg, bool negate)
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 1, (PCRE2_UCHAR8 *)tosbytes_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -145,9 +146,10 @@ static DetectTosData *DetectTosParse(const char *arg, bool negate)
     }
 
     if (!(tos >= DETECT_IPTOS_MIN && tos <= DETECT_IPTOS_MAX)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid tos argument - "
+        SCLogError("Invalid tos argument - "
                    "%s.  The tos option value must be in the range "
-                   "%u - %u", tosbytes_str, DETECT_IPTOS_MIN, DETECT_IPTOS_MAX);
+                   "%u - %u",
+                tosbytes_str, DETECT_IPTOS_MIN, DETECT_IPTOS_MAX);
         goto error;
     }
 
index 2e6d8d4ea6f731dda0ced77c28f0c32fd86eb437..9e6ee1986a5be24b00b587a65ce773bb74f0193d 100644 (file)
@@ -72,8 +72,8 @@ static int DetectTransformToMd5Setup (DetectEngineCtx *de_ctx, Signature *s, con
 {
     SCEnter();
     if (g_disable_hashing) {
-        SCLogError(SC_ERR_HASHING_DISABLED, "MD5 hashing has been disabled, "
-                                            "needed for to_md5 keyword");
+        SCLogError("MD5 hashing has been disabled, "
+                   "needed for to_md5 keyword");
         SCReturnInt(-1);
     }
     int r = DetectSignatureAddTransform(s, DETECT_TRANSFORM_MD5, NULL);
index 7ab9fd3a349b5df24a86d7e85d83e1839239563e..c517175b8722ea4ffa667ba0622aa7a0d65f2a82 100644 (file)
@@ -104,9 +104,8 @@ static int DetectTransformPcrexformSetup (DetectEngineCtx *de_ctx, Signature *s,
     if (pxd->regex == NULL) {
         PCRE2_UCHAR buffer[256];
         pcre2_get_error_message(en, buffer, sizeof(buffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 regexstr, (int)eo, buffer);
         pcre2_match_context_free(pxd->context);
         SCFree(pxd);
@@ -115,13 +114,12 @@ static int DetectTransformPcrexformSetup (DetectEngineCtx *de_ctx, Signature *s,
     // check pcd->regex has exactly one capture expression
     uint32_t nb;
     if (pcre2_pattern_info(pxd->regex, PCRE2_INFO_CAPTURECOUNT, &nb) < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "pcrexform failed getting info about capturecount");
+        SCLogError("pcrexform failed getting info about capturecount");
         DetectTransformPcrexformFree(de_ctx, pxd);
         SCReturnInt(-1);
     }
     if (nb != 1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "pcrexform needs exactly one substring capture, found %" PRIu32, nb);
+        SCLogError("pcrexform needs exactly one substring capture, found %" PRIu32, nb);
         DetectTransformPcrexformFree(de_ctx, pxd);
         SCReturnInt(-1);
     }
index 6ff84b5ccbef40dcb4a27fce210a84b1961ca2af..927b25e97abda9d9284c545d0fabe409e5d8cb67 100644 (file)
@@ -73,8 +73,8 @@ static int DetectTransformToSha1Setup (DetectEngineCtx *de_ctx, Signature *s, co
 {
     SCEnter();
     if (g_disable_hashing) {
-        SCLogError(SC_ERR_HASHING_DISABLED, "SHA1 hashing has been disabled, "
-                                            "needed for to_sha1 keyword");
+        SCLogError("SHA1 hashing has been disabled, "
+                   "needed for to_sha1 keyword");
         SCReturnInt(-1);
     }
     int r = DetectSignatureAddTransform(s, DETECT_TRANSFORM_SHA1, NULL);
index af07454d8a6de24d0c2de07f340b76aa7f594085..3eeb582a8361ee183c33b7ccec3d10eaa566882f 100644 (file)
@@ -73,8 +73,8 @@ static int DetectTransformToSha256Setup (DetectEngineCtx *de_ctx, Signature *s,
 {
     SCEnter();
     if (g_disable_hashing) {
-        SCLogError(SC_ERR_HASHING_DISABLED, "SHA256 hashing has been disabled, "
-                                            "needed for to_sha256 keyword");
+        SCLogError("SHA256 hashing has been disabled, "
+                   "needed for to_sha256 keyword");
         SCReturnInt(-1);
     }
     int r = DetectSignatureAddTransform(s, DETECT_TRANSFORM_SHA256, NULL);
index 27c7106aad22f5010ac3671251d61e7b030b4dc4..e42700feb3691ba8924471954e01fb6b184f9969 100644 (file)
@@ -81,25 +81,25 @@ static int DetectTransformXorSetup(DetectEngineCtx *de_ctx, Signature *s, const
     // Create pxd from optstr
     DetectTransformXorData *pxd = SCCalloc(1, sizeof(*pxd));
     if (pxd == NULL) {
-        SCLogError(SC_ENOMEM, "memory allocation failed");
+        SCLogError("memory allocation failed");
         SCReturnInt(-1);
     }
 
     size_t keylen = strlen(optstr);
     if (keylen % 2 == 1) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "XOR transform key's length must be an even number");
+        SCLogError("XOR transform key's length must be an even number");
         DetectTransformXorFree(de_ctx, pxd);
         SCReturnInt(-1);
     }
     if (keylen / 2 > UINT8_MAX) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Key length too big for XOR transform");
+        SCLogError("Key length too big for XOR transform");
         DetectTransformXorFree(de_ctx, pxd);
         SCReturnInt(-1);
     }
     pxd->length = (uint8_t)(keylen / 2);
     pxd->key = SCMalloc(keylen / 2);
     if (pxd->key == NULL) {
-        SCLogError(SC_ENOMEM, "memory allocation failed");
+        SCLogError("memory allocation failed");
         DetectTransformXorFree(de_ctx, pxd);
         SCReturnInt(-1);
     }
@@ -111,8 +111,7 @@ static int DetectTransformXorSetup(DetectEngineCtx *de_ctx, Signature *s, const
             pxd->key[i] |= (optstr[2 * i + 1] >= 'A' ? ((optstr[2 * i + 1] & 0xdf) - 'A') + 10
                                                      : (optstr[2 * i + 1] - '0'));
         } else {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                    "XOR transform key must be hexadecimal characters only");
+            SCLogError("XOR transform key must be hexadecimal characters only");
             DetectTransformXorFree(de_ctx, pxd);
             SCReturnInt(-1);
         }
index 425e22324964f3355d9a3f9ede9cd0fe0f8220b9..ca43304bdd5e4855e1a7bafd5f494982e72fba27 100644 (file)
@@ -121,18 +121,20 @@ int DetectUricontentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *con
     const char *legacy = NULL;
     if (ConfGet("legacy.uricontent", &legacy) == 1) {
         if (strcasecmp("disabled", legacy) == 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "uriconent deprecated.  To "
+            SCLogError("uriconent deprecated.  To "
                        "use a rule with \"uricontent\", either set the "
                        "option - \"legacy.uricontent\" in the conf to "
                        "\"enabled\" OR replace uricontent with "
-                       "\'content:%s; http_uri;\'.", contentstr);
+                       "\'content:%s; http_uri;\'.",
+                    contentstr);
             goto error;
         } else if (strcasecmp("enabled", legacy) == 0) {
             ;
         } else {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid value found "
+            SCLogError("Invalid value found "
                        "for legacy.uriconent - \"%s\".  Valid values are "
-                       "\"enabled\" OR \"disabled\".", legacy);
+                       "\"enabled\" OR \"disabled\".",
+                    legacy);
             goto error;
         }
     }
index ba24b966b47030bffa463483e00f0ec61869348a..2730729d6e3fad2cde15253aead12866c47cc47c 100644 (file)
@@ -222,8 +222,9 @@ bool DetectUrilenValidateContent(const Signature *s, int list, const char **sige
 
         if (cd->depth && cd->depth < cd->content_len) {
             *sigerror = "depth or urilen smaller than content len";
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "depth or urilen %u smaller "
-                    "than content len %u", cd->depth, cd->content_len);
+            SCLogError("depth or urilen %u smaller "
+                       "than content len %u",
+                    cd->depth, cd->content_len);
             return false;
         }
     }
index 5bb89a1b2a1c75e83a519e6bf8b91dd8b52f1e8c..4ae382f0531c71a37cda6108786ef8501950eb9b 100644 (file)
@@ -77,7 +77,7 @@ static int DetectWithinSetup(DetectEngineCtx *de_ctx, Signature *s, const char *
     /* retrieve the sm to apply the within against */
     pm = DetectGetLastSMFromLists(s, DETECT_CONTENT, -1);
     if (pm == NULL) {
-        SCLogError(SC_ERR_OFFSET_MISSING_CONTENT, "within needs "
+        SCLogError("within needs "
                    "preceding content option");
         goto end;
     }
@@ -85,47 +85,47 @@ static int DetectWithinSetup(DetectEngineCtx *de_ctx, Signature *s, const char *
     /* verify other conditions */
     DetectContentData *cd = (DetectContentData *)pm->ctx;
     if (cd->flags & DETECT_CONTENT_WITHIN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use multiple withins for the same content.");
+        SCLogError("can't use multiple withins for the same content.");
         goto end;
     }
     if ((cd->flags & DETECT_CONTENT_DEPTH) || (cd->flags & DETECT_CONTENT_OFFSET)) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't use a relative "
+        SCLogError("can't use a relative "
                    "keyword like within/distance with a absolute "
                    "relative keyword like depth/offset for the same "
-                   "content." );
+                   "content.");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_NEGATED && cd->flags & DETECT_CONTENT_FAST_PATTERN) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "negated keyword set along with a fast_pattern");
         goto end;
     }
     if (cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "can't have a relative "
+        SCLogError("can't have a relative "
                    "keyword set along with a fast_pattern:only;");
         goto end;
     }
     if (str[0] != '-' && isalpha((unsigned char)str[0])) {
         DetectByteIndexType index;
         if (!DetectByteRetrieveSMVar(str, s, &index)) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "unknown byte_ keyword var "
-                       "seen in within - %s\n", str);
+            SCLogError("unknown byte_ keyword var "
+                       "seen in within - %s\n",
+                    str);
             goto end;
         }
         cd->within = index;
         cd->flags |= DETECT_CONTENT_WITHIN_VAR;
     } else {
         if (StringParseInt32(&cd->within, 0, 0, str) < 0) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE,
-                      "invalid value for within: %s", str);
+            SCLogError("invalid value for within: %s", str);
             goto end;
         }
 
         if (cd->within < (int32_t)cd->content_len) {
-            SCLogError(SC_ERR_WITHIN_INVALID, "within argument \"%"PRIi32"\" is "
-                       "less than the content length \"%"PRIu32"\" which is invalid, since "
-                       "this will never match.  Invalidating signature", cd->within,
-                       cd->content_len);
+            SCLogError("within argument \"%" PRIi32 "\" is "
+                       "less than the content length \"%" PRIu32 "\" which is invalid, since "
+                       "this will never match.  Invalidating signature",
+                    cd->within, cd->content_len);
             goto end;
         }
     }
@@ -143,7 +143,7 @@ static int DetectWithinSetup(DetectEngineCtx *de_ctx, Signature *s, const char *
     if (prev_pm->type == DETECT_CONTENT) {
         DetectContentData *prev_cd = (DetectContentData *)prev_pm->ctx;
         if (prev_cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) {
-            SCLogError(SC_ERR_INVALID_SIGNATURE, "previous keyword "
+            SCLogError("previous keyword "
                        "has a fast_pattern:only; set. Can't "
                        "have relative keywords around a fast_pattern "
                        "only content");
index 1e21468fef402a4baabeafb0e943933c7c88fe6e..22845f4ee4610247086865d4d776c5b35e4e0df0 100644 (file)
@@ -203,7 +203,7 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
 
     ret = DetectParsePcreExec(&parse_regex, rawstr, 0, 0);
     if (ret != 2 && ret != 3 && ret != 4 && ret != 5) {
-        SCLogError(SC_ERR_PCRE_MATCH, "\"%s\" is not a valid setting for xbits.", rawstr);
+        SCLogError("\"%s\" is not a valid setting for xbits.", rawstr);
         return -1;
     }
     SCLogDebug("ret %d, %s", ret, rawstr);
@@ -211,7 +211,7 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
     res = pcre2_substring_copy_bynumber(
             parse_regex.match, 1, (PCRE2_UCHAR8 *)fb_cmd_str, &pcre2len);
     if (res < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         return -1;
     }
 
@@ -220,7 +220,7 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
         res = pcre2_substring_copy_bynumber(
                 parse_regex.match, 2, (PCRE2_UCHAR8 *)fb_name, &pcre2len);
         if (res < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             return -1;
         }
         if (ret >= 4) {
@@ -228,7 +228,7 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
             res = pcre2_substring_copy_bynumber(
                     parse_regex.match, 3, (PCRE2_UCHAR8 *)hb_dir_str, &pcre2len);
             if (res < 0) {
-                SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                SCLogError("pcre2_substring_copy_bynumber failed");
                 return -1;
             }
             SCLogDebug("hb_dir_str %s", hb_dir_str);
@@ -254,19 +254,18 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
                 res = pcre2_substring_copy_bynumber(
                         parse_regex.match, 4, (PCRE2_UCHAR8 *)expire_str, &pcre2len);
                 if (res < 0) {
-                    SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     return -1;
                 }
                 SCLogDebug("expire_str %s", expire_str);
                 if (StringParseUint32(&expire, 10, 0, (const char *)expire_str) < 0) {
-                    SCLogError(SC_EINVAL,
-                            "Invalid value for "
-                            "expire: \"%s\"",
+                    SCLogError("Invalid value for "
+                               "expire: \"%s\"",
                             expire_str);
                     return -1;
                 }
                 if (expire == 0) {
-                    SCLogError(SC_EINVAL, "expire must be bigger than 0");
+                    SCLogError("expire must be bigger than 0");
                     return -1;
                 }
                 SCLogDebug("expire %d", expire);
@@ -287,7 +286,7 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
     } else if (strcmp(fb_cmd_str,"toggle") == 0) {
         fb_cmd = DETECT_XBITS_CMD_TOGGLE;
     } else {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "xbits action \"%s\" is not supported.", fb_cmd_str);
+        SCLogError("xbits action \"%s\" is not supported.", fb_cmd_str);
         return -1;
     }
 
index 7345e8d466109fcd6010fccd1f2dd22ffc18499c..e716afd86f6c221b9bc222a5a3889f8c8a2e627b 100644 (file)
@@ -970,7 +970,7 @@ void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size
     DEBUG_VALIDATE_BUG_ON(det_ctx->tx_candidates);
     det_ctx->tx_candidates = SCCalloc(size, sizeof(RuleMatchCandidateTx));
     if (det_ctx->tx_candidates == NULL) {
-        FatalError(SC_ENOMEM, "failed to allocate %" PRIu64 " bytes",
+        FatalError("failed to allocate %" PRIu64 " bytes",
                 (uint64_t)(size * sizeof(RuleMatchCandidateTx)));
     }
     det_ctx->tx_candidates_size = size;
@@ -1000,7 +1000,7 @@ static int RuleMatchCandidateTxArrayExpand(DetectEngineThreadCtx *det_ctx, const
     uint32_t new_size = needed;
     void *ptmp = SCRealloc(det_ctx->tx_candidates, (new_size * sizeof(RuleMatchCandidateTx)));
     if (ptmp == NULL) {
-        FatalError(SC_ENOMEM, "failed to expand to %" PRIu64 " bytes",
+        FatalError("failed to expand to %" PRIu64 " bytes",
                 (uint64_t)(new_size * sizeof(RuleMatchCandidateTx)));
         // TODO can this be handled more gracefully?
     }
index 359e7e519f19415aa80586693ee1903a7eb19e1e..0edf9433aca96dde80c26e03e5c6062220048664 100644 (file)
@@ -85,7 +85,7 @@ static void FeatureInit(void) {
                                            FeatureHashFreeFunc);
 
     if (!feature_hash_table) {
-        FatalError(sc_errno, "Unable to allocate feature hash table.");
+        FatalError("Unable to allocate feature hash table.");
     }
 }
 
@@ -95,7 +95,7 @@ static void FeatureAddEntry(const char *feature_name)
 
     FeatureEntryType *feature = SCCalloc(1, sizeof(*feature));
     if (!feature) {
-        FatalError(SC_ENOMEM, "Unable to allocate feature entry memory.");
+        FatalError("Unable to allocate feature entry memory.");
     }
 
     feature->feature = SCStrdup(feature_name);
index 298c8be64aa6d5335a3571e7f659cb1044c7facb..4b0b5cf068f70a3586a4ea6ba1b0b4309a1d4ebe 100644 (file)
@@ -160,8 +160,8 @@ void FlowDisableFlowManagerThread(void)
 again:
     gettimeofday(&cur_ts, NULL);
     if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-        FatalError(SC_ERR_SHUTDOWN, "unable to get all flow manager "
-                "threads to shutdown in time");
+        FatalError("unable to get all flow manager "
+                   "threads to shutdown in time");
     }
 
     SCMutexLock(&tv_root_lock);
@@ -957,8 +957,7 @@ void FlowManagerThreadSpawn()
     (void)ConfGetInt("flow.managers", &setting);
 
     if (setting < 1 || setting > 1024) {
-        FatalError(SC_ERR_INVALID_ARGUMENTS,
-                "invalid flow.managers setting %"PRIdMAX, setting);
+        FatalError("invalid flow.managers setting %" PRIdMAX, setting);
     }
     flowmgr_number = (uint32_t)setting;
 
@@ -977,10 +976,10 @@ void FlowManagerThreadSpawn()
         BUG_ON(tv_flowmgr == NULL);
 
         if (tv_flowmgr == NULL) {
-            FatalError(SC_ERR_FATAL, "flow manager thread creation failed");
+            FatalError("flow manager thread creation failed");
         }
         if (TmThreadSpawn(tv_flowmgr) != TM_ECODE_OK) {
-            FatalError(SC_ERR_FATAL, "flow manager thread spawn failed");
+            FatalError("flow manager thread spawn failed");
         }
     }
     return;
@@ -1004,7 +1003,7 @@ static TmEcode FlowRecyclerThreadInit(ThreadVars *t, const void *initdata, void
     if (ftd == NULL)
         return TM_ECODE_FAILED;
     if (OutputFlowLogThreadInit(t, NULL, &ftd->output_thread_data) != TM_ECODE_OK) {
-        SCLogError(SC_ERR_THREAD_INIT, "initializing flow log API for thread failed");
+        SCLogError("initializing flow log API for thread failed");
         SCFree(ftd);
         return TM_ECODE_FAILED;
     }
@@ -1153,8 +1152,7 @@ void FlowRecyclerThreadSpawn()
     (void)ConfGetInt("flow.recyclers", &setting);
 
     if (setting < 1 || setting > 1024) {
-        FatalError(SC_ERR_INVALID_ARGUMENTS,
-                "invalid flow.recyclers setting %"PRIdMAX, setting);
+        FatalError("invalid flow.recyclers setting %" PRIdMAX, setting);
     }
     flowrec_number = (uint32_t)setting;
 
@@ -1171,10 +1169,10 @@ void FlowRecyclerThreadSpawn()
                 "FlowRecycler", 0);
 
         if (tv_flowrec == NULL) {
-            FatalError(SC_ERR_FATAL, "flow recycler thread creation failed");
+            FatalError("flow recycler thread creation failed");
         }
         if (TmThreadSpawn(tv_flowrec) != TM_ECODE_OK) {
-            FatalError(SC_ERR_FATAL, "flow recycler thread spawn failed");
+            FatalError("flow recycler thread spawn failed");
         }
     }
     return;
@@ -1225,8 +1223,8 @@ void FlowDisableFlowRecyclerThread(void)
 again:
     gettimeofday(&cur_ts, NULL);
     if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-        FatalError(SC_ERR_SHUTDOWN, "unable to get all flow recycler "
-                "threads to shutdown in time");
+        FatalError("unable to get all flow recycler "
+                   "threads to shutdown in time");
     }
 
     SCMutexLock(&tv_root_lock);
index 874fa3abbc5fa1951ef4863a272c7978be88d9c5..d6fc7c04dea827d9a46eee43be725464b3dde970 100644 (file)
@@ -36,7 +36,7 @@ FlowQueue *FlowQueueNew()
 {
     FlowQueue *q = (FlowQueue *)SCMalloc(sizeof(FlowQueue));
     if (q == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in FlowQueueNew. Exiting...");
+        SCLogError("Fatal error encountered in FlowQueueNew. Exiting...");
         exit(EXIT_SUCCESS);
     }
     q = FlowQueueInit(q);
index d9fe7abd53f7db0280cfc475f8b7097119e29871..cd8a3fdde8b64487b71288b9c4f79cd7163159d0 100644 (file)
@@ -248,7 +248,7 @@ void FlowSparePoolInit(void)
     for (uint32_t cnt = 0; cnt < flow_config.prealloc; ) {
         FlowSparePool *p = FlowSpareGetPool();
         if (p == NULL) {
-            FatalError(SC_ERR_FLOW_INIT, "failed to initialize flow pool");
+            FatalError("failed to initialize flow pool");
         }
         FlowSparePoolUpdateBlock(p);
         cnt += p->queue.len;
index 9ddb34773b4601a453131a53d64f53470429c407..1363e27b88e62192fb53183f1756fae5006e3fed 100644 (file)
@@ -301,7 +301,7 @@ static TmEcode FlowWorkerThreadInit(ThreadVars *tv, const void *initdata, void *
         return TM_ECODE_FAILED;
     }
     if (OutputFlowLogThreadInit(tv, NULL, &fw->output_thread_flow) != TM_ECODE_OK) {
-        SCLogError(SC_ERR_THREAD_INIT, "initializing flow log API for thread failed");
+        SCLogError("initializing flow log API for thread failed");
         FlowWorkerThreadDeinit(tv, fw);
         return TM_ECODE_FAILED;
     }
index 3375c98057c75e26c14b2191f7cca6bcad14146d..a82165971ac69786cf7a35146150048737c8c8c1 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_EINVAL, "flow.emergency-recovery must be in the range of "
-                                  "1 and 100 (as percentage)");
+            SCLogError("flow.emergency-recovery must be in the range of "
+                       "1 and 100 (as percentage)");
             flow_config.emergency_recovery = FLOW_DEFAULT_EMERGENCY_RECOVERY;
         }
     } else {
@@ -582,13 +582,13 @@ void FlowInitConfig(bool quiet)
     if ((ConfGet("flow.memcap", &conf_val)) == 1)
     {
         if (conf_val == NULL) {
-            FatalError(SC_ERR_FATAL, "Invalid value for flow.memcap: NULL");
+            FatalError("Invalid value for flow.memcap: NULL");
         }
 
         if (ParseSizeStringU64(conf_val, &flow_memcap_copy) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing flow.memcap "
+            SCLogError("Error parsing flow.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(flow_config.memcap, flow_memcap_copy);
@@ -597,7 +597,7 @@ void FlowInitConfig(bool quiet)
     if ((ConfGet("flow.hash-size", &conf_val)) == 1)
     {
         if (conf_val == NULL) {
-            FatalError(SC_ERR_FATAL, "Invalid value for flow.hash-size: NULL");
+            FatalError("Invalid value for flow.hash-size: NULL");
         }
 
         if (StringParseUint32(&configval, 10, strlen(conf_val),
@@ -608,7 +608,7 @@ void FlowInitConfig(bool quiet)
     if ((ConfGet("flow.prealloc", &conf_val)) == 1)
     {
         if (conf_val == NULL) {
-            FatalError(SC_ERR_FATAL, "Invalid value for flow.prealloc: NULL");
+            FatalError("Invalid value for flow.prealloc: NULL");
         }
 
         if (StringParseUint32(&configval, 10, strlen(conf_val),
@@ -626,18 +626,17 @@ void FlowInitConfig(bool quiet)
     /* alloc hash memory */
     uint64_t hash_size = flow_config.hash_size * sizeof(FlowBucket);
     if (!(FLOW_CHECK_MEMCAP(hash_size))) {
-        SCLogError(SC_ERR_FLOW_INIT, "allocating flow hash failed: "
-                "max flow memcap is smaller than projected hash size. "
-                "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate "
-                "total hash size by multiplying \"flow.hash-size\" with %"PRIuMAX", "
-                "which is the hash bucket size.", SC_ATOMIC_GET(flow_config.memcap), hash_size,
-                (uintmax_t)sizeof(FlowBucket));
+        SCLogError("allocating flow hash failed: "
+                   "max flow memcap is smaller than projected hash size. "
+                   "Memcap: %" PRIu64 ", Hash table size %" PRIu64 ". Calculate "
+                   "total hash size by multiplying \"flow.hash-size\" with %" PRIuMAX ", "
+                   "which is the hash bucket size.",
+                SC_ATOMIC_GET(flow_config.memcap), hash_size, (uintmax_t)sizeof(FlowBucket));
         exit(EXIT_FAILURE);
     }
     flow_hash = SCMallocAligned(flow_config.hash_size * sizeof(FlowBucket), CLS);
     if (unlikely(flow_hash == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in FlowInitConfig. Exiting...");
+        FatalError("Fatal error encountered in FlowInitConfig. Exiting...");
     }
     memset(flow_hash, 0, flow_config.hash_size * sizeof(FlowBucket));
 
@@ -1035,26 +1034,30 @@ void FlowInitFlowProto(void)
         FlowProtoTimeout *e = &flow_timeouts_emerg[i];
 
         if (e->est_timeout > n->est_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value %u for \'established\' "
-                    "must be below regular value %u", e->est_timeout, n->est_timeout);
+            SCLogWarning("emergency timeout value %u for \'established\' "
+                         "must be below regular value %u",
+                    e->est_timeout, n->est_timeout);
             e->est_timeout = n->est_timeout / 10;
         }
 
         if (e->new_timeout > n->new_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value %u for \'new\' must be "
-                    "below regular value %u", e->new_timeout, n->new_timeout);
+            SCLogWarning("emergency timeout value %u for \'new\' must be "
+                         "below regular value %u",
+                    e->new_timeout, n->new_timeout);
             e->new_timeout = n->new_timeout / 10;
         }
 
         if (e->closed_timeout > n->closed_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value %u for \'closed\' must "
-                    "be below regular value %u", e->closed_timeout, n->closed_timeout);
+            SCLogWarning("emergency timeout value %u for \'closed\' must "
+                         "be below regular value %u",
+                    e->closed_timeout, n->closed_timeout);
             e->closed_timeout = n->closed_timeout / 10;
         }
 
         if (e->bypassed_timeout > n->bypassed_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value %u for \'bypassed\' "
-                    "must be below regular value %u", e->bypassed_timeout, n->bypassed_timeout);
+            SCLogWarning("emergency timeout value %u for \'bypassed\' "
+                         "must be below regular value %u",
+                    e->bypassed_timeout, n->bypassed_timeout);
             e->bypassed_timeout = n->bypassed_timeout / 10;
         }
     }
@@ -1065,25 +1068,25 @@ void FlowInitFlowProto(void)
         FlowProtoTimeout *d = &flow_timeouts_delta[i];
 
         if (e->est_timeout > n->est_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value for \'established\' must be below normal value");
+            SCLogWarning("emergency timeout value for \'established\' must be below normal value");
             e->est_timeout = n->est_timeout / 10;
         }
         d->est_timeout = n->est_timeout - e->est_timeout;
 
         if (e->new_timeout > n->new_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value for \'new\' must be below normal value");
+            SCLogWarning("emergency timeout value for \'new\' must be below normal value");
             e->new_timeout = n->new_timeout / 10;
         }
         d->new_timeout = n->new_timeout - e->new_timeout;
 
         if (e->closed_timeout > n->closed_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value for \'closed\' must be below normal value");
+            SCLogWarning("emergency timeout value for \'closed\' must be below normal value");
             e->closed_timeout = n->closed_timeout / 10;
         }
         d->closed_timeout = n->closed_timeout - e->closed_timeout;
 
         if (e->bypassed_timeout > n->bypassed_timeout) {
-            SCLogWarning(SC_WARN_FLOW_EMERGENCY, "emergency timeout value for \'bypassed\' must be below normal value");
+            SCLogWarning("emergency timeout value for \'bypassed\' must be below normal value");
             e->bypassed_timeout = n->bypassed_timeout / 10;
         }
         d->bypassed_timeout = n->bypassed_timeout - e->bypassed_timeout;
index 40aae4920eb906b777ebbdc051f5eef2cd493543..01f79ea2f72120e50806684ac3fc5d873cd747d5 100644 (file)
@@ -50,7 +50,7 @@ void HostBitInitCtx(void)
 {
     host_bit_id = HostStorageRegister("bit", sizeof(void *), NULL, HostBitFreeAll);
     if (host_bit_id.id == -1) {
-        FatalError(SC_ERR_FATAL, "Can't initiate host storage for bits");
+        FatalError("Can't initiate host storage for bits");
     }
 }
 
index 43ce26369ccd861a204530e299909337d47ddfbe..3d400315f5a0ef1b4e9fa640e897df2c3247fba7 100644 (file)
@@ -43,7 +43,7 @@ HostQueue *HostQueueNew()
 {
     HostQueue *q = (HostQueue *)SCMalloc(sizeof(HostQueue));
     if (q == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in HostQueueNew. Exiting...");
+        SCLogError("Fatal error encountered in HostQueueNew. Exiting...");
         exit(EXIT_SUCCESS);
     }
     q = HostQueueInit(q);
index 015a0889e02fbf7bec8df626abc10c35c43f26b9..1d4203d84d44bc6e90ea22300652f85d27d1cc9f 100644 (file)
@@ -202,9 +202,9 @@ void HostInitConfig(bool quiet)
     if ((ConfGet("host.memcap", &conf_val)) == 1) {
         uint64_t host_memcap = 0;
         if (ParseSizeStringU64(conf_val, &host_memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing host.memcap "
+            SCLogError("Error parsing host.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(host_config.memcap, host_memcap);
@@ -232,18 +232,17 @@ void HostInitConfig(bool quiet)
     /* alloc hash memory */
     uint64_t hash_size = host_config.hash_size * sizeof(HostHashRow);
     if (!(HOST_CHECK_MEMCAP(hash_size))) {
-        SCLogError(SC_ERR_HOST_INIT, "allocating host hash failed: "
-                "max host memcap is smaller than projected hash size. "
-                "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate "
-                "total hash size by multiplying \"host.hash-size\" with %"PRIuMAX", "
-                "which is the hash bucket size.", SC_ATOMIC_GET(host_config.memcap), hash_size,
-                (uintmax_t)sizeof(HostHashRow));
+        SCLogError("allocating host hash failed: "
+                   "max host memcap is smaller than projected hash size. "
+                   "Memcap: %" PRIu64 ", Hash table size %" PRIu64 ". Calculate "
+                   "total hash size by multiplying \"host.hash-size\" with %" PRIuMAX ", "
+                   "which is the hash bucket size.",
+                SC_ATOMIC_GET(host_config.memcap), hash_size, (uintmax_t)sizeof(HostHashRow));
         exit(EXIT_FAILURE);
     }
     host_hash = SCMallocAligned(host_config.hash_size * sizeof(HostHashRow), CLS);
     if (unlikely(host_hash == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in HostInitConfig. Exiting...");
+        FatalError("Fatal error encountered in HostInitConfig. Exiting...");
     }
     memset(host_hash, 0, host_config.hash_size * sizeof(HostHashRow));
 
@@ -263,16 +262,17 @@ void HostInitConfig(bool quiet)
     /* pre allocate hosts */
     for (i = 0; i < host_config.prealloc; i++) {
         if (!(HOST_CHECK_MEMCAP(g_host_size))) {
-            SCLogError(SC_ERR_HOST_INIT, "preallocating hosts failed: "
-                    "max host memcap reached. Memcap %"PRIu64", "
-                    "Memuse %"PRIu64".", SC_ATOMIC_GET(host_config.memcap),
+            SCLogError("preallocating hosts failed: "
+                       "max host memcap reached. Memcap %" PRIu64 ", "
+                       "Memuse %" PRIu64 ".",
+                    SC_ATOMIC_GET(host_config.memcap),
                     ((uint64_t)SC_ATOMIC_GET(host_memuse) + g_host_size));
             exit(EXIT_FAILURE);
         }
 
         Host *h = HostAlloc();
         if (h == NULL) {
-            SCLogError(SC_ERR_HOST_INIT, "preallocating host failed: %s", strerror(errno));
+            SCLogError("preallocating host failed: %s", strerror(errno));
             exit(EXIT_FAILURE);
         }
         HostEnqueue(&host_spare_q,h);
index 501d750fd21c0447bff1f6924091db273466bee9..dae920fff935ee323cebfc771e040c8cd2cd2356 100644 (file)
@@ -50,7 +50,7 @@ void IPPairBitInitCtx(void)
 {
     g_ippair_bit_storage_id = IPPairStorageRegister("bit", sizeof(void *), NULL, XBitFreeAll);
     if (g_ippair_bit_storage_id.id == -1) {
-        FatalError(SC_ERR_FATAL, "Can't initiate ippair storage for bits");
+        FatalError("Can't initiate ippair storage for bits");
     }
 }
 
index b88bc1b8dd485fa472e53a6c5cbf50e7327cba03..d410d30a875673ec1381d92669d6cdc696121073 100644 (file)
@@ -43,7 +43,7 @@ IPPairQueue *IPPairQueueNew()
 {
     IPPairQueue *q = (IPPairQueue *)SCMalloc(sizeof(IPPairQueue));
     if (q == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in IPPairQueueNew. Exiting...");
+        SCLogError("Fatal error encountered in IPPairQueueNew. Exiting...");
         exit(EXIT_SUCCESS);
     }
     q = IPPairQueueInit(q);
index 00c2b80eb39ffda14b28a58088f83da6272ee545..71ef24fef5ff4f4b8c45189bcb6f06bf58614b91 100644 (file)
@@ -197,9 +197,9 @@ void IPPairInitConfig(bool quiet)
     if ((ConfGet("ippair.memcap", &conf_val)) == 1)
     {
         if (ParseSizeStringU64(conf_val, &ippair_memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing ippair.memcap "
+            SCLogError("Error parsing ippair.memcap "
                        "from conf file - %s.  Killing engine",
-                       conf_val);
+                    conf_val);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(ippair_config.memcap, ippair_memcap);
@@ -229,18 +229,17 @@ void IPPairInitConfig(bool quiet)
     /* alloc hash memory */
     uint64_t hash_size = ippair_config.hash_size * sizeof(IPPairHashRow);
     if (!(IPPAIR_CHECK_MEMCAP(hash_size))) {
-        SCLogError(SC_ERR_IPPAIR_INIT, "allocating ippair hash failed: "
-                "max ippair memcap is smaller than projected hash size. "
-                "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate "
-                "total hash size by multiplying \"ippair.hash-size\" with %"PRIuMAX", "
-                "which is the hash bucket size.", SC_ATOMIC_GET(ippair_config.memcap), hash_size,
-                (uintmax_t)sizeof(IPPairHashRow));
+        SCLogError("allocating ippair hash failed: "
+                   "max ippair memcap is smaller than projected hash size. "
+                   "Memcap: %" PRIu64 ", Hash table size %" PRIu64 ". Calculate "
+                   "total hash size by multiplying \"ippair.hash-size\" with %" PRIuMAX ", "
+                   "which is the hash bucket size.",
+                SC_ATOMIC_GET(ippair_config.memcap), hash_size, (uintmax_t)sizeof(IPPairHashRow));
         exit(EXIT_FAILURE);
     }
     ippair_hash = SCMallocAligned(ippair_config.hash_size * sizeof(IPPairHashRow), CLS);
     if (unlikely(ippair_hash == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in IPPairInitConfig. Exiting...");
+        FatalError("Fatal error encountered in IPPairInitConfig. Exiting...");
     }
     memset(ippair_hash, 0, ippair_config.hash_size * sizeof(IPPairHashRow));
 
@@ -260,16 +259,17 @@ void IPPairInitConfig(bool quiet)
     /* pre allocate ippairs */
     for (i = 0; i < ippair_config.prealloc; i++) {
         if (!(IPPAIR_CHECK_MEMCAP(g_ippair_size))) {
-            SCLogError(SC_ERR_IPPAIR_INIT, "preallocating ippairs failed: "
-                    "max ippair memcap reached. Memcap %"PRIu64", "
-                    "Memuse %"PRIu64".", SC_ATOMIC_GET(ippair_config.memcap),
+            SCLogError("preallocating ippairs failed: "
+                       "max ippair memcap reached. Memcap %" PRIu64 ", "
+                       "Memuse %" PRIu64 ".",
+                    SC_ATOMIC_GET(ippair_config.memcap),
                     ((uint64_t)SC_ATOMIC_GET(ippair_memuse) + g_ippair_size));
             exit(EXIT_FAILURE);
         }
 
         IPPair *h = IPPairAlloc();
         if (h == NULL) {
-            SCLogError(SC_ERR_IPPAIR_INIT, "preallocating ippair failed: %s", strerror(errno));
+            SCLogError("preallocating ippair failed: %s", strerror(errno));
             exit(EXIT_FAILURE);
         }
         IPPairEnqueue(&ippair_spare_q,h);
index fbe76b1a9b0bc5c1596b6da1c306c1792c7dbd75..b5ba7120385e9174bff37696b84e4d3684f6fb0b 100644 (file)
@@ -40,7 +40,7 @@ LogCustomFormatNode * LogCustomFormatNodeAlloc()
 {
     LogCustomFormatNode * node = SCCalloc(1, sizeof(LogCustomFormatNode));
     if (unlikely(node == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to alloc custom format node");
+        SCLogError("Failed to alloc custom format node");
         return NULL;
     }
     return node;
@@ -55,7 +55,7 @@ LogCustomFormat * LogCustomFormatAlloc()
 {
     LogCustomFormat * cf = SCCalloc(1, sizeof(LogCustomFormat));
     if (unlikely(cf == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to alloc custom format");
+        SCLogError("Failed to alloc custom format");
         return NULL;
     }
     return cf;
@@ -188,7 +188,7 @@ void LogCustomFormatAddNode(LogCustomFormat *cf, LogCustomFormatNode *node)
         return;
 
     if (cf->cf_n == LOG_MAXN_NODES) {
-        SCLogWarning(SC_WARN_LOG_CF_TOO_MANY_NODES, "Too many options for custom format");
+        SCLogWarning("Too many options for custom format");
         return;
     }
 
index ba3f077055cd945db9efc9d8ccf42ddc8bdc49fa..d56b906c531d9b5dfab82ae2ad2fd8708da5cb55 100644 (file)
@@ -552,7 +552,7 @@ OutputInitResult LogHttpLogInitCtx(ConfNode *conf)
     OutputInitResult result = { NULL, false };
     LogFileCtx* file_ctx = LogFileNewCtx();
     if(file_ctx == NULL) {
-        SCLogError(SC_ERR_HTTP_LOG_GENERIC, "couldn't create new file_ctx");
+        SCLogError("couldn't create new file_ctx");
         return result;
     }
 
@@ -616,7 +616,7 @@ OutputInitResult LogHttpLogInitCtx(ConfNode *conf)
     return result;
 
 parsererror:
-    SCLogError(SC_ERR_INVALID_ARGUMENT,"Syntax error in custom http log format string.");
+    SCLogError("Syntax error in custom http log format string.");
 errorfree:
     LogCustomFormatFree(httplog_ctx->cf);
     LogFileFreeCtx(file_ctx);
index 8f9d810ff23cb0bcde1f12b3e0ba8b22279612c3..a9a38420170a2a09e6e56dcc2f2534ba6538abc0 100644 (file)
@@ -280,8 +280,7 @@ static int PcapLogCloseFile(ThreadVars *t, PcapLogData *pl)
                 comp->pcap_buf_wrapper = SCFmemopen(comp->pcap_buf,
                         comp->pcap_buf_size, "w");
                 if (comp->pcap_buf_wrapper == NULL) {
-                    SCLogError(SC_ERR_FOPEN, "SCFmemopen failed: %s",
-                            strerror(errno));
+                    SCLogError("SCFmemopen failed: %s", strerror(errno));
                     return TM_ECODE_FAILED;
                 }
             }
@@ -303,12 +302,11 @@ static int PcapLogCloseFile(ThreadVars *t, PcapLogData *pl)
             uint64_t bytes_written = LZ4F_compressEnd(comp->lz4f_context,
                     comp->buffer, comp->buffer_size, NULL);
             if (LZ4F_isError(bytes_written)) {
-                SCLogError(SC_ERR_PCAP_LOG_COMPRESS, "LZ4F_compressEnd: %s",
-                        LZ4F_getErrorName(bytes_written));
+                SCLogError("LZ4F_compressEnd: %s", LZ4F_getErrorName(bytes_written));
                 return TM_ECODE_FAILED;
             }
             if (fwrite(comp->buffer, 1, bytes_written, comp->file) < bytes_written) {
-                SCLogError(SC_ERR_FWRITE, "fwrite failed: %s", strerror(errno));
+                SCLogError("fwrite failed: %s", strerror(errno));
                 return TM_ECODE_FAILED;
             }
             fclose(comp->file);
@@ -364,8 +362,7 @@ static int PcapLogRotateFile(ThreadVars *t, PcapLogData *pl)
 
         if (remove(pf->filename) != 0) {
             // VJ remove can fail because file is already gone
-            //LogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED,
-            //           "failed to remove log file %s: %s",
+            // SCLogWarning("failed to remove log file %s: %s",
             //           pf->filename, strerror( errno ));
         }
 
@@ -383,9 +380,7 @@ static int PcapLogRotateFile(ThreadVars *t, PcapLogData *pl)
                         pf->dirname, pfnext->dirname);
 
                 if (remove(pf->dirname) != 0) {
-                    SCLogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED,
-                            "failed to remove sguil log %s: %s",
-                            pf->dirname, strerror( errno ));
+                    SCLogWarning("failed to remove sguil log %s: %s", pf->dirname, strerror(errno));
                 }
             }
         }
@@ -396,7 +391,7 @@ static int PcapLogRotateFile(ThreadVars *t, PcapLogData *pl)
     }
 
     if (PcapLogOpenFileCtx(pl) < 0) {
-        SCLogError(SC_ERR_FOPEN, "opening new pcap log file failed");
+        SCLogError("opening new pcap log file failed");
         return -1;
     }
     pl->file_cnt++;
@@ -436,27 +431,23 @@ static int PcapLogOpenHandles(PcapLogData *pl, const Packet *p)
             PcapLogCompressionData *comp = &pl->compression;
             if ((pl->pcap_dumper = pcap_dump_fopen(pl->pcap_dead_handle,
                     comp->pcap_buf_wrapper)) == NULL) {
-                SCLogError(SC_ERR_OPENING_FILE, "Error opening dump file %s",
-                        pcap_geterr(pl->pcap_dead_handle));
+                SCLogError("Error opening dump file %s", pcap_geterr(pl->pcap_dead_handle));
                 return TM_ECODE_FAILED;
             }
             comp->file = fopen(pl->filename, "w");
             if (comp->file == NULL) {
-                SCLogError(SC_ERR_OPENING_FILE,
-                        "Error opening file for compressed output: %s",
-                        strerror(errno));
+                SCLogError("Error opening file for compressed output: %s", strerror(errno));
                 return TM_ECODE_FAILED;
             }
 
             uint64_t bytes_written = LZ4F_compressBegin(comp->lz4f_context,
                     comp->buffer, comp->buffer_size, NULL);
             if (LZ4F_isError(bytes_written)) {
-                SCLogError(SC_ERR_PCAP_LOG_COMPRESS, "LZ4F_compressBegin: %s",
-                        LZ4F_getErrorName(bytes_written));
+                SCLogError("LZ4F_compressBegin: %s", LZ4F_getErrorName(bytes_written));
                 return TM_ECODE_FAILED;
             }
             if (fwrite(comp->buffer, 1, bytes_written, comp->file) < bytes_written) {
-                SCLogError(SC_ERR_FWRITE, "fwrite failed: %s", strerror(errno));
+                SCLogError("fwrite failed: %s", strerror(errno));
                 return TM_ECODE_FAILED;
             }
         }
@@ -507,21 +498,21 @@ static inline int PcapWrite(
         pcap_dump_flush(pl->pcap_dumper);
         long in_size = ftell(comp->pcap_buf_wrapper);
         if (in_size < 0) {
-            SCLogError(SC_ERR_PCAP_LOG_COMPRESS, "ftell failed with: %s", strerror(errno));
+            SCLogError("ftell failed with: %s", strerror(errno));
             return TM_ECODE_FAILED;
         }
         uint64_t out_size = LZ4F_compressUpdate(comp->lz4f_context, comp->buffer, comp->buffer_size,
                 comp->pcap_buf, (uint64_t)in_size, NULL);
         if (LZ4F_isError(len)) {
-            SCLogError(SC_ERR_PCAP_LOG_COMPRESS, "LZ4F_compressUpdate: %s", LZ4F_getErrorName(len));
+            SCLogError("LZ4F_compressUpdate: %s", LZ4F_getErrorName(len));
             return TM_ECODE_FAILED;
         }
         if (fseek(pl->compression.pcap_buf_wrapper, 0, SEEK_SET) != 0) {
-            SCLogError(SC_ERR_FSEEK, "fseek failed: %s", strerror(errno));
+            SCLogError("fseek failed: %s", strerror(errno));
             return TM_ECODE_FAILED;
         }
         if (fwrite(comp->buffer, 1, out_size, comp->file) < out_size) {
-            SCLogError(SC_ERR_FWRITE, "fwrite failed: %s", strerror(errno));
+            SCLogError("fwrite failed: %s", strerror(errno));
             return TM_ECODE_FAILED;
         }
         if (out_size > 0) {
@@ -784,14 +775,14 @@ static PcapLogData *PcapLogDataCopy(const PcapLogData *pl)
 
         copy_comp->buffer = SCMalloc(copy_comp->buffer_size);
         if (copy_comp->buffer == NULL) {
-            SCLogError(SC_ENOMEM, "SCMalloc failed: %s", strerror(errno));
+            SCLogError("SCMalloc failed: %s", strerror(errno));
             SCFree(copy->h);
             SCFree(copy);
             return NULL;
         }
         copy_comp->pcap_buf = SCMalloc(copy_comp->pcap_buf_size);
         if (copy_comp->pcap_buf == NULL) {
-            SCLogError(SC_ENOMEM, "SCMalloc failed: %s", strerror(errno));
+            SCLogError("SCMalloc failed: %s", strerror(errno));
             SCFree(copy_comp->buffer);
             SCFree(copy->h);
             SCFree(copy);
@@ -800,7 +791,7 @@ static PcapLogData *PcapLogDataCopy(const PcapLogData *pl)
         copy_comp->pcap_buf_wrapper = SCFmemopen(copy_comp->pcap_buf,
                 copy_comp->pcap_buf_size, "w");
         if (copy_comp->pcap_buf_wrapper == NULL) {
-            SCLogError(SC_ERR_FOPEN, "SCFmemopen failed: %s", strerror(errno));
+            SCLogError("SCFmemopen failed: %s", strerror(errno));
             SCFree(copy_comp->buffer);
             SCFree(copy_comp->pcap_buf);
             SCFree(copy->h);
@@ -813,9 +804,7 @@ static PcapLogData *PcapLogDataCopy(const PcapLogData *pl)
         LZ4F_errorCode_t errcode =
                LZ4F_createCompressionContext(&copy_comp->lz4f_context, 1);
         if (LZ4F_isError(errcode)) {
-            SCLogError(SC_ERR_PCAP_LOG_COMPRESS,
-                    "LZ4F_createCompressionContext failed: %s",
-                    LZ4F_getErrorName(errcode));
+            SCLogError("LZ4F_createCompressionContext failed: %s", LZ4F_getErrorName(errcode));
             fclose(copy_comp->pcap_buf_wrapper);
             SCFree(copy_comp->buffer);
             SCFree(copy_comp->pcap_buf);
@@ -911,8 +900,7 @@ static TmEcode PcapLogInitRingBuffer(PcapLogData *pl)
             }
             switch (part[1]) {
                 case 'i':
-                    SCLogError(
-                            SC_ERR_INVALID_ARGUMENT, "Thread ID not allowed in ring buffer mode.");
+                    SCLogError("Thread ID not allowed in ring buffer mode.");
                     return TM_ECODE_FAILED;
                 case 'n': {
                     char tmp[PATH_MAX];
@@ -924,8 +912,7 @@ static TmEcode PcapLogInitRingBuffer(PcapLogData *pl)
                     strlcat(pattern, "*", PATH_MAX);
                     break;
                 default:
-                    SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "Unsupported format character: %%%s", part);
+                    SCLogError("Unsupported format character: %%%s", part);
                     return TM_ECODE_FAILED;
             }
         }
@@ -941,8 +928,7 @@ static TmEcode PcapLogInitRingBuffer(PcapLogData *pl)
     /* Pattern is now just the directory name. */
     DIR *dir = opendir(pattern);
     if (dir == NULL) {
-        SCLogWarning(SC_ERR_DIR_OPEN, "Failed to open directory %s: %s",
-            pattern, strerror(errno));
+        SCLogWarning("Failed to open directory %s: %s", pattern, strerror(errno));
         return TM_ECODE_FAILED;
     }
 
@@ -1020,9 +1006,7 @@ static TmEcode PcapLogInitRingBuffer(PcapLogData *pl)
         while (pf != NULL && pl->file_cnt > pl->max_files) {
             SCLogDebug("Removing PCAP file %s", pf->filename);
             if (remove(pf->filename) != 0) {
-                SCLogWarning(SC_WARN_REMOVE_FILE,
-                    "Failed to remove PCAP file %s: %s", pf->filename,
-                    strerror(errno));
+                SCLogWarning("Failed to remove PCAP file %s: %s", pf->filename, strerror(errno));
             }
             TAILQ_REMOVE(&pl->pcap_file_list, pf, next);
             PcapFileNameFree(pf);
@@ -1061,8 +1045,7 @@ static TmEcode PcapLogDataInit(ThreadVars *t, const void *initdata, void **data)
 
     if (DatalinkHasMultipleValues()) {
         if (pl->mode != LOGMODE_MULTI) {
-            FatalError(SC_ERR_PCAP_MULTI_DEV_NO_SUPPORT,
-                    "Pcap logging with multiple link type is not supported.");
+            FatalError("Pcap logging with multiple link type is not supported.");
         } else {
             /* In multi mode, only pcap conditional is not supported as a flow timeout
              * will trigger packet logging with potentially invalid datalink. In regular
@@ -1073,12 +1056,10 @@ static TmEcode PcapLogDataInit(ThreadVars *t, const void *initdata, void **data)
             switch (pl->conditional) {
                 case LOGMODE_COND_ALERTS:
                 case LOGMODE_COND_TAG:
-                    FatalError(SC_ERR_PCAP_MULTI_DEV_NO_SUPPORT,
-                            "Can't have multiple link types in pcap conditional mode.");
+                    FatalError("Can't have multiple link types in pcap conditional mode.");
                     break;
                 default:
-                    SCLogWarning(SC_WARN_COMPATIBILITY,
-                            "Using multiple link types can result in invalid pcap output");
+                    SCLogWarning("Using multiple link types can result in invalid pcap output");
             }
         }
     }
@@ -1189,7 +1170,7 @@ static void PcapLogDataFree(PcapLogData *pl)
         LZ4F_errorCode_t errcode =
                 LZ4F_freeCompressionContext(pl->compression.lz4f_context);
         if (LZ4F_isError(errcode)) {
-            SCLogWarning(SC_EINVAL, "Error freeing lz4 context.");
+            SCLogWarning("Error freeing lz4 context.");
         }
     }
 #endif /* HAVE_LIBLZ4 */
@@ -1254,14 +1235,13 @@ static int ParseFilename(PcapLogData *pl, const char *filename)
     if (filename) {
         filename_len = strlen(filename);
         if (filename_len > (MAX_FILENAMELEN-1)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid filename option. Max filename-length: %d",MAX_FILENAMELEN-1);
+            SCLogError("invalid filename option. Max filename-length: %d", MAX_FILENAMELEN - 1);
             goto error;
         }
 
         for (i = 0; i < (int)strlen(filename); i++) {
             if (tok >= MAX_TOKS) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "invalid filename option. Max 2 %%-sign options");
+                SCLogError("invalid filename option. Max 2 %%-sign options");
                 goto error;
             }
 
@@ -1280,13 +1260,12 @@ static int ParseFilename(PcapLogData *pl, const char *filename)
 
                 if (i+1 < (int)strlen(filename)) {
                     if (tok >= MAX_TOKS) {
-                        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                                "invalid filename option. Max 2 %%-sign options");
+                        SCLogError("invalid filename option. Max 2 %%-sign options");
                         goto error;
                     }
 
                     if (filename[i+1] != 'n' && filename[i+1] != 't' && filename[i+1] != 'i') {
-                        SCLogError(SC_ERR_INVALID_ARGUMENT,
+                        SCLogError(
                                 "invalid filename option. Valid %%-sign options: %%n, %%i and %%t");
                         goto error;
                     }
@@ -1303,15 +1282,13 @@ static int ParseFilename(PcapLogData *pl, const char *filename)
         }
 
         if ((tok == 0) && (pl->mode == LOGMODE_MULTI)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                    "Invalid filename for multimode. Need at list one %%-sign option");
+            SCLogError("Invalid filename for multimode. Need at list one %%-sign option");
             goto error;
         }
 
         if (s) {
             if (tok >= MAX_TOKS) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "invalid filename option. Max 3 %%-sign options");
+                SCLogError("invalid filename option. Max 3 %%-sign options");
                 goto error;
 
             }
@@ -1353,14 +1330,13 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
 
     PcapLogData *pl = SCMalloc(sizeof(PcapLogData));
     if (unlikely(pl == NULL)) {
-        FatalError(SC_ERR_FATAL, "Failed to allocate Memory for PcapLogData");
+        FatalError("Failed to allocate Memory for PcapLogData");
     }
     memset(pl, 0, sizeof(PcapLogData));
 
     pl->h = SCMalloc(sizeof(*pl->h));
     if (pl->h == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "Failed to allocate Memory for pcap header struct");
+        FatalError("Failed to allocate Memory for pcap header struct");
     }
 
     /* Set the defaults */
@@ -1382,8 +1358,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
     if (pcre_timestamp_code == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        FatalError(SC_ERR_PCRE_COMPILE, "Failed to compile \"%s\" at offset %d: %s",
-                timestamp_pattern, (int)eo, errbuffer);
+        FatalError(
+                "Failed to compile \"%s\" at offset %d: %s", timestamp_pattern, (int)eo, errbuffer);
     }
     pcre_timestamp_match = pcre2_match_data_create_from_pattern(pcre_timestamp_code, NULL);
 
@@ -1410,9 +1386,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         s_limit = ConfNodeLookupChildValue(conf, "limit");
         if (s_limit != NULL) {
             if (ParseSizeStringU64(s_limit, &pl->size_limit) < 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                    "Failed to initialize pcap output, invalid limit: %s",
-                    s_limit);
+                SCLogError("Failed to initialize pcap output, invalid limit: %s", s_limit);
                 exit(EXIT_FAILURE);
             }
             if (pl->size_limit < 4096) {
@@ -1421,9 +1395,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
                 uint64_t size = pl->size_limit * 1024 * 1024;
                 pl->size_limit = size;
             } else if (pl->size_limit < MIN_LIMIT) {
-                    FatalError(SC_ERR_FATAL,
-                               "Fail to initialize pcap-log output, limit less than "
-                               "allowed minimum.");
+                FatalError("Fail to initialize pcap-log output, limit less than "
+                           "allowed minimum.");
             }
         }
     }
@@ -1437,9 +1410,9 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
             } else if (strcasecmp(s_mode, "multi") == 0) {
                 pl->mode = LOGMODE_MULTI;
             } else if (strcasecmp(s_mode, "normal") != 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                    "log-pcap: invalid mode \"%s\". Valid options: \"normal\", "
-                    "\"sguil\", or \"multi\" mode ", s_mode);
+                SCLogError("log-pcap: invalid mode \"%s\". Valid options: \"normal\", "
+                           "\"sguil\", or \"multi\" mode ",
+                        s_mode);
                 exit(EXIT_FAILURE);
             }
         }
@@ -1451,9 +1424,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         }
         if (s_dir == NULL) {
             if (pl->mode == LOGMODE_SGUIL) {
-                    FatalError(SC_ERR_FATAL,
-                               "log-pcap \"sguil\" mode requires \"sguil-base-dir\" "
-                               "option to be set.");
+                FatalError("log-pcap \"sguil\" mode requires \"sguil-base-dir\" "
+                           "option to be set.");
             } else {
                 const char *log_dir = NULL;
                 log_dir = ConfigGetLogDirectory();
@@ -1476,8 +1448,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
 
             struct stat stat_buf;
             if (stat(pl->dir, &stat_buf) != 0) {
-                SCLogError(SC_ERR_LOGDIR_CONFIG, "The sguil-base-dir directory \"%s\" "
-                        "supplied doesn't exist. Shutting down the engine",
+                SCLogError("The sguil-base-dir directory \"%s\" "
+                           "supplied doesn't exist. Shutting down the engine",
                         pl->dir);
                 exit(EXIT_FAILURE);
             }
@@ -1499,8 +1471,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         } else if (strcmp(compression_str, "lz4") == 0) {
 #ifdef HAVE_LIBLZ4
             if (pl->mode == LOGMODE_SGUIL) {
-                SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Compressed pcap "
-                        "logs are not possible in sguil mode");
+                SCLogError("Compressed pcap "
+                           "logs are not possible in sguil mode");
                 SCFree(pl->h);
                 SCFree(pl);
                 return result;
@@ -1513,14 +1485,13 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
                     sizeof(struct pcap_pkthdr) + PCAP_SNAPLEN;
             comp->pcap_buf = SCMalloc(comp->pcap_buf_size);
             if (comp->pcap_buf == NULL) {
-                SCLogError(SC_ENOMEM, "SCMalloc failed: %s", strerror(errno));
+                SCLogError("SCMalloc failed: %s", strerror(errno));
                 exit(EXIT_FAILURE);
             }
             comp->pcap_buf_wrapper = SCFmemopen(comp->pcap_buf,
                     comp->pcap_buf_size, "w");
             if (comp->pcap_buf_wrapper == NULL) {
-                SCLogError(SC_ERR_FOPEN, "SCFmemopen failed: %s",
-                        strerror(errno));
+                SCLogError("SCFmemopen failed: %s", strerror(errno));
                 exit(EXIT_FAILURE);
             }
 
@@ -1553,9 +1524,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
                 LZ4F_createCompressionContext(&pl->compression.lz4f_context, 1);
 
             if (LZ4F_isError(errcode)) {
-                SCLogError(SC_ERR_PCAP_LOG_COMPRESS,
-                        "LZ4F_createCompressionContext failed: %s",
-                        LZ4F_getErrorName(errcode));
+                SCLogError("LZ4F_createCompressionContext failed: %s", LZ4F_getErrorName(errcode));
                 exit(EXIT_FAILURE);
             }
 
@@ -1566,7 +1535,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
 
             comp->buffer = SCMalloc(comp->buffer_size);
             if (unlikely(comp->buffer == NULL)) {
-                FatalError(SC_ERR_FATAL, "Failed to allocate memory for "
+                FatalError("Failed to allocate memory for "
                            "lz4 output buffer.");
             }
 
@@ -1576,16 +1545,17 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
 
             pl->suffix = ".lz4";
 #else
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "lz4 compression was selected "
-                    "in pcap-log, but suricata was not compiled with lz4 "
-                    "support.");
+            SCLogError("lz4 compression was selected "
+                       "in pcap-log, but suricata was not compiled with lz4 "
+                       "support.");
             PcapLogDataFree(pl);
             return result;
 #endif /* HAVE_LIBLZ4 */
         }
         else {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Unsupported pcap-log "
-                    "compression format: %s", compression_str);
+            SCLogError("Unsupported pcap-log "
+                       "compression format: %s",
+                    compression_str);
             PcapLogDataFree(pl);
             return result;
         }
@@ -1602,9 +1572,8 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
                 pl->conditional = LOGMODE_COND_TAG;
                 EnableTcpSessionDumping();
             } else if (strcasecmp(s_conditional, "all") != 0) {
-                FatalError(SC_ERR_INVALID_ARGUMENT,
-                        "log-pcap: invalid conditional \"%s\". Valid options: \"all\", "
-                        "\"alerts\", or \"tag\" mode ",
+                FatalError("log-pcap: invalid conditional \"%s\". Valid options: \"all\", "
+                           "\"alerts\", or \"tag\" mode ",
                         s_conditional);
             }
         }
@@ -1626,14 +1595,13 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         if (max_number_of_files_s != NULL) {
             if (StringParseUint32(&max_file_limit, 10, 0,
                                         max_number_of_files_s) == -1) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "Failed to initialize "
+                SCLogError("Failed to initialize "
                            "pcap-log output, invalid number of files limit: %s",
-                           max_number_of_files_s);
+                        max_number_of_files_s);
                 exit(EXIT_FAILURE);
             } else if (max_file_limit < 1) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to initialize pcap-log output, limit less than "
-                               "allowed minimum.");
+                FatalError("Failed to initialize pcap-log output, limit less than "
+                           "allowed minimum.");
             } else {
                 pl->max_files = max_file_limit;
                 pl->use_ringbuffer = RING_BUFFER_MODE_ENABLED;
@@ -1649,9 +1617,9 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         if (strcasecmp(ts_format, "usec") == 0) {
             pl->timestamp_format = TS_FORMAT_USEC;
         } else if (strcasecmp(ts_format, "sec") != 0) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                "log-pcap ts_format specified %s is invalid must be"
-                " \"sec\" or \"usec\"", ts_format);
+            SCLogError("log-pcap ts_format specified %s is invalid must be"
+                       " \"sec\" or \"usec\"",
+                    ts_format);
             exit(EXIT_FAILURE);
         }
     }
@@ -1666,8 +1634,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         } else if (ConfValIsTrue(use_stream_depth)) {
             pl->use_stream_depth = USE_STREAM_DEPTH_ENABLED;
         } else {
-                FatalError(SC_ERR_FATAL,
-                           "log-pcap use_stream_depth specified is invalid must be");
+            FatalError("log-pcap use_stream_depth specified is invalid must be");
         }
     }
 
@@ -1681,8 +1648,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
         } else if (ConfValIsTrue(honor_pass_rules)) {
             pl->honor_pass_rules = HONOR_PASS_RULES_ENABLED;
         } else {
-                FatalError(SC_ERR_FATAL,
-                           "log-pcap honor-pass-rules specified is invalid");
+            FatalError("log-pcap honor-pass-rules specified is invalid");
         }
     }
 
@@ -1690,7 +1656,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
 
     OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
     if (unlikely(output_ctx == NULL)) {
-        FatalError(SC_ERR_FATAL, "Failed to allocate memory for OutputCtx.");
+        FatalError("Failed to allocate memory for OutputCtx.");
     }
     output_ctx->data = pl;
     output_ctx->DeInit = PcapLogFileDeInitCtx;
@@ -1769,7 +1735,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
         /* create the filename to use */
         int ret = snprintf(dirfull, sizeof(dirfull), "%s/%s", pl->dir, dirname);
         if (ret < 0 || (size_t)ret >= sizeof(dirfull)) {
-            SCLogError(SC_ERR_SPRINTF,"failed to construct path");
+            SCLogError("failed to construct path");
             goto error;
         }
 
@@ -1777,8 +1743,8 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
         (void)SCMkDir(dirfull, 0700);
 
         if ((pf->dirname = SCStrdup(dirfull)) == NULL) {
-            SCLogError(SC_ENOMEM, "Error allocating memory for "
-                                  "directory name");
+            SCLogError("Error allocating memory for "
+                       "directory name");
             goto error;
         }
 
@@ -1792,7 +1758,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
                      (uint32_t)ts.tv_usec, pl->suffix);
         }
         if (written == PATH_MAX) {
-            SCLogError(SC_ERR_SPRINTF,"log-pcap path overflow");
+            SCLogError("log-pcap path overflow");
             goto error;
         }
     } else if (pl->mode == LOGMODE_NORMAL) {
@@ -1807,7 +1773,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
                     (uint32_t)ts.tv_sec, (uint32_t)ts.tv_usec, pl->suffix);
         }
         if (ret < 0 || (size_t)ret >= PATH_MAX) {
-            SCLogError(SC_ERR_SPRINTF,"failed to construct path");
+            SCLogError("failed to construct path");
             goto error;
         }
     } else if (pl->mode == LOGMODE_MULTI) {
@@ -1869,7 +1835,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
                         (uint32_t)ts.tv_usec, pl->suffix);
             }
             if (ret < 0 || (size_t)ret >= PATH_MAX) {
-                SCLogError(SC_ERR_SPRINTF,"failed to construct path");
+                SCLogError("failed to construct path");
                 goto error;
             }
         }
@@ -1877,7 +1843,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
     }
 
     if ((pf->filename = SCStrdup(pl->filename)) == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory. For filename");
+        SCLogError("Error allocating memory. For filename");
         goto error;
     }
     SCLogDebug("Opening pcap file log %s", pf->filename);
@@ -1967,8 +1933,7 @@ static void PcapLogProfilingDump(PcapLogData *pl)
     if (profiling_pcaplog_output_to_file == 1) {
         fp = fopen(profiling_pcaplog_file_name, profiling_pcaplog_file_mode);
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s",
-                    profiling_pcaplog_file_name, strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_pcaplog_file_name, strerror(errno));
             return;
         }
     } else {
@@ -2033,7 +1998,7 @@ void PcapLogProfileSetup(void)
 
             profiling_pcaplog_file_name = SCMalloc(PATH_MAX);
             if (unlikely(profiling_pcaplog_file_name == NULL)) {
-                FatalError(SC_ERR_FATAL, "can't duplicate file name");
+                FatalError("can't duplicate file name");
             }
 
             snprintf(profiling_pcaplog_file_name, PATH_MAX, "%s/%s", log_dir, filename);
index 09b20a6384ab4fb8493ae7d92b55359522e3c9b8..52ad90c589057294350f1d3f6afd9c64ede34e99 100644 (file)
@@ -214,7 +214,7 @@ static OutputInitResult LogStatsLogInitCtx(ConfNode *conf)
     OutputInitResult result = { NULL, false };
     LogFileCtx *file_ctx = LogFileNewCtx();
     if (file_ctx == NULL) {
-        SCLogError(SC_ERR_STATS_LOG_GENERIC, "couldn't create new file_ctx");
+        SCLogError("couldn't create new file_ctx");
         return result;
     }
 
@@ -242,8 +242,7 @@ static OutputInitResult LogStatsLogInitCtx(ConfNode *conf)
                 (threads != NULL && ConfValIsFalse(threads))) {
             LogFileFreeCtx(file_ctx);
             SCFree(statslog_ctx);
-            SCLogError(SC_ERR_STATS_LOG_NEGATED,
-                    "Cannot disable both totals and threads in stats logging");
+            SCLogError("Cannot disable both totals and threads in stats logging");
             return result;
         }
 
index 56195a26d108cba48c7be9e1db94f2421e5c48a2..ffc5a97e7f97d5b55784702871447157ca139ad2 100644 (file)
@@ -218,7 +218,7 @@ OutputInitResult LogTcpDataLogInitCtx(ConfNode *conf)
 
     LogFileCtx *file_ctx = LogFileNewCtx();
     if(file_ctx == NULL) {
-        SCLogError(SC_ERR_TCPDATA_LOG_GENERIC, "couldn't create new file_ctx");
+        SCLogError("couldn't create new file_ctx");
         return result;
     }
 
@@ -299,7 +299,7 @@ OutputInitResult LogTcpDataLogInitCtx(ConfNode *conf)
 parsererror:
     LogFileFreeCtx(file_ctx);
     SCFree(tcpdatalog_ctx);
-    SCLogError(SC_ERR_INVALID_ARGUMENT,"Syntax error in custom http log format string.");
+    SCLogError("Syntax error in custom http log format string.");
     return result;
 
 }
index aa5e6db82e8ee61dc068c33d8356b39ec5b2a376..0eb041a489af0d4257ef75953073d8168f09e53b 100644 (file)
@@ -209,7 +209,7 @@ static OutputInitResult LogTlsLogInitCtx(ConfNode *conf)
     LogFileCtx* file_ctx = LogFileNewCtx();
 
     if (file_ctx == NULL) {
-        SCLogError(SC_ERR_TLS_LOG_GENERIC, "LogTlsLogInitCtx: Couldn't "
+        SCLogError("LogTlsLogInitCtx: Couldn't "
                    "create new file_ctx");
         return result;
     }
@@ -273,7 +273,7 @@ static OutputInitResult LogTlsLogInitCtx(ConfNode *conf)
     return result;
 
 parser_error:
-    SCLogError(SC_ERR_INVALID_ARGUMENT, "Syntax error in custom tls log "
+    SCLogError("Syntax error in custom tls log "
                "format string.");
 tlslog_error:
     LogCustomFormatFree(tlslog_ctx->cf);
index b6a966dae51c6d96b61bd1b0f2f3f7d9c86c416c..f1fe2225ebddfd82d9ae671ba1dbee4f4dae46eb 100644 (file)
@@ -94,16 +94,15 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
 
     CreateFileName(p, state, filename, sizeof(filename));
     if (strlen(filename) == 0) {
-        SCLogWarning(SC_ERR_FOPEN, "Can't create PEM filename");
+        SCLogWarning("Can't create PEM filename");
         SCReturn;
     }
 
     fp = fopen(filename, "w");
     if (fp == NULL) {
         if (logging_dir_not_writable < LOGGING_WRITE_ISSUE_LIMIT) {
-            SCLogWarning(SC_ERR_FOPEN,
-                         "Can't create PEM file '%s' in '%s' directory",
-                         filename, tls_logfile_base_dir);
+            SCLogWarning(
+                    "Can't create PEM file '%s' in '%s' directory", filename, tls_logfile_base_dir);
             logging_dir_not_writable++;
         }
         SCReturn;
@@ -117,7 +116,7 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
                 SCFree(aft->enc_buf);
                 aft->enc_buf = NULL;
                 aft->enc_buf_len = 0;
-                SCLogWarning(SC_ENOMEM, "Can't allocate data for base64 encoding");
+                SCLogWarning("Can't allocate data for base64 encoding");
                 goto end_fp;
             }
             aft->enc_buf = ptmp;
@@ -128,7 +127,7 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
 
         ret = Base64Encode((unsigned char*) cert->cert_data, cert->cert_len, aft->enc_buf, &pemlen);
         if (ret != SC_BASE64_OK) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "Invalid return of Base64Encode function");
+            SCLogWarning("Invalid return of Base64Encode function");
             goto end_fwrite_fp;
         }
 
@@ -194,9 +193,8 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
         fclose(fpmeta);
     } else {
         if (logging_dir_not_writable < LOGGING_WRITE_ISSUE_LIMIT) {
-            SCLogWarning(SC_ERR_FOPEN,
-                         "Can't create meta file '%s' in '%s' directory",
-                         filename, tls_logfile_base_dir);
+            SCLogWarning("Can't create meta file '%s' in '%s' directory", filename,
+                    tls_logfile_base_dir);
             logging_dir_not_writable++;
         }
         SCReturn;
@@ -209,14 +207,14 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
 end_fwrite_fp:
     fclose(fp);
     if (logging_dir_not_writable < LOGGING_WRITE_ISSUE_LIMIT) {
-        SCLogWarning(SC_ERR_FWRITE, "Unable to write certificate");
+        SCLogWarning("Unable to write certificate");
         logging_dir_not_writable++;
     }
 end_fwrite_fpmeta:
     if (fpmeta) {
         fclose(fpmeta);
         if (logging_dir_not_writable < LOGGING_WRITE_ISSUE_LIMIT) {
-            SCLogWarning(SC_ERR_FWRITE, "Unable to write certificate metafile");
+            SCLogWarning("Unable to write certificate metafile");
             logging_dir_not_writable++;
         }
     }
@@ -299,9 +297,8 @@ static TmEcode LogTlsStoreLogThreadInit(ThreadVars *t, const void *initdata, voi
         if (ret != 0) {
             int err = errno;
             if (err != EEXIST) {
-                SCLogError(SC_ERR_LOGDIR_CONFIG,
-                        "Cannot create certs drop directory %s: %s",
-                        tls_logfile_base_dir, strerror(err));
+                SCLogError("Cannot create certs drop directory %s: %s", tls_logfile_base_dir,
+                        strerror(err));
                 exit(EXIT_FAILURE);
             }
         } else {
index f759440207fce5d3298ef6f6534c1d9d4eb8c3f2..a19d2589449e609b8de77a4e214bc3b27f8fbc8f 100644 (file)
@@ -45,7 +45,7 @@ static int SyslogInit(ConfNode *conf, bool threaded, void **init_data)
 {
     Context *context = SCCalloc(1, sizeof(Context));
     if (context == NULL) {
-        SCLogError(SC_ENOMEM, "Unable to allocate context for %s", OUTPUT_NAME);
+        SCLogError("Unable to allocate context for %s", OUTPUT_NAME);
         return -1;
     }
     const char *facility_s = ConfNodeLookupChildValue(conf, "facility");
@@ -55,9 +55,8 @@ static int SyslogInit(ConfNode *conf, bool threaded, void **init_data)
 
     int facility = SCMapEnumNameToValue(facility_s, SCSyslogGetFacilityMap());
     if (facility == -1) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                "Invalid syslog facility: \"%s\","
-                " now using \"%s\" as syslog facility",
+        SCLogWarning("Invalid syslog facility: \"%s\","
+                     " now using \"%s\" as syslog facility",
                 facility_s, DEFAULT_ALERT_SYSLOG_FACILITY_STR);
         facility = DEFAULT_ALERT_SYSLOG_FACILITY;
     }
@@ -101,7 +100,7 @@ void SyslogInitialize(void)
     SCEveFileType *file_type = SCCalloc(1, sizeof(SCEveFileType));
 
     if (file_type == NULL) {
-        FatalError(SC_ENOMEM, "Unable to allocate memory for eve file type %s", OUTPUT_NAME);
+        FatalError("Unable to allocate memory for eve file type %s", OUTPUT_NAME);
     }
 
     file_type->name = OUTPUT_NAME;
@@ -109,7 +108,7 @@ void SyslogInitialize(void)
     file_type->Deinit = SyslogDeInit;
     file_type->Write = SyslogWrite;
     if (!SCRegisterEveFileType(file_type)) {
-        FatalError(SC_ERR_LOG_OUTPUT, "Failed to register EVE file type: %s", OUTPUT_NAME);
+        FatalError("Failed to register EVE file type: %s", OUTPUT_NAME);
     }
 }
 #endif /* !OS_WIN32 */
index dcfaf1350f2898bd9ab619c5984cc9282ba5766e..b5b43771ddf97536a7c256ad1ac8949201877995 100644 (file)
@@ -58,15 +58,26 @@ typedef struct OutputFilestoreLogThread_ {
     uint16_t fs_error_counter;
 } OutputFilestoreLogThread;
 
+enum WarnOnceTypes {
+    WOT_OPEN,
+    WOT_WRITE,
+    WOT_UNLINK,
+    WOT_RENAME,
+    WOT_SNPRINTF,
+
+    WOT_MAX,
+};
+
 /* For WARN_ONCE, a record of warnings that have already been
  * issued. */
-static thread_local bool once_errs[SC_ERR_MAX];
-
-#define WARN_ONCE(err_code, ...)  do {                   \
-        if (!once_errs[err_code]) {                      \
-            once_errs[err_code] = true;                  \
-            SCLogWarning(err_code, __VA_ARGS__);         \
-        }                                                \
+static thread_local bool once_errs[WOT_MAX];
+
+#define WARN_ONCE(wot_type, ...)                                                                   \
+    do {                                                                                           \
+        if (!once_errs[wot_type]) {                                                                \
+            once_errs[wot_type] = true;                                                            \
+            SCLogWarning(__VA_ARGS__);                                                             \
+        }                                                                                          \
     } while (0)
 
 static uint64_t OutputFilestoreOpenFilesCounter(void)
@@ -133,14 +144,13 @@ static void OutputFilestoreFinalizeFiles(ThreadVars *tv, const OutputFilestoreLo
         OutputFilestoreUpdateFileTime(tmp_filename, final_filename);
         if (unlink(tmp_filename) != 0) {
             StatsIncr(tv, oft->fs_error_counter);
-            WARN_ONCE(SC_WARN_REMOVE_FILE,
-                    "Failed to remove temporary file %s: %s", tmp_filename,
+            WARN_ONCE(WOT_UNLINK, "Failed to remove temporary file %s: %s", tmp_filename,
                     strerror(errno));
         }
     } else if (rename(tmp_filename, final_filename) != 0) {
         StatsIncr(tv, oft->fs_error_counter);
-        WARN_ONCE(SC_WARN_RENAMING_FILE, "Failed to rename %s to %s: %s",
-                tmp_filename, final_filename, strerror(errno));
+        WARN_ONCE(WOT_RENAME, "Failed to rename %s to %s: %s", tmp_filename, final_filename,
+                strerror(errno));
         if (unlink(tmp_filename) != 0) {
             /* Just increment, don't log as has_fs_errors would
              * already be set above. */
@@ -155,8 +165,7 @@ static void OutputFilestoreFinalizeFiles(ThreadVars *tv, const OutputFilestoreLo
                         "%s.%"PRIuMAX".%u.json", final_filename,
                         (uintmax_t)p->ts.tv_sec, ff->file_store_id)
                 == (int)sizeof(js_metadata_filename)) {
-            WARN_ONCE(SC_ERR_SPRINTF,
-                "Failed to write file info record. Output filename truncated.");
+            WARN_ONCE(WOT_SNPRINTF, "Failed to write file info record. Output filename truncated.");
         } else {
             JsonBuilder *js_fileinfo =
                     JsonBuildFileInfoRecord(p, ff, tx, tx_id, true, dir, ctx->xff_cfg, NULL);
@@ -196,9 +205,7 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
                 0644);
         if (file_fd == -1) {
             StatsIncr(tv, aft->fs_error_counter);
-            SCLogWarning(SC_ERR_OPENING_FILE,
-                    "Filestore (v2) failed to create %s: %s", filename,
-                    strerror(errno));
+            SCLogWarning("Filestore (v2) failed to create %s: %s", filename, strerror(errno));
             return -1;
         }
 
@@ -217,9 +224,8 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
             file_fd = open(filename, O_APPEND | O_NOFOLLOW | O_WRONLY);
             if (file_fd == -1) {
                 StatsIncr(tv, aft->fs_error_counter);
-                WARN_ONCE(SC_ERR_OPENING_FILE,
-                        "Filestore (v2) failed to open file %s: %s",
-                        filename, strerror(errno));
+                WARN_ONCE(WOT_OPEN, "Filestore (v2) failed to open file %s: %s", filename,
+                        strerror(errno));
                 return -1;
             }
         } else {
@@ -231,9 +237,8 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
         ssize_t r = write(file_fd, (const void *)data, (size_t)data_len);
         if (r == -1) {
             StatsIncr(tv, aft->fs_error_counter);
-            WARN_ONCE(SC_ERR_FWRITE,
-                    "Filestore (v2) failed to write to %s: %s",
-                    filename, strerror(errno));
+            WARN_ONCE(WOT_WRITE, "Filestore (v2) failed to write to %s: %s", filename,
+                    strerror(errno));
             if (ff->fd != -1) {
                 SC_ATOMIC_SUB(filestore_open_file_cnt, 1);
             }
@@ -331,9 +336,7 @@ static bool InitFilestoreDirectory(const char *dir)
     if (!SCPathExists(dir)) {
         SCLogInfo("Filestore (v2) creating directory %s", dir);
         if (SCCreateDirectoryTree(dir, true) != 0) {
-            SCLogError(SC_ERR_CREATE_DIRECTORY,
-                    "Filestore (v2) failed to create directory %s: %s", dir,
-                    strerror(errno));
+            SCLogError("Filestore (v2) failed to create directory %s: %s", dir, strerror(errno));
             return false;
         }
     }
@@ -342,17 +345,15 @@ static bool InitFilestoreDirectory(const char *dir)
         char leaf[PATH_MAX];
         int n = snprintf(leaf, sizeof(leaf), "%s/%02x", dir, i);
         if (n < 0 || n >= PATH_MAX) {
-            SCLogError(SC_ERR_CREATE_DIRECTORY,
-                    "Filestore (v2) failed to create leaf directory: "
-                    "path too long");
+            SCLogError("Filestore (v2) failed to create leaf directory: "
+                       "path too long");
             return false;
         }
         if (!SCPathExists(leaf)) {
             SCLogInfo("Filestore (v2) creating directory %s", leaf);
             if (SCDefaultMkDir(leaf) != 0) {
-                SCLogError(SC_ERR_CREATE_DIRECTORY,
-                        "Filestore (v2) failed to create directory %s: %s",
-                        leaf, strerror(errno));
+                SCLogError(
+                        "Filestore (v2) failed to create directory %s: %s", leaf, strerror(errno));
                 return false;
             }
         }
@@ -362,16 +363,13 @@ static bool InitFilestoreDirectory(const char *dir)
     char tmpdir[PATH_MAX];
     int n = snprintf(tmpdir, sizeof(tmpdir), "%s/tmp", dir);
     if (n < 0 || n >= PATH_MAX) {
-        SCLogError(SC_ERR_CREATE_DIRECTORY,
-                "Filestore (v2) failed to create tmp directory: path too long");
+        SCLogError("Filestore (v2) failed to create tmp directory: path too long");
         return false;
     }
     if (!SCPathExists(tmpdir)) {
         SCLogInfo("Filestore (v2) creating directory %s", tmpdir);
         if (SCDefaultMkDir(tmpdir) != 0) {
-            SCLogError(SC_ERR_CREATE_DIRECTORY,
-                    "Filestore (v2) failed to create directory %s: %s", tmpdir,
-                    strerror(errno));
+            SCLogError("Filestore (v2) failed to create directory %s: %s", tmpdir, strerror(errno));
             return false;
         }
     }
@@ -389,15 +387,13 @@ static OutputInitResult OutputFilestoreLogInitCtx(ConfNode *conf)
 
     intmax_t version = 0;
     if (!ConfGetChildValueInt(conf, "version", &version) || version < 2) {
-        SCLogWarning(SC_WARN_DEPRECATED,
-                "File-store v1 has been removed. Please update to file-store v2.");
+        SCLogWarning("File-store v1 has been removed. Please update to file-store v2.");
         return result;
     }
 
     if (RunModeOutputFiledataEnabled()) {
-        SCLogWarning(SC_ERR_NOT_SUPPORTED,
-                "A file data logger is already enabled. Filestore (v2) "
-                "will not be enabled.");
+        SCLogWarning("A file data logger is already enabled. Filestore (v2) "
+                     "will not be enabled.");
         return result;
     }
 
@@ -416,7 +412,7 @@ static OutputInitResult OutputFilestoreLogInitCtx(ConfNode *conf)
     int written = snprintf(ctx->tmpdir, sizeof(ctx->tmpdir) - 1, "%s/tmp",
             log_directory);
     if (written == sizeof(ctx->tmpdir)) {
-        SCLogError(SC_ERR_SPRINTF, "File-store output directory overflow.");
+        SCLogError("File-store output directory overflow.");
         SCFree(ctx);
         return result;
     }
@@ -468,18 +464,18 @@ static OutputInitResult OutputFilestoreLogInitCtx(ConfNode *conf)
         uint32_t stream_depth = 0;
         if (ParseSizeStringU32(stream_depth_str,
                                &stream_depth) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "file-store.stream-depth "
                        "from conf file - %s.  Killing engine",
-                       stream_depth_str);
+                    stream_depth_str);
             exit(EXIT_FAILURE);
         }
         if (stream_depth) {
             if (stream_depth <= stream_config.reassembly_depth) {
-                SCLogWarning(SC_WARN_FILESTORE_CONFIG,
-                           "file-store.stream-depth value %" PRIu32 " has "
-                           "no effect since it's less than stream.reassembly.depth "
-                           "value.", stream_depth);
+                SCLogWarning("file-store.stream-depth value %" PRIu32 " has "
+                             "no effect since it's less than stream.reassembly.depth "
+                             "value.",
+                        stream_depth);
             } else {
                 FileReassemblyDepthEnable(stream_depth);
             }
@@ -492,10 +488,10 @@ static OutputInitResult OutputFilestoreLogInitCtx(ConfNode *conf)
         uint32_t file_count = 0;
         if (ParseSizeStringU32(file_count_str,
                                &file_count) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "file-store.max-open-files "
                        "from conf file - %s.  Killing engine",
-                       file_count_str);
+                    file_count_str);
             exit(EXIT_FAILURE);
         } else {
             if (file_count != 0) {
index 9f9f8a777147fb53f5e408932904be1cc5cdf1e0..ff0c14046a3083116c36d758fa99aab842644275 100644 (file)
@@ -1035,9 +1035,9 @@ static void JsonAlertLogSetupMetadata(AlertJsonOutputCtx *json_output_ctx,
         if (payload_buffer_value != NULL) {
             uint32_t value;
             if (ParseSizeStringU32(payload_buffer_value, &value) < 0) {
-                SCLogError(SC_ERR_ALERT_PAYLOAD_BUFFER, "Error parsing "
+                SCLogError("Error parsing "
                            "payload-buffer-size - %s. Killing engine",
-                           payload_buffer_value);
+                        payload_buffer_value);
                 exit(EXIT_FAILURE);
             } else {
                 payload_buffer_size = value;
@@ -1046,8 +1046,9 @@ static void JsonAlertLogSetupMetadata(AlertJsonOutputCtx *json_output_ctx,
 
         if (!warn_no_meta && flags & JSON_BODY_LOGGING) {
             if (((flags & LOG_JSON_APP_LAYER) == 0)) {
-                SCLogWarning(SC_WARN_ALERT_CONFIG, "HTTP body logging has been configured, however, "
-                             "metadata logging has not been enabled. HTTP body logging will be disabled.");
+                SCLogWarning("HTTP body logging has been configured, however, "
+                             "metadata logging has not been enabled. HTTP body logging will be "
+                             "disabled.");
                 flags &= ~JSON_BODY_LOGGING;
                 warn_no_meta = true;
             }
index 4d6690beaf76e1ab966f19867e5303d2fa39fe5f..606ead0e62249f9d125e57710212ad429e7dcfae 100644 (file)
@@ -381,14 +381,14 @@ static void JsonAnomalyLogConf(AnomalyJsonOutputCtx *json_output_ctx,
         SetFlag(conf, "packethdr", LOG_JSON_PACKETHDR, &flags);
     }
     if (((flags & (LOG_JSON_DECODE_TYPE | LOG_JSON_PACKETHDR)) == LOG_JSON_PACKETHDR) && !warn_no_packet) {
-        SCLogWarning(SC_WARN_ANOMALY_CONFIG, "Anomaly logging configured to include packet headers, however decode "
+        SCLogWarning("Anomaly logging configured to include packet headers, however decode "
                      "type logging has not been selected. Packet headers will not be logged.");
         warn_no_packet = true;
         flags &= ~LOG_JSON_PACKETHDR;
     }
 
     if (flags == 0 && !warn_no_flags) {
-        SCLogWarning(SC_WARN_ANOMALY_CONFIG, "Anomaly logging has been configured; however, no logging types "
+        SCLogWarning("Anomaly logging has been configured; however, no logging types "
                      "have been selected. Select one or more logging types.");
         warn_no_flags = true;
     }
@@ -436,8 +436,8 @@ static OutputInitResult JsonAnomalyLogInitCtxSub(ConfNode *conf, OutputCtx *pare
 
     if (!OutputAnomalyLoggerEnable()) {
         OutputInitResult result = { NULL, false };
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "only one 'anomaly' logger "
-                "can be enabled");
+        SCLogError("only one 'anomaly' logger "
+                   "can be enabled");
         return result;
     }
 
index 2d1e7d3c4a36883ae608b98b964f183d8e217270..ab7cf8edfe552bfd2d430008248721081011507d 100644 (file)
@@ -493,8 +493,7 @@ static void JsonDnsCheckVersion(ConfNode *conf)
                     break;
                 case 1:
                     if (!v1_deprecation_warned) {
-                        SCLogError(SC_WARN_DEPRECATED,
-                                "DNS EVE v1 logging has been removed, will use v2");
+                        SCLogError("DNS EVE v1 logging has been removed, will use v2");
                         v1_deprecation_warned = true;
                     }
                     break;
@@ -506,8 +505,7 @@ static void JsonDnsCheckVersion(ConfNode *conf)
             invalid = true;
         }
         if (invalid) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid EVE DNS version \"%s\", will use v2",
-                    has_version->val);
+            SCLogWarning("Invalid EVE DNS version \"%s\", will use v2", has_version->val);
         }
     }
 }
index 0b7609c435205a21cd9942b8a27364ae89a4814c..39d283d3aadd8ef9fa5382350d8a75fb402f9f66 100644 (file)
@@ -252,8 +252,8 @@ static OutputInitResult JsonDropLogInitCtxSub(ConfNode *conf, OutputCtx *parent_
 {
     OutputInitResult result = { NULL, false };
     if (OutputDropLoggerEnable() != 0) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "only one 'drop' logger "
-            "can be enabled");
+        SCLogError("only one 'drop' logger "
+                   "can be enabled");
         return result;
     }
 
@@ -283,8 +283,8 @@ static OutputInitResult JsonDropLogInitCtxSub(ConfNode *conf, OutputCtx *parent_
             } else if (strcasecmp(extended, "all") == 0) {
                 g_droplog_flows_start = 0;
             } else {
-                SCLogWarning(SC_ERR_CONF_YAML_ERROR, "valid options for "
-                        "'flow' are 'start' and 'all'");
+                SCLogWarning("valid options for "
+                             "'flow' are 'start' and 'all'");
             }
         }
     }
index 46484a814037d38e4ba87d0a9471757e2a48aedd..464f66ee572983faba459f1ee70af6f746f66955 100644 (file)
@@ -249,7 +249,7 @@ static void EveFlowLogJSON(OutputJsonThreadCtx *aft, JsonBuilder *jb, Flow *f)
                 break;
 #endif
             default:
-                SCLogError(SC_EINVAL, "Invalid flow state: %d, contact developers", flow_state);
+                SCLogError("Invalid flow state: %d, contact developers", flow_state);
         }
     }
 
index 7ad3b22ef39b808fba6e0429cd6ced85195fb9f3..3a504874822f4061b19d9fec02e389b790e1dad5 100644 (file)
@@ -389,9 +389,9 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_
     OutputJsonCtx *ajt = parent_ctx->data;
 
     if (!StatsEnabled()) {
-        SCLogError(SC_ERR_STATS_LOG_GENERIC,
-                "eve.stats: stats are disabled globally: set stats.enabled to true. "
-                "See %s/configuration/suricata-yaml.html#stats", GetDocURL());
+        SCLogError("eve.stats: stats are disabled globally: set stats.enabled to true. "
+                   "See %s/configuration/suricata-yaml.html#stats",
+                GetDocURL());
         return result;
     }
 
@@ -401,10 +401,9 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_
 
     if (stats_decoder_events &&
             strcmp(stats_decoder_events_prefix, "decoder") == 0) {
-        SCLogWarning(SC_WARN_EVE_MISSING_EVENTS,
-                "eve.stats will not display "
-                "all decoder events correctly. See ticket #2225. Set a prefix in "
-                "stats.decoder-events-prefix.");
+        SCLogWarning("eve.stats will not display "
+                     "all decoder events correctly. See ticket #2225. Set a prefix in "
+                     "stats.decoder-events-prefix.");
     }
 
     stats_ctx->flags = JSON_STATS_TOTALS;
@@ -418,8 +417,7 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_
         if ((totals != NULL && ConfValIsFalse(totals)) &&
                 (threads != NULL && ConfValIsFalse(threads))) {
             SCFree(stats_ctx);
-            SCLogError(SC_ERR_JSON_STATS_LOG_NEGATED,
-                    "Cannot disable both totals and threads in stats logging");
+            SCLogError("Cannot disable both totals and threads in stats logging");
             return result;
         }
 
index d302d9106f56a227a978ad181f4ea80a489a7608..152b0756ed4f94312daf83b20f7e9ae7f2adeb46 100644 (file)
@@ -575,7 +575,7 @@ static OutputTlsCtx *OutputTlsInitCtx(ConfNode *conf)
                 }
             }
             if (!valid) {
-                SCLogWarning(SC_ERR_LOG_OUTPUT, "eve.tls: unknown 'custom' field '%s'", field->val);
+                SCLogWarning("eve.tls: unknown 'custom' field '%s'", field->val);
             }
         }
     }
@@ -594,17 +594,15 @@ static OutputTlsCtx *OutputTlsInitCtx(ConfNode *conf)
 
     if ((tls_ctx->fields & LOG_TLS_FIELD_CERTIFICATE) &&
             (tls_ctx->fields & LOG_TLS_FIELD_CHAIN)) {
-        SCLogWarning(SC_WARN_DUPLICATE_OUTPUT,
-                     "Both 'certificate' and 'chain' contains the top "
+        SCLogWarning("Both 'certificate' and 'chain' contains the top "
                      "certificate, so only one of them should be enabled "
                      "at a time");
     }
     if ((tls_ctx->fields & LOG_TLS_FIELD_CLIENT_CERT) &&
             (tls_ctx->fields & LOG_TLS_FIELD_CLIENT_CHAIN)) {
-        SCLogWarning(SC_WARN_DUPLICATE_OUTPUT,
-                "Both 'client_certificate' and 'client_chain' contains the top "
-                "certificate, so only one of them should be enabled "
-                "at a time");
+        SCLogWarning("Both 'client_certificate' and 'client_chain' contains the top "
+                     "certificate, so only one of them should be enabled "
+                     "at a time");
     }
 
     if ((tls_ctx->fields & LOG_TLS_FIELD_CLIENT) == 0) {
@@ -647,8 +645,7 @@ static OutputInitResult OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ct
 
     if ((tls_ctx->fields & LOG_TLS_FIELD_CERTIFICATE) &&
             (tls_ctx->fields & LOG_TLS_FIELD_CHAIN)) {
-        SCLogWarning(SC_WARN_DUPLICATE_OUTPUT,
-                     "Both 'certificate' and 'chain' contains the top "
+        SCLogWarning("Both 'certificate' and 'chain' contains the top "
                      "certificate, so only one of them should be enabled "
                      "at a time");
     }
index 3fe7891bd869be0ca9e0d3c4d4ccc8c48da4b326..9fe8b5c8b7c81373c1febfb72bade578f15b25fa 100644 (file)
@@ -978,7 +978,7 @@ static inline enum LogFileType FileTypeFromConf(const char *typestr)
 #ifdef HAVE_LIBHIREDIS
         log_filetype = LOGFILE_TYPE_REDIS;
 #else
-        FatalError(SC_ERR_FATAL, "redis JSON output option is not compiled");
+        FatalError("redis JSON output option is not compiled");
 #endif
     }
     SCLogDebug("type %s, file type value %d", typestr, log_filetype);
@@ -1052,9 +1052,8 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf)
      * node (deprecated). If that fails, lookup the global one. */
     const char *sensor_name = ConfNodeLookupChildValue(conf, "sensor-name");
     if (sensor_name != NULL) {
-        SCLogWarning(SC_ERR_DEPRECATED_CONF,
-            "Found deprecated eve-log setting \"sensor-name\". "
-            "Please set sensor-name globally.");
+        SCLogWarning("Found deprecated eve-log setting \"sensor-name\". "
+                     "Please set sensor-name globally.");
     }
     else {
         (void)ConfGet("sensor-name", &sensor_name);
@@ -1099,7 +1098,7 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf)
                 json_ctx->plugin = plugin;
             } else
 #endif
-                FatalError(SC_ERR_INVALID_ARGUMENT, "Invalid JSON output option: %s", output_s);
+                FatalError("Invalid JSON output option: %s", output_s);
         }
 
         const char *prefix = ConfNodeLookupChildValue(conf, "prefix");
@@ -1109,8 +1108,7 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf)
             json_ctx->file_ctx->prefix = SCStrdup(prefix);
             if (json_ctx->file_ctx->prefix == NULL)
             {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to allocate memory for eve-log.prefix setting.");
+                FatalError("Failed to allocate memory for eve-log.prefix setting.");
             }
             json_ctx->file_ctx->prefix_len = strlen(prefix);
         }
@@ -1130,9 +1128,8 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf)
         const char *sensor_id_s = ConfNodeLookupChildValue(conf, "sensor-id");
         if (sensor_id_s != NULL) {
             if (StringParseUint64((uint64_t *)&sensor_id, 10, 0, sensor_id_s) < 0) {
-                FatalError(SC_ERR_INVALID_ARGUMENT,
-                        "Failed to initialize JSON output, "
-                        "invalid sensor-id: %s",
+                FatalError("Failed to initialize JSON output, "
+                           "invalid sensor-id: %s",
                         sensor_id_s);
             }
         }
@@ -1168,9 +1165,8 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf)
             if (StringParseUint16(&json_ctx->cfg.community_id_seed,
                         10, 0, cid_seed) < 0)
             {
-                FatalError(SC_ERR_INVALID_ARGUMENT,
-                        "Failed to initialize JSON output, "
-                        "invalid community-id-seed: %s",
+                FatalError("Failed to initialize JSON output, "
+                           "invalid community-id-seed: %s",
                         cid_seed);
             }
         }
@@ -1222,9 +1218,9 @@ static void OutputJsonDeInitCtx(OutputCtx *output_ctx)
     OutputJsonCtx *json_ctx = (OutputJsonCtx *)output_ctx->data;
     LogFileCtx *logfile_ctx = json_ctx->file_ctx;
     if (logfile_ctx->dropped) {
-        SCLogWarning(SC_WARN_EVENT_DROPPED,
-                "%"PRIu64" events were dropped due to slow or "
-                "disconnected socket", logfile_ctx->dropped);
+        SCLogWarning("%" PRIu64 " events were dropped due to slow or "
+                     "disconnected socket",
+                logfile_ctx->dropped);
     }
     if (json_ctx->xff_cfg != NULL) {
         SCFree(json_ctx->xff_cfg);
index f9ffb2d2551dcae7e7ac8c490f5effdd27cc6baa..04adf61aaaa27f955f0e20e9f516a11ac4ffdd40 100644 (file)
@@ -423,25 +423,25 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options) {
 
     int status = luaL_loadfile(luastate, filename);
     if (status) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't load file: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     /* prime the script (or something) */
     if (lua_pcall(luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't prime file: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't prime file: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     lua_getglobal(luastate, "init");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no init function in script");
+        SCLogError("no init function in script");
         goto error;
     }
 
     lua_newtable(luastate); /* stack at -1 */
     if (lua_gettop(luastate) == 0 || lua_type(luastate, 2) != LUA_TTABLE) {
-        SCLogError(SC_ERR_LUA_ERROR, "no table setup");
+        SCLogError("no table setup");
         goto error;
     }
 
@@ -450,17 +450,17 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options) {
     lua_settable(luastate, -3);
 
     if (lua_pcall(luastate, 1, 1, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't run script 'init' function: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't run script 'init' function: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     /* process returns from script */
     if (lua_gettop(luastate) == 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "init function in script should return table, nothing returned");
+        SCLogError("init function in script should return table, nothing returned");
         goto error;
     }
     if (lua_type(luastate, 1) != LUA_TTABLE) {
-        SCLogError(SC_ERR_LUA_ERROR, "init function in script should return table, returned is not table");
+        SCLogError("init function in script should return table, returned is not table");
         goto error;
     }
 
@@ -507,25 +507,25 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options) {
     }
 
     if (((options->alproto != ALPROTO_UNKNOWN)) + options->packet + options->file > 1) {
-        SCLogError(SC_ERR_LUA_ERROR, "invalid combination of 'needs' in the script");
+        SCLogError("invalid combination of 'needs' in the script");
         goto error;
     }
 
     lua_getglobal(luastate, "setup");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no setup function in script");
+        SCLogError("no setup function in script");
         goto error;
     }
 
     lua_getglobal(luastate, "log");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no log function in script");
+        SCLogError("no log function in script");
         goto error;
     }
 
     lua_getglobal(luastate, "deinit");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no deinit function in script");
+        SCLogError("no deinit function in script");
         goto error;
     }
 
@@ -547,7 +547,7 @@ static lua_State *LuaScriptSetup(const char *filename)
 {
     lua_State *luastate = LuaGetState();
     if (luastate == NULL) {
-        SCLogError(SC_ERR_LUA_ERROR, "luaL_newstate failed");
+        SCLogError("luaL_newstate failed");
         goto error;
     }
 
@@ -555,13 +555,13 @@ static lua_State *LuaScriptSetup(const char *filename)
 
     int status = luaL_loadfile(luastate, filename);
     if (status) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't load file: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't load file: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
     /* prime the script */
     if (lua_pcall(luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't prime file: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't prime file: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
@@ -580,7 +580,7 @@ static lua_State *LuaScriptSetup(const char *filename)
     LuaRegisterSmtpFunctions(luastate);
 
     if (lua_pcall(luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't run script 'setup' function: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't run script 'setup' function: %s", lua_tostring(luastate, -1));
         goto error;
     }
 
@@ -630,7 +630,7 @@ static OutputInitResult OutputLuaLogInitSub(ConfNode *conf, OutputCtx *parent_ct
     char path[PATH_MAX] = "";
     int ret = snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val);
     if (ret < 0 || ret == sizeof(path)) {
-        SCLogError(SC_ERR_SPRINTF,"failed to construct lua script path");
+        SCLogError("failed to construct lua script path");
         goto error;
     }
     SCLogDebug("script full path %s", path);
@@ -717,7 +717,7 @@ static OutputInitResult OutputLuaLogInit(ConfNode *conf)
 
         int r = LuaScriptInit(path, &opts);
         if (r != 0) {
-            SCLogError(SC_ERR_LUA_ERROR, "couldn't initialize script");
+            SCLogError("couldn't initialize script");
             goto error;
         }
 
@@ -725,7 +725,7 @@ static OutputInitResult OutputLuaLogInit(ConfNode *conf)
          * on it's needs. */
         OutputModule *om = SCCalloc(1, sizeof(*om));
         if (om == NULL) {
-            SCLogError(SC_ENOMEM, "calloc() failed");
+            SCLogError("calloc() failed");
             goto error;
         }
 
@@ -788,7 +788,7 @@ static OutputInitResult OutputLuaLogInit(ConfNode *conf)
         } else if (opts.stats) {
             om->StatsLogFunc = LuaStatsLogger;
         } else {
-            SCLogError(SC_ERR_LUA_ERROR, "failed to setup thread module");
+            SCLogError("failed to setup thread module");
             SCFree(om);
             goto error;
         }
@@ -809,9 +809,8 @@ error:
         SCLogDebug("ConfGetBool could not load the value.");
     }
     if (failure_fatal) {
-                   FatalError(SC_ERR_FATAL,
-                              "Error during setup of lua output. Details should be "
-                              "described in previous error messages. Shutting down...");
+        FatalError("Error during setup of lua output. Details should be "
+                   "described in previous error messages. Shutting down...");
     }
 
     return result;
@@ -826,13 +825,13 @@ static void OutputLuaLogDoDeinit(LogLuaCtx *lua_ctx)
 
     lua_getglobal(luastate, "deinit");
     if (lua_type(luastate, -1) != LUA_TFUNCTION) {
-        SCLogError(SC_ERR_LUA_ERROR, "no deinit function in script");
+        SCLogError("no deinit function in script");
         return;
     }
     //LuaPrintStack(luastate);
 
     if (lua_pcall(luastate, 0, 0, 0) != 0) {
-        SCLogError(SC_ERR_LUA_ERROR, "couldn't run script 'deinit' function: %s", lua_tostring(luastate, -1));
+        SCLogError("couldn't run script 'deinit' function: %s", lua_tostring(luastate, -1));
         return;
     }
     LuaReturnState(luastate);
index 4bc60f90e48dbb863d767282f4de47fb47ba6dca..cc7d348b66a30ad27b4e6ccfd1f2593f2cd19dcb 100644 (file)
@@ -120,7 +120,7 @@ int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto,
         while (t->next)
             t = t->next;
         if (t->id * 2 > UINT32_MAX) {
-            FatalError(SC_ERR_FATAL, "Too many loggers registered.");
+            FatalError("Too many loggers registered.");
         }
         op->id = t->id * 2;
         t->next = op;
@@ -577,12 +577,12 @@ static TmEcode OutputTxLogThreadInit(ThreadVars *tv, const void *_initdata, void
 
     if (g_file_logger_enabled) {
         if (OutputFileLogThreadInit(tv, &td->file) != TM_ECODE_OK) {
-            FatalError(SC_ERR_FATAL, "failed to set up file thread data");
+            FatalError("failed to set up file thread data");
         }
     }
     if (g_filedata_logger_enabled) {
         if (OutputFiledataLogThreadInit(tv, &td->filedata) != TM_ECODE_OK) {
-            FatalError(SC_ERR_FATAL, "failed to set up filedata thread data");
+            FatalError("failed to set up filedata thread data");
         }
     }
 
index 914679aa26637b9a5c00397d8e9a3c526b1e944e..2d756d7acb0cebe7cf2d09467c20ef1684d794b6 100644 (file)
@@ -161,8 +161,7 @@ void OutputRegisterModule(const char *name, const char *conf_name,
     return;
 
 error:
-    FatalError(SC_ERR_FATAL,
-               "Fatal error encountered in OutputRegisterModule. Exiting...");
+    FatalError("Fatal error encountered in OutputRegisterModule. Exiting...");
 }
 
 /**
@@ -202,7 +201,7 @@ void OutputRegisterPacketModule(LoggerId id, const char *name,
     SCLogDebug("Packet logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -243,7 +242,7 @@ void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("Packet logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -287,7 +286,7 @@ static void OutputRegisterTxModuleWrapper(LoggerId id, const char *name,
     SCLogDebug("Tx logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 static void OutputRegisterTxSubModuleWrapper(LoggerId id, const char *parent_name,
@@ -324,7 +323,7 @@ static void OutputRegisterTxSubModuleWrapper(LoggerId id, const char *parent_nam
     SCLogDebug("Tx logger for alproto %d \"%s\" registered.", alproto, name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -454,7 +453,7 @@ void OutputRegisterFileModule(LoggerId id, const char *name,
     SCLogDebug("File logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -494,7 +493,7 @@ void OutputRegisterFileSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("File logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -533,7 +532,7 @@ void OutputRegisterFiledataModule(LoggerId id, const char *name,
     SCLogDebug("Filedata logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -573,7 +572,7 @@ void OutputRegisterFiledataSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("Filedata logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -613,7 +612,7 @@ void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("Flow logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -654,7 +653,7 @@ void OutputRegisterStreamingModule(LoggerId id, const char *name,
     SCLogDebug("Streaming logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -695,7 +694,7 @@ void OutputRegisterStreamingSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("Streaming logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -733,7 +732,7 @@ void OutputRegisterStatsModule(LoggerId id, const char *name,
     SCLogDebug("Stats logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -773,7 +772,7 @@ void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
     SCLogDebug("Stats logger \"%s\" registered.", name);
     return;
 error:
-    FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+    FatalError("Fatal error encountered. Exiting...");
 }
 
 /**
@@ -833,7 +832,7 @@ void OutputRegisterFileRotationFlag(int *flag)
 {
     OutputFileRolloverFlag *flag_entry = SCCalloc(1, sizeof(*flag_entry));
     if (unlikely(flag_entry == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to allocate memory to register file rotation flag");
+        SCLogError("Failed to allocate memory to register file rotation flag");
         return;
     }
     flag_entry->flag = flag;
@@ -968,7 +967,7 @@ void OutputRegisterRootLogger(ThreadInitFunc ThreadInit,
 
     RootLogger *logger = SCCalloc(1, sizeof(*logger));
     if (logger == NULL) {
-        FatalError(SC_ENOMEM, "failed to alloc root logger");
+        FatalError("failed to alloc root logger");
     }
     logger->ThreadInit = ThreadInit;
     logger->ThreadDeinit = ThreadDeinit;
@@ -982,7 +981,7 @@ static void OutputRegisterActiveLogger(RootLogger *reg)
 {
     RootLogger *logger = SCCalloc(1, sizeof(*logger));
     if (logger == NULL) {
-        FatalError(SC_ENOMEM, "failed to alloc root logger");
+        FatalError("failed to alloc root logger");
     }
     logger->ThreadInit = reg->ThreadInit;
     logger->ThreadDeinit = reg->ThreadDeinit;
index 012d4acf8d527bac5450bc973fd7fa2cd1863e46..f22f021c66f0ee1a6d2bf45c14631bb0955351b3 100644 (file)
@@ -81,7 +81,7 @@ static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, uint8
 {
     SReputation *user_data = NULL;
     if ((user_data = SCMalloc(sizeof(SReputation))) == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory. Exiting");
+        FatalError("Error allocating memory. Exiting");
     }
     memset(user_data, 0x00, sizeof(SReputation));
 
@@ -100,7 +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_EINVAL, "failed to add ipv6 host %s", ip);
+            SCLogWarning("failed to add ipv6 host %s", ip);
         }
 
     } else {
@@ -115,7 +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_EINVAL, "failed to add ipv4 host %s", ip);
+            SCLogWarning("failed to add ipv4 host %s", ip);
         }
     }
 }
@@ -353,7 +353,7 @@ static int SRepLoadCatFile(const char *filename)
     FILE *fp = fopen(filename, "r");
 
     if (fp == NULL) {
-        SCLogError(SC_ERR_OPENING_RULE_FILE, "opening ip rep file %s: %s", filename, strerror(errno));
+        SCLogError("opening ip rep file %s: %s", filename, strerror(errno));
         return -1;
     }
 
@@ -399,7 +399,7 @@ int SRepLoadCatFileFromFD(FILE *fp)
         if (SRepCatSplitLine(line, &cat, shortname, sizeof(shortname)) == 0) {
             strlcpy(srep_cat_table[cat], shortname, SREP_SHORTNAME_LEN);
         } else {
-            SCLogError(SC_ERR_NO_REPUTATION, "bad line \"%s\"", line);
+            SCLogError("bad line \"%s\"", line);
         }
     }
 
@@ -419,7 +419,7 @@ static int SRepLoadFile(SRepCIDRTree *cidr_ctx, char *filename)
     FILE *fp = fopen(filename, "r");
 
     if (fp == NULL) {
-        SCLogError(SC_ERR_OPENING_RULE_FILE, "opening ip rep file %s: %s", filename, strerror(errno));
+        SCLogError("opening ip rep file %s: %s", filename, strerror(errno));
         return -1;
     }
 
@@ -462,7 +462,7 @@ int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp)
         uint8_t cat = 0, value = 0;
         int r = SRepSplitLine(cidr_ctx, line, &a, &cat, &value);
         if (r < 0) {
-            SCLogError(SC_ERR_NO_REPUTATION, "bad line \"%s\"", line);
+            SCLogError("bad line \"%s\"", line);
         } else if (r == 0) {
             if (a.family == AF_INET) {
                 char ipstr[16];
@@ -476,7 +476,7 @@ int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp)
 
             Host *h = HostGetHostFromHash(&a);
             if (h == NULL) {
-                SCLogError(SC_ERR_NO_REPUTATION, "failed to get a host, increase host.memcap");
+                SCLogError("failed to get a host, increase host.memcap");
                 break;
             } else {
                 //SCLogInfo("host %p", h);
@@ -609,21 +609,22 @@ int SRepInit(DetectEngineCtx *de_ctx)
     }
 
     if (files == NULL) {
-        SCLogError(SC_ERR_NO_REPUTATION, "\"reputation-files\" not set");
+        SCLogError("\"reputation-files\" not set");
         return -1;
     }
 
     if (init) {
         if (filename == NULL) {
-            SCLogError(SC_ERR_NO_REPUTATION, "\"reputation-categories-file\" not set");
+            SCLogError("\"reputation-categories-file\" not set");
             return -1;
         }
 
         /* init even if we have reputation files, so that when we
          * have a live reload, we have inited the cats */
         if (SRepLoadCatFile(filename) < 0) {
-            SCLogError(SC_ERR_NO_REPUTATION, "failed to load reputation "
-                    "categories file %s", filename);
+            SCLogError("failed to load reputation "
+                       "categories file %s",
+                    filename);
             return -1;
         }
     }
index 9a646bc013fd503e495fb0adeb0d3daed232f391..5feb9c4af6f13bfc30c5724773e9eb8d5fb40ceb 100644 (file)
@@ -109,7 +109,7 @@ static inline libnet_t *GetCtx(const Packet *p, int injection_type)
     char ebuf[LIBNET_ERRBUF_SIZE];
     libnet_t *c = libnet_init(injection_type, LIBNET_INIT_CAST devname, ebuf);
     if (c == NULL) {
-        SCLogError(SC_ERR_LIBNET_INIT,"libnet_init failed: %s", ebuf);
+        SCLogError("libnet_init failed: %s", ebuf);
     }
     if (store_ctx) {
         t_c = c;
@@ -186,7 +186,7 @@ static inline int BuildTCP(libnet_t *c, Libnet11Packet *lpacket)
                     c,                     /* libnet context */
                     0)) < 0)               /* libnet ptag */
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_tcp %s", libnet_geterror(c));
+        SCLogError("libnet_build_tcp %s", libnet_geterror(c));
         return -1;
     }
     return 0;
@@ -209,7 +209,7 @@ static inline int BuildIPv4(libnet_t *c, Libnet11Packet *lpacket, const uint8_t
                     c,                            /* libnet context pointer */
                     0)) < 0)                      /* packet id */
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_ipv4 %s", libnet_geterror(c));
+        SCLogError("libnet_build_ipv4 %s", libnet_geterror(c));
         return -1;
     }
     return 0;
@@ -230,7 +230,7 @@ static inline int BuildIPv6(libnet_t *c, Libnet11Packet *lpacket, const uint8_t
                     c,                            /* libnet context pointer */
                     0)) < 0)                      /* packet id */
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_ipv6 %s", libnet_geterror(c));
+        SCLogError("libnet_build_ipv6 %s", libnet_geterror(c));
         return -1;
     }
     return 0;
@@ -254,7 +254,7 @@ static inline void SetupEthernet(Packet *p, Libnet11Packet *lpacket, enum Reject
 static inline int BuildEthernet(libnet_t *c, Libnet11Packet *lpacket, uint16_t proto)
 {
     if ((libnet_build_ethernet(lpacket->dmac,lpacket->smac, proto , NULL, 0, c, 0)) < 0) {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_ethernet %s", libnet_geterror(c));
+        SCLogError("libnet_build_ethernet %s", libnet_geterror(c));
         return -1;
     }
     return 0;
@@ -270,7 +270,7 @@ static inline int BuildEthernetVLAN(libnet_t *c, Libnet11Packet *lpacket, uint16
                 c,                                      /* libnet handle */
                 0) < 0)
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_802_1q %s", libnet_geterror(c));
+        SCLogError("libnet_build_802_1q %s", libnet_geterror(c));
         return -1;
     }
     return 0;
@@ -333,7 +333,7 @@ int RejectSendLibnet11IPv4TCP(ThreadVars *tv, Packet *p, void *data, enum Reject
 
     result = libnet_write(c);
     if (result == -1) {
-        SCLogError(SC_ERR_LIBNET_WRITE_FAILED,"libnet_write failed: %s", libnet_geterror(c));
+        SCLogError("libnet_write failed: %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -389,7 +389,7 @@ int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
                     c,                        /* libnet context */
                     0)) < 0)                  /* libnet ptag */
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_icmpv4_unreach %s", libnet_geterror(c));
+        SCLogError("libnet_build_icmpv4_unreach %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -410,7 +410,7 @@ int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
 
     result = libnet_write(c);
     if (result == -1) {
-        SCLogError(SC_ERR_LIBNET_WRITE_FAILED,"libnet_write_raw_ipv4 failed: %s", libnet_geterror(c));
+        SCLogError("libnet_write_raw_ipv4 failed: %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -474,7 +474,7 @@ int RejectSendLibnet11IPv6TCP(ThreadVars *tv, Packet *p, void *data, enum Reject
 
     result = libnet_write(c);
     if (result == -1) {
-        SCLogError(SC_ERR_LIBNET_WRITE_FAILED,"libnet_write failed: %s", libnet_geterror(c));
+        SCLogError("libnet_write failed: %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -531,7 +531,7 @@ int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
                     c,                        /* libnet context */
                     0)) < 0)                  /* libnet ptag */
     {
-        SCLogError(SC_ERR_LIBNET_BUILD_FAILED,"libnet_build_icmpv6_unreach %s", libnet_geterror(c));
+        SCLogError("libnet_build_icmpv6_unreach %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -551,7 +551,7 @@ int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
 
     result = libnet_write(c);
     if (result == -1) {
-        SCLogError(SC_ERR_LIBNET_WRITE_FAILED,"libnet_write_raw_ipv6 failed: %s", libnet_geterror(c));
+        SCLogError("libnet_write_raw_ipv6 failed: %s", libnet_geterror(c));
         goto cleanup;
     }
 
@@ -564,9 +564,9 @@ cleanup:
 
 int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
 {
-    SCLogError(SC_ERR_LIBNET_NOT_ENABLED, "Libnet ICMPv6 based rejects are disabled."
-                "Usually this means that you don't have a patched libnet installed,"
-                " or configure couldn't find it.");
+    SCLogError("Libnet ICMPv6 based rejects are disabled."
+               "Usually this means that you don't have a patched libnet installed,"
+               " or configure couldn't find it.");
     return 0;
 }
 #endif /* HAVE_LIBNET_ICMPV6_UNREACH */
@@ -576,33 +576,33 @@ int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
 
 int RejectSendLibnet11IPv4TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
 {
-    SCLogError(SC_ERR_LIBNET_NOT_ENABLED, "Libnet based rejects are disabled."
-                "Usually this means that you don't have libnet installed,"
-                " or configure couldn't find it.");
+    SCLogError("Libnet based rejects are disabled."
+               "Usually this means that you don't have libnet installed,"
+               " or configure couldn't find it.");
     return 0;
 }
 
 int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
 {
-    SCLogError(SC_ERR_LIBNET_NOT_ENABLED, "Libnet based rejects are disabled."
-                "Usually this means that you don't have libnet installed,"
-                " or configure couldn't find it.");
+    SCLogError("Libnet based rejects are disabled."
+               "Usually this means that you don't have libnet installed,"
+               " or configure couldn't find it.");
     return 0;
 }
 
 int RejectSendLibnet11IPv6TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
 {
-    SCLogError(SC_ERR_LIBNET_NOT_ENABLED, "Libnet based rejects are disabled."
-                "Usually this means that you don't have libnet installed,"
-                " or configure couldn't find it.");
+    SCLogError("Libnet based rejects are disabled."
+               "Usually this means that you don't have libnet installed,"
+               " or configure couldn't find it.");
     return 0;
 }
 
 int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
 {
-    SCLogError(SC_ERR_LIBNET_NOT_ENABLED, "Libnet based rejects are disabled."
-                "Usually this means that you don't have libnet installed,"
-                " or configure couldn't find it.");
+    SCLogError("Libnet based rejects are disabled."
+               "Usually this means that you don't have libnet installed,"
+               " or configure couldn't find it.");
     return 0;
 }
 
index badd786f221361e2aed2bcc32d2288ba87876c66..02e060c20639f3e9e57447e7f68b94e361555f9d 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_EINVAL, "Invalid number of "
-                                            "threads, resetting to default");
+                    SCLogWarning("Invalid number of "
+                                 "threads, resetting to default");
                     aconf->threads = 0;
                 }
             }
@@ -214,7 +214,7 @@ static void *ParseAFPConfig(const char *iface)
 
     if (ConfGetChildValueBoolWithDefault(if_root, if_default, "use-mmap", (int *)&boolval) == 1) {
         if (!boolval) {
-            SCLogWarning(SC_WARN_OPTION_OBSOLETE,
+            SCLogWarning(
                     "%s: \"use-mmap\" option is obsolete: mmap is always enabled", aconf->iface);
         }
     }
@@ -236,8 +236,8 @@ static void *ParseAFPConfig(const char *iface)
                 aconf->flags &= ~AFP_TPACKET_V3;
 #endif
             } else {
-                SCLogWarning(SC_ERR_RUNMODE, "tpacket v3 is only implemented for 'workers' runmode."
-                                             " Switching to tpacket v2.");
+                SCLogWarning("tpacket v3 is only implemented for 'workers' runmode."
+                             " Switching to tpacket v2.");
                 aconf->flags &= ~AFP_TPACKET_V3;
             }
         } else {
@@ -264,7 +264,7 @@ static void *ParseAFPConfig(const char *iface)
                     aconf->out_iface);
             aconf->copy_mode = AFP_COPY_MODE_IPS;
             if (aconf->flags & AFP_TPACKET_V3) {
-                SCLogWarning(SC_ERR_RUNMODE, "Using tpacket_v3 in IPS mode will result in high latency");
+                SCLogWarning("Using tpacket_v3 in IPS mode will result in high latency");
             }
         } else if (strcmp(copymodestr, "tap") == 0) {
             SCLogInfo("AF_PACKET TAP mode activated %s->%s",
@@ -272,7 +272,7 @@ static void *ParseAFPConfig(const char *iface)
                     aconf->out_iface);
             aconf->copy_mode = AFP_COPY_MODE_TAP;
             if (aconf->flags & AFP_TPACKET_V3) {
-                SCLogWarning(SC_ERR_RUNMODE, "Using tpacket_v3 in TAP mode will result in high latency");
+                SCLogWarning("Using tpacket_v3 in TAP mode will result in high latency");
             }
         } else {
             SCLogInfo("Invalid mode (not in tap, ips)");
@@ -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_EINVAL, "Invalid cluster_id, resetting to 0");
+            SCLogWarning("Invalid cluster_id, resetting to 0");
             aconf->cluster_id = 0;
         }
         SCLogDebug("Going to use cluster-id %" PRIu16, aconf->cluster_id);
@@ -331,8 +331,8 @@ static void *ParseAFPConfig(const char *iface)
     } else if (strcmp(tmpctype, "cluster_rollover") == 0) {
         SCLogConfig("Using rollover based cluster mode for AF_PACKET (iface %s)",
                 aconf->iface);
-        SCLogWarning(SC_WARN_UNCOMMON, "Rollover mode is causing severe flow "
-                                       "tracking issues, use it at your own risk.");
+        SCLogWarning("Rollover mode is causing severe flow "
+                     "tracking issues, use it at your own risk.");
         aconf->cluster_type = PACKET_FANOUT_ROLLOVER;
         cluster_type = PACKET_FANOUT_ROLLOVER;
 #ifdef HAVE_PACKET_EBPF
@@ -343,7 +343,7 @@ static void *ParseAFPConfig(const char *iface)
         cluster_type = PACKET_FANOUT_EBPF;
 #endif
     } else {
-        SCLogWarning(SC_ERR_INVALID_CLUSTER_TYPE,"invalid cluster-type %s",tmpctype);
+        SCLogWarning("invalid cluster-type %s", tmpctype);
     }
 
     int conf_val = 0;
@@ -352,8 +352,8 @@ static void *ParseAFPConfig(const char *iface)
         SCLogConfig("Using rollover kernel functionality for AF_PACKET (iface %s)",
                 aconf->iface);
         aconf->cluster_type |= PACKET_FANOUT_FLAG_ROLLOVER;
-        SCLogWarning(SC_WARN_UNCOMMON, "Rollover option is causing severe flow "
-                                       "tracking issues, use it at your own risk.");
+        SCLogWarning("Rollover option is causing severe flow "
+                     "tracking issues, use it at your own risk.");
     }
 
     /*load af_packet bpf filter*/
@@ -406,12 +406,12 @@ static void *ParseAFPConfig(const char *iface)
                                &aconf->ebpf_lb_fd,
                                &aconf->ebpf_t_config);
         if (ret != 0) {
-            SCLogWarning(SC_EINVAL, "Error when loading eBPF lb file");
+            SCLogWarning("Error when loading eBPF lb file");
         }
     }
 #else
     if (aconf->ebpf_lb_file) {
-        SCLogError(SC_ERR_UNIMPLEMENTED, "eBPF support is not build-in");
+        SCLogError("eBPF support is not build-in");
     }
 #endif
 
@@ -433,7 +433,7 @@ static void *ParseAFPConfig(const char *iface)
             aconf->flags |= AFP_BYPASS;
             BypassedFlowManagerRegisterUpdateFunc(EBPFUpdateFlow, NULL);
 #else
-            SCLogError(SC_ERR_UNIMPLEMENTED, "Bypass set but eBPF support is not built-in");
+            SCLogError("Bypass set but eBPF support is not built-in");
 #endif
         }
     }
@@ -445,10 +445,10 @@ static void *ParseAFPConfig(const char *iface)
                                &aconf->ebpf_filter_fd,
                                &aconf->ebpf_t_config);
         if (ret != 0) {
-            SCLogWarning(SC_EINVAL, "Error when loading eBPF filter file");
+            SCLogWarning("Error when loading eBPF filter file");
         }
 #else
-        SCLogError(SC_ERR_UNIMPLEMENTED, "eBPF support is not build-in");
+        SCLogError("eBPF support is not build-in");
 #endif
     }
 
@@ -469,7 +469,7 @@ static void *ParseAFPConfig(const char *iface)
                 RunModeEnablesBypassManager();
                 struct ebpf_timeout_config *ebt = SCCalloc(1, sizeof(struct ebpf_timeout_config));
                 if (ebt == NULL) {
-                    SCLogError(SC_ENOMEM, "Flow bypass alloc error");
+                    SCLogError("Flow bypass alloc error");
                 } else {
                     memcpy(ebt, &(aconf->ebpf_t_config), sizeof(struct ebpf_timeout_config));
                     BypassedFlowManagerRegisterCheckFunc(NULL,
@@ -480,7 +480,7 @@ static void *ParseAFPConfig(const char *iface)
             BypassedFlowManagerRegisterUpdateFunc(EBPFUpdateFlow, NULL);
         }
 #else
-        SCLogWarning(SC_ERR_UNIMPLEMENTED, "XDP filter set but XDP support is not built-in");
+        SCLogWarning("XDP filter set but XDP support is not built-in");
 #endif
 #ifdef HAVE_PACKET_XDP
         const char *xdp_mode;
@@ -495,7 +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_EINVAL, "Invalid xdp-mode value: '%s'", xdp_mode);
+                SCLogWarning("Invalid xdp-mode value: '%s'", xdp_mode);
             }
         }
 
@@ -521,12 +521,12 @@ static void *ParseAFPConfig(const char *iface)
                 SCLogInfo("Loaded pinned maps from sysfs");
                 break;
             case -1:
-                SCLogWarning(SC_EINVAL, "Error when loading XDP filter file");
+                SCLogWarning("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_EINVAL, "Error when setting up XDP");
+                    SCLogWarning("Error when setting up XDP");
                 } else {
                     /* Try to get the xdp-cpu-redirect key */
                     const char *cpuset;
@@ -535,7 +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_EINVAL, "Previously found node has disappeared");
+                            SCLogError("Previously found node has disappeared");
                         } else {
                             EBPFBuildCPUSet(node, aconf->iface);
                         }
@@ -550,7 +550,7 @@ static void *ParseAFPConfig(const char *iface)
                 }
         }
 #else
-        SCLogError(SC_ERR_UNIMPLEMENTED, "XDP support is not built-in");
+        SCLogError("XDP support is not built-in");
 #endif
     }
 
@@ -565,7 +565,7 @@ static void *ParseAFPConfig(const char *iface)
 
     if ((ConfGetChildValueIntWithDefault(if_root, if_default, "block-size", &value)) == 1) {
         if (value % getpagesize()) {
-            SCLogError(SC_EINVAL, "Block-size must be a multiple of pagesize.");
+            SCLogError("Block-size must be a multiple of pagesize.");
         } else {
             aconf->block_size = value;
         }
@@ -594,7 +594,7 @@ static void *ParseAFPConfig(const char *iface)
         } else if (strcmp(tmpctype, "kernel") == 0) {
             aconf->checksum_mode = CHECKSUM_VALIDATION_KERNEL;
         } else {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid value for checksum-checks for %s", aconf->iface);
+            SCLogError("Invalid value for checksum-checks for %s", aconf->iface);
         }
     }
 
@@ -642,8 +642,9 @@ finalize:
     if (aconf->ring_size != 0) {
         if (aconf->ring_size * aconf->threads < max_pending_packets) {
             aconf->ring_size = max_pending_packets / aconf->threads + 1;
-            SCLogWarning(SC_ERR_AFP_CREATE, "Inefficient setup: ring-size < max_pending_packets. "
-                         "Resetting to decent value %d.", aconf->ring_size);
+            SCLogWarning("Inefficient setup: ring-size < max_pending_packets. "
+                         "Resetting to decent value %d.",
+                    aconf->ring_size);
             /* We want at least that max_pending_packets packets can be handled by the
              * interface. This is generous if we have multiple interfaces listening. */
         }
@@ -660,7 +661,7 @@ finalize:
             /* af-packet can handle csum offloading */
             if (LiveGetOffload() == 0) {
                 if (GetIfaceOffloading(iface, 0, 1) == 1) {
-                    SCLogWarning(SC_ERR_AFP_CREATE,
+                    SCLogWarning(
                             "Using AF_PACKET with offloading activated leads to capture problems");
                 }
             } else {
@@ -707,7 +708,7 @@ int AFPRunModeIsIPS()
     for (ldev = 0; ldev < nlive; ldev++) {
         const char *live_dev = LiveGetDeviceName(ldev);
         if (live_dev == NULL) {
-            SCLogError(SC_EINVAL, "Problem with config file");
+            SCLogError("Problem with config file");
             return 0;
         }
         const char *copymodestr = NULL;
@@ -715,7 +716,7 @@ int AFPRunModeIsIPS()
 
         if (if_root == NULL) {
             if (if_default == NULL) {
-                SCLogError(SC_EINVAL, "Problem with config file");
+                SCLogError("Problem with config file");
                 return 0;
             }
             if_root = if_default;
@@ -733,13 +734,12 @@ int AFPRunModeIsIPS()
     }
 
     if (has_ids && has_ips) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                "AF_PACKET using both IPS and TAP/IDS mode, this will not "
-                "be allowed in Suricata 8 due to undefined behavior. See ticket #5588.");
+        SCLogWarning("AF_PACKET using both IPS and TAP/IDS mode, this will not "
+                     "be allowed in Suricata 8 due to undefined behavior. See ticket #5588.");
         for (ldev = 0; ldev < nlive; ldev++) {
             const char *live_dev = LiveGetDeviceName(ldev);
             if (live_dev == NULL) {
-                SCLogError(SC_EINVAL, "Problem with config file");
+                SCLogError("Problem with config file");
                 return 0;
             }
             if_root = ConfNodeLookupKeyValue(af_packet_node, "interface", live_dev);
@@ -747,7 +747,7 @@ int AFPRunModeIsIPS()
 
             if (if_root == NULL) {
                 if (if_default == NULL) {
-                    SCLogError(SC_EINVAL, "Problem with config file");
+                    SCLogError("Problem with config file");
                     return 0;
                 }
                 if_root = if_default;
@@ -755,9 +755,8 @@ int AFPRunModeIsIPS()
 
             if (! ((ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) &&
                         (strcmp(copymodestr, "ips") == 0))) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "AF_PACKET IPS mode used and interface '%s' is in IDS or TAP mode. "
-                        "Sniffing '%s' but expect bad result as stream-inline is activated.",
+                SCLogError("AF_PACKET IPS mode used and interface '%s' is in IDS or TAP mode. "
+                           "Sniffing '%s' but expect bad result as stream-inline is activated.",
                         live_dev, live_dev);
             }
         }
@@ -787,7 +786,7 @@ int RunModeIdsAFPAutoFp(void)
     SCLogDebug("live_dev %s", live_dev);
 
     if (AFPPeersListInit() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Unable to init peers list.");
+        FatalError("Unable to init peers list.");
     }
 
     ret = RunModeSetLiveCaptureAutoFp(ParseAFPConfig,
@@ -796,12 +795,12 @@ int RunModeIdsAFPAutoFp(void)
                               "DecodeAFP", thread_name_autofp,
                               live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     /* In IPS mode each threads must have a peer */
     if (AFPPeersListCheck() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Some IPS capture threads did not peer.");
+        FatalError("Some IPS capture threads did not peer.");
     }
 
     SCLogDebug("RunModeIdsAFPAutoFp initialised");
@@ -826,7 +825,7 @@ int RunModeIdsAFPSingle(void)
     (void)ConfGet("af-packet.live-interface", &live_dev);
 
     if (AFPPeersListInit() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Unable to init peers list.");
+        FatalError("Unable to init peers list.");
     }
 
     ret = RunModeSetLiveCaptureSingle(ParseAFPConfig,
@@ -835,12 +834,12 @@ int RunModeIdsAFPSingle(void)
                                     "DecodeAFP", thread_name_single,
                                     live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     /* In IPS mode each threads must have a peer */
     if (AFPPeersListCheck() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Some IPS capture threads did not peer.");
+        FatalError("Some IPS capture threads did not peer.");
     }
 
     SCLogDebug("RunModeIdsAFPSingle initialised");
@@ -868,7 +867,7 @@ int RunModeIdsAFPWorkers(void)
     (void)ConfGet("af-packet.live-interface", &live_dev);
 
     if (AFPPeersListInit() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Unable to init peers list.");
+        FatalError("Unable to init peers list.");
     }
 
     ret = RunModeSetLiveCaptureWorkers(ParseAFPConfig,
@@ -877,12 +876,12 @@ int RunModeIdsAFPWorkers(void)
                                     "DecodeAFP", thread_name_workers,
                                     live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     /* In IPS mode each threads must have a peer */
     if (AFPPeersListCheck() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Some IPS capture threads did not peer.");
+        FatalError("Some IPS capture threads did not peer.");
     }
 
     SCLogDebug("RunModeIdsAFPWorkers initialised");
index 7c85a2d6a56cbf3a886102011ae977a04633c7c4..299a0e085549f72eed7e056745c92cd1ad314935 100644 (file)
@@ -108,8 +108,7 @@ static TmEcode ConfigSetThreads(AFXDPIfaceConfig *aconf, const char *entry_str)
     }
 
     if (entry_str == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Number of threads for interface \"%s\" not specified",
-                aconf->iface);
+        SCLogError("Number of threads for interface \"%s\" not specified", aconf->iface);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -128,20 +127,18 @@ static TmEcode ConfigSetThreads(AFXDPIfaceConfig *aconf, const char *entry_str)
     }
 
     if (StringParseInt32(&aconf->threads, 10, 0, entry_str) < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE,
-                "Threads entry for interface %s contain non-numerical characters - \"%s\"",
+        SCLogError("Threads entry for interface %s contain non-numerical characters - \"%s\"",
                 aconf->iface, entry_str);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (aconf->threads < 0) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Interface %s has a negative number of threads",
-                aconf->iface);
+        SCLogError("Interface %s has a negative number of threads", aconf->iface);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (aconf->threads > nr_queues) {
-        SCLogWarning(SC_WARN_AFXDP_CONF,
+        SCLogWarning(
                 "Selected threads greater than configured queues, using: %d thread(s)", nr_queues);
         aconf->threads = nr_queues;
     }
@@ -241,8 +238,7 @@ static void *ParseAFXDPConfig(const char *iface)
             aconf->mode |= XDP_FLAGS_SKB_MODE;
         } else if (strncasecmp(confstr, "none", 4) == 0) {
         } else {
-            SCLogWarning(SC_WARN_AFXDP_CONF,
-                    "Incorrect af-xdp xdp-mode setting, default (none) shall be applied");
+            SCLogWarning("Incorrect af-xdp xdp-mode setting, default (none) shall be applied");
         }
     }
 
@@ -254,8 +250,7 @@ static void *ParseAFXDPConfig(const char *iface)
             aconf->bind_flags |= XDP_COPY;
         } else if (strncasecmp(confstr, "none", 4) == 0) {
         } else {
-            SCLogWarning(SC_WARN_AFXDP_CONF,
-                    "Incorrect af-xdp copy-mode setting, default (none) shall be applied");
+            SCLogWarning("Incorrect af-xdp copy-mode setting, default (none) shall be applied");
         }
     }
 
@@ -304,8 +299,7 @@ static void *ParseAFXDPConfig(const char *iface)
 finalize:
     if (LiveGetOffload() == 0) {
         if (GetIfaceOffloading(iface, 0, 1) == 1) {
-            SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                    "Using AF_XDP with offloading activated leads to capture problems");
+            SCLogWarning("Using AF_XDP with offloading activated leads to capture problems");
         }
     } else {
         DisableIfaceOffloading(LiveGetDevice(iface), 0, 1);
@@ -317,7 +311,7 @@ finalize:
 static int AFXDPConfigGetThreadsCount(void *conf)
 {
     if (conf == NULL)
-        FatalError(SC_ERR_AFXDP_CONF, "Configuration file is NULL");
+        FatalError("Configuration file is NULL");
 
     AFXDPIfaceConfig *afxdp_conf = (AFXDPIfaceConfig *)conf;
     return afxdp_conf->threads;
@@ -342,13 +336,13 @@ int RunModeIdsAFXDPSingle(void)
     (void)ConfGet("af-xdp.live-interface", &live_dev);
 
     if (AFXDPQueueProtectionInit() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Unable to init AF_XDP queue protection.");
+        FatalError("Unable to init AF_XDP queue protection.");
     }
 
     ret = RunModeSetLiveCaptureSingle(ParseAFXDPConfig, AFXDPConfigGetThreadsCount, "ReceiveAFXDP",
             "DecodeAFXDP", thread_name_single, live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogDebug("RunModeIdsAFXDPSingle initialised");
@@ -377,13 +371,13 @@ int RunModeIdsAFXDPWorkers(void)
     (void)ConfGet("af-xdp.live-interface", &live_dev);
 
     if (AFXDPQueueProtectionInit() != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "Unable to init AF_XDP queue protection.");
+        FatalError("Unable to init AF_XDP queue protection.");
     }
 
     ret = RunModeSetLiveCaptureWorkers(ParseAFXDPConfig, AFXDPConfigGetThreadsCount, "ReceiveAFXDP",
             "DecodeAFXDP", thread_name_workers, live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogDebug("RunModeIdsAFXDPWorkers initialised");
index 798e63bfd5eb04155f635cc894badf80fdb71286..5b191ef9b4acc4e0ed11f88acd6d566240a226fc 100644 (file)
@@ -154,7 +154,7 @@ static char *AllocArgument(size_t arg_len)
     arg_len += 1; // null character
     ptr = (char *)SCCalloc(arg_len, sizeof(char));
     if (ptr == NULL)
-        FatalError(SC_ENOMEM, "Could not allocate memory for an argument");
+        FatalError("Could not allocate memory for an argument");
 
     SCReturnPtr(ptr, "char *");
 }
@@ -168,7 +168,7 @@ static char *AllocAndSetArgument(const char *arg)
 {
     SCEnter();
     if (arg == NULL)
-        FatalError(SC_ERR_DPDK_CONF, "Passed argument is NULL in DPDK config initialization");
+        FatalError("Passed argument is NULL in DPDK config initialization");
 
     char *ptr;
     size_t arg_len = strlen(arg);
@@ -182,7 +182,7 @@ static char *AllocAndSetOption(const char *arg)
 {
     SCEnter();
     if (arg == NULL)
-        FatalError(SC_ERR_DPDK_CONF, "Passed option is NULL in DPDK config initialization");
+        FatalError("Passed option is NULL in DPDK config initialization");
 
     char *ptr = NULL;
     size_t arg_len = strlen(arg);
@@ -201,7 +201,7 @@ static void ArgumentsInit(struct Arguments *args, unsigned capacity)
     SCEnter();
     args->argv = SCCalloc(capacity, sizeof(ptrdiff_t)); // alloc array of pointers
     if (args->argv == NULL)
-        FatalError(SC_ENOMEM, "Could not allocate memory for Arguments structure");
+        FatalError("Could not allocate memory for Arguments structure");
 
     args->capacity = capacity;
     args->argc = 0;
@@ -228,8 +228,7 @@ static void ArgumentsAdd(struct Arguments *args, char *value)
 {
     SCEnter();
     if (args->argc + 1 > args->capacity)
-        FatalError(SC_ERR_DPDK_EAL_INIT, "No capacity for more arguments (Max: %" PRIu32 ")",
-                EAL_ARGS);
+        FatalError("No capacity for more arguments (Max: %" PRIu32 ")", EAL_ARGS);
 
     args->argv[args->argc++] = value;
     SCReturn;
@@ -263,7 +262,7 @@ static void InitEal()
     char **eal_argv;
 
     if (eal_params == NULL) {
-        FatalError(SC_ERR_DPDK_CONF, "DPDK EAL parameters not found in the config");
+        FatalError("DPDK EAL parameters not found in the config");
     }
 
     ArgumentsInit(&args, EAL_ARGS);
@@ -276,7 +275,7 @@ static void InitEal()
     // creating a shallow copy for cleanup because rte_eal_init changes array contents
     eal_argv = SCMalloc(args.argc * sizeof(args.argv));
     if (eal_argv == NULL) {
-        FatalError(SC_ENOMEM, "Failed to allocate memory for the array of DPDK EAL arguments");
+        FatalError("Failed to allocate memory for the array of DPDK EAL arguments");
     }
     memcpy(eal_argv, args.argv, args.argc * sizeof(*args.argv));
 
@@ -287,8 +286,7 @@ static void InitEal()
     SCFree(eal_argv);
 
     if (retval < 0) { // retval binded to the result of rte_eal_init
-        FatalError(
-                SC_ERR_DPDK_EAL_INIT, "DPDK EAL initialization error: %s", rte_strerror(-retval));
+        FatalError("DPDK EAL initialization error: %s", rte_strerror(-retval));
     }
     DPDKSetTimevalOfMachineStart();
 }
@@ -314,7 +312,7 @@ static void ConfigInit(DPDKIfaceConfig **iconf)
     DPDKIfaceConfig *ptr = NULL;
     ptr = SCCalloc(1, sizeof(DPDKIfaceConfig));
     if (ptr == NULL)
-        FatalError(SC_ERR_DPDK_CONF, "Could not allocate memory for DPDKIfaceConfig");
+        FatalError("Could not allocate memory for DPDKIfaceConfig");
 
     ptr->pkt_mempool = NULL;
     ptr->out_port_id = -1; // make sure no port is set
@@ -333,11 +331,11 @@ static void ConfigSetIface(DPDKIfaceConfig *iconf, const char *entry_str)
     int retval;
 
     if (entry_str == NULL || entry_str[0] == '\0')
-        FatalError(SC_EINVAL, "Interface name in DPDK config is NULL or empty");
+        FatalError("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)
-        FatalError(SC_ERR_DPDK_CONF, "Interface \"%s\": %s", entry_str, rte_strerror(-retval));
+        FatalError("Interface \"%s\": %s", entry_str, rte_strerror(-retval));
 
     strlcpy(iconf->iface, entry_str, sizeof(iconf->iface));
     SCReturn;
@@ -354,7 +352,7 @@ static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
     }
 
     if (entry_str == NULL) {
-        SCLogError(SC_EINVAL, "Number of threads for interface \"%s\" not specified", iconf->iface);
+        SCLogError("Number of threads for interface \"%s\" not specified", iconf->iface);
         SCReturnInt(-EINVAL);
     }
 
@@ -365,14 +363,13 @@ static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
     }
 
     if (StringParseInt32(&iconf->threads, 10, 0, entry_str) < 0) {
-        SCLogError(SC_EINVAL,
-                "Threads entry for interface %s contain non-numerical characters - \"%s\"",
+        SCLogError("Threads entry for interface %s contain non-numerical characters - \"%s\"",
                 iconf->iface, entry_str);
         SCReturnInt(-EINVAL);
     }
 
     if (iconf->threads < 0) {
-        SCLogError(SC_EINVAL, "Interface %s has a negative number of threads", iconf->iface);
+        SCLogError("Interface %s has a negative number of threads", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -384,8 +381,7 @@ static int ConfigSetRxQueues(DPDKIfaceConfig *iconf, uint16_t nb_queues)
     SCEnter();
     iconf->nb_rx_queues = nb_queues;
     if (iconf->nb_rx_queues < 1) {
-        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX queues",
-                iconf->iface);
+        SCLogError("Interface %s requires to have positive number of RX queues", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -397,8 +393,7 @@ static int ConfigSetTxQueues(DPDKIfaceConfig *iconf, uint16_t nb_queues)
     SCEnter();
     iconf->nb_tx_queues = nb_queues;
     if (iconf->nb_tx_queues < 1) {
-        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX queues",
-                iconf->iface);
+        SCLogError("Interface %s requires to have positive number of TX queues", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -409,8 +404,7 @@ static int ConfigSetMempoolSize(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(
-                SC_EINVAL, "Interface %s requires to have positive memory pool size", iconf->iface);
+        SCLogError("Interface %s requires to have positive memory pool size", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -427,7 +421,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_EINVAL, "Cannot calculate mempool cache size of a mempool with size %d",
+            SCLogError("Cannot calculate mempool cache size of a mempool with size %d",
                     iconf->mempool_size);
             SCReturnInt(-EINVAL);
         }
@@ -438,15 +432,14 @@ static int ConfigSetMempoolCacheSize(DPDKIfaceConfig *iconf, const char *entry_s
     }
 
     if (StringParseUint32(&iconf->mempool_cache_size, 10, 0, entry_str) < 0) {
-        SCLogError(SC_EINVAL,
-                "Mempool cache size entry for interface %s contain non-numerical "
-                "characters - \"%s\"",
+        SCLogError("Mempool cache size entry for interface %s contain non-numerical "
+                   "characters - \"%s\"",
                 iconf->iface, entry_str);
         SCReturnInt(-EINVAL);
     }
 
     if (iconf->mempool_cache_size <= 0 || iconf->mempool_cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
-        SCLogError(SC_EINVAL,
+        SCLogError(
                 "Interface %s requires to have mempool cache size set to a positive number smaller "
                 "than %" PRIu32,
                 iconf->iface, RTE_MEMPOOL_CACHE_MAX_SIZE);
@@ -460,8 +453,7 @@ static int ConfigSetRxDescriptors(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX descriptors",
-                iconf->iface);
+        SCLogError("Interface %s requires to have positive number of RX descriptors", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -473,8 +465,7 @@ static int ConfigSetTxDescriptors(DPDKIfaceConfig *iconf, intmax_t entry_int)
 {
     SCEnter();
     if (entry_int <= 0) {
-        SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX descriptors",
-                iconf->iface);
+        SCLogError("Interface %s requires to have positive number of TX descriptors", iconf->iface);
         SCReturnInt(-ERANGE);
     }
 
@@ -491,9 +482,8 @@ static int ConfigSetRSSHashFunctions(DPDKIfaceConfig *iconf, const char *entry_s
     }
 
     if (StringParseUint64(&iconf->rss_hf, 0, 0, entry_str) < 0) {
-        SCLogError(SC_EINVAL,
-                "RSS hash functions entry for interface %s contain non-numerical "
-                "characters - \"%s\"",
+        SCLogError("RSS hash functions entry for interface %s contain non-numerical "
+                   "characters - \"%s\"",
                 iconf->iface, entry_str);
         SCReturnInt(-EINVAL);
     }
@@ -505,8 +495,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_EINVAL,
-                "Interface %s requires to have size of MTU between %" PRIu32 " and %" PRIu32,
+        SCLogError("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);
     }
@@ -563,7 +552,7 @@ static int ConfigSetCopyIface(DPDKIfaceConfig *iconf, const char *entry_str)
 
     retval = rte_eth_dev_get_port_by_name(entry_str, &iconf->out_port_id);
     if (retval < 0) {
-        SCLogWarning(SC_ERR_DPDK_CONF,
+        SCLogWarning(
                 "Name of the copy interface (%s) for the interface %s is not valid, changing to %s",
                 entry_str, iconf->iface, DPDK_CONFIG_DEFAULT_COPY_INTERFACE);
         iconf->out_iface = DPDK_CONFIG_DEFAULT_COPY_INTERFACE;
@@ -577,14 +566,14 @@ static int ConfigSetCopyMode(DPDKIfaceConfig *iconf, const char *entry_str)
 {
     SCEnter();
     if (entry_str == NULL) {
-        SCLogWarning(SC_EINVAL, "Interface %s has no copy mode specified, changing to %s ",
-                iconf->iface, DPDK_CONFIG_DEFAULT_COPY_MODE);
+        SCLogWarning("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_EINVAL,
+        SCLogWarning(
                 "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);
@@ -622,7 +611,7 @@ static int ConfigSetCopyIfaceSettings(DPDKIfaceConfig *iconf, const char *iface,
     }
 
     if (iconf->out_iface == NULL || strlen(iconf->out_iface) <= 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "Copy mode enabled but interface not set");
+        SCLogError("Copy mode enabled but interface not set");
         SCReturnInt(-EINVAL);
     }
 
@@ -645,8 +634,7 @@ static int ConfigLoad(DPDKIfaceConfig *iconf, const char *iface)
 
     retval = ConfSetRootAndDefaultNodes("dpdk.interfaces", iconf->iface, &if_root, &if_default);
     if (retval < 0) {
-        FatalError(SC_ERR_DPDK_CONF, "failed to find DPDK configuration for the interface %s",
-                iconf->iface);
+        FatalError("failed to find DPDK configuration for the interface %s", iconf->iface);
     }
 
     retval = ConfGetChildValueWithDefault(if_root, if_default, dpdk_yaml.threads, &entry_str) != 1
@@ -760,7 +748,7 @@ static DPDKIfaceConfig *ConfigParse(const char *iface)
     int retval;
     DPDKIfaceConfig *iconf = NULL;
     if (iface == NULL)
-        FatalError(SC_ERR_DPDK_CONF, "DPDK interface is NULL");
+        FatalError("DPDK interface is NULL");
 
     ConfigInit(&iconf);
     retval = ConfigLoad(iconf, iface);
@@ -925,9 +913,8 @@ static void DumpRSSFlags(const uint64_t requested, const uint64_t actual)
 static int DeviceValidateMTU(const DPDKIfaceConfig *iconf, const struct rte_eth_dev_info *dev_info)
 {
     if (iconf->mtu > dev_info->max_mtu || iconf->mtu < dev_info->min_mtu) {
-        SCLogError(SC_ERR_DPDK_INIT,
-                "Loaded MTU of \"%s\" is out of bounds. "
-                "Min MTU: %" PRIu16 " Max MTU: %" PRIu16,
+        SCLogError("Loaded MTU of \"%s\" is out of bounds. "
+                   "Min MTU: %" PRIu16 " Max MTU: %" PRIu16,
                 iconf->iface, dev_info->min_mtu, dev_info->max_mtu);
         SCReturnInt(-ERANGE);
     }
@@ -936,8 +923,7 @@ static int DeviceValidateMTU(const DPDKIfaceConfig *iconf, const struct rte_eth_
     // check if jumbo frames are set and are available
     if (iconf->mtu > RTE_ETHER_MAX_LEN &&
             !(dev_info->rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME)) {
-        SCLogError(SC_ERR_DPDK_CONF, "Jumbo frames not supported, set MTU of \"%s\" to 1500B",
-                iconf->iface);
+        SCLogError("Jumbo frames not supported, set MTU of \"%s\" to 1500B", iconf->iface);
         SCReturnInt(-EINVAL);
     }
 #endif
@@ -988,9 +974,8 @@ static void DeviceInitPortConf(const DPDKIfaceConfig *iconf,
             if (port_conf->rx_adv_conf.rss_conf.rss_hf != rss_hf_tmp) {
                 DumpRSSFlags(port_conf->rx_adv_conf.rss_conf.rss_hf, rss_hf_tmp);
 
-                SCLogWarning(SC_WARN_DPDK_CONF,
-                        "Interface %s modified RSS hash function based on hardware support, "
-                        "requested:%#" PRIx64 " configured:%#" PRIx64,
+                SCLogWarning("Interface %s modified RSS hash function based on hardware support, "
+                             "requested:%#" PRIx64 " configured:%#" PRIx64,
                         iconf->iface, port_conf->rx_adv_conf.rss_conf.rss_hf, rss_hf_tmp);
                 port_conf->rx_adv_conf.rss_conf.rss_hf = rss_hf_tmp;
             }
@@ -1049,8 +1034,7 @@ static int DeviceConfigureQueues(DPDKIfaceConfig *iconf, const struct rte_eth_de
             iconf->mempool_cache_size, 0, mbuf_size, (int)iconf->socket_id);
     if (iconf->pkt_mempool == NULL) {
         retval = -rte_errno;
-        SCLogError(SC_ERR_DPDK_INIT,
-                "Error (err=%d) during rte_pktmbuf_pool_create (mempool: %s) - %s", rte_errno,
+        SCLogError("Error (err=%d) during rte_pktmbuf_pool_create (mempool: %s) - %s", rte_errno,
                 mempool_name, rte_strerror(rte_errno));
         SCReturnInt(retval);
     }
@@ -1074,8 +1058,7 @@ static int DeviceConfigureQueues(DPDKIfaceConfig *iconf, const struct rte_eth_de
                 iconf->socket_id, &rxq_conf, iconf->pkt_mempool);
         if (retval < 0) {
             rte_mempool_free(iconf->pkt_mempool);
-            SCLogError(SC_ERR_DPDK_INIT,
-                    "Error (err=%d) during initialization of device queue %u of port %u", retval,
+            SCLogError("Error (err=%d) during initialization of device queue %u of port %u", retval,
                     queue_id, iconf->port_id);
             SCReturnInt(retval);
         }
@@ -1089,8 +1072,7 @@ static int DeviceConfigureQueues(DPDKIfaceConfig *iconf, const struct rte_eth_de
                 iconf->port_id, queue_id, iconf->nb_tx_desc, iconf->socket_id, &txq_conf);
         if (retval < 0) {
             rte_mempool_free(iconf->pkt_mempool);
-            SCLogError(SC_ERR_DPDK_INIT,
-                    "Error (err=%d) during initialization of device queue %u of port %u", retval,
+            SCLogError("Error (err=%d) during initialization of device queue %u of port %u", retval,
                     queue_id, iconf->port_id);
             SCReturnInt(retval);
         }
@@ -1106,41 +1088,37 @@ static int DeviceValidateOutIfaceConfig(DPDKIfaceConfig *iconf)
     DPDKIfaceConfig *out_iconf = NULL;
     ConfigInit(&out_iconf);
     if (out_iconf == NULL) {
-        FatalError(
-                SC_ERR_DPDK_CONF, "Copy interface of the interface \"%s\" is NULL", iconf->iface);
+        FatalError("Copy interface of the interface \"%s\" is NULL", iconf->iface);
     }
 
     retval = ConfigLoad(out_iconf, iconf->out_iface);
     if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "Fail to load config of interface %s", iconf->out_iface);
+        SCLogError("Fail to load config of interface %s", iconf->out_iface);
         out_iconf->DerefFunc(out_iconf);
         SCReturnInt(-EINVAL);
     }
 
     if (iconf->nb_rx_queues != out_iconf->nb_tx_queues) {
         // the other direction is validated when the copy interface is configured
-        SCLogError(SC_ERR_DPDK_CONF,
-                "Interface %s has configured %d RX queues but copy interface %s has %d TX queues"
-                " - number of queues must be equal",
+        SCLogError("Interface %s has configured %d RX queues but copy interface %s has %d TX queues"
+                   " - number of queues must be equal",
                 iconf->iface, iconf->nb_rx_queues, out_iconf->iface, out_iconf->nb_tx_queues);
         out_iconf->DerefFunc(out_iconf);
         SCReturnInt(-EINVAL);
     } else if (iconf->mtu != out_iconf->mtu) {
-        SCLogError(SC_ERR_DPDK_CONF,
-                "Interface %s has configured MTU of %dB but copy interface %s has MTU set to %dB"
-                " - MTU must be equal",
+        SCLogError("Interface %s has configured MTU of %dB but copy interface %s has MTU set to %dB"
+                   " - MTU must be equal",
                 iconf->iface, iconf->mtu, out_iconf->iface, out_iconf->mtu);
         out_iconf->DerefFunc(out_iconf);
         SCReturnInt(-EINVAL);
     } else if (iconf->copy_mode != out_iconf->copy_mode) {
-        SCLogError(SC_ERR_DPDK_CONF, "Copy modes of interfaces %s and %s are not equal",
-                iconf->iface, out_iconf->iface);
+        SCLogError(
+                "Copy modes of interfaces %s and %s are not equal", iconf->iface, out_iconf->iface);
         out_iconf->DerefFunc(out_iconf);
         SCReturnInt(-EINVAL);
     } else if (strcmp(iconf->iface, out_iconf->out_iface) != 0) {
         // check if the other iface has the current iface set as a copy iface
-        SCLogError(SC_ERR_DPDK_CONF, "Copy interface of %s is not set to %s", out_iconf->iface,
-                iconf->iface);
+        SCLogError("Copy interface of %s is not set to %s", out_iconf->iface, iconf->iface);
         out_iconf->DerefFunc(out_iconf);
         SCReturnInt(-EINVAL);
     }
@@ -1157,14 +1135,12 @@ static int DeviceConfigureIPS(DPDKIfaceConfig *iconf)
     if (iconf->out_iface != NULL) {
         retval = rte_eth_dev_get_port_by_name(iconf->out_iface, &iconf->out_port_id);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) during obtaining port id of %s", retval,
-                    iconf->out_iface);
+            SCLogError("Error (err=%d) during obtaining port id of %s", retval, iconf->out_iface);
             SCReturnInt(retval);
         }
 
         if (rte_eth_dev_socket_id(iconf->port_id) != rte_eth_dev_socket_id(iconf->out_port_id)) {
-            SCLogWarning(SC_WARN_DPDK_CONF, "%s and %s are not on the same NUMA node", iconf->iface,
-                    iconf->out_iface);
+            SCLogWarning("%s and %s are not on the same NUMA node", iconf->iface, iconf->out_iface);
         }
 
         retval = DeviceValidateOutIfaceConfig(iconf);
@@ -1193,20 +1169,19 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
 
     retval = rte_eth_dev_get_port_by_name(iconf->iface, &(iconf->port_id));
     if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) when getting port id of %s Is device enabled?",
-                retval, iconf->iface);
+        SCLogError("Error (err=%d) when getting port id of %s Is device enabled?", retval,
+                iconf->iface);
         SCReturnInt(retval);
     }
 
     if (!rte_eth_dev_is_valid_port(iconf->port_id)) {
-        SCLogError(SC_ERR_DPDK_INIT, "Specified port %d is invalid", iconf->port_id);
+        SCLogError("Specified port %d is invalid", iconf->port_id);
         SCReturnInt(retval);
     }
 
     retval = rte_eth_dev_socket_id(iconf->port_id);
     if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) invalid socket id (port %s)", retval,
-                iconf->iface);
+        SCLogError("Error (err=%d) invalid socket id (port %s)", retval, iconf->iface);
         SCReturnInt(retval);
     } else {
         iconf->socket_id = retval;
@@ -1214,21 +1189,20 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
 
     retval = rte_eth_dev_info_get(iconf->port_id, &dev_info);
     if (retval != 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) during getting device info (port %s)", retval,
-                iconf->iface);
+        SCLogError("Error (err=%d) during getting device info (port %s)", retval, iconf->iface);
         SCReturnInt(retval);
     }
 
     if (iconf->nb_rx_queues > dev_info.max_rx_queues) {
-        SCLogError(SC_ERR_DPDK_INIT,
-                "Number of configured RX queues of %s is higher than maximum allowed (%" PRIu16 ")",
+        SCLogError("Number of configured RX queues of %s is higher than maximum allowed (%" PRIu16
+                   ")",
                 iconf->iface, dev_info.max_rx_queues);
         SCReturnInt(-ERANGE);
     }
 
     if (iconf->nb_tx_queues > dev_info.max_tx_queues) {
-        SCLogError(SC_ERR_DPDK_INIT,
-                "Number of configured TX queues of %s is higher than maximum allowed (%" PRIu16 ")",
+        SCLogError("Number of configured TX queues of %s is higher than maximum allowed (%" PRIu16
+                   ")",
                 iconf->iface, dev_info.max_tx_queues);
         SCReturnInt(-ERANGE);
     }
@@ -1246,17 +1220,16 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
     retval = rte_eth_dev_configure(
             iconf->port_id, iconf->nb_rx_queues, iconf->nb_tx_queues, &port_conf);
     if (retval != 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) during configuring the device (port %u)",
-                retval, iconf->port_id);
+        SCLogError(
+                "Error (err=%d) during configuring the device (port %u)", retval, iconf->port_id);
         SCReturnInt(retval);
     }
 
     retval = rte_eth_dev_adjust_nb_rx_tx_desc(
             iconf->port_id, &iconf->nb_rx_desc, &iconf->nb_tx_desc);
     if (retval != 0) {
-        SCLogError(SC_ERR_DPDK_INIT,
-                "Error (err=%d) during adjustment of device queues descriptors (port %u)", retval,
-                iconf->port_id);
+        SCLogError("Error (err=%d) during adjustment of device queues descriptors (port %u)",
+                retval, iconf->port_id);
         SCReturnInt(retval);
     }
 
@@ -1267,24 +1240,22 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
         // when multicast is enabled but set to disable or vice versa
         if ((retval == 1 && !(iconf->flags & DPDK_MULTICAST)) ||
                 (retval == 0 && (iconf->flags & DPDK_MULTICAST))) {
-            SCLogError(SC_ERR_DPDK_CONF,
-                    "Allmulticast setting of port (%" PRIu16
-                    ") can not be configured. Set it to %s",
+            SCLogError("Allmulticast setting of port (%" PRIu16
+                       ") can not be configured. Set it to %s",
                     iconf->port_id, retval == 1 ? "true" : "false");
         } else if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) Unable to get multicast mode on port %u",
-                    retval, iconf->port_id);
+            SCLogError("Error (err=%d) Unable to get multicast mode on port %u", retval,
+                    iconf->port_id);
             SCReturnInt(retval);
         }
 
         if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) Unable to get multicast mode on port %u",
-                    retval, iconf->port_id);
+            SCLogError("Error (err=%d) Unable to get multicast mode on port %u", retval,
+                    iconf->port_id);
             SCReturnInt(retval);
         }
     } else if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) when en/disabling multicast on port %u",
-                retval, iconf->port_id);
+        SCLogError("Error (err=%d) when en/disabling multicast on port %u", retval, iconf->port_id);
         SCReturnInt(retval);
     }
 
@@ -1294,18 +1265,18 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
         retval = rte_eth_promiscuous_get(iconf->port_id);
         if ((retval == 1 && !(iconf->flags & DPDK_PROMISC)) ||
                 (retval == 0 && (iconf->flags & DPDK_PROMISC))) {
-            SCLogError(SC_ERR_DPDK_CONF,
-                    "Promiscuous setting of port (%" PRIu16 ") can not be configured. Set it to %s",
+            SCLogError("Promiscuous setting of port (%" PRIu16
+                       ") can not be configured. Set it to %s",
                     iconf->port_id, retval == 1 ? "true" : "false");
             SCReturnInt(TM_ECODE_FAILED);
         } else if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) Unable to get promiscuous mode on port %u",
-                    retval, iconf->port_id);
+            SCLogError("Error (err=%d) Unable to get promiscuous mode on port %u", retval,
+                    iconf->port_id);
             SCReturnInt(retval);
         }
     } else if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) when enabling promiscuous mode on port %u",
-                retval, iconf->port_id);
+        SCLogError(
+                "Error (err=%d) when enabling promiscuous mode on port %u", retval, iconf->port_id);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -1313,19 +1284,18 @@ static int DeviceConfigure(DPDKIfaceConfig *iconf)
     SCLogConfig("Setting MTU of %s to %dB", iconf->iface, iconf->mtu);
     retval = rte_eth_dev_set_mtu(iconf->port_id, iconf->mtu);
     if (retval == -ENOTSUP) {
-        SCLogWarning(SC_WARN_DPDK_CONF,
-                "Changing MTU on port %u is not supported, ignoring the setting...",
+        SCLogWarning("Changing MTU on port %u is not supported, ignoring the setting...",
                 iconf->port_id);
         // if it is not possible to set the MTU, retrieve it
         retval = rte_eth_dev_get_mtu(iconf->port_id, &iconf->mtu);
         if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) Unable to retrieve MTU from port %u",
-                    retval, iconf->port_id);
+            SCLogError(
+                    "Error (err=%d) Unable to retrieve MTU from port %u", retval, iconf->port_id);
             SCReturnInt(retval);
         }
     } else if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) when setting MTU to %u on port %u", retval,
-                iconf->mtu, iconf->port_id);
+        SCLogError("Error (err=%d) when setting MTU to %u on port %u", retval, iconf->mtu,
+                iconf->port_id);
         SCReturnInt(retval);
     }
 
@@ -1347,16 +1317,16 @@ static void *ParseDpdkConfigAndConfigureDevice(const char *iface)
     int retval;
     DPDKIfaceConfig *iconf = ConfigParse(iface);
     if (iconf == NULL) {
-        FatalError(SC_ERR_DPDK_CONF, "DPDK configuration could not be parsed");
+        FatalError("DPDK configuration could not be parsed");
     }
 
     if (DeviceConfigure(iconf) != 0) {
         iconf->DerefFunc(iconf);
         retval = rte_eal_cleanup();
         if (retval != 0)
-            FatalError(SC_ERR_DPDK_EAL_INIT, "EAL cleanup failed: %s", strerror(-retval));
+            FatalError("EAL cleanup failed: %s", strerror(-retval));
 
-        FatalError(SC_ERR_DPDK_CONF, "Device %s fails to configure", iface);
+        FatalError("Device %s fails to configure", iface);
     }
 
     SC_ATOMIC_RESET(iconf->ref);
@@ -1383,7 +1353,7 @@ static void *ParseDpdkConfigAndConfigureDevice(const char *iface)
 static int DPDKConfigGetThreadsCount(void *conf)
 {
     if (conf == NULL)
-        FatalError(SC_ERR_DPDK_CONF, "Configuration file is NULL");
+        FatalError("Configuration file is NULL");
 
     DPDKIfaceConfig *dpdk_conf = (DPDKIfaceConfig *)conf;
     return dpdk_conf->threads;
@@ -1423,7 +1393,7 @@ int RunModeIdsDpdkWorkers(void)
     ret = RunModeSetLiveCaptureWorkers(ParseDpdkConfigAndConfigureDevice, DPDKConfigGetThreadsCount,
             "ReceiveDPDK", "DecodeDPDK", thread_name_workers, NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogDebug("RunModeIdsDpdkWorkers initialised");
index 3019f6caf917cdb56642c3069579fc3bf5a3a644..b4d7e345320aabf0a53e8d312306182924c62115 100644 (file)
@@ -84,7 +84,7 @@ int RunModeIdsErfDagSingle(void)
         thread_name_single,
         NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "DAG single runmode failed to start");
+        FatalError("DAG single runmode failed to start");
     }
 
     SCLogInfo("RunModeIdsDagSingle initialised");
@@ -109,7 +109,7 @@ int RunModeIdsErfDagAutoFp(void)
         thread_name_autofp,
         NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "DAG autofp runmode failed to start");
+        FatalError("DAG autofp runmode failed to start");
     }
 
     SCLogInfo("RunModeIdsDagAutoFp initialised");
@@ -134,7 +134,7 @@ int RunModeIdsErfDagWorkers(void)
         thread_name_workers,
         NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "DAG workers runmode failed to start");
+        FatalError("DAG workers runmode failed to start");
     }
 
     SCLogInfo("RunModeIdsErfDagWorkers initialised");
index 31e8d26391109a901deb4f3cefa531486d32d797..9b0a1e743c0c4185e647f5d4efebcb988aa57e72 100644 (file)
@@ -57,7 +57,7 @@ int RunModeErfFileSingle(void)
     SCEnter();
 
     if (ConfGet("erf-file.file", &file) == 0) {
-        FatalError(SC_ERR_FATAL, "Failed to get erf-file.file from config.");
+        FatalError("Failed to get erf-file.file from config.");
     }
 
     RunModeInitialize();
@@ -91,7 +91,7 @@ int RunModeErfFileSingle(void)
 
     tm_module = TmModuleGetByName("FlowWorker");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName for FlowWorker failed");
+        FatalError("TmModuleGetByName for FlowWorker failed");
     }
     TmSlotSetFuncAppend(tv, tm_module, NULL);
 
@@ -118,8 +118,7 @@ int RunModeErfFileAutoFp(void)
 
     const char *file = NULL;
     if (ConfGet("erf-file.file", &file) == 0) {
-            FatalError(SC_ERR_FATAL,
-                       "Failed retrieving erf-file.file from config");
+        FatalError("Failed retrieving erf-file.file from config");
     }
 
     TimeModeSetOffline();
@@ -143,8 +142,7 @@ int RunModeErfFileAutoFp(void)
 
     queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
     if (queues == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "RunmodeAutoFpCreatePickupQueuesString failed");
+        FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
     }
 
     /* create the threads */
@@ -204,8 +202,7 @@ int RunModeErfFileAutoFp(void)
 
         tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
index 8350014ff58b1e6330ad0804484b979d5aa4e81f..82cbc59358a666bf8f38d8e76648d4faafd4fc5b 100644 (file)
@@ -120,8 +120,8 @@ static int NapatechRegisterDeviceStreams(void)
      * automatically creates streams.  Therefore, these two options are mutually exclusive.
      */
     if (use_all_streams && auto_config) {
-        FatalError(SC_ERR_FATAL,
-                   "napatech.auto-config cannot be used in configuration file at the same time as napatech.use-all-streams.");
+        FatalError("napatech.auto-config cannot be used in configuration file at the same time as "
+                   "napatech.use-all-streams.");
     }
 
     /* to use hardware_bypass we need to configure the streams to be consistent.
@@ -129,8 +129,7 @@ static int NapatechRegisterDeviceStreams(void)
      * option.
      */
     if (use_hw_bypass && auto_config == 0) {
-        FatalError(SC_ERR_FATAL,
-                   "napatech auto-config must be enabled when using napatech.use_hw_bypass.");
+        FatalError("napatech auto-config must be enabled when using napatech.use_hw_bypass.");
     }
 
     /* Get the stream ID's either from the conf or by querying Napatech */
@@ -143,20 +142,16 @@ static int NapatechRegisterDeviceStreams(void)
     for (uint16_t inst = 0; inst < stream_cnt; ++inst) {
         char *plive_dev_buf = SCCalloc(1, 9);
         if (unlikely(plive_dev_buf == NULL)) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to allocate memory for NAPATECH stream counter.");
+            FatalError("Failed to allocate memory for NAPATECH stream counter.");
         }
         snprintf(plive_dev_buf, 9, "nt%d", stream_config[inst].stream_id);
 
         if (auto_config) {
             if (stream_config[inst].is_active) {
-                SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED,
-                        "Registering Napatech device: %s - active stream found.",
-                        plive_dev_buf);
-                SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED,
+                SCLogError("Registering Napatech device: %s - active stream found.", plive_dev_buf);
+                SCLogError(
                         "run /opt/napatech3/bin/ntpl -e \"delete=all\" to delete existing stream");
-                        FatalError(SC_ERR_FATAL,
-                                   "or disable auto-config in the conf file before running.");
+                FatalError("or disable auto-config in the conf file before running.");
             }
         } else {
             SCLogInfo("Registering Napatech device: %s - active stream%sfound.",
@@ -182,20 +177,19 @@ static void *NapatechConfigParser(const char *device)
     /* Expect device to be of the form nt%d where %d is the stream id to use */
     int dev_len = strlen(device);
     if (dev_len < 3 || dev_len > 5) {
-        SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG,
-                "Could not parse config for device: %s - invalid length", device);
+        SCLogError("Could not parse config for device: %s - invalid length", device);
         return NULL;
     }
 
     struct NapatechStreamDevConf *conf = SCCalloc(1, sizeof (struct NapatechStreamDevConf));
     if (unlikely(conf == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to allocate memory for NAPATECH device name.");
+        SCLogError("Failed to allocate memory for NAPATECH device name.");
         return NULL;
     }
 
     /* 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_EINVAL, "Invalid value for stream_id: %s", device + 2);
+        SCLogError("Invalid value for stream_id: %s", device + 2);
         SCFree(conf);
         return NULL;
     }
@@ -206,8 +200,7 @@ static void *NapatechConfigParser(const char *device)
     if (ConfGetInt("napatech.hba", &conf->hba) == 0) {
         conf->hba = -1;
     } else {
-        SCLogWarning(SC_WARN_COMPATIBILITY,
-                "Napatech Host Buffer Allocation (hba) will be deprecated in Suricata v7.0.");
+        SCLogWarning("Napatech Host Buffer Allocation (hba) will be deprecated in Suricata v7.0.");
     }
     return (void *) conf;
 }
@@ -228,21 +221,19 @@ static int NapatechInit(int runmode)
 
     /* Initialize the API and check version compatibility */
     if ((status = NT_Init(NTAPI_VERSION)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
     status = NapatechRegisterDeviceStreams();
     if (status < 0 || num_configured_streams <= 0) {
-                    FatalError(SC_ERR_FATAL,
-                               "Unable to find existing Napatech Streams");
+        FatalError("Unable to find existing Napatech Streams");
     }
 
     struct NapatechStreamDevConf *conf =
                             SCCalloc(1, sizeof (struct NapatechStreamDevConf));
     if (unlikely(conf == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Failed to allocate memory for NAPATECH device.");
+        FatalError("Failed to allocate memory for NAPATECH device.");
     }
 
     if ((ConfGetInt("napatech.hba", &conf->hba) != 0) && (conf->hba > 0)) {
@@ -254,12 +245,12 @@ static int NapatechInit(int runmode)
         if (NapatechVerifyBypassSupport()) {
             SCLogInfo("Napatech Hardware Bypass is supported and enabled.");
         } else {
-                    FatalError(SC_ERR_FATAL,
-                               "Napatech Hardware Bypass requested in conf but is not supported by the hardware.");
+            FatalError("Napatech Hardware Bypass requested in conf but is not supported by the "
+                       "hardware.");
         }
 #else
-                FatalError(SC_ERR_FATAL,
-                           "Napatech Hardware Bypass requested in conf but is not enabled by the software.");
+        FatalError(
+                "Napatech Hardware Bypass requested in conf but is not enabled by the software.");
 #endif
     } else {
         SCLogInfo("Hardware Bypass is disabled in the conf file.");
@@ -280,7 +271,7 @@ static int NapatechInit(int runmode)
     }
 
     if (status != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
     return 0;
 }
index c198b81ed21aa007ff688df747274d6adda78c2c..010ffc9c83cbf91e6a0a0ba2fe742bf862e70f02 100644 (file)
@@ -95,9 +95,8 @@ static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
     if (ns->iface[0]) {
         size_t len = strlen(ns->iface);
         if (ns->iface[len-1] == '+') {
-            SCLogWarning(SC_WARN_OPTION_OBSOLETE,
-                    "netmap interface %s uses obsolete '+' notation. "
-                    "Using '^' instead.", ns->iface);
+            SCLogWarning("netmap interface %s uses obsolete '+' notation. Using '^' instead.",
+                    ns->iface);
             ns->iface[len-1] = '^';
             ns->sw_ring = true;
         } else if (ns->iface[len-1] == '^') {
@@ -151,10 +150,7 @@ static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
             ns->threads_auto = true;
         } else {
             if (StringParseUint16(&ns->threads, 10, 0, threadsstr) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid config value for "
-                        "threads: %s, resetting to 0",
-                        threadsstr);
+                SCLogWarning("Invalid config value for threads: %s, resetting to 0", threadsstr);
                 ns->threads = 0;
             }
         }
@@ -189,8 +185,7 @@ static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
         } else if (ConfValIsFalse(tmpctype)) {
             ns->checksum_mode = CHECKSUM_VALIDATION_DISABLE;
         } else {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid value for "
-                    "checksum-checks for %s", iface);
+            SCLogWarning("Invalid value for checksum-checks for %s", iface);
         }
     }
 
@@ -203,8 +198,7 @@ static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
         } else if (strcmp(copymodestr, "tap") == 0) {
             ns->copy_mode = NETMAP_COPY_MODE_TAP;
         } else {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid copy-mode "
-                    "(valid are tap, ips)");
+            SCLogWarning("Invalid copy-mode (valid are tap, ips)");
         }
     }
 
@@ -349,7 +343,7 @@ int NetmapRunModeIsIPS()
     for (ldev = 0; ldev < nlive; ldev++) {
         const char *live_dev = LiveGetDeviceName(ldev);
         if (live_dev == NULL) {
-            SCLogError(SC_EINVAL, "Problem with config file");
+            SCLogError("Problem with config file");
             return 0;
         }
         const char *copymodestr = NULL;
@@ -357,7 +351,7 @@ int NetmapRunModeIsIPS()
 
         if (if_root == NULL) {
             if (if_default == NULL) {
-                SCLogError(SC_EINVAL, "Problem with config file");
+                SCLogError("Problem with config file");
                 return 0;
             }
             if_root = if_default;
@@ -375,13 +369,12 @@ int NetmapRunModeIsIPS()
     }
 
     if (has_ids && has_ips) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                "Netmap using both IPS and TAP/IDS mode, this will not be "
-                "allowed in Suricata 8 due to undefined behavior. See ticket #5588.");
+        SCLogWarning("Netmap using both IPS and TAP/IDS mode, this will not be allowed in Suricata "
+                     "8 due to undefined behavior. See ticket #5588.");
         for (ldev = 0; ldev < nlive; ldev++) {
             const char *live_dev = LiveGetDeviceName(ldev);
             if (live_dev == NULL) {
-                SCLogError(SC_EINVAL, "Problem with config file");
+                SCLogError("Problem with config file");
                 return 0;
             }
             if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
@@ -389,7 +382,7 @@ int NetmapRunModeIsIPS()
 
             if (if_root == NULL) {
                 if (if_default == NULL) {
-                    SCLogError(SC_EINVAL, "Problem with config file");
+                    SCLogError("Problem with config file");
                     return 0;
                 }
                 if_root = if_default;
@@ -397,9 +390,8 @@ int NetmapRunModeIsIPS()
 
             if (! ((ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) &&
                     (strcmp(copymodestr, "ips") == 0))) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "Netmap IPS mode used and interface '%s' is in IDS or TAP mode. "
-                                "Sniffing '%s' but expect bad result as stream-inline is activated.",
+                SCLogError("Netmap IPS mode used and interface '%s' is in IDS or TAP mode. "
+                           "Sniffing '%s' but expect bad result as stream-inline is activated.",
                         live_dev, live_dev);
             }
         }
@@ -436,9 +428,9 @@ static int NetmapRunModeInit(NetmapRunMode_t runmode)
             break;
     }
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode %s",
-                runmode == NETMAP_AUTOFP ? "autofp"
-                                         : runmode == NETMAP_WORKERS ? "workers" : "single");
+        FatalError("Unable to start runmode %s", runmode == NETMAP_AUTOFP    ? "autofp"
+                                                 : runmode == NETMAP_WORKERS ? "workers"
+                                                                             : "single");
     }
 
     SCLogDebug("%s initialized",
@@ -474,7 +466,7 @@ int RunModeIdsNetmapWorkers(void)
 int RunModeIdsNetmapAutoFp(void)
 {
     SCEnter();
-    FatalError(SC_ERR_FATAL, "Netmap not configured");
+    FatalError("Netmap not configured");
     SCReturnInt(0);
 }
 
@@ -484,7 +476,7 @@ int RunModeIdsNetmapAutoFp(void)
 int RunModeIdsNetmapSingle(void)
 {
     SCEnter();
-    FatalError(SC_ERR_FATAL, "Netmap not configured");
+    FatalError("Netmap not configured");
     SCReturnInt(0);
 }
 
@@ -497,7 +489,7 @@ int RunModeIdsNetmapSingle(void)
 int RunModeIdsNetmapWorkers(void)
 {
     SCEnter();
-    FatalError(SC_ERR_FATAL, "Netmap not configured");
+    FatalError("Netmap not configured");
     SCReturnInt(0);
 }
 #endif // #ifdef HAVE_NETMAP
index fe795764c069bbd08a68c79769a76b966d1b6043..ddb36409bd445525e0619afa83dc09fb4479ac4a 100644 (file)
@@ -85,7 +85,7 @@ static void *ParseNflogConfig(const char *group)
     strlcpy(nflogconf->numgroup, group, sizeof(nflogconf->numgroup));
 
     if (ParseSizeStringU16(group, &nflogconf->group) < 0) {
-        FatalError(SC_ERR_FATAL, "NFLOG's group number invalid.");
+        FatalError("NFLOG's group number invalid.");
     }
 
     boolval = ConfGetChildValueIntWithDefault(group_root, group_default,
@@ -94,7 +94,7 @@ static void *ParseNflogConfig(const char *group)
     if (boolval)
         nflogconf->nlbufsiz = bufsize;
     else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid buffer-size value");
+        SCLogError("Invalid buffer-size value");
         SCFree(nflogconf);
         return NULL;
     }
@@ -105,14 +105,14 @@ static void *ParseNflogConfig(const char *group)
     if (boolval)
         nflogconf->nlbufsiz_max = bufsize_max;
     else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid max-size value");
+        SCLogError("Invalid max-size value");
         SCFree(nflogconf);
         return NULL;
     }
 
     if (nflogconf->nlbufsiz > nflogconf->nlbufsiz_max) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "buffer-size value larger "
-                "than max-size value, adjusting buffer-size");
+        SCLogWarning("buffer-size value larger "
+                     "than max-size value, adjusting buffer-size");
         nflogconf->nlbufsiz = nflogconf->nlbufsiz_max;
     }
 
@@ -122,7 +122,7 @@ static void *ParseNflogConfig(const char *group)
     if (boolval)
         nflogconf->qthreshold = qthreshold;
     else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid qthreshold value");
+        SCLogError("Invalid qthreshold value");
         SCFree(nflogconf);
         return NULL;
     }
@@ -133,7 +133,7 @@ static void *ParseNflogConfig(const char *group)
     if (boolval)
         nflogconf->qtimeout = qtimeout;
     else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid qtimeout value");
+        SCLogError("Invalid qtimeout value");
         SCFree(nflogconf);
         return NULL;
     }
@@ -159,7 +159,7 @@ static int RunModeIdsNflogAutoFp(void)
     int ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig, NflogConfigGeThreadsCount,
             "ReceiveNFLOG", "DecodeNFLOG", thread_name_autofp, NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogInfo("RunModeIdsNflogAutoFp initialised");
@@ -179,7 +179,7 @@ static int RunModeIdsNflogSingle(void)
     int ret = RunModeSetLiveCaptureSingle(ParseNflogConfig, NflogConfigGeThreadsCount,
             "ReceiveNFLOG", "DecodeNFLOG", thread_name_single, NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogInfo("RunModeIdsNflogSingle initialised");
@@ -199,7 +199,7 @@ static int RunModeIdsNflogWorkers(void)
     int ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig, NflogConfigGeThreadsCount,
             "ReceiveNFLOG", "DecodeNFLOG", thread_name_workers, NULL);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogInfo("RunModeIdsNflogWorkers initialised");
index 1961b1d80910957d2f0324b5029d4531855468fc..a45b510d5ecf77cc912deaa60f82e79a84dfa8b3 100644 (file)
@@ -62,7 +62,7 @@ int RunModeFilePcapSingle(void)
     char tname[TM_THREAD_NAME_MAX];
 
     if (ConfGet("pcap-file.file", &file) == 0) {
-        FatalError(SC_ERR_FATAL, "Failed retrieving pcap-file from Conf");
+        FatalError("Failed retrieving pcap-file from Conf");
     }
 
     RunModeInitialize();
@@ -78,31 +78,31 @@ int RunModeFilePcapSingle(void)
                                                  "packetpool", "packetpool",
                                                  "pktacqloop");
     if (tv == NULL) {
-        FatalError(SC_ERR_FATAL, "threading setup failed");
+        FatalError("threading setup failed");
     }
 
     TmModule *tm_module = TmModuleGetByName("ReceivePcapFile");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName failed for ReceivePcap");
+        FatalError("TmModuleGetByName failed for ReceivePcap");
     }
     TmSlotSetFuncAppend(tv, tm_module, file);
 
     tm_module = TmModuleGetByName("DecodePcapFile");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName DecodePcap failed");
+        FatalError("TmModuleGetByName DecodePcap failed");
     }
     TmSlotSetFuncAppend(tv, tm_module, NULL);
 
     tm_module = TmModuleGetByName("FlowWorker");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName for FlowWorker failed");
+        FatalError("TmModuleGetByName for FlowWorker failed");
     }
     TmSlotSetFuncAppend(tv, tm_module, NULL);
 
     TmThreadSetCPU(tv, WORKER_CPU_SET);
 
     if (TmThreadSpawn(tv) != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "TmThreadSpawn failed");
+        FatalError("TmThreadSpawn failed");
     }
     return 0;
 }
@@ -135,7 +135,7 @@ int RunModeFilePcapAutoFp(void)
 
     const char *file = NULL;
     if (ConfGet("pcap-file.file", &file) == 0) {
-        FatalError(SC_ERR_FATAL, "Failed retrieving pcap-file from Conf");
+        FatalError("Failed retrieving pcap-file from Conf");
     }
     SCLogDebug("file %s", file);
 
@@ -162,8 +162,7 @@ int RunModeFilePcapAutoFp(void)
 
     queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
     if (queues == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "RunmodeAutoFpCreatePickupQueuesString failed");
+        FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
     }
 
     snprintf(tname, sizeof(tname), "%s#01", thread_name_autofp);
@@ -177,24 +176,24 @@ int RunModeFilePcapAutoFp(void)
     SCFree(queues);
 
     if (tv_receivepcap == NULL) {
-        FatalError(SC_ERR_FATAL, "threading setup failed");
+        FatalError("threading setup failed");
     }
     TmModule *tm_module = TmModuleGetByName("ReceivePcapFile");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName failed for ReceivePcap");
+        FatalError("TmModuleGetByName failed for ReceivePcap");
     }
     TmSlotSetFuncAppend(tv_receivepcap, tm_module, file);
 
     tm_module = TmModuleGetByName("DecodePcapFile");
     if (tm_module == NULL) {
-        FatalError(SC_ERR_FATAL, "TmModuleGetByName DecodePcap failed");
+        FatalError("TmModuleGetByName DecodePcap failed");
     }
     TmSlotSetFuncAppend(tv_receivepcap, tm_module, NULL);
 
     TmThreadSetCPU(tv_receivepcap, RECEIVE_CPU_SET);
 
     if (TmThreadSpawn(tv_receivepcap) != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "TmThreadSpawn failed");
+        FatalError("TmThreadSpawn failed");
     }
 
     for (thread = 0; thread < (uint16_t)thread_max; thread++) {
@@ -210,13 +209,12 @@ int RunModeFilePcapAutoFp(void)
                                         "packetpool", "packetpool",
                                         "varslot");
         if (tv_detect_ncpu == NULL) {
-            FatalError(SC_ERR_FATAL, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
 
         tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_FATAL,
-                       "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
@@ -225,7 +223,7 @@ int RunModeFilePcapAutoFp(void)
         TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
 
         if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
-            FatalError(SC_ERR_FATAL, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
 
         if ((cpu + 1) == ncpus)
index a81b5649a6ca8f0aa79b82e438d62dba376a038c..54e79efc322d1f7644094001f2ee8bb18f61d79b 100644 (file)
@@ -97,9 +97,10 @@ static void *ParsePcapConfig(const char *iface)
             SCLogInfo("Pcap will use %d buffer size", (int)value);
             aconf->buffer_size = value;
         } else {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "pcap.buffer-size "
-                    "value of %"PRIiMAX" is invalid. Valid range is "
-                    "0-2147483647", value);
+            SCLogWarning("pcap.buffer-size "
+                         "value of %" PRIiMAX " is invalid. Valid range is "
+                         "0-2147483647",
+                    value);
         }
     }
 
@@ -142,9 +143,8 @@ static void *ParsePcapConfig(const char *iface)
     } else {
         if (threadsstr != NULL) {
             if (StringParseInt32(&aconf->threads, 10, 0, (const char *)threadsstr) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid value for "
-                        "pcap.threads: %s, resetting to 1",
+                SCLogWarning("Invalid value for "
+                             "pcap.threads: %s, resetting to 1",
                         threadsstr);
                 aconf->threads = 1;
             }
@@ -163,9 +163,7 @@ static void *ParsePcapConfig(const char *iface)
             uint64_t bsize = 0;
 
             if (ParseSizeStringU64(s_limit, &bsize) < 0) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                    "Failed to parse pcap buffer size: %s",
-                    s_limit);
+                SCLogError("Failed to parse pcap buffer size: %s", s_limit);
             } else {
                 /* the string 2gb returns 2147483648 which is 1 to high
                  * for a int. */
@@ -173,8 +171,8 @@ static void *ParsePcapConfig(const char *iface)
                     bsize = (uint64_t)INT_MAX;
 
                 if (bsize > INT_MAX) {
-                    SCLogError(SC_ERR_INVALID_ARGUMENT,
-                            "Failed to set pcap buffer size: 2gb max. %"PRIu64" > %d", bsize, INT_MAX);
+                    SCLogError("Failed to set pcap buffer size: 2gb max. %" PRIu64 " > %d", bsize,
+                            INT_MAX);
                 } else {
                     aconf->buffer_size = (int)bsize;
                 }
@@ -201,7 +199,7 @@ static void *ParsePcapConfig(const char *iface)
         } else if (ConfValIsFalse(tmpctype)) {
             aconf->checksum_mode = CHECKSUM_VALIDATION_DISABLE;
         } else {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid value for checksum-checks for %s", aconf->iface);
+            SCLogError("Invalid value for checksum-checks for %s", aconf->iface);
         }
     }
 
@@ -249,7 +247,7 @@ int RunModeIdsPcapSingle(void)
                                     "DecodePcap", thread_name_single,
                                     live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
 
     SCLogInfo("RunModeIdsPcapSingle initialised");
@@ -289,7 +287,7 @@ int RunModeIdsPcapAutoFp(void)
                               "DecodePcap", thread_name_autofp,
                               live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
 
     SCLogInfo("RunModeIdsPcapAutoFp initialised");
@@ -320,7 +318,7 @@ int RunModeIdsPcapWorkers(void)
                                     "DecodePcap", thread_name_workers,
                                     live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Unable to start runmode");
+        FatalError("Unable to start runmode");
     }
 
     SCLogInfo("RunModeIdsPcapWorkers initialised");
index 774f7bcb24321f75d7387dcc1e92890384f51912..e385fef1dbbde48e3dfc725c52024ded7352a3ba 100644 (file)
@@ -124,9 +124,8 @@ static void *OldParsePfringConfig(const char *iface)
     } else {
         if (threadsstr != NULL) {
             if (StringParseInt32(&pfconf->threads, 10, 0, threadsstr) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid value for "
-                        "pfring.threads: '%s'. Resetting to 1.",
+                SCLogWarning("Invalid value for "
+                             "pfring.threads: '%s'. Resetting to 1.",
                         threadsstr);
                 pfconf->threads = 1;
             }
@@ -145,12 +144,11 @@ static void *OldParsePfringConfig(const char *iface)
     else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) {
         SCLogInfo("DNA interface detected, not setting cluster-id");
     } else if (ConfGet("pfring.cluster-id", &tmpclusterid) != 1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,"Could not get cluster-id from config");
+        SCLogError("Could not get cluster-id from config");
     } else {
         if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-            SCLogWarning(SC_EINVAL,
-                    "Invalid value for "
-                    "pfring.cluster_id: '%s'. Resetting to 1.",
+            SCLogWarning("Invalid value for "
+                         "pfring.cluster_id: '%s'. Resetting to 1.",
                     tmpclusterid);
             pfconf->cluster_id = 1;
         }
@@ -165,7 +163,7 @@ static void *OldParsePfringConfig(const char *iface)
         SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)",
                 pfconf->iface);
     } else if (ConfGet("pfring.cluster-type", &tmpctype) != 1) {
-        SCLogError(SC_ERR_GET_CLUSTER_TYPE_FAILED,"Could not get cluster-type from config");
+        SCLogError("Could not get cluster-type from config");
     } else if (strcmp(tmpctype, "cluster_round_robin") == 0) {
         SCLogInfo("Using round-robin cluster mode for PF_RING (iface %s)",
                 pfconf->iface);
@@ -175,7 +173,7 @@ static void *OldParsePfringConfig(const char *iface)
                 pfconf->iface);
         pfconf->ctype = (cluster_type)tmpctype;
     } else {
-        SCLogError(SC_ERR_INVALID_CLUSTER_TYPE,"invalid cluster-type %s",tmpctype);
+        SCLogError("invalid cluster-type %s", tmpctype);
         SCFree(pfconf);
         return NULL;
     }
@@ -269,9 +267,8 @@ static void *ParsePfringConfig(const char *iface)
         } else {
             uint16_t threads = 0;
             if (StringParseUint16(&threads, 10, 0, (const char *)threadsstr) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid value for "
-                        "pfring.threads: '%s'. Resetting to 1.",
+                SCLogWarning("Invalid value for "
+                             "pfring.threads: '%s'. Resetting to 1.",
                         threadsstr);
                 pfconf->threads = 1;
             } else {
@@ -289,9 +286,8 @@ 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_EINVAL,
-                    "Invalid value for "
-                    "pfring.cluster-id: '%s'. Resetting to 1.",
+            SCLogWarning("Invalid value for "
+                         "pfring.cluster-id: '%s'. Resetting to 1.",
                     tmpclusterid);
             pfconf->cluster_id = 1;
         }
@@ -307,13 +303,11 @@ static void *ParsePfringConfig(const char *iface)
             SCLogInfo("DNA interface detected, not setting cluster-id for PF_RING (iface %s)",
                     pfconf->iface);
         } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-id", &tmpclusterid) != 1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                       "Could not get cluster-id from config");
+            SCLogError("Could not get cluster-id from config");
         } else {
             if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
-                SCLogWarning(SC_EINVAL,
-                        "Invalid value for "
-                        "pfring.cluster-id: '%s'. Resetting to 1.",
+                SCLogWarning("Invalid value for "
+                             "pfring.cluster-id: '%s'. Resetting to 1.",
                         tmpclusterid);
                 pfconf->cluster_id = 1;
             }
@@ -328,7 +322,7 @@ static void *ParsePfringConfig(const char *iface)
         if (strlen(bpf_filter) > 0) {
             pfconf->bpf_filter = SCStrdup(bpf_filter);
             if (unlikely(pfconf->bpf_filter == NULL)) {
-                SCLogError(SC_ENOMEM, "Can't allocate BPF filter string");
+                SCLogError("Can't allocate BPF filter string");
             } else {
                 SCLogDebug("Going to use command-line provided bpf filter %s",
                            pfconf->bpf_filter);
@@ -339,7 +333,7 @@ static void *ParsePfringConfig(const char *iface)
             if (strlen(bpf_filter) > 0) {
                 pfconf->bpf_filter = SCStrdup(bpf_filter);
                 if (unlikely(pfconf->bpf_filter == NULL)) {
-                    SCLogError(SC_ENOMEM, "Can't allocate BPF filter string");
+                    SCLogError("Can't allocate BPF filter string");
                 } else {
                     SCLogDebug("Going to use bpf filter %s",
                                pfconf->bpf_filter);
@@ -359,8 +353,7 @@ static void *ParsePfringConfig(const char *iface)
             SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)",
                     pfconf->iface);
         } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-type", &tmpctype) != 1) {
-            SCLogError(SC_ERR_GET_CLUSTER_TYPE_FAILED,
-                       "Could not get cluster-type from config");
+            SCLogError("Could not get cluster-type from config");
         } else {
             getctype = 1;
         }
@@ -376,9 +369,7 @@ static void *ParsePfringConfig(const char *iface)
                     pfconf->iface);
             pfconf->ctype = CLUSTER_FLOW;
         } else {
-            SCLogError(SC_ERR_INVALID_CLUSTER_TYPE,
-                       "invalid cluster-type %s",
-                       tmpctype);
+            SCLogError("invalid cluster-type %s", tmpctype);
             SCFree(pfconf);
             return NULL;
         }
@@ -393,7 +384,7 @@ static void *ParsePfringConfig(const char *iface)
         } else if (strcmp(tmpctype, "rx-only") == 0) {
             pfconf->checksum_mode = CHECKSUM_VALIDATION_RXONLY;
         } else {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid value for checksum-checks for %s", pfconf->iface);
+            SCLogError("Invalid value for checksum-checks for %s", pfconf->iface);
         }
     }
 
@@ -403,7 +394,7 @@ static void *ParsePfringConfig(const char *iface)
             SCLogConfig("Enabling bypass support in PF_RING for iface %s (if supported by underlying hw)", pfconf->iface);
             pfconf->flags |= PFRING_CONF_FLAGS_BYPASS;
 #else
-            SCLogError(SC_ERR_BYPASS_NOT_SUPPORTED, "Bypass is not supported by this Pfring version, please upgrade");
+            SCLogError("Bypass is not supported by this Pfring version, please upgrade");
             SCFree(pfconf);
             return NULL;
 #endif
@@ -412,8 +403,7 @@ static void *ParsePfringConfig(const char *iface)
 
     if (LiveGetOffload() == 0) {
         if (GetIfaceOffloading(iface, 0, 1) == 1) {
-            SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                    "Using PF_RING with offloading activated leads to capture problems");
+            SCLogWarning("Using PF_RING with offloading activated leads to capture problems");
         }
     } else {
         DisableIfaceOffloading(LiveGetDevice(iface), 0, 1);
@@ -480,8 +470,7 @@ int RunModeIdsPfringAutoFp(void)
 
     ret = GetDevAndParser(&live_dev, &tparser);
     if (ret != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Unable to get parser and interface params");
+        FatalError("Unable to get parser and interface params");
     }
 
     ret = RunModeSetLiveCaptureAutoFp(tparser,
@@ -490,7 +479,7 @@ int RunModeIdsPfringAutoFp(void)
                               "DecodePfring", thread_name_autofp,
                               live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
 
     SCLogInfo("RunModeIdsPfringAutoFp initialised");
@@ -515,8 +504,7 @@ int RunModeIdsPfringSingle(void)
 
     ret = GetDevAndParser(&live_dev, &tparser);
     if (ret != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Unable to get parser and interface params");
+        FatalError("Unable to get parser and interface params");
     }
 
     ret = RunModeSetLiveCaptureSingle(tparser,
@@ -525,7 +513,7 @@ int RunModeIdsPfringSingle(void)
                               "DecodePfring", thread_name_single,
                               live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
 
     SCLogInfo("RunModeIdsPfringSingle initialised");
@@ -550,8 +538,7 @@ int RunModeIdsPfringWorkers(void)
 
     ret = GetDevAndParser(&live_dev, &tparser);
     if (ret != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Unable to get parser and interface params");
+        FatalError("Unable to get parser and interface params");
     }
 
     ret = RunModeSetLiveCaptureWorkers(tparser,
@@ -560,7 +547,7 @@ int RunModeIdsPfringWorkers(void)
                               "DecodePfring", thread_name_workers,
                               live_dev);
     if (ret != 0) {
-        FatalError(SC_ERR_FATAL, "Runmode start failed");
+        FatalError("Runmode start failed");
     }
 
     SCLogInfo("RunModeIdsPfringWorkers initialised");
index 985f2aefd3eea70d21f10e2295ba4c0a65bb9b52..41f2b13283a50535b3da08274841408b0c469bae 100644 (file)
@@ -298,6 +298,6 @@ void RunUnittests(int list_unittests, const char *regex_arg)
 
     exit(EXIT_SUCCESS);
 #else
-    FatalError(SC_ERR_FATAL, "Unittests are not build-in");
+    FatalError("Unittests are not build-in");
 #endif /* UNITTESTS */
 }
index 3e3fe468b633da634c48bbd1b1bb37e63b306960..70af3ff8ee571080640b503d4e94c2d9a28da407 100644 (file)
@@ -281,7 +281,7 @@ static TmEcode UnixListAddFile(
         return TM_ECODE_FAILED;
     cfile = SCMalloc(sizeof(PcapFiles));
     if (unlikely(cfile == NULL)) {
-        SCLogError(SC_ENOMEM, "Unable to allocate new file");
+        SCLogError("Unable to allocate new file");
         return TM_ECODE_FAILED;
     }
     memset(cfile, 0, sizeof(PcapFiles));
@@ -289,7 +289,7 @@ static TmEcode UnixListAddFile(
     cfile->filename = SCStrdup(filename);
     if (unlikely(cfile->filename == NULL)) {
         SCFree(cfile);
-        SCLogError(SC_ENOMEM, "Unable to dup filename");
+        SCLogError("Unable to dup filename");
         return TM_ECODE_FAILED;
     }
 
@@ -298,7 +298,7 @@ static TmEcode UnixListAddFile(
         if (unlikely(cfile->output_dir == NULL)) {
             SCFree(cfile->filename);
             SCFree(cfile);
-            SCLogError(SC_ENOMEM, "Unable to dup output_dir");
+            SCLogError("Unable to dup output_dir");
             return TM_ECODE_FAILED;
         }
     }
@@ -339,7 +339,7 @@ static TmEcode UnixSocketAddPcapFileImpl(json_t *cmd, json_t* answer, void *data
 
     json_t *jarg = json_object_get(cmd, "filename");
     if (!json_is_string(jarg)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "filename is not a string");
+        SCLogError("filename is not a string");
         json_object_set_new(answer, "message",
                             json_string("filename is not a string"));
         return TM_ECODE_FAILED;
@@ -358,7 +358,7 @@ static TmEcode UnixSocketAddPcapFileImpl(json_t *cmd, json_t* answer, void *data
     json_t *oarg = json_object_get(cmd, "output-dir");
     if (oarg != NULL) {
         if (!json_is_string(oarg)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "output-dir is not a string");
+            SCLogError("output-dir is not a string");
 
             json_object_set_new(answer, "message",
                                 json_string("output-dir is not a string"));
@@ -366,7 +366,7 @@ static TmEcode UnixSocketAddPcapFileImpl(json_t *cmd, json_t* answer, void *data
         }
         output_dir = json_string_value(oarg);
     } else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "can't get output-dir");
+        SCLogError("can't get output-dir");
 
         json_object_set_new(answer, "message",
                             json_string("output-dir param is mandatory"));
@@ -401,7 +401,7 @@ static TmEcode UnixSocketAddPcapFileImpl(json_t *cmd, json_t* answer, void *data
     json_t *delay_arg = json_object_get(cmd, "delay");
     if (delay_arg != NULL) {
         if (!json_is_integer(delay_arg)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "delay is not a integer");
+            SCLogError("delay is not a integer");
             json_object_set_new(answer, "message",
                                 json_string("delay is not a integer"));
             return TM_ECODE_FAILED;
@@ -412,7 +412,7 @@ static TmEcode UnixSocketAddPcapFileImpl(json_t *cmd, json_t* answer, void *data
     json_t *interval_arg = json_object_get(cmd, "poll-interval");
     if (interval_arg != NULL) {
         if (!json_is_integer(interval_arg)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "poll-interval is not a integer");
+            SCLogError("poll-interval is not a integer");
 
             json_object_set_new(answer, "message",
                                 json_string("poll-interval is not a integer"));
@@ -515,8 +515,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
     this->running = 1;
 
     if (ConfSetFinal("pcap-file.file", cfile->filename) != 1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Can not set working file to '%s'",
-                   cfile->filename);
+        SCLogError("Can not set working file to '%s'", cfile->filename);
         PcapFilesFree(cfile);
         return TM_ECODE_FAILED;
     }
@@ -528,7 +527,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
         set_res = ConfSetFinal("pcap-file.continuous", "false");
     }
     if (set_res != 1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Can not set continuous mode for pcap processing");
+        SCLogError("Can not set continuous mode for pcap processing");
         PcapFilesFree(cfile);
         return TM_ECODE_FAILED;
     }
@@ -538,7 +537,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
         set_res = ConfSetFinal("pcap-file.delete-when-done", "false");
     }
     if (set_res != 1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Can not set delete mode for pcap processing");
+        SCLogError("Can not set delete mode for pcap processing");
         PcapFilesFree(cfile);
         return TM_ECODE_FAILED;
     }
@@ -547,7 +546,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
         char tstr[32];
         snprintf(tstr, sizeof(tstr), "%" PRIuMAX, (uintmax_t)cfile->delay);
         if (ConfSetFinal("pcap-file.delay", tstr) != 1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Can not set delay to '%s'", tstr);
+            SCLogError("Can not set delay to '%s'", tstr);
             PcapFilesFree(cfile);
             return TM_ECODE_FAILED;
         }
@@ -557,8 +556,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
         char tstr[32];
         snprintf(tstr, sizeof(tstr), "%" PRIuMAX, (uintmax_t)cfile->poll_interval);
         if (ConfSetFinal("pcap-file.poll-interval", tstr) != 1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                       "Can not set poll-interval to '%s'", tstr);
+            SCLogError("Can not set poll-interval to '%s'", tstr);
             PcapFilesFree(cfile);
             return TM_ECODE_FAILED;
         }
@@ -568,8 +566,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
         char tstr[16];
         snprintf(tstr, sizeof(tstr), "%d", cfile->tenant_id);
         if (ConfSetFinal("pcap-file.tenant-id", tstr) != 1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                       "Can not set working tenant-id to '%s'", tstr);
+            SCLogError("Can not set working tenant-id to '%s'", tstr);
             PcapFilesFree(cfile);
             return TM_ECODE_FAILED;
         }
@@ -579,8 +576,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
 
     if (cfile->output_dir) {
         if (ConfSetFinal("default-log-dir", cfile->output_dir) != 1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT,
-                       "Can not set output dir to '%s'", cfile->output_dir);
+            SCLogError("Can not set output dir to '%s'", cfile->output_dir);
             PcapFilesFree(cfile);
             return TM_ECODE_FAILED;
         }
@@ -1073,7 +1069,7 @@ TmEcode UnixSocketRegisterTenant(json_t *cmd, json_t* answer, void *data)
     char prefix[64];
     snprintf(prefix, sizeof(prefix), "multi-detect.%d", tenant_id);
     if (ConfYamlLoadFileWithPrefix(filename, prefix) != 0) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "failed to load yaml %s", filename);
+        SCLogError("failed to load yaml %s", filename);
         json_object_set_new(answer, "message", json_string("failed to load yaml"));
         return TM_ECODE_FAILED;
     }
@@ -1512,8 +1508,9 @@ TmEcode UnixSocketSetMemcap(json_t *cmd, json_t* answer, void *data)
     value_str = (char *)json_string_value(jarg);
 
     if (ParseSizeStringU64(value_str, &value) < 0) {
-        SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
-                   "memcap from unix socket: %s", value_str);
+        SCLogError("Error parsing "
+                   "memcap from unix socket: %s",
+                value_str);
         json_object_set_new(answer, "message",
                             json_string("error parsing memcap specified, "
                                         "value not changed"));
@@ -1685,7 +1682,7 @@ static int RunModeUnixSocketMaster(void)
 
     PcapCommand *pcapcmd = SCMalloc(sizeof(PcapCommand));
     if (unlikely(pcapcmd == NULL)) {
-        SCLogError(SC_ENOMEM, "Can not allocate pcap command");
+        SCLogError("Can not allocate pcap command");
         return 1;
     }
     TAILQ_INIT(&pcapcmd->files);
index 3d56d110af5df06613305d60256043043cf079bc..09b9855e385263d8ae699de137afbac55f24e531 100644 (file)
@@ -182,7 +182,7 @@ static const char *RunModeTranslateModeToName(int runmode)
 #endif
 
         default:
-            FatalError(SC_ERR_UNKNOWN_RUN_MODE, "Unknown runtime mode. Aborting");
+            FatalError("Unknown runtime mode. Aborting");
     }
 }
 
@@ -337,8 +337,7 @@ void RunModeDispatch(int runmode, const char *custom_mode,
 #ifdef HAVE_PLUGINS
                 SCCapturePlugin *plugin = SCPluginFindCaptureByName(capture_plugin_name);
                 if (plugin == NULL) {
-                    FatalError(SC_ERR_PLUGIN, "No capture plugin found with name %s",
-                            capture_plugin_name);
+                    FatalError("No capture plugin found with name %s", capture_plugin_name);
                 }
                 custom_mode = (const char *)plugin->GetDefaultMode();
 #endif
@@ -385,16 +384,16 @@ void RunModeDispatch(int runmode, const char *custom_mode,
                 break;
 #endif
             default:
-                FatalError(SC_ERR_FATAL, "Unknown runtime mode. Aborting");
+                FatalError("Unknown runtime mode. Aborting");
         }
     } else { /* if (custom_mode == NULL) */
         /* Add compability with old 'worker' name */
         if (!strcmp("worker", custom_mode)) {
-            SCLogWarning(SC_ERR_RUNMODE, "'worker' mode have been renamed "
+            SCLogWarning("'worker' mode have been renamed "
                          "to 'workers', please modify your setup.");
             local_custom_mode = SCStrdup("workers");
             if (unlikely(local_custom_mode == NULL)) {
-                FatalError(SC_ERR_FATAL, "Unable to dup custom mode");
+                FatalError("Unable to dup custom mode");
             }
             custom_mode = local_custom_mode;
         }
@@ -402,10 +401,10 @@ void RunModeDispatch(int runmode, const char *custom_mode,
 
     RunMode *mode = RunModeGetCustomMode(runmode, custom_mode);
     if (mode == NULL) {
-        SCLogError(SC_ERR_RUNMODE, "The custom type \"%s\" doesn't exist "
+        SCLogError("The custom type \"%s\" doesn't exist "
                    "for this runmode type \"%s\".  Please use --list-runmodes to "
                    "see available custom types for this runmode",
-                   custom_mode, RunModeTranslateModeToName(runmode));
+                custom_mode, RunModeTranslateModeToName(runmode));
         exit(EXIT_FAILURE);
     }
 
@@ -415,7 +414,7 @@ void RunModeDispatch(int runmode, const char *custom_mode,
     }
     active_runmode = SCStrdup(custom_mode);
     if (unlikely(active_runmode == NULL)) {
-        FatalError(SC_ERR_FATAL, "Unable to dup active mode");
+        FatalError("Unable to dup active mode");
     }
 
     if (strcasecmp(active_runmode, "autofp") == 0) {
@@ -470,8 +469,9 @@ void RunModeRegisterNewRunMode(enum RunModes runmode,
                                int (*RunModeFunc)(void))
 {
     if (RunModeGetCustomMode(runmode, name) != NULL) {
-        FatalError(SC_ERR_RUNMODE, "runmode '%s' has already "
-                   "been registered. Please use an unique name.", name);
+        FatalError("runmode '%s' has already "
+                   "been registered. Please use an unique name.",
+                name);
     }
 
     void *ptmp = SCRealloc(runmodes[runmode].runmodes,
@@ -490,11 +490,11 @@ void RunModeRegisterNewRunMode(enum RunModes runmode,
     mode->runmode = runmode;
     mode->name = SCStrdup(name);
     if (unlikely(mode->name == NULL)) {
-        FatalError(SC_ENOMEM, "Failed to allocate string");
+        FatalError("Failed to allocate string");
     }
     mode->description = SCStrdup(description);
     if (unlikely(mode->description == NULL)) {
-        FatalError(SC_ENOMEM, "Failed to allocate string");
+        FatalError("Failed to allocate string");
     }
     mode->RunModeFunc = RunModeFunc;
 
@@ -657,8 +657,7 @@ static void SetupOutput(const char *name, OutputModule *module, OutputCtx *outpu
             module->ThreadInit, module->ThreadDeinit,
             module->ThreadExitPrintStats);
     } else {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Unknown logger type: name=%s",
-            module->name);
+        SCLogError("Unknown logger type: name=%s", module->name);
     }
 }
 
@@ -676,7 +675,7 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
         char subname[256];
 
         if (strcmp(type->val, "ikev2") == 0) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "eve module 'ikev2' has been replaced by 'ike'");
+            SCLogWarning("eve module 'ikev2' has been replaced by 'ike'");
             strlcpy(subname, "eve-log.ike", sizeof(subname));
         } else {
             snprintf(subname, sizeof(subname), "eve-log.%s", type->val);
@@ -701,12 +700,10 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
 
                 if (sub_module->parent_name == NULL ||
                         strcmp(sub_module->parent_name, "eve-log") != 0) {
-                    FatalError(SC_ERR_INVALID_ARGUMENT,
-                            "bad parent for %s", subname);
+                    FatalError("bad parent for %s", subname);
                 }
                 if (sub_module->InitSubFunc == NULL) {
-                    FatalError(SC_ERR_INVALID_ARGUMENT,
-                            "bad sub-module for %s", subname);
+                    FatalError("bad sub-module for %s", subname);
                 }
 
                 /* pass on parent output_ctx */
@@ -725,8 +722,7 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
         /* Error is no registered loggers with this name
          * were found .*/
         if (!sub_count) {
-            FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
-                    "No output module named %s", subname);
+            FatalErrorOnInit("No output module named %s", subname);
             continue;
         }
     }
@@ -790,8 +786,7 @@ void RunModeInitializeOutputs(void)
         output_config = ConfNodeLookupChild(output, output->val);
         if (output_config == NULL) {
             /* Shouldn't happen. */
-            FatalError(SC_ERR_INVALID_ARGUMENT,
-                "Failed to lookup configuration child node: %s", output->val);
+            FatalError("Failed to lookup configuration child node: %s", output->val);
         }
 
         if (strcmp(output->val, "tls-store") == 0) {
@@ -804,32 +799,29 @@ void RunModeInitializeOutputs(void)
         }
 
         if (strcmp(output->val, "file-log") == 0) {
-            SCLogWarning(SC_ERR_NOT_SUPPORTED, "file-log is no longer supported,"
-                                               " use eve.files instead "
-                                               "(see ticket #2376"
-                                               " for an explanation)");
+            SCLogWarning("file-log is no longer supported,"
+                         " use eve.files instead "
+                         "(see ticket #2376"
+                         " for an explanation)");
             continue;
         } else if (strncmp(output->val, "unified-", sizeof("unified-") - 1) == 0) {
-            SCLogWarning(SC_ERR_NOT_SUPPORTED, "Unified1 is no longer supported,"
-                                               " use Unified2 instead "
-                                               "(see ticket #353"
-                                               " for an explanation)");
+            SCLogWarning("Unified1 is no longer supported,"
+                         " use Unified2 instead "
+                         "(see ticket #353"
+                         " for an explanation)");
             continue;
         } else if (strncmp(output->val, "unified2-", sizeof("unified2-") - 1) == 0) {
-            SCLogWarning(SC_ERR_NOT_SUPPORTED,
-                    "Unified2 is no longer supported.");
+            SCLogWarning("Unified2 is no longer supported.");
             continue;
         } else if (strcmp(output->val, "lua") == 0) {
 #ifndef HAVE_LUA
-            SCLogWarning(SC_ERR_NOT_SUPPORTED,
-                    "lua support not compiled in. Reconfigure/"
-                    "recompile with lua(jit) and its development "
-                    "files installed to add lua support.");
+            SCLogWarning("lua support not compiled in. Reconfigure/"
+                         "recompile with lua(jit) and its development "
+                         "files installed to add lua support.");
             continue;
 #endif
         } else if (strcmp(output->val, "dns-log") == 0) {
-            SCLogWarning(SC_ERR_NOT_SUPPORTED,
-                    "dns-log is not longer available as of Suricata 5.0");
+            SCLogWarning("dns-log is not longer available as of Suricata 5.0");
             continue;
         } else if (strcmp(output->val, "tls-log") == 0) {
             tls_log_enabled = 1;
@@ -848,8 +840,7 @@ void RunModeInitializeOutputs(void)
             if (module->InitFunc != NULL) {
                 OutputInitResult r = module->InitFunc(output_config);
                 if (!r.ok) {
-                    FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
-                        "output module \"%s\": setup failed", output->val);
+                    FatalErrorOnInit("output module \"%s\": setup failed", output->val);
                     continue;
                 } else if (r.ctx == NULL) {
                     continue;
@@ -880,8 +871,7 @@ void RunModeInitializeOutputs(void)
             }
         }
         if (count == 0) {
-            FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
-                "No output module named %s", output->val);
+            FatalErrorOnInit("No output module named %s", output->val);
             continue;
         }
     }
@@ -890,8 +880,7 @@ void RunModeInitializeOutputs(void)
     if (!tls_store_present && tls_log_enabled) {
         /* old YAML with no "tls-store" in outputs. "tls-log" value needs
          * to be started using 'tls-log' config as own config */
-        SCLogWarning(SC_ERR_CONF_YAML_ERROR,
-                     "Please use 'tls-store' in YAML to configure TLS storage");
+        SCLogWarning("Please use 'tls-store' in YAML to configure TLS storage");
 
         TAILQ_FOREACH(output, &outputs->head, next) {
             output_config = ConfNodeLookupChild(output, output->val);
@@ -900,8 +889,7 @@ void RunModeInitializeOutputs(void)
 
                 OutputModule *module = OutputGetModuleByConfName("tls-store");
                 if (module == NULL) {
-                    SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                            "No output module named %s, ignoring", "tls-store");
+                    SCLogWarning("No output module named %s, ignoring", "tls-store");
                     continue;
                 }
 
@@ -909,8 +897,7 @@ void RunModeInitializeOutputs(void)
                 if (module->InitFunc != NULL) {
                     OutputInitResult r = module->InitFunc(output_config);
                     if (!r.ok) {
-                        FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
-                                "output module setup failed");
+                        FatalErrorOnInit("output module setup failed");
                         continue;
                     } else if (r.ctx == NULL) {
                         continue;
@@ -997,8 +984,7 @@ void RunModeInitialize(void)
     if ((ConfGet("threading.stack-size", &ss)) == 1) {
         if (ss != NULL) {
             if (ParseSizeStringU64(ss, &threading_set_stack_size) < 0) {
-                FatalError(SC_ERR_INVALID_ARGUMENT,
-                        "Failed to initialize thread_stack_size output, invalid limit: %s", ss);
+                FatalError("Failed to initialize thread_stack_size output, invalid limit: %s", ss);
             }
         }
     }
index 750d69ce0c7586b13149f48a43979d012badf507..4b0303f49b214998805763a714a5b361f29df558 100644 (file)
@@ -37,8 +37,8 @@ typedef struct HttpRangeContainerBlock HttpRangeContainerBlock;
 struct AppLayerParser;
 
 typedef struct SuricataContext_ {
-    SCError (*SCLogMessage)(const SCLogLevel, const char *, const unsigned int,
-            const char *, const SCError, const char *message);
+    SCError (*SCLogMessage)(
+            const SCLogLevel, const char *, const unsigned int, const char *, const char *message);
     void (*DetectEngineStateFree)(DetectEngineState *);
     void (*AppLayerDecoderEventsSetEventRaw)(AppLayerDecoderEvents **,
             uint8_t);
index ad20c8e8c834945724e03ff54068fdae0a194901..104dfd396590d797b03b9ec8422b7ed7011cf9ce 100644 (file)
@@ -154,9 +154,10 @@ void TmModuleDecodeAFPRegister (void)
  */
 TmEcode NoAFPSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_NO_AF_PACKET,"Error creating thread %s: you do not have "
+    SCLogError("Error creating thread %s: you do not have "
                "support for AF_PACKET enabled, on Linux host please recompile "
-               "with --enable-af-packet", tv->name);
+               "with --enable-af-packet",
+            tv->name);
     exit(EXIT_FAILURE);
 }
 
@@ -476,7 +477,7 @@ TmEcode AFPPeersListCheck()
         }
         try++;
     }
-    SCLogError(SC_ERR_AFP_CREATE, "Threads number not equals");
+    SCLogError("Threads number not equals");
     SCReturnInt(TM_ECODE_FAILED);
 }
 
@@ -526,12 +527,9 @@ static TmEcode AFPPeersListAdd(AFPThreadVars *ptv)
             mtu = GetIfaceMTU(ptv->iface);
             out_mtu = GetIfaceMTU(ptv->out_iface);
             if (mtu != out_mtu) {
-                SCLogError(SC_ERR_AFP_CREATE,
-                        "MTU on %s (%d) and %s (%d) are not equal, "
-                        "transmission of packets bigger than %d will fail.",
-                        ptv->iface, mtu,
-                        ptv->out_iface, out_mtu,
-                        (out_mtu > mtu) ? mtu : out_mtu);
+                SCLogError("MTU on %s (%d) and %s (%d) are not equal, "
+                           "transmission of packets bigger than %d will fail.",
+                        ptv->iface, mtu, ptv->out_iface, out_mtu, (out_mtu > mtu) ? mtu : out_mtu);
             }
             peerslist.peered += 2;
             break;
@@ -655,7 +653,7 @@ static void AFPWritePacket(Packet *p, int version)
     }
 
     if (p->ethh == NULL) {
-        SCLogWarning(SC_EINVAL, "Should have an Ethernet header");
+        SCLogWarning("Should have an Ethernet header");
         return;
     }
 
@@ -674,8 +672,7 @@ static void AFPWritePacket(Packet *p, int version)
     if (sendto(socket, GET_PKT_DATA(p), GET_PKT_LEN(p), 0, (struct sockaddr *)&socket_address,
                 sizeof(struct sockaddr_ll)) < 0) {
         if (SC_ATOMIC_ADD(p->afp_v.peer->send_errors, 1) == 0) {
-            SCLogWarning(SC_ERR_SOCKET, "sending packet failed on socket %d: %s", socket,
-                    strerror(errno));
+            SCLogWarning("sending packet failed on socket %d: %s", socket, strerror(errno));
         }
     }
     if (p->afp_v.peer->flags & AFP_SOCK_PROTECT)
@@ -1210,8 +1207,8 @@ static int AFPSynchronizeStart(AFPThreadVars *ptv, uint64_t *discarded_pkts)
         int r = poll(&fds, 1, POLL_TIMEOUT);
         if (r > 0 &&
                 (fds.revents & (POLLHUP|POLLRDHUP|POLLERR|POLLNVAL))) {
-            SCLogWarning(SC_ERR_AFP_READ, "poll failed %02x",
-                    fds.revents & (POLLHUP|POLLRDHUP|POLLERR|POLLNVAL));
+            SCLogWarning(
+                    "poll failed %02x", fds.revents & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL));
             return 0;
         } else if (r > 0) {
             if (AFPPeersListStarted() && synctv.tv_sec == (time_t) 0xffffffff) {
@@ -1231,7 +1228,7 @@ static int AFPSynchronizeStart(AFPThreadVars *ptv, uint64_t *discarded_pkts)
             SCLogDebug("Starting to read on %s", ptv->tv->name);
             return 1;
         } else if (r < 0) { /* only exit on error */
-            SCLogWarning(SC_ERR_AFP_READ, "poll failed with retval %d", r);
+            SCLogWarning("poll failed with retval %d", r);
             return 0;
         }
     }
@@ -1259,8 +1256,7 @@ static int AFPTryReopen(AFPThreadVars *ptv)
     int afp_activate_r = AFPCreateSocket(ptv, ptv->iface, 0);
     if (afp_activate_r != 0) {
         if (ptv->down_count % AFP_DOWN_COUNTER_INTERVAL == 0) {
-            SCLogWarning(SC_ERR_AFP_CREATE, "Can not open iface '%s'",
-                         ptv->iface);
+            SCLogWarning("Can not open iface '%s'", ptv->iface);
         }
         return afp_activate_r;
     }
@@ -1305,10 +1301,10 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
         if (r < 0) {
             switch (-r) {
                 case AFP_FATAL_ERROR:
-                    SCLogError(SC_ERR_AFP_CREATE, "Couldn't init AF_PACKET socket, fatal error");
+                    SCLogError("Couldn't init AF_PACKET socket, fatal error");
                     SCReturnInt(TM_ECODE_FAILED);
                 case AFP_RECOVERABLE_ERROR:
-                    SCLogWarning(SC_ERR_AFP_CREATE, "Couldn't init AF_PACKET socket, retrying soon");
+                    SCLogWarning("Couldn't init AF_PACKET socket, retrying soon");
             }
         }
         AFPPeersListReachedInc();
@@ -1383,13 +1379,12 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
                 /* Do a recv to get errno */
                 if (recv(ptv->socket, &c, sizeof c, MSG_PEEK) != -1)
                     continue; /* what, no error? */
-                SCLogError(SC_ERR_AFP_READ,
-                           "Error reading data from iface '%s': (%d) %s",
-                           ptv->iface, errno, strerror(errno));
+                SCLogError("Error reading data from iface '%s': (%d) %s", ptv->iface, errno,
+                        strerror(errno));
                 AFPSwitchState(ptv, AFP_STATE_DOWN);
                 continue;
             } else if (fds.revents & POLLNVAL) {
-                SCLogError(SC_ERR_AFP_READ, "Invalid polling request");
+                SCLogError("Invalid polling request");
                 AFPSwitchState(ptv, AFP_STATE_DOWN);
                 continue;
             }
@@ -1407,9 +1402,8 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
                     break;
                 case AFP_READ_FAILURE:
                     /* AFPRead in error: best to reset the socket */
-                    SCLogError(SC_ERR_AFP_READ,
-                           "AFPRead error reading data from iface '%s': (%d) %s",
-                           ptv->iface, errno, strerror(errno));
+                    SCLogError("AFPRead error reading data from iface '%s': (%d) %s", ptv->iface,
+                            errno, strerror(errno));
                     AFPSwitchState(ptv, AFP_STATE_DOWN);
                     continue;
                 case AFP_SURI_FAILURE:
@@ -1432,9 +1426,8 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
 
         } else if ((r < 0) && (errno != EINTR)) {
             StatsIncr(ptv->tv, ptv->capture_afp_poll_err);
-            SCLogError(SC_ERR_AFP_READ, "Error reading data from iface '%s': (%d) %s",
-                       ptv->iface,
-                       errno, strerror(errno));
+            SCLogError("Error reading data from iface '%s': (%d) %s", ptv->iface, errno,
+                    strerror(errno));
             AFPSwitchState(ptv, AFP_STATE_DOWN);
             continue;
         }
@@ -1454,8 +1447,7 @@ static int AFPGetDevFlags(int fd, const char *ifname)
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 
     if (ioctl(fd, SIOCGIFFLAGS, &ifr) == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Unable to find type for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to find type for iface \"%s\": %s", ifname, strerror(errno));
         return -1;
     }
 
@@ -1472,8 +1464,7 @@ static int AFPGetIfnumByDev(int fd, const char *ifname, int verbose)
 
     if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
         if (verbose)
-            SCLogError(SC_ERR_AFP_CREATE, "Unable to find iface %s: %s",
-                       ifname, strerror(errno));
+            SCLogError("Unable to find iface %s: %s", ifname, strerror(errno));
         return -1;
     }
 
@@ -1488,8 +1479,7 @@ static int AFPGetDevLinktype(int fd, const char *ifname)
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 
     if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Unable to find type for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to find type for iface \"%s\": %s", ifname, strerror(errno));
         return -1;
     }
 
@@ -1510,7 +1500,7 @@ int AFPGetLinkType(const char *ifname)
 
     int fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
     if (fd == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Couldn't create a AF_PACKET socket, error %s", strerror(errno));
+        SCLogError("Couldn't create a AF_PACKET socket, error %s", strerror(errno));
         return LINKTYPE_RAW;
     }
 
@@ -1553,7 +1543,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_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
+            SCLogWarning("Unable to get MTU, setting snaplen to sane default of 1514");
             snaplen = 1514;
         }
     }
@@ -1562,7 +1552,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_EINVAL, "Frame size bigger than block size");
+        SCLogError("Frame size bigger than block size");
         return -1;
     }
     ptv->req.v2.tp_frame_nr = ptv->ring_size;
@@ -1587,7 +1577,7 @@ static int AFPComputeRingParamsV3(AFPThreadVars *ptv)
     if (snaplen == 0) {
         snaplen = GetIfaceMaxPacketSize(ptv->iface);
         if (snaplen <= 0) {
-            SCLogWarning(SC_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
+            SCLogWarning("Unable to get MTU, setting snaplen to sane default of 1514");
             snaplen = 1514;
         }
     }
@@ -1596,8 +1586,7 @@ 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_EINVAL, "Block size is too small, it should be at least %d",
-                ptv->req.v3.tp_frame_size);
+        SCLogError("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;
@@ -1632,14 +1621,12 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
     if (getsockopt(ptv->socket, SOL_PACKET, PACKET_HDRLEN, &val, &len) < 0) {
         if (errno == ENOPROTOOPT) {
             if (ptv->flags & AFP_TPACKET_V3) {
-                SCLogError(SC_ERR_AFP_CREATE,
-                        "Too old kernel giving up (need 3.2 for TPACKET_V3)");
+                SCLogError("Too old kernel giving up (need 3.2 for TPACKET_V3)");
             } else {
-                SCLogError(SC_ERR_AFP_CREATE,
-                        "Too old kernel giving up (need 2.6.27 at least)");
+                SCLogError("Too old kernel giving up (need 2.6.27 at least)");
             }
         }
-        SCLogError(SC_ERR_AFP_CREATE, "Error when retrieving packet header len");
+        SCLogError("Error when retrieving packet header len");
         return AFP_FATAL_ERROR;
     }
 
@@ -1651,9 +1638,7 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
 #endif
     if (setsockopt(ptv->socket, SOL_PACKET, PACKET_VERSION, &val,
                 sizeof(val)) < 0) {
-        SCLogError(SC_ERR_AFP_CREATE,
-                "Can't activate TPACKET_V2/TPACKET_V3 on packet socket: %s",
-                strerror(errno));
+        SCLogError("Can't activate TPACKET_V2/TPACKET_V3 on packet socket: %s", strerror(errno));
         return AFP_FATAL_ERROR;
     }
 
@@ -1661,9 +1646,7 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
     int req = SOF_TIMESTAMPING_RAW_HARDWARE;
     if (setsockopt(ptv->socket, SOL_PACKET, PACKET_TIMESTAMP, (void *) &req,
                 sizeof(req)) < 0) {
-        SCLogWarning(SC_ERR_AFP_CREATE,
-                "Can't activate hardware timestamping on packet socket: %s",
-                strerror(errno));
+        SCLogWarning("Can't activate hardware timestamping on packet socket: %s", strerror(errno));
     }
 #endif
 
@@ -1672,8 +1655,7 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
     int reserve = VLAN_HEADER_LEN;
     if (setsockopt(ptv->socket, SOL_PACKET, PACKET_RESERVE, (void *)&reserve, sizeof(reserve)) <
             0) {
-        SCLogError(
-                SC_ERR_AFP_CREATE, "Can't activate reserve on packet socket: %s", strerror(errno));
+        SCLogError("Can't activate reserve on packet socket: %s", strerror(errno));
         return AFP_FATAL_ERROR;
     }
 
@@ -1686,8 +1668,8 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
         r = setsockopt(ptv->socket, SOL_PACKET, PACKET_RX_RING,
                 (void *) &ptv->req.v3, sizeof(ptv->req.v3));
         if (r < 0) {
-            SCLogError(SC_ENOMEM, "Unable to allocate RX Ring for iface %s: (%d) %s", devname,
-                    errno, strerror(errno));
+            SCLogError("Unable to allocate RX Ring for iface %s: (%d) %s", devname, errno,
+                    strerror(errno));
             return AFP_FATAL_ERROR;
         }
     } else {
@@ -1706,15 +1688,15 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
                     SCLogInfo("Memory issue with ring parameters. Retrying.");
                     continue;
                 }
-                SCLogError(SC_EINVAL, "Unable to setup RX Ring for iface %s: (%d) %s", devname,
-                        errno, strerror(errno));
+                SCLogError("Unable to setup RX Ring for iface %s: (%d) %s", devname, errno,
+                        strerror(errno));
                 return AFP_FATAL_ERROR;
             } else {
                 break;
             }
         }
         if (order < 0) {
-            SCLogError(SC_EINVAL, "Unable to setup RX Ring for iface %s (order 0 failed)", devname);
+            SCLogError("Unable to setup RX Ring for iface %s (order 0 failed)", devname);
             return AFP_FATAL_ERROR;
         }
 #ifdef HAVE_TPACKET_V3
@@ -1737,14 +1719,14 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
     ptv->ring_buf = mmap(0, ptv->ring_buflen, PROT_READ|PROT_WRITE,
             mmap_flag, ptv->socket, 0);
     if (ptv->ring_buf == MAP_FAILED) {
-        SCLogError(SC_ENOMEM, "Unable to mmap, error %s", strerror(errno));
+        SCLogError("Unable to mmap, error %s", strerror(errno));
         goto mmap_err;
     }
 #ifdef HAVE_TPACKET_V3
     if (ptv->flags & AFP_TPACKET_V3) {
         ptv->ring.v3 = SCMalloc(ptv->req.v3.tp_block_nr * sizeof(*ptv->ring.v3));
         if (!ptv->ring.v3) {
-            SCLogError(SC_ENOMEM, "Unable to malloc ptv ring.v3");
+            SCLogError("Unable to malloc ptv ring.v3");
             goto postmmap_err;
         }
         for (i = 0; i < ptv->req.v3.tp_block_nr; ++i) {
@@ -1756,7 +1738,7 @@ static int AFPSetupRing(AFPThreadVars *ptv, char *devname)
         /* allocate a ring for each frame header pointer*/
         ptv->ring.v2 = SCCalloc(ptv->req.v2.tp_frame_nr, sizeof(union thdr *));
         if (ptv->ring.v2 == NULL) {
-            SCLogError(SC_ENOMEM, "Unable to allocate frame buf");
+            SCLogError("Unable to allocate frame buf");
             goto postmmap_err;
         }
         /* fill the header ring with proper frame ptr*/
@@ -1803,9 +1785,8 @@ int AFPIsFanoutSupported(uint16_t cluster_id)
     close(fd);
 
     if (r < 0) {
-        SCLogError(SC_EINVAL,
-                "fanout not supported by kernel: "
-                "Kernel too old or cluster-id %d already in use.",
+        SCLogError("fanout not supported by kernel: "
+                   "Kernel too old or cluster-id %d already in use.",
                 cluster_id);
         return 0;
     }
@@ -1821,12 +1802,12 @@ static int SockFanoutSeteBPF(AFPThreadVars *ptv)
 {
     int pfd = ptv->ebpf_lb_fd;
     if (pfd == -1) {
-        SCLogError(SC_EINVAL, "Fanout file descriptor is invalid");
+        SCLogError("Fanout file descriptor is invalid");
         return -1;
     }
 
     if (setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT_DATA, &pfd, sizeof(pfd))) {
-        SCLogError(SC_EINVAL, "Error setting ebpf");
+        SCLogError("Error setting ebpf");
         return -1;
     }
     SCLogInfo("Activated eBPF on socket");
@@ -1838,12 +1819,12 @@ static int SetEbpfFilter(AFPThreadVars *ptv)
 {
     int pfd = ptv->ebpf_filter_fd;
     if (pfd == -1) {
-        SCLogError(SC_EINVAL, "Filter file descriptor is invalid");
+        SCLogError("Filter file descriptor is invalid");
         return -1;
     }
 
     if (setsockopt(ptv->socket, SOL_SOCKET, SO_ATTACH_BPF, &pfd, sizeof(pfd))) {
-        SCLogError(SC_EINVAL, "Error setting ebpf: %s", strerror(errno));
+        SCLogError("Error setting ebpf: %s", strerror(errno));
         return -1;
     }
     SCLogInfo("Activated eBPF filter on socket");
@@ -1863,7 +1844,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
     /* open socket */
     ptv->socket = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
     if (ptv->socket == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Couldn't create a AF_PACKET socket, error %s", strerror(errno));
+        SCLogError("Couldn't create a AF_PACKET socket, error %s", strerror(errno));
         goto error;
     }
 
@@ -1880,7 +1861,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
     bind_address.sll_ifindex = if_idx;
     if (bind_address.sll_ifindex == -1) {
         if (verbose)
-            SCLogError(SC_ERR_AFP_CREATE, "Couldn't find iface %s", devname);
+            SCLogError("Couldn't find iface %s", devname);
         ret = AFP_RECOVERABLE_ERROR;
         goto socket_err;
     }
@@ -1888,17 +1869,13 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
     int if_flags = AFPGetDevFlags(ptv->socket, ptv->iface);
     if (if_flags == -1) {
         if (verbose) {
-            SCLogError(SC_ERR_AFP_READ,
-                    "Couldn't get flags for interface '%s'",
-                    ptv->iface);
+            SCLogError("Couldn't get flags for interface '%s'", ptv->iface);
         }
         ret = AFP_RECOVERABLE_ERROR;
         goto socket_err;
     } else if ((if_flags & (IFF_UP | IFF_RUNNING)) == 0) {
         if (verbose) {
-            SCLogError(SC_ERR_AFP_READ,
-                    "Interface '%s' is down",
-                    ptv->iface);
+            SCLogError("Interface '%s' is down", ptv->iface);
         }
         ret = AFP_RECOVERABLE_ERROR;
         goto socket_err;
@@ -1911,9 +1888,8 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
         sock_params.mr_ifindex = bind_address.sll_ifindex;
         r = setsockopt(ptv->socket, SOL_PACKET, PACKET_ADD_MEMBERSHIP,(void *)&sock_params, sizeof(sock_params));
         if (r < 0) {
-            SCLogError(SC_ERR_AFP_CREATE,
-                    "Couldn't switch iface %s to promiscuous, error %s",
-                    devname, strerror(errno));
+            SCLogError(
+                    "Couldn't switch iface %s to promiscuous, error %s", devname, strerror(errno));
             goto socket_err;
         }
     }
@@ -1922,8 +1898,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
         int val = 1;
         if (setsockopt(ptv->socket, SOL_PACKET, PACKET_AUXDATA, &val,
                     sizeof(val)) == -1 && errno != ENOPROTOOPT) {
-            SCLogWarning(SC_ERR_NO_AF_PACKET,
-                         "'kernel' checksum mode not supported, falling back to full mode.");
+            SCLogWarning("'kernel' checksum mode not supported, falling back to full mode.");
             ptv->checksum_mode = CHECKSUM_VALIDATION_ENABLE;
         }
     }
@@ -1937,9 +1912,8 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
         if (setsockopt(ptv->socket, SOL_SOCKET, SO_RCVBUF,
                        &ptv->buffer_size,
                        sizeof(ptv->buffer_size)) == -1) {
-            SCLogError(SC_ERR_AFP_CREATE,
-                    "Couldn't set buffer size to %d on iface %s, error %s",
-                    ptv->buffer_size, devname, strerror(errno));
+            SCLogError("Couldn't set buffer size to %d on iface %s, error %s", ptv->buffer_size,
+                    devname, strerror(errno));
             goto socket_err;
         }
     }
@@ -1948,13 +1922,10 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
     if (r < 0) {
         if (verbose) {
             if (errno == ENETDOWN) {
-                SCLogError(SC_ERR_AFP_CREATE,
-                        "Couldn't bind AF_PACKET socket, iface %s is down",
-                        devname);
+                SCLogError("Couldn't bind AF_PACKET socket, iface %s is down", devname);
             } else {
-                SCLogError(SC_ERR_AFP_CREATE,
-                        "Couldn't bind AF_PACKET socket to iface %s, error %s",
-                        devname, strerror(errno));
+                SCLogError("Couldn't bind AF_PACKET socket to iface %s, error %s", devname,
+                        strerror(errno));
             }
         }
         ret = AFP_RECOVERABLE_ERROR;
@@ -1970,9 +1941,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
         uint32_t option = (mode << 16) | (id & 0xffff);
         r = setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option));
         if (r < 0) {
-            SCLogError(SC_ERR_AFP_CREATE,
-                       "Couldn't set fanout mode, error %s",
-                       strerror(errno));
+            SCLogError("Couldn't set fanout mode, error %s", strerror(errno));
             goto socket_err;
         }
     }
@@ -1982,9 +1951,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
     if (ptv->cluster_type == PACKET_FANOUT_EBPF) {
         r = SockFanoutSeteBPF(ptv);
         if (r < 0) {
-            SCLogError(SC_ERR_AFP_CREATE,
-                       "Coudn't set EBPF, error %s",
-                       strerror(errno));
+            SCLogError("Coudn't set EBPF, error %s", strerror(errno));
             goto socket_err;
         }
     }
@@ -2055,9 +2022,7 @@ TmEcode AFPSetBPFFilter(AFPThreadVars *ptv)
                 0,              /* mask */
                 errbuf,
                 sizeof(errbuf)) == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Failed to compile BPF \"%s\": %s",
-                   ptv->bpf_filter,
-                   errbuf);
+        SCLogError("Failed to compile BPF \"%s\": %s", ptv->bpf_filter, errbuf);
         return TM_ECODE_FAILED;
     }
 
@@ -2071,7 +2036,7 @@ TmEcode AFPSetBPFFilter(AFPThreadVars *ptv)
 
     SCBPFFree(&filter);
     if(rc == -1) {
-        SCLogError(SC_ERR_AFP_CREATE, "Failed to attach filter: %s", strerror(errno));
+        SCLogError("Failed to attach filter: %s", strerror(errno));
         return TM_ECODE_FAILED;
     }
 
@@ -2114,9 +2079,7 @@ static int AFPInsertHalfFlow(int mapd, void *key, unsigned int nr_cpus)
                 return 1;
             /* Not supposed to be there so issue a error */
             default:
-                SCLogError(SC_ERR_BPF, "Can't update eBPF map: %s (%d)",
-                        strerror(errno),
-                        errno);
+                SCLogError("Can't update eBPF map: %s (%d)", strerror(errno), errno);
                 return 0;
         }
     }
@@ -2485,7 +2448,7 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
     AFPIfaceConfig *afpconfig = (AFPIfaceConfig *)initdata;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -2503,7 +2466,7 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
 
     ptv->livedev = LiveGetDevice(ptv->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -2543,14 +2506,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_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v4");
+                SCLogError("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_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v6");
+                SCLogError("Can't find eBPF map fd for '%s'", "flow_table_v6");
                 g_flowv6_ok = false;
             }
         }
@@ -2582,8 +2545,8 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
         ptv->out_iface[AFP_IFACE_NAME_LENGTH - 1]= '\0';
         /* Warn about BPF filter consequence */
         if (ptv->bpf_filter) {
-            SCLogWarning(SC_WARN_UNCOMMON, "Enabling a BPF filter in IPS mode result"
-                      " in dropping all non matching packets.");
+            SCLogWarning("Enabling a BPF filter in IPS mode result"
+                         " in dropping all non matching packets.");
         }
     }
 
index 8271d3a72ec7d6b15be862de7ac7e61792b2729f..9e25d09d79fdb089fb631562777603957410dfdf 100644 (file)
@@ -103,10 +103,9 @@ void TmModuleDecodeAFXDPRegister(void)
  */
 TmEcode NoAFXDPSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_NO_AF_XDP,
-            "Error creating thread %s: you do not have "
-            "support for AF_XDP enabled, on Linux host please recompile "
-            "with --enable-af-xdp",
+    SCLogError("Error creating thread %s: you do not have "
+               "support for AF_XDP enabled, on Linux host please recompile "
+               "with --enable-af-xdp",
             tv->name);
     exit(EXIT_FAILURE);
 }
@@ -312,7 +311,7 @@ static TmEcode AcquireBuffer(AFXDPThreadVars *ptv)
     ptv->umem.buf = mmap(NULL, MEM_BYTES, PROT_READ | PROT_WRITE, mmap_flags, -1, 0);
 
     if (ptv->umem.buf == MAP_FAILED) {
-        SCLogError(SC_ERR_MEM_ALLOC, "mmap: failed to acquire memory");
+        SCLogError("mmap: failed to acquire memory");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -323,7 +322,7 @@ static TmEcode ConfigureXSKUmem(AFXDPThreadVars *ptv)
 {
     if (xsk_umem__create(&ptv->umem.umem, ptv->umem.buf, MEM_BYTES, &ptv->umem.fq, &ptv->umem.cq,
                 &ptv->umem.cfg)) {
-        SCLogError(SC_ERR_AFXDP_CREATE, "failed to create umem: %s", strerror(errno));
+        SCLogError("failed to create umem: %s", strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -336,7 +335,7 @@ static TmEcode InitFillRing(AFXDPThreadVars *ptv, const uint32_t cnt)
 
     uint32_t ret = xsk_ring_prod__reserve(&ptv->umem.fq, cnt, &idx_fq);
     if (ret != cnt) {
-        SCLogError(SC_ERR_AFXDP_INIT, "Failed to initialise the fill ring.");
+        SCLogError("Failed to initialise the fill ring.");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -391,9 +390,8 @@ static TmEcode ConfigureBusyPolling(AFXDPThreadVars *ptv)
      * see linux commit: 7fd3253a7de6a317a0683f83739479fb880bffc8
      */
     if (!SCKernelVersionIsAtLeast(5, 11)) {
-        SCLogWarning(SC_WARN_AFXDP_CONF,
-                "Kernel version older than required: v5.11,"
-                " upgrade kernel version to use 'enable-busy-poll' option.");
+        SCLogWarning("Kernel version older than required: v5.11,"
+                     " upgrade kernel version to use 'enable-busy-poll' option.");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -430,13 +428,13 @@ static TmEcode OpenXSKSocket(AFXDPThreadVars *ptv)
     SCMutexLock(&xsk_protect.queue_protect);
 
     if (AFXDPAssignQueueID(ptv) != TM_ECODE_OK) {
-        SCLogError(SC_ERR_SOCKET, "Failed to assign queue ID");
+        SCLogError("Failed to assign queue ID");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if ((ret = xsk_socket__create(&ptv->xsk.xsk, ptv->livedev->dev, ptv->xsk.queue.queue_num,
                  ptv->umem.umem, &ptv->xsk.rx, &ptv->xsk.tx, &ptv->xsk.cfg))) {
-        SCLogError(SC_ERR_SOCKET, "Failed to create socket: %s", strerror(-ret));
+        SCLogError("Failed to create socket: %s", strerror(-ret));
         SCReturnInt(TM_ECODE_FAILED);
     }
     SCLogDebug("bind to %s on queue %u", ptv->iface, ptv->xsk.queue.queue_num);
@@ -484,13 +482,13 @@ static TmEcode AFXDPSocketCreation(AFXDPThreadVars *ptv)
     }
 
     if (ConfigureBusyPolling(ptv) != TM_ECODE_OK) {
-        SCLogWarning(SC_WARN_AFXDP_CONF, "Failed to configure busy polling"
-                                         " performance may be reduced.");
+        SCLogWarning("Failed to configure busy polling"
+                     " performance may be reduced.");
     }
 
     /* Has the eBPF program successfully bound? */
     if (bpf_get_link_xdp_id(ptv->ifindex, &ptv->prog_id, ptv->xsk.cfg.xdp_flags)) {
-        SCLogError(SC_ERR_BPF, "Failed to attach eBPF program to interface: %s", ptv->livedev->dev);
+        SCLogError("Failed to attach eBPF program to interface: %s", ptv->livedev->dev);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -587,7 +585,7 @@ static TmEcode ReceiveAFXDPThreadInit(ThreadVars *tv, const void *initdata, void
     AFXDPIfaceConfig *afxdpconfig = (AFXDPIfaceConfig *)initdata;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -606,7 +604,7 @@ static TmEcode ReceiveAFXDPThreadInit(ThreadVars *tv, const void *initdata, void
 
     ptv->livedev = LiveGetDevice(ptv->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -615,8 +613,7 @@ static TmEcode ReceiveAFXDPThreadInit(ThreadVars *tv, const void *initdata, void
     if (ptv->promisc != 0) {
         /* Force promiscuous mode */
         if (SetIfaceFlags(ptv->iface, IFF_PROMISC | IFF_UP) != 0) {
-            SCLogError(SC_ERR_AFXDP_CREATE,
-                    "Failed to switch interface (%s) to promiscuous, error %s", ptv->iface,
+            SCLogError("Failed to switch interface (%s) to promiscuous, error %s", ptv->iface,
                     strerror(errno));
             SCReturnInt(TM_ECODE_FAILED);
         }
@@ -730,7 +727,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
                     StatsIncr(ptv->tv, ptv->capture_afxdp_poll_timeout);
                 } else if (r < 0) {
                     StatsIncr(ptv->tv, ptv->capture_afxdp_poll_failed);
-                    SCLogWarning(SC_ERR_AFXDP_READ, "poll failed with retval %d", r);
+                    SCLogWarning("poll failed with retval %d", r);
                     AFXDPSwitchState(ptv, AFXDP_STATE_DOWN);
                 }
 
@@ -744,7 +741,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
             StatsIncr(ptv->tv, ptv->capture_afxdp_empty_reads);
             ssize_t ret = WakeupSocket(ptv);
             if (ret < 0) {
-                SCLogWarning(SC_ERR_AFXDP_READ, "recv failed with retval %ld", ret);
+                SCLogWarning("recv failed with retval %ld", ret);
                 AFXDPSwitchState(ptv, AFXDP_STATE_DOWN);
             }
             DumpStatsEverySecond(ptv, &last_dump);
@@ -756,7 +753,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
             StatsIncr(ptv->tv, ptv->capture_afxdp_failed_reads);
             ssize_t ret = WakeupSocket(ptv);
             if (ret < 0) {
-                SCLogWarning(SC_ERR_AFXDP_READ, "recv failed with retval %ld", ret);
+                SCLogWarning("recv failed with retval %ld", ret);
                 AFXDPSwitchState(ptv, AFXDP_STATE_DOWN);
                 continue;
             }
index 543047e7a9b6ea3fb986dee71822194e67247630..e32611e99cfe51abe023ff5036f880cc9ac091e3 100644 (file)
@@ -77,10 +77,9 @@ void TmModuleDecodeDPDKRegister(void)
  */
 TmEcode NoDPDKSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    FatalError(SC_ERR_NO_DPDK,
-            "Error creating thread %s: you do not have "
-            "support for DPDK enabled, on Linux host please recompile "
-            "with --enable-dpdk",
+    FatalError("Error creating thread %s: you do not have "
+               "support for DPDK enabled, on Linux host please recompile "
+               "with --enable-dpdk",
             tv->name);
 }
 
@@ -207,7 +206,7 @@ static void DevicePreStopPMDSpecificActions(DPDKThreadVars *ptv, const char *dri
         struct rte_flow_error flush_error = { 0 };
         retval = rte_flow_flush(ptv->port_id, &flush_error);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_CONF, "Unable to flush rte_flow rules: %s Flush error msg: %s",
+            SCLogError("Unable to flush rte_flow rules: %s Flush error msg: %s",
                     rte_strerror(-retval), flush_error.message);
         }
     }
@@ -226,7 +225,7 @@ static int GetNumaNode(void)
     cpu = sched_getcpu();
     node = numa_node_of_cpu(cpu);
 #else
-    SCLogWarning(SC_ERR_TM_THREADS_ERROR, "NUMA node retrieval is not supported on this OS.");
+    SCLogWarning("NUMA node retrieval is not supported on this OS.");
 #endif
 
     return node;
@@ -269,8 +268,7 @@ static inline void DPDKDumpCounters(DPDKThreadVars *ptv)
     struct rte_eth_stats eth_stats;
     int retval = rte_eth_stats_get(ptv->port_id, &eth_stats);
     if (unlikely(retval != 0)) {
-        SCLogError(SC_ERR_STAT, "Failed to get stats for port id %d: %s", ptv->port_id,
-                rte_strerror(-retval));
+        SCLogError("Failed to get stats for port id %d: %s", ptv->port_id, rte_strerror(-retval));
         return;
     }
 
@@ -423,13 +421,13 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
     DPDKIfaceConfig *dpdk_config = (DPDKIfaceConfig *)initdata;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "DPDK configuration is NULL in thread initialization");
+        SCLogError("DPDK configuration is NULL in thread initialization");
         goto fail;
     }
 
     ptv = SCCalloc(1, sizeof(DPDKThreadVars));
     if (unlikely(ptv == NULL)) {
-        SCLogError(SC_ENOMEM, "Unable to allocate memory");
+        SCLogError("Unable to allocate memory");
         goto fail;
     }
 
@@ -469,16 +467,16 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
     if (queue_id == dpdk_config->threads - 1) {
         retval = rte_eth_dev_start(ptv->port_id);
         if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (%s) during device startup of %s",
-                    rte_strerror(-retval), dpdk_config->iface);
+            SCLogError("Error (%s) during device startup of %s", rte_strerror(-retval),
+                    dpdk_config->iface);
             goto fail;
         }
 
         struct rte_eth_dev_info dev_info;
         retval = rte_eth_dev_info_get(ptv->port_id, &dev_info);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (%s) when getting device info of %s",
-                    rte_strerror(-retval), dpdk_config->iface);
+            SCLogError("Error (%s) when getting device info of %s", rte_strerror(-retval),
+                    dpdk_config->iface);
             goto fail;
         }
 
@@ -487,8 +485,7 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
 
         uint16_t inconsist_numa_cnt = SC_ATOMIC_GET(dpdk_config->inconsitent_numa_cnt);
         if (inconsist_numa_cnt > 0) {
-            SCLogWarning(SC_WARN_DPDK_CONF,
-                    "%s: NIC is on NUMA %d, %u threads on different NUMA node(s)",
+            SCLogWarning("%s: NIC is on NUMA %d, %u threads on different NUMA node(s)",
                     dpdk_config->iface, rte_eth_dev_socket_id(ptv->port_id), inconsist_numa_cnt);
         }
     }
@@ -522,14 +519,13 @@ static void ReceiveDPDKThreadExitStats(ThreadVars *tv, void *data)
 
         retval = rte_eth_dev_get_name_by_port(ptv->port_id, port_name);
         if (unlikely(retval != 0)) {
-            SCLogError(SC_ERR_STAT, "Failed to convert port id %d to the interface name: %s",
-                    ptv->port_id, strerror(-retval));
+            SCLogError("Failed to convert port id %d to the interface name: %s", ptv->port_id,
+                    strerror(-retval));
             SCReturn;
         }
         retval = rte_eth_stats_get(ptv->port_id, &eth_stats);
         if (unlikely(retval != 0)) {
-            SCLogError(SC_ERR_STAT, "Failed to get stats for interface %s: %s", port_name,
-                    strerror(-retval));
+            SCLogError("Failed to get stats for interface %s: %s", port_name, strerror(-retval));
             SCReturn;
         }
         SCLogPerf("Total RX stats of %s: packets %" PRIu64 " bytes: %" PRIu64 " missed: %" PRIu64
@@ -562,14 +558,12 @@ static TmEcode ReceiveDPDKThreadDeinit(ThreadVars *tv, void *data)
         char iface[RTE_ETH_NAME_MAX_LEN];
         retval = rte_eth_dev_get_name_by_port(ptv->port_id, iface);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) when getting device name (port %d)",
-                    retval, ptv->port_id);
+            SCLogError("Error (err=%d) when getting device name (port %d)", retval, ptv->port_id);
             SCReturnInt(TM_ECODE_FAILED);
         }
         retval = rte_eth_dev_info_get(ptv->port_id, &dev_info);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_INIT, "Error (err=%d) during getting device info (port %s)",
-                    retval, iface);
+            SCLogError("Error (err=%d) during getting device info (port %s)", retval, iface);
             SCReturnInt(TM_ECODE_FAILED);
         }
 
index 531b986aa21b13566fe7be517724e1c919388345..9b4349671c71fb7d3bb5657f7c09cd738a54578a 100644 (file)
@@ -67,9 +67,9 @@ TmModuleDecodeErfDagRegister(void)
 TmEcode
 NoErfDagSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_DAG_NOSUPPORT,
-        "Error creating thread %s: you do not have support for DAG cards "
-        "enabled please recompile with --enable-dag", tv->name);
+    SCLogError("Error creating thread %s: you do not have support for DAG cards "
+               "enabled please recompile with --enable-dag",
+            tv->name);
     exit(EXIT_FAILURE);
 }
 
@@ -182,15 +182,13 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
     int stream_count = 0;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-            "Error: No DAG interface provided.");
+        SCLogError("Error: No DAG interface provided.");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     ErfDagThreadVars *ewtn = SCMalloc(sizeof(ErfDagThreadVars));
     if (unlikely(ewtn == NULL)) {
-            FatalError(SC_ERR_FATAL,
-                       "Failed to allocate memory for ERF DAG thread vars.");
+        FatalError("Failed to allocate memory for ERF DAG thread vars.");
     }
 
     memset(ewtn, 0, sizeof(*ewtn));
@@ -200,16 +198,14 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
      */
     if (dag_parse_name(initdata, ewtn->dagname, DAGNAME_BUFSIZE,
             &ewtn->dagstream) < 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-            "Failed to parse DAG interface: %s",
-            (char*)initdata);
+        SCLogError("Failed to parse DAG interface: %s", (char *)initdata);
         SCFree(ewtn);
         exit(EXIT_FAILURE);
     }
 
     ewtn->livedev = LiveGetDevice(initdata);
     if (ewtn->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to get %s live device", (char *)initdata);
+        SCLogError("Unable to get %s live device", (char *)initdata);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -218,8 +214,7 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
         ewtn->dagname, ewtn->dagstream);
 
     if ((ewtn->dagfd = dag_open(ewtn->dagname)) < 0) {
-        SCLogError(SC_ERR_ERF_DAG_OPEN_FAILED, "Failed to open DAG: %s",
-            ewtn->dagname);
+        SCLogError("Failed to open DAG: %s", ewtn->dagname);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -228,9 +223,8 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
      * support reading from the one specified.
      */
     if ((stream_count = dag_rx_get_stream_count(ewtn->dagfd)) < 0) {
-        SCLogError(SC_ERR_ERF_DAG_OPEN_FAILED,
-            "Failed to open stream: %d, DAG: %s, could not query stream count",
-            ewtn->dagstream, ewtn->dagname);
+        SCLogError("Failed to open stream: %d, DAG: %s, could not query stream count",
+                ewtn->dagstream, ewtn->dagname);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -239,9 +233,8 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
      * the user is asking for.
      */
     if (ewtn->dagstream > stream_count * 2) {
-        SCLogError(SC_ERR_ERF_DAG_OPEN_FAILED,
-            "Failed to open stream: %d, DAG: %s, insufficient streams: %d",
-            ewtn->dagstream, ewtn->dagname, stream_count);
+        SCLogError("Failed to open stream: %d, DAG: %s, insufficient streams: %d", ewtn->dagstream,
+                ewtn->dagname, stream_count);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -252,26 +245,21 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
     if (0 != (ewtn->dagstream & 0x01)) {
         /* Setting reverse mode for using with soft dag from daemon side */
         if (dag_set_mode(ewtn->dagfd, ewtn->dagstream, DAG_REVERSE_MODE)) {
-            SCLogError(SC_ERR_ERF_DAG_STREAM_OPEN_FAILED,
-                "Failed to set mode to DAG_REVERSE_MODE on stream: %d, DAG: %s",
-                ewtn->dagstream, ewtn->dagname);
+            SCLogError("Failed to set mode to DAG_REVERSE_MODE on stream: %d, DAG: %s",
+                    ewtn->dagstream, ewtn->dagname);
             SCFree(ewtn);
             SCReturnInt(TM_ECODE_FAILED);
         }
     }
 
     if (dag_attach_stream(ewtn->dagfd, ewtn->dagstream, 0, 0) < 0) {
-        SCLogError(SC_ERR_ERF_DAG_STREAM_OPEN_FAILED,
-            "Failed to open DAG stream: %d, DAG: %s",
-            ewtn->dagstream, ewtn->dagname);
+        SCLogError("Failed to open DAG stream: %d, DAG: %s", ewtn->dagstream, ewtn->dagname);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (dag_start_stream(ewtn->dagfd, ewtn->dagstream) < 0) {
-        SCLogError(SC_ERR_ERF_DAG_STREAM_START_FAILED,
-            "Failed to start DAG stream: %d, DAG: %s",
-            ewtn->dagstream, ewtn->dagname);
+        SCLogError("Failed to start DAG stream: %d, DAG: %s", ewtn->dagstream, ewtn->dagname);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -292,9 +280,8 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
      */
     if (dag_set_stream_poll(ewtn->dagfd, ewtn->dagstream, MINDATA,
             &(ewtn->maxwait), &(ewtn->poll)) < 0) {
-        SCLogError(SC_ERR_ERF_DAG_STREAM_SET_FAILED,
-            "Failed to set poll parameters for stream: %d, DAG: %s",
-            ewtn->dagstream, ewtn->dagname);
+        SCLogError("Failed to set poll parameters for stream: %d, DAG: %s", ewtn->dagstream,
+                ewtn->dagname);
         SCFree(ewtn);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -356,10 +343,9 @@ ReceiveErfDagLoop(ThreadVars *tv, void *data, void *slot)
                 }
                 continue;
             } else {
-                SCLogError(SC_ERR_ERF_DAG_STREAM_READ_FAILED,
-                    "Failed to read from stream: %d, DAG: %s when "
-                    "using dag_advance_stream",
-                    dtv->dagstream, dtv->dagname);
+                SCLogError("Failed to read from stream: %d, DAG: %s when "
+                           "using dag_advance_stream",
+                        dtv->dagstream, dtv->dagname);
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -374,9 +360,7 @@ ReceiveErfDagLoop(ThreadVars *tv, void *data, void *slot)
         err = ProcessErfDagRecords(dtv, top, &pkts_read);
 
         if (err == TM_ECODE_FAILED) {
-            SCLogError(SC_ERR_ERF_DAG_STREAM_READ_FAILED,
-                "Failed to read from stream: %d, DAG: %s",
-                dtv->dagstream, dtv->dagname);
+            SCLogError("Failed to read from stream: %d, DAG: %s", dtv->dagstream, dtv->dagname);
             ReceiveErfDagCloseStream(dtv->dagfd, dtv->dagstream);
             SCReturnInt(TM_ECODE_FAILED);
         }
@@ -449,8 +433,7 @@ ProcessErfDagRecords(ErfDagThreadVars *ewtn, uint8_t *top, uint32_t *pkts_read)
             }
             break;
         default:
-            SCLogError(SC_ERR_UNIMPLEMENTED,
-                "Processing of DAG record type: %d not implemented.", dr->type);
+            SCLogError("Processing of DAG record type: %d not implemented.", dr->type);
             SCReturnInt(TM_ECODE_FAILED);
         }
 
@@ -490,8 +473,7 @@ ProcessErfDagRecord(ErfDagThreadVars *ewtn, char *prec)
     /* count extension headers */
     while (hdr_type & 0x80) {
         if (rlen < (dag_record_size + (hdr_num * 8))) {
-            SCLogError(SC_ERR_UNIMPLEMENTED,
-                "Insufficient captured packet length.");
+            SCLogError("Insufficient captured packet length.");
             SCReturnInt(TM_ECODE_FAILED);
         }
         hdr_type = prec[(dag_record_size + (hdr_num * 8))];
@@ -509,7 +491,7 @@ ProcessErfDagRecord(ErfDagThreadVars *ewtn, char *prec)
 
     p = PacketGetFromQueueOrAlloc();
     if (p == NULL) {
-        SCLogError(SC_ENOMEM, "Failed to allocate a Packet on stream: %d, DAG: %s", ewtn->dagstream,
+        SCLogError("Failed to allocate a Packet on stream: %d, DAG: %s", ewtn->dagstream,
                 ewtn->dagname);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -625,10 +607,8 @@ DecodeErfDag(ThreadVars *tv, Packet *p, void *data)
             DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p));
             break;
         default:
-            SCLogError(SC_ERR_DATALINK_UNIMPLEMENTED,
-                "Error: datalink type %" PRId32
-                " not yet supported in module DecodeErfDag",
-                p->datalink);
+            SCLogError("Error: datalink type %" PRId32 " not yet supported in module DecodeErfDag",
+                    p->datalink);
             break;
     }
 
index e1b75b0120f11cadd9e44e7c275d649956b77247..2f2e43a6f523de0f8e87c514446231d96afb8830 100644 (file)
@@ -131,7 +131,7 @@ TmEcode ReceiveErfFileLoop(ThreadVars *tv, void *data, void *slot)
 
         p = PacketGetFromQueueOrAlloc();
         if (unlikely(p == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate a packet.");
+            SCLogError("Failed to allocate a packet.");
             EngineStop();
             SCReturnInt(TM_ECODE_FAILED);
         }
@@ -171,8 +171,8 @@ static inline TmEcode ReadErfRecord(ThreadVars *tv, Packet *p, void *data)
     uint16_t rlen = SCNtohs(dr.rlen);
     uint16_t wlen = SCNtohs(dr.wlen);
     if (rlen < sizeof(DagRecord)) {
-        SCLogError(SC_ERR_ERF_BAD_RLEN, "Bad ERF record, "
-            "record length less than size of header");
+        SCLogError("Bad ERF record, "
+                   "record length less than size of header");
         SCReturnInt(TM_ECODE_FAILED);
     }
     r = fread(GET_PKT_DATA(p), rlen - sizeof(DagRecord), 1, etv->erf);
@@ -188,8 +188,7 @@ static inline TmEcode ReadErfRecord(ThreadVars *tv, Packet *p, void *data)
 
     /* Only support ethernet at this time. */
     if (dr.type != DAG_TYPE_ETH) {
-        SCLogError(SC_ERR_UNIMPLEMENTED,
-            "DAG record type %d not implemented.", dr.type);
+        SCLogError("DAG record type %d not implemented.", dr.type);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -222,20 +221,19 @@ ReceiveErfFileThreadInit(ThreadVars *tv, const void *initdata, void **data)
     SCEnter();
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Error: No filename provided.");
+        SCLogError("Error: No filename provided.");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     FILE *erf = fopen((const char *)initdata, "r");
     if (erf == NULL) {
-        SCLogError(SC_ERR_FOPEN, "Failed to open %s: %s", (char *)initdata,
-            strerror(errno));
+        SCLogError("Failed to open %s: %s", (char *)initdata, strerror(errno));
         exit(EXIT_FAILURE);
     }
 
     ErfFileThreadVars *etv = SCMalloc(sizeof(ErfFileThreadVars));
     if (unlikely(etv == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to allocate memory for ERF file thread vars.");
+        SCLogError("Failed to allocate memory for ERF file thread vars.");
         fclose(erf);
         SCReturnInt(TM_ECODE_FAILED);
     }
index 73621ec1e1554fd5d355f8a1713d633467cb2c5a..505fb906b0387bf04aba23cfdff75500af3d509f 100644 (file)
@@ -92,8 +92,9 @@ void TmModuleDecodeIPFWRegister (void)
 TmEcode NoIPFWSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
 
-    SCLogError(SC_ERR_IPFW_NOSUPPORT,"Error creating thread %s: you do not have support for ipfw "
-           "enabled please recompile with --enable-ipfw", tv->name);
+    SCLogError("Error creating thread %s: you do not have support for ipfw "
+               "enabled please recompile with --enable-ipfw",
+            tv->name);
     exit(EXIT_FAILURE);
 }
 
@@ -236,7 +237,7 @@ TmEcode ReceiveIPFWLoop(ThreadVars *tv, void *data, void *slot)
 
     nq = IPFWGetQueue(ptv->ipfw_index);
     if (nq == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Can't get thread variable");
+        SCLogWarning("Can't get thread variable");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -268,9 +269,7 @@ TmEcode ReceiveIPFWLoop(ThreadVars *tv, void *data, void *slot)
                 /* Nothing for us to process */
                 continue;
             } else {
-                SCLogWarning(SC_WARN_IPFW_RECV,
-                             "Read from IPFW divert socket failed: %s",
-                             strerror(errno));
+                SCLogWarning("Read from IPFW divert socket failed: %s", strerror(errno));
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -346,7 +345,7 @@ TmEcode ReceiveIPFWThreadInit(ThreadVars *tv, const void *initdata, void **data)
 #else
     if ((nq->fd = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)) == -1) {
 #endif
-        SCLogError(SC_ERR_IPFW_SOCK,"Can't create divert socket: %s", strerror(errno));
+        SCLogError("Can't create divert socket: %s", strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -356,7 +355,7 @@ TmEcode ReceiveIPFWThreadInit(ThreadVars *tv, const void *initdata, void **data)
     timev.tv_usec = 0;
 
     if (setsockopt(nq->fd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev)) == -1) {
-        SCLogError(SC_ERR_IPFW_SETSOCKOPT,"Can't set IPFW divert socket timeout: %s", strerror(errno));
+        SCLogError("Can't set IPFW divert socket timeout: %s", strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -368,7 +367,7 @@ TmEcode ReceiveIPFWThreadInit(ThreadVars *tv, const void *initdata, void **data)
 
     /* Bind that SOB */
     if (bind(nq->fd, (struct sockaddr *)&nq->ipfw_sin, nq->ipfw_sinlen) == -1) {
-        SCLogError(SC_ERR_IPFW_BIND,"Can't bind divert socket on port %d: %s",nq->port_num,strerror(errno));
+        SCLogError("Can't bind divert socket on port %d: %s", nq->port_num, strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -416,7 +415,7 @@ TmEcode ReceiveIPFWThreadDeinit(ThreadVars *tv, void *data)
 
     /* Attempt to shut the socket down...close instead? */
     if (shutdown(nq->fd, SHUT_RD) < 0) {
-        SCLogWarning(SC_WARN_IPFW_UNBIND,"Unable to disable ipfw socket: %s",strerror(errno));
+        SCLogWarning("Unable to disable ipfw socket: %s", strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -521,13 +520,13 @@ TmEcode IPFWSetVerdict(ThreadVars *tv, IPFWThreadVars *ptv, Packet *p)
     SCEnter();
 
     if (p == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Packet is NULL");
+        SCLogWarning("Packet is NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     nq = IPFWGetQueue(p->ipfw_v.ipfw_index);
     if (nq == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT, "No thread found");
+        SCLogWarning("No thread found");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -566,7 +565,7 @@ TmEcode IPFWSetVerdict(ThreadVars *tv, IPFWThreadVars *ptv, Packet *p)
             int r = errno;
             switch (r) {
                 default:
-                    SCLogWarning(SC_WARN_IPFW_XMIT,"Write to ipfw divert socket failed: %s",strerror(r));
+                    SCLogWarning("Write to ipfw divert socket failed: %s", strerror(r));
                     IPFWMutexUnlock(nq);
                     SCReturnInt(TM_ECODE_FAILED);
                 case EHOSTDOWN:
@@ -709,16 +708,15 @@ int IPFWRegisterQueue(char *queue)
     uint16_t port_num = 0;
     if ((StringParseUint16(&port_num, 10, strlen(queue), queue)) < 0)
     {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "specified queue number %s is not "
-                                        "valid", queue);
+        SCLogError("specified queue number %s is not "
+                   "valid",
+                queue);
         return -1;
     }
 
     SCMutexLock(&ipfw_init_lock);
     if (receive_port_num >= IPFW_MAX_QUEUE) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "too much IPFW divert port registered (%d)",
-                   receive_port_num);
+        SCLogError("too much IPFW divert port registered (%d)", receive_port_num);
         SCMutexUnlock(&ipfw_init_lock);
         return -1;
     }
index 8d2ae69e2c618fb4713d5fa3461caeee1d876df9..865b78ca43c0783c2e31800f41d4cf17483b5012 100644 (file)
@@ -67,9 +67,8 @@ void TmModuleNapatechDecodeRegister(void)
 
 TmEcode NoNapatechSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_NAPATECH_NOSUPPORT,
-            "Error creating thread %s: you do not have support for Napatech adapter "
-            "enabled please recompile with --enable-napatech",
+    SCLogError("Error creating thread %s: you do not have support for Napatech adapter "
+               "enabled please recompile with --enable-napatech",
             tv->name);
     exit(EXIT_FAILURE);
 }
@@ -268,8 +267,7 @@ int NapatechSetPortmap(int port, int peer)
         inline_port_map[port] = peer;
         inline_port_map[peer] = port;
     } else {
-        SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG,
-                "Port pairing is already configured.");
+        SCLogError("Port pairing is already configured.");
         return 0;
     }
     return 1;
@@ -293,7 +291,7 @@ int NapatechGetAdapter(uint8_t port)
 
     if (unlikely(port_adapter_map[port] == -1)) {
         if ((status = NT_InfoOpen(&h_info_stream, "ExampleInfo")) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+            NAPATECH_ERROR(status);
             return -1;
         }
         /* Read the system info */
@@ -301,7 +299,7 @@ int NapatechGetAdapter(uint8_t port)
         h_info.u.port_v9.portNo = (uint8_t) port;
         if ((status = NT_InfoRead(h_info_stream, &h_info)) != NT_SUCCESS) {
             /* Get the status code as text */
-            NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+            NAPATECH_ERROR(status);
             NT_InfoClose(h_info_stream);
             return -1;
         }
@@ -381,8 +379,8 @@ static NtFlowStream_t InitFlowStream(int adapter, int stream_id)
     snprintf(flow_name, sizeof(flow_name), "Flow_stream_%d", stream_id );
     SCLogDebug("Opening flow programming stream:  %s", flow_name);
     if ((status = NT_FlowOpen_Attr(&hFlowStream, flow_name, &attr)) != NT_SUCCESS) {
-        SCLogWarning(SC_WARN_COMPATIBILITY,
-                "Napatech bypass functionality not supported by the FPGA version on adapter %d - disabling support.",
+        SCLogWarning("Napatech bypass functionality not supported by the FPGA version on adapter "
+                     "%d - disabling support.",
                 adapter);
         return NULL;
     }
@@ -596,7 +594,7 @@ static int ProgramFlow(Packet *p, int is_inline)
 
     if (NT_FlowWrite(ntpv->flow_stream, &flow_match, -1) != NT_SUCCESS) {
         if (!(suricata_ctl_flags & SURICATA_STOP)) {
-            SCLogError(SC_ERR_NAPATECH_OPEN_FAILED,"NT_FlowWrite failed!.");
+            SCLogError("NT_FlowWrite failed!.");
             exit(EXIT_FAILURE);
         }
     }
@@ -651,8 +649,7 @@ TmEcode NapatechStreamThreadInit(ThreadVars *tv, const void *initdata, void **da
 
     NapatechThreadVars *ntv = SCCalloc(1, sizeof (NapatechThreadVars));
     if (unlikely(ntv == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Failed to allocate memory for NAPATECH  thread vars.");
+        FatalError("Failed to allocate memory for NAPATECH  thread vars.");
     }
 
     memset(ntv, 0, sizeof (NapatechThreadVars));
@@ -719,8 +716,7 @@ static int GetNumaNode(void)
     cpu = sched_getcpu();
     node = numa_node_of_cpu(cpu);
 #else
-    SCLogWarning(SC_ERR_NAPATECH_NOSUPPORT,
-            "Auto configuration of NUMA node is not supported on this OS.");
+    SCLogWarning("Auto configuration of NUMA node is not supported on this OS.");
 #endif
 
     return node;
@@ -775,8 +771,8 @@ static void RecommendNUMAConfig(SCLogLevel log_level)
                 "E.g.: HostBuffersRx=%s%s%s%s", string0, string1, string2,
                 string3);
     } else if (log_level == SC_LOG_ERROR) {
-        SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED,
-                "Or, try running /opt/napatech3/bin/ntpl -e \"delete=all\" to clean-up stream NUMA config.");
+        SCLogError("Or, try running /opt/napatech3/bin/ntpl -e \"delete=all\" to clean-up stream "
+                   "NUMA config.");
     }
 }
 
@@ -870,14 +866,12 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
             closer = 1;
 
             if (status == 0x20002061) {
-                SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED,
-                        "Check host buffer configuration in ntservice.ini.");
+                SCLogError("Check host buffer configuration in ntservice.ini.");
                 RecommendNUMAConfig(SC_LOG_ERROR);
                 exit(EXIT_FAILURE);
 
             } else if (status == 0x20000008) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Check napatech.ports in the suricata config file.");
+                FatalError("Check napatech.ports in the suricata config file.");
             }
             RecommendNUMAConfig(SC_LOG_PERF);
             SCLogNotice("Napatech packet input engine started.");
@@ -891,8 +885,7 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
     if (ntv->hba > 0) {
         char *s_hbad_pkt = SCCalloc(1, 32);
         if (unlikely(s_hbad_pkt == NULL)) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to allocate memory for NAPATECH stream counter.");
+            FatalError("Failed to allocate memory for NAPATECH stream counter.");
         }
         snprintf(s_hbad_pkt, 32, "nt%d.hba_drop", ntv->stream_id);
         hba_pkt = StatsRegisterCounter(s_hbad_pkt, tv);
@@ -904,7 +897,7 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
     if ((status = NT_NetRxOpen(&(ntv->rx_stream), "SuricataStream",
             NT_NET_INTERFACE_PACKET, ntv->stream_id, ntv->hba)) != NT_SUCCESS) {
 
-        NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+        NAPATECH_ERROR(status);
         SCFree(ntv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -929,7 +922,7 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
             }
             continue;
         } else if (unlikely(status != NT_SUCCESS)) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+            NAPATECH_ERROR(status);
             SCLogInfo("Failed to read from Napatech Stream %d: %s",
                     ntv->stream_id, error_buffer);
             break;
@@ -973,8 +966,8 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
                 p->ts.tv_usec = ((pkt_ts % 100000000) / 100) + ((pkt_ts % 100) > 50 ? 1 : 0);
                 break;
             default:
-                SCLogError(SC_ERR_NAPATECH_TIMESTAMP_TYPE_NOT_SUPPORTED,
-                        "Packet from Napatech Stream: %u does not have a supported timestamp format",
+                SCLogError("Packet from Napatech Stream: %u does not have a supported timestamp "
+                           "format",
                         ntv->stream_id);
                 NT_NetRxRelease(ntv->rx_stream, packet_buffer);
                 SCReturnInt(TM_ECODE_FAILED);
@@ -985,7 +978,7 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
             stat_cmd.cmd = NT_NETRX_READ_CMD_STREAM_DROP;
             /* Update drop counter */
             if (unlikely((status = NT_NetRxRead(ntv->rx_stream, &stat_cmd)) != NT_SUCCESS)) {
-                NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+                NAPATECH_ERROR(status);
                 SCLogInfo("Couldn't retrieve drop statistics from the RX stream: %u",
                         ntv->stream_id);
             } else {
@@ -1122,8 +1115,7 @@ TmEcode NapatechDecode(ThreadVars *tv, Packet *p, void *data)
             DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p));
             break;
         default:
-            SCLogError(SC_ERR_DATALINK_UNIMPLEMENTED,
-                    "Datalink type %" PRId32 " not yet supported in module NapatechDecode",
+            SCLogError("Datalink type %" PRId32 " not yet supported in module NapatechDecode",
                     p->datalink);
             break;
     }
index c1d97666ef8cb6a43edebe656f134d7eb0430e11..3757b017d80573e83a84f324fb526c400c46836a 100644 (file)
@@ -66,9 +66,8 @@
 */
 static TmEcode NoNetmapSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    FatalError(SC_ERR_NO_NETMAP,
-            "Error creating thread %s: Netmap is not enabled. "
-            "Make sure to pass --enable-netmap to configure when building.",
+    FatalError("Error creating thread %s: Netmap is not enabled. "
+               "Make sure to pass --enable-netmap to configure when building.",
             tv->name);
 }
 
@@ -185,9 +184,7 @@ int NetmapGetRSSCount(const char *ifname)
     /* open netmap device */
     int fd = open("/dev/netmap", O_RDWR);
     if (fd == -1) {
-        SCLogError(SC_ERR_NETMAP_CREATE,
-                "Couldn't open netmap device, error %s",
-                strerror(errno));
+        SCLogError("Couldn't open netmap device, error %s", strerror(errno));
         goto error_open;
     }
 
@@ -200,8 +197,7 @@ int NetmapGetRSSCount(const char *ifname)
     strlcpy(hdr.nr_name, base_name, sizeof(hdr.nr_name));
 
     if (ioctl(fd, NIOCCTRL, &hdr) != 0) {
-        SCLogError(SC_ERR_NETMAP_CREATE, "Couldn't query netmap for info about %s, error %s",
-                ifname, strerror(errno));
+        SCLogError("Couldn't query netmap for info about %s, error %s", ifname, strerror(errno));
         goto error_fd;
     };
 
@@ -297,15 +293,14 @@ static int NetmapOpen(NetmapIfaceSettings *ns, NetmapDevice **pdevice, int verbo
         int if_flags = GetIfaceFlags(base_name);
         if (if_flags == -1) {
             if (verbose) {
-                SCLogError(SC_ERR_NETMAP_CREATE, "Cannot access network interface '%s' (%s)",
-                        base_name, ns->iface);
+                SCLogError("Cannot access network interface '%s' (%s)", base_name, ns->iface);
             }
             goto error;
         }
 
         /* bring iface up if it is down */
         if ((if_flags & IFF_UP) == 0) {
-            SCLogError(SC_ERR_NETMAP_CREATE, "interface '%s' (%s) is down", base_name, ns->iface);
+            SCLogError("interface '%s' (%s) is down", base_name, ns->iface);
             goto error;
         }
         /* if needed, try to set iface in promisc mode */
@@ -318,7 +313,7 @@ static int NetmapOpen(NetmapIfaceSettings *ns, NetmapDevice **pdevice, int verbo
     NetmapDevice *pdev = NULL, *spdev = NULL;
     pdev = SCCalloc(1, sizeof(*pdev));
     if (unlikely(pdev == NULL)) {
-        SCLogError(SC_ENOMEM, "Memory allocation failed");
+        SCLogError("Memory allocation failed");
         goto error;
     }
     SC_ATOMIC_INIT(pdev->threads_run);
@@ -456,7 +451,7 @@ retry:
         }
 
         NetmapCloseAll();
-        FatalError(SC_ERR_FATAL, "opening devname %s failed: %s", devname, strerror(errno));
+        FatalError("opening devname %s failed: %s", devname, strerror(errno));
     }
 
     /* Work around bug in libnetmap library where "cur_{r,t}x_ring" values not initialized */
@@ -506,19 +501,19 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, const void *initdata, voi
 
     NetmapIfaceConfig *aconf = (NetmapIfaceConfig *)initdata;
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     NetmapThreadVars *ntv = SCCalloc(1, sizeof(*ntv));
     if (unlikely(ntv == NULL)) {
-        SCLogError(SC_ENOMEM, "Memory allocation failed");
+        SCLogError("Memory allocation failed");
         goto error;
     }
 
     ntv->livedev = LiveGetDevice(aconf->iface_name);
     if (ntv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         goto error_ntv;
     }
 
@@ -568,9 +563,7 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, const void *initdata, voi
                     errbuf,
                     sizeof(errbuf)) == -1)
         {
-            SCLogError(SC_ERR_NETMAP_CREATE, "Failed to compile BPF \"%s\": %s",
-                   aconf->in.bpf_filter,
-                   errbuf);
+            SCLogError("Failed to compile BPF \"%s\": %s", aconf->in.bpf_filter, errbuf);
             goto error_dst;
         }
     }
@@ -808,8 +801,7 @@ static TmEcode ReceiveNetmapLoop(ThreadVars *tv, void *data, void *slot)
         if (r < 0) {
             /* error */
             if (errno != EINTR)
-                SCLogError(SC_ERR_NETMAP_READ,
-                        "Error polling netmap from iface '%s': (%d" PRIu32 ") %s",
+                SCLogError("Error polling netmap from iface '%s': (%d" PRIu32 ") %s",
                         ntv->ifsrc->ifname, errno, strerror(errno));
             continue;
 
@@ -826,11 +818,11 @@ static TmEcode ReceiveNetmapLoop(ThreadVars *tv, void *data, void *slot)
 
         if (unlikely(fds.revents & POLL_EVENTS)) {
             if (fds.revents & POLLERR) {
-                SCLogError(SC_ERR_NETMAP_READ,
-                        "Error reading netmap data via polling from iface '%s': (%d" PRIu32 ") %s",
+                SCLogError("Error reading netmap data via polling from iface '%s': (%d" PRIu32
+                           ") %s",
                         ntv->ifsrc->ifname, errno, strerror(errno));
             } else if (fds.revents & POLLNVAL) {
-                SCLogError(SC_ERR_NETMAP_READ, "Invalid polling request");
+                SCLogError("Invalid polling request");
             }
             continue;
         }
index 70645306709bad6e827388d1703033fa13d26bf3..2d45bf15abe69e8ce6b825f285660dad0ab64a12 100644 (file)
@@ -60,8 +60,9 @@ void TmModuleDecodeNFLOGRegister (void)
 
 TmEcode NoNFLOGSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_NFLOG_NOSUPPORT,"Error creating thread %s: you do not have support for nflog "
-           "enabled please recompile with --enable-nflog", tv->name);
+    SCLogError("Error creating thread %s: you do not have support for nflog "
+               "enabled please recompile with --enable-nflog",
+            tv->name);
     exit(EXIT_FAILURE);
 }
 
@@ -168,7 +169,7 @@ static int NFLOGCallback(struct nflog_g_handle *gh, struct nfgenmsg *msg,
 
     if (ret > 0) {
         if (ret > 65536) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "NFLOG sent too big packet");
+            SCLogWarning("NFLOG sent too big packet");
             SET_PKT_LEN(p, 0);
         } else if (runmode_workers)
             PacketSetData(p, (uint8_t *)payload, ret);
@@ -212,7 +213,7 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
     NflogGroupConfig *nflconfig = (NflogGroupConfig *)initdata;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -233,7 +234,7 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
 
     ntv->h = nflog_open();
     if (ntv->h == NULL) {
-        SCLogError(SC_ERR_NFLOG_OPEN, "nflog_open() failed");
+        SCLogError("nflog_open() failed");
         SCFree(ntv);
         return TM_ECODE_FAILED;
     }
@@ -241,21 +242,21 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
     SCLogDebug("binding netfilter_log as nflog handler for AF_INET and AF_INET6");
 
     if (nflog_bind_pf(ntv->h, AF_INET) < 0) {
-        FatalError(SC_ERR_FATAL, "nflog_bind_pf() for AF_INET failed");
+        FatalError("nflog_bind_pf() for AF_INET failed");
     }
     if (nflog_bind_pf(ntv->h, AF_INET6) < 0) {
-        FatalError(SC_ERR_FATAL, "nflog_bind_pf() for AF_INET6 failed");
+        FatalError("nflog_bind_pf() for AF_INET6 failed");
     }
 
     ntv->gh = nflog_bind_group(ntv->h, ntv->group);
     if (!ntv->gh) {
-        SCLogError(SC_ERR_NFLOG_OPEN, "nflog_bind_group() failed");
+        SCLogError("nflog_bind_group() failed");
         SCFree(ntv);
         return TM_ECODE_FAILED;
     }
 
     if (nflog_set_mode(ntv->gh, NFULNL_COPY_PACKET, 0xFFFF) < 0) {
-        SCLogError(SC_ERR_NFLOG_SET_MODE, "can't set packet_copy mode");
+        SCLogError("can't set packet_copy mode");
         SCFree(ntv);
         return TM_ECODE_FAILED;
     }
@@ -265,8 +266,9 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
     if (ntv->nlbufsiz < ntv->nlbufsiz_max)
         ntv->nlbufsiz = nfnl_rcvbufsiz(nflog_nfnlh(ntv->h), ntv->nlbufsiz);
     else {
-        SCLogError(SC_ERR_NFLOG_MAX_BUFSIZ, "Maximum buffer size (%d) in NFLOG "
-                                            "has been reached", ntv->nlbufsiz);
+        SCLogError("Maximum buffer size (%d) in NFLOG "
+                   "has been reached",
+                ntv->nlbufsiz);
         return TM_ECODE_FAILED;
     }
 
@@ -286,7 +288,7 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
 
     ntv->livedev = LiveGetDevice(nflconfig->numgroup);
     if (ntv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         SCFree(ntv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -299,8 +301,9 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
 
     int fd = nflog_fd(ntv->h);
     if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev)) == -1) {
-        SCLogWarning(SC_WARN_NFLOG_SETSOCKOPT, "can't set socket "
-                "timeout: %s", strerror(errno));
+        SCLogWarning("can't set socket "
+                     "timeout: %s",
+                strerror(errno));
     }
 
 #ifdef PACKET_STATISTICS
@@ -347,11 +350,11 @@ TmEcode ReceiveNFLOGThreadDeinit(ThreadVars *tv, void *data)
 
     SCLogDebug("closing nflog group %d", ntv->group);
     if (nflog_unbind_pf(ntv->h, AF_INET) < 0) {
-        FatalError(SC_ERR_FATAL, "nflog_unbind_pf() for AF_INET failed");
+        FatalError("nflog_unbind_pf() for AF_INET failed");
     }
 
     if (nflog_unbind_pf(ntv->h, AF_INET6) < 0) {
-        FatalError(SC_ERR_FATAL, "nflog_unbind_pf() for AF_INET6 failed");
+        FatalError("nflog_unbind_pf() for AF_INET6 failed");
     }
 
     if (ntv->gh) {
@@ -394,11 +397,10 @@ static int NFLOGSetnlbufsiz(void *data, unsigned int size)
         return 1;
     }
 
-    SCLogWarning(SC_WARN_NFLOG_MAXBUFSIZ_REACHED,
-                 "Maximum buffer size (%d) in NFLOG has been "
+    SCLogWarning("Maximum buffer size (%d) in NFLOG has been "
                  "reached. Please, consider raising "
                  "`buffer-size` and `max-size` in nflog configuration",
-                 ntv->nlbufsiz);
+            ntv->nlbufsiz);
     return 0;
 
 }
@@ -426,7 +428,7 @@ TmEcode ReceiveNFLOGLoop(ThreadVars *tv, void *data, void *slot)
 
     fd = nflog_fd(ntv->h);
     if (fd < 0) {
-        SCLogError(SC_ERR_NFLOG_FD, "Can't obtain a file descriptor");
+        SCLogError("Can't obtain a file descriptor");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -448,27 +450,24 @@ TmEcode ReceiveNFLOGLoop(ThreadVars *tv, void *data, void *slot)
                 if (!ntv->nful_overrun_warned) {
                     int s = ntv->nlbufsiz * 2;
                     if (NFLOGSetnlbufsiz((void *)ntv, s)) {
-                        SCLogWarning(SC_WARN_NFLOG_LOSING_EVENTS,
-                                "We are losing events, "
-                                "increasing buffer size "
-                                "to %d", ntv->nlbufsiz);
+                        SCLogWarning("We are losing events, "
+                                     "increasing buffer size "
+                                     "to %d",
+                                ntv->nlbufsiz);
                     } else {
                         ntv->nful_overrun_warned = 1;
                     }
                 }
                 continue;
             } else {
-                SCLogWarning(SC_WARN_NFLOG_RECV,
-                             "Read from NFLOG fd failed: %s",
-                             strerror(errno));
+                SCLogWarning("Read from NFLOG fd failed: %s", strerror(errno));
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
 
         ret = nflog_handle_packet(ntv->h, ntv->data, rv);
         if (ret != 0)
-            SCLogWarning(SC_ERR_NFLOG_HANDLE_PKT,
-                         "nflog_handle_packet error %" PRId32 "", ret);
+            SCLogWarning("nflog_handle_packet error %" PRId32 "", ret);
 
         StatsSyncCountersIfSignalled(tv);
     }
index a9d34813bff04610cff6bc094a2a031e36403d05..337d74bafbe540f6dde4b97a064b620a3417aaa9 100644 (file)
@@ -89,9 +89,10 @@ void TmModuleDecodeNFQRegister (void)
 
 static TmEcode NoNFQSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    FatalError(SC_ERR_NFQ_NOSUPPORT,"Error creating thread %s: you do not "
-            "have support for nfqueue enabled please recompile with "
-            "--enable-nfqueue", tv->name);
+    FatalError("Error creating thread %s: you do not "
+               "have support for nfqueue enabled please recompile with "
+               "--enable-nfqueue",
+            tv->name);
 }
 
 #else /* we do have NFQ support */
@@ -223,7 +224,7 @@ void NFQInitConfig(bool quiet)
         }  else if (!strcmp("route", nfq_mode)) {
             nfq_config.mode = NFQ_ROUTE_MODE;
         } else {
-            FatalError(SC_ERR_FATAL, "Unknown nfq.mode");
+            FatalError("Unknown nfq.mode");
         }
     }
 
@@ -233,8 +234,7 @@ void NFQInitConfig(bool quiet)
         SCLogInfo("Enabling fail-open on queue");
         nfq_config.flags |= NFQ_FLAG_FAIL_OPEN;
 #else
-        SCLogError(SC_ERR_NFQ_NOSUPPORT,
-                   "nfq.%s set but NFQ library has no support for it.", "fail-open");
+        SCLogError("nfq.%s set but NFQ library has no support for it.", "fail-open");
 #endif
     }
 
@@ -261,14 +261,13 @@ void NFQInitConfig(bool quiet)
     if ((ConfGetInt("nfq.batchcount", &value)) == 1) {
 #ifdef HAVE_NFQ_SET_VERDICT_BATCH
         if (value > 255) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "nfq.batchcount cannot exceed 255.");
+            SCLogWarning("nfq.batchcount cannot exceed 255.");
             value = 255;
         }
         if (value > 1)
             nfq_config.batchcount = (uint8_t) (value - 1);
 #else
-        SCLogWarning(SC_ERR_NFQ_NOSUPPORT,
-                   "nfq.%s set but NFQ library has no support for it.", "batchcount");
+        SCLogWarning("nfq.%s set but NFQ library has no support for it.", "batchcount");
 #endif
     }
 
@@ -318,8 +317,7 @@ static void NFQVerdictCacheFlush(NFQQueueVars *t)
     } while ((ret < 0) && (iter++ < NFQ_VERDICT_RETRY_TIME));
 
     if (ret < 0) {
-        SCLogWarning(SC_ERR_NFQ_SET_VERDICT, "nfq_set_verdict_batch failed: %s",
-                     strerror(errno));
+        SCLogWarning("nfq_set_verdict_batch failed: %s", strerror(errno));
     } else {
         t->verdict_cache.len = 0;
         t->verdict_cache.mark_valid = 0;
@@ -427,9 +425,8 @@ static int NFQSetupPkt (Packet *p, struct nfq_q_handle *qh, void *data)
                 ret = nfq_set_verdict(qh, p->nfq_v.id, NF_ACCEPT, 0, NULL);
             } while ((ret < 0) && (iter++ < NFQ_VERDICT_RETRY_TIME));
             if (ret < 0) {
-                SCLogWarning(SC_ERR_NFQ_SET_VERDICT,
-                             "nfq_set_verdict of %p failed %" PRId32 ": %s",
-                             p, ret, strerror(errno));
+                SCLogWarning(
+                        "nfq_set_verdict of %p failed %" PRId32 ": %s", p, ret, strerror(errno));
             }
             return -1 ;
         }
@@ -451,7 +448,7 @@ static int NFQSetupPkt (Packet *p, struct nfq_q_handle *qh, void *data)
             /* Will not be able to copy data ! Set length to 0
              * to trigger an error in packet decoding.
              * This is unlikely to happen */
-            SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "NFQ sent too big packet");
+            SCLogWarning("NFQ sent too big packet");
             SET_PKT_LEN(p, 0);
         } else if (runmode_workers) {
             PacketSetData(p, (uint8_t *)pktdata, ret);
@@ -571,13 +568,13 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
     int opt;
     NFQQueueVars *q = NFQGetQueue(t->nfq_index);
     if (q == NULL) {
-        SCLogError(SC_ERR_NFQ_OPEN, "no queue for given index");
+        SCLogError("no queue for given index");
         return TM_ECODE_FAILED;
     }
     SCLogDebug("opening library handle");
     q->h = nfq_open();
     if (q->h == NULL) {
-        SCLogError(SC_ERR_NFQ_OPEN, "nfq_open() failed");
+        SCLogError("nfq_open() failed");
         return TM_ECODE_FAILED;
     }
 
@@ -587,20 +584,20 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
          * run. Ignoring the error seems to have no bad effects. */
         SCLogDebug("unbinding existing nf_queue handler for AF_INET (if any)");
         if (nfq_unbind_pf(q->h, AF_INET) < 0) {
-            FatalError(SC_ERR_FATAL, "nfq_unbind_pf() for AF_INET failed");
+            FatalError("nfq_unbind_pf() for AF_INET failed");
         }
         if (nfq_unbind_pf(q->h, AF_INET6) < 0) {
-            FatalError(SC_ERR_FATAL, "nfq_unbind_pf() for AF_INET6 failed");
+            FatalError("nfq_unbind_pf() for AF_INET6 failed");
         }
         nfq_g.unbind = 1;
 
         SCLogDebug("binding nfnetlink_queue as nf_queue handler for AF_INET and AF_INET6");
 
         if (nfq_bind_pf(q->h, AF_INET) < 0) {
-            FatalError(SC_ERR_FATAL, "nfq_bind_pf() for AF_INET failed");
+            FatalError("nfq_bind_pf() for AF_INET failed");
         }
         if (nfq_bind_pf(q->h, AF_INET6) < 0) {
-            FatalError(SC_ERR_FATAL, "nfq_bind_pf() for AF_INET6 failed");
+            FatalError("nfq_bind_pf() for AF_INET6 failed");
         }
     }
 
@@ -610,7 +607,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
      * callback function has access to it. */
     q->qh = nfq_create_queue(q->h, q->queue_num, &NFQCallBack, (void *)t);
     if (q->qh == NULL) {
-        SCLogError(SC_ERR_NFQ_CREATE_QUEUE, "nfq_create_queue failed");
+        SCLogError("nfq_create_queue failed");
         return TM_ECODE_FAILED;
     }
 
@@ -619,7 +616,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
     /* 05DC = 1500 */
     //if (nfq_set_mode(nfq_t->qh, NFQNL_COPY_PACKET, 0x05DC) < 0) {
     if (nfq_set_mode(q->qh, NFQNL_COPY_PACKET, 0xFFFF) < 0) {
-        SCLogError(SC_ERR_NFQ_SET_MODE, "can't set packet_copy mode");
+        SCLogError("can't set packet_copy mode");
         return TM_ECODE_FAILED;
     }
 
@@ -629,8 +626,8 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
 
         /* non-fatal if it fails */
         if (nfq_set_queue_maxlen(q->qh, queue_maxlen) < 0) {
-            SCLogWarning(SC_ERR_NFQ_MAXLEN, "can't set queue maxlen: your kernel probably "
-                    "doesn't support setting the queue length");
+            SCLogWarning("can't set queue maxlen: your kernel probably "
+                         "doesn't support setting the queue length");
         }
     }
 #endif /* HAVE_NFQ_MAXLEN */
@@ -649,9 +646,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
 #ifdef NETLINK_BROADCAST_SEND_ERROR
     if (setsockopt(q->fd, SOL_NETLINK,
                    NETLINK_BROADCAST_SEND_ERROR, &opt, sizeof(int)) == -1) {
-        SCLogWarning(SC_ERR_NFQ_SETSOCKOPT,
-                     "can't set netlink broadcast error: %s",
-                     strerror(errno));
+        SCLogWarning("can't set netlink broadcast error: %s", strerror(errno));
     }
 #endif
     /* Don't send error about no buffer space available but drop the
@@ -659,9 +654,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
 #ifdef NETLINK_NO_ENOBUFS
     if (setsockopt(q->fd, SOL_NETLINK,
                    NETLINK_NO_ENOBUFS, &opt, sizeof(int)) == -1) {
-        SCLogWarning(SC_ERR_NFQ_SETSOCKOPT,
-                     "can't set netlink enobufs: %s",
-                     strerror(errno));
+        SCLogWarning("can't set netlink enobufs: %s", strerror(errno));
     }
 #endif
 
@@ -672,8 +665,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
         int r = nfq_set_queue_flags(q->qh, mask, flags);
 
         if (r == -1) {
-            SCLogWarning(SC_ERR_NFQ_SET_MODE, "can't set fail-open mode: %s",
-                         strerror(errno));
+            SCLogWarning("can't set fail-open mode: %s", strerror(errno));
         } else {
             SCLogInfo("fail-open mode should be set on queue");
         }
@@ -684,7 +676,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
     if (runmode_workers) {
         q->verdict_cache.maxlen = nfq_config.batchcount;
     } else if (nfq_config.batchcount) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "nfq.batchcount is only valid in workers runmode.");
+        SCLogError("nfq.batchcount is only valid in workers runmode.");
     }
 #endif
 
@@ -694,7 +686,7 @@ static TmEcode NFQInitThread(NFQThreadVars *t, uint32_t queue_maxlen)
     tv.tv_usec = 0;
 
     if(setsockopt(q->fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) {
-        SCLogWarning(SC_ERR_NFQ_SETSOCKOPT, "can't set socket timeout: %s", strerror(errno));
+        SCLogWarning("can't set socket timeout: %s", strerror(errno));
     }
 
     SCLogDebug("nfq_q->h %p, nfq_q->nh %p, nfq_q->qh %p, nfq_q->fd %" PRId32 "",
@@ -718,7 +710,7 @@ TmEcode ReceiveNFQThreadInit(ThreadVars *tv, const void *initdata, void **data)
 
     int r = NFQInitThread(ntv, (max_pending_packets * NFQ_BURST_FACTOR));
     if (r != TM_ECODE_OK) {
-        SCLogError(SC_ERR_NFQ_THREAD_INIT, "nfq thread failed to initialize");
+        SCLogError("nfq thread failed to initialize");
 
         SCMutexUnlock(&nfq_init_lock);
         exit(EXIT_FAILURE);
@@ -811,22 +803,19 @@ int NFQRegisterQueue(const uint16_t number)
     uint16_t num_cpus = UtilCpuGetNumProcessorsOnline();
 
     if (g_nfq_t == NULL || g_nfq_q == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "NFQ context is not initialized");
+        SCLogError("NFQ context is not initialized");
         return -1;
     }
 
     SCMutexLock(&nfq_init_lock);
     if (!many_queues_warned && (receive_queue_num >= num_cpus)) {
-        SCLogWarning(SC_WARN_UNCOMMON,
-                     "using more Netfilter queues than %hu available CPU core(s) "
+        SCLogWarning("using more Netfilter queues than %hu available CPU core(s) "
                      "may degrade performance",
-                     num_cpus);
+                num_cpus);
         many_queues_warned = true;
     }
     if (receive_queue_num >= NFQ_MAX_QUEUE) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "can not register more than %d Netfilter queues",
-                   NFQ_MAX_QUEUE);
+        SCLogError("can not register more than %d Netfilter queues", NFQ_MAX_QUEUE);
         SCMutexUnlock(&nfq_init_lock);
         return -1;
     }
@@ -845,7 +834,7 @@ int NFQRegisterQueue(const uint16_t number)
     ntv->livedev = LiveGetDevice(queue);
 
     if (ntv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         return -1;
     }
 
@@ -871,8 +860,9 @@ int NFQParseAndRegisterQueues(const char *queues)
     int count = sscanf(queues, "%hu:%hu", &queue_start, &queue_end);
 
     if (count < 1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "specified queue(s) argument '%s' is not "
-                                            "valid (allowed queue numbers are 0-65535)", queues);
+        SCLogError("specified queue(s) argument '%s' is not "
+                   "valid (allowed queue numbers are 0-65535)",
+                queues);
         return -1;
     }
 
@@ -880,8 +870,9 @@ int NFQParseAndRegisterQueues(const char *queues)
     if (count == 2) {
         // Sanity check
         if (queue_start > queue_end) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "start queue's number %d is greater than "
-                                            "ending number %d", queue_start, queue_end);
+            SCLogError("start queue's number %d is greater than "
+                       "ending number %d",
+                    queue_start, queue_end);
             return -1;
         }
 
@@ -891,7 +882,7 @@ int NFQParseAndRegisterQueues(const char *queues)
     // We do realloc() to preserve previously registered queues
     void *ptmp = SCRealloc(g_nfq_t, (receive_queue_num + num_queues) * sizeof(NFQThreadVars));
     if (ptmp == NULL) {
-        SCLogError(SC_ENOMEM, "Unable to allocate NFQThreadVars");
+        SCLogError("Unable to allocate NFQThreadVars");
         NFQContextsClean();
         exit(EXIT_FAILURE);
     }
@@ -900,7 +891,7 @@ int NFQParseAndRegisterQueues(const char *queues)
 
     ptmp = SCRealloc(g_nfq_q, (receive_queue_num + num_queues) * sizeof(NFQQueueVars));
     if (ptmp == NULL) {
-        SCLogError(SC_ENOMEM, "Unable to allocate NFQQueueVars");
+        SCLogError("Unable to allocate NFQQueueVars");
         NFQContextsClean();
         exit(EXIT_FAILURE);
     }
@@ -977,7 +968,7 @@ static void NFQRecvPkt(NFQQueueVars *t, NFQThreadVars *tv)
 #endif /* COUNTERS */
         }
     } else if(rv == 0) {
-        SCLogWarning(SC_ERR_NFQ_RECV, "recv got returncode 0");
+        SCLogWarning("recv got returncode 0");
     } else {
 #ifdef DBG_PERF
         if (rv > t->dbg_maxreadsize)
@@ -988,7 +979,7 @@ static void NFQRecvPkt(NFQQueueVars *t, NFQThreadVars *tv)
         if (t->qh != NULL) {
             ret = nfq_handle_packet(t->h, tv->data, rv);
         } else {
-            SCLogWarning(SC_ERR_NFQ_HANDLE_PKT, "NFQ handle has been destroyed");
+            SCLogWarning("NFQ handle has been destroyed");
             ret = -1;
         }
         NFQMutexUnlock(t);
@@ -1180,9 +1171,7 @@ TmEcode NFQSetVerdict(Packet *p)
     NFQMutexUnlock(t);
 
     if (ret < 0) {
-        SCLogWarning(SC_ERR_NFQ_SET_VERDICT,
-                     "nfq_set_verdict of %p failed %" PRId32 ": %s",
-                     p, ret, strerror(errno));
+        SCLogWarning("nfq_set_verdict of %p failed %" PRId32 ": %s", p, ret, strerror(errno));
         return TM_ECODE_FAILED;
     }
     return TM_ECODE_OK;
index d409810b285166409977f655405a948ca5a6a64a..d701cc7405a24aee5fa17212de355da1ae2bf63e 100644 (file)
@@ -133,11 +133,11 @@ TmEcode PcapDirectoryFailure(PcapFileDirectoryVars *ptv)
     TmEcode status = TM_ECODE_FAILED;
 
     if (unlikely(ptv == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Directory vars was null");
+        SCLogError("Directory vars was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
     if (unlikely(ptv->shared == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Directory shared vars was null");
+        SCLogError("Directory shared vars was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -153,11 +153,11 @@ TmEcode PcapDirectoryDone(PcapFileDirectoryVars *ptv)
     TmEcode status = TM_ECODE_DONE;
 
     if (unlikely(ptv == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Directory vars was null");
+        SCLogError("Directory vars was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
     if (unlikely(ptv->shared == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Directory shared vars was null");
+        SCLogError("Directory shared vars was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -178,36 +178,26 @@ TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory)
     if (temp_dir == NULL) {//if null, our filename may just be a normal file
         switch (errno) {
             case EACCES:
-                SCLogError(SC_ERR_FOPEN, "%s: Permission denied", filename);
+                SCLogError("%s: Permission denied", filename);
                 break;
 
             case EBADF:
-                SCLogError(SC_ERR_FOPEN,
-                           "%s: Not a valid file descriptor opened for reading",
-                           filename);
+                SCLogError("%s: Not a valid file descriptor opened for reading", filename);
                 break;
 
             case EMFILE:
-                SCLogError(SC_ERR_FOPEN,
-                           "%s: Per process open file descriptor limit reached",
-                           filename);
+                SCLogError("%s: Per process open file descriptor limit reached", filename);
                 break;
 
             case ENFILE:
-                SCLogError(SC_ERR_FOPEN,
-                           "%s: System wide open file descriptor limit reached",
-                           filename);
+                SCLogError("%s: System wide open file descriptor limit reached", filename);
                 break;
 
             case ENOENT:
-                SCLogError(SC_ERR_FOPEN,
-                           "%s: Does not exist, or name is an empty string",
-                           filename);
+                SCLogError("%s: Does not exist, or name is an empty string", filename);
                 break;
             case ENOMEM:
-                SCLogError(SC_ERR_FOPEN,
-                           "%s: Insufficient memory to complete the operation",
-                           filename);
+                SCLogError("%s: Insufficient memory to complete the operation", filename);
                 break;
 
             case ENOTDIR: //no error checking the directory, just is a plain file
@@ -216,7 +206,7 @@ TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory)
                 break;
 
             default:
-                SCLogError(SC_ERR_FOPEN, "%s: %" PRId32, filename, errno);
+                SCLogError("%s: %" PRId32, filename, errno);
         }
     } else {
         //no error, filename references a directory
@@ -267,17 +257,17 @@ TmEcode PcapDirectoryInsertFile(PcapFileDirectoryVars *pv,
     PendingFile *next_file_to_compare = NULL;
 
     if (unlikely(pv == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "No directory vars passed");
+        SCLogError("No directory vars passed");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (unlikely(file_to_add == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "File passed was null");
+        SCLogError("File passed was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (unlikely(file_to_add->filename == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "File was passed with null filename");
+        SCLogError("File was passed with null filename");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -309,11 +299,11 @@ TmEcode PcapDirectoryPopulateBuffer(PcapFileDirectoryVars *pv,
                                     struct timespec *older_than
 ) {
     if (unlikely(pv == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "No directory vars passed");
+        SCLogError("No directory vars passed");
         SCReturnInt(TM_ECODE_FAILED);
     }
     if (unlikely(pv->filename == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "No directory filename was passed");
+        SCLogError("No directory filename was passed");
         SCReturnInt(TM_ECODE_FAILED);
     }
     struct dirent * dir = NULL;
@@ -337,7 +327,7 @@ TmEcode PcapDirectoryPopulateBuffer(PcapFileDirectoryVars *pv,
         written = snprintf(pathbuff, PATH_MAX, "%s/%s", pv->filename, dir->d_name);
 
         if (written <= 0 || written >= PATH_MAX) {
-            SCLogError(SC_ERR_SPRINTF, "Could not write path");
+            SCLogError("Could not write path");
 
             SCReturnInt(TM_ECODE_FAILED);
         } else {
@@ -367,14 +357,14 @@ TmEcode PcapDirectoryPopulateBuffer(PcapFileDirectoryVars *pv,
 
             file_to_add = SCCalloc(1, sizeof(PendingFile));
             if (unlikely(file_to_add == NULL)) {
-                SCLogError(SC_ENOMEM, "Failed to allocate pending file");
+                SCLogError("Failed to allocate pending file");
 
                 SCReturnInt(TM_ECODE_FAILED);
             }
 
             file_to_add->filename = SCStrdup(pathbuff);
             if (unlikely(file_to_add->filename == NULL)) {
-                SCLogError(SC_ENOMEM, "Failed to copy filename");
+                SCLogError("Failed to copy filename");
                 CleanupPendingFile(file_to_add);
 
                 SCReturnInt(TM_ECODE_FAILED);
@@ -387,7 +377,7 @@ TmEcode PcapDirectoryPopulateBuffer(PcapFileDirectoryVars *pv,
                        (uintmax_t)SCTimespecAsEpochMillis(&file_to_add->modified_time));
 
             if (PcapDirectoryInsertFile(pv, file_to_add) == TM_ECODE_FAILED) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "Failed to add file");
+                SCLogError("Failed to add file");
                 CleanupPendingFile(file_to_add);
 
                 SCReturnInt(TM_ECODE_FAILED);
@@ -403,7 +393,7 @@ TmEcode PcapDirectoryDispatchForTimeRange(PcapFileDirectoryVars *pv,
                                           struct timespec *older_than)
 {
     if (PcapDirectoryPopulateBuffer(pv, older_than) == TM_ECODE_FAILED) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Failed to populate directory buffer");
+        SCLogError("Failed to populate directory buffer");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -426,31 +416,29 @@ TmEcode PcapDirectoryDispatchForTimeRange(PcapFileDirectoryVars *pv,
             TAILQ_REMOVE(&pv->directory_content, current_file, next);
 
             if (unlikely(current_file == NULL)) {
-                SCLogWarning(SC_ERR_PCAP_DISPATCH, "Current file was null");
+                SCLogWarning("Current file was null");
             } else if (unlikely(current_file->filename == NULL)) {
-                SCLogWarning(SC_ERR_PCAP_DISPATCH, "Current file filename was null");
+                SCLogWarning("Current file filename was null");
             } else {
                 SCLogDebug("Processing file %s", current_file->filename);
 
                 PcapFileFileVars *pftv = SCMalloc(sizeof(PcapFileFileVars));
                 if (unlikely(pftv == NULL)) {
-                    SCLogError(SC_ENOMEM, "Failed to allocate PcapFileFileVars");
+                    SCLogError("Failed to allocate PcapFileFileVars");
                     SCReturnInt(TM_ECODE_FAILED);
                 }
                 memset(pftv, 0, sizeof(PcapFileFileVars));
 
                 pftv->filename = SCStrdup(current_file->filename);
                 if (unlikely(pftv->filename == NULL)) {
-                    SCLogError(SC_ENOMEM, "Failed to allocate filename");
+                    SCLogError("Failed to allocate filename");
                     CleanupPcapFileFileVars(pftv);
                     SCReturnInt(TM_ECODE_FAILED);
                 }
                 pftv->shared = pv->shared;
 
                 if (InitPcapFile(pftv) == TM_ECODE_FAILED) {
-                    SCLogWarning(SC_ERR_PCAP_DISPATCH,
-                                 "Failed to init pcap file %s, skipping",
-                                 current_file->filename);
+                    SCLogWarning("Failed to init pcap file %s, skipping", current_file->filename);
                     CleanupPendingFile(current_file);
                     CleanupPcapFileFileVars(pftv);
                     status = TM_ECODE_OK;
@@ -544,7 +532,7 @@ TmEcode PcapDirectoryDispatch(PcapFileDirectoryVars *ptv)
     StatsSyncCountersIfSignalled(ptv->shared->tv);
 
     if (status == TM_ECODE_FAILED) {
-        SCLogError(SC_ERR_PCAP_DISPATCH, "Directory %s run mode failed", ptv->filename);
+        SCLogError("Directory %s run mode failed", ptv->filename);
         status = PcapDirectoryFailure(ptv);
     } else {
         SCLogInfo("Directory run mode complete");
index 91341facfb2a616d7f2b784d572fcb0ef102e065..3eeb9919e5aedff27dfa2cd4c42ceaf32d44947f 100644 (file)
@@ -47,8 +47,7 @@ void CleanupPcapFileFileVars(PcapFileFileVars *pfv)
             if (pfv->shared != NULL && pfv->shared->should_delete) {
                 SCLogDebug("Deleting pcap file %s", pfv->filename);
                 if (unlink(pfv->filename) != 0) {
-                    SCLogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED,
-                                 "Failed to delete %s", pfv->filename);
+                    SCLogWarning("Failed to delete %s", pfv->filename);
                 }
             }
             SCFree(pfv->filename);
@@ -155,8 +154,8 @@ TmEcode PcapFileDispatch(PcapFileFileVars *ptv)
         int r = pcap_dispatch(ptv->pcap_handle, packet_q_len,
                           (pcap_handler)PcapFileCallbackLoop, (u_char *)ptv);
         if (unlikely(r == -1)) {
-            SCLogError(SC_ERR_PCAP_DISPATCH, "error code %" PRId32 " %s for %s",
-                       r, pcap_geterr(ptv->pcap_handle), ptv->filename);
+            SCLogError("error code %" PRId32 " %s for %s", r, pcap_geterr(ptv->pcap_handle),
+                    ptv->filename);
             if (ptv->shared->cb_result == TM_ECODE_FAILED) {
                 SCReturnInt(TM_ECODE_FAILED);
             }
@@ -167,8 +166,7 @@ TmEcode PcapFileDispatch(PcapFileFileVars *ptv)
             ptv->shared->files++;
             loop_result = TM_ECODE_DONE;
         } else if (ptv->shared->cb_result == TM_ECODE_FAILED) {
-            SCLogError(SC_ERR_PCAP_DISPATCH,
-                       "Pcap callback PcapFileCallbackLoop failed for %s", ptv->filename);
+            SCLogError("Pcap callback PcapFileCallbackLoop failed for %s", ptv->filename);
             loop_result = TM_ECODE_FAILED;
         }
         StatsSyncCountersIfSignalled(ptv->shared->tv);
@@ -186,8 +184,7 @@ static bool PeekFirstPacketTimestamp(PcapFileFileVars *pfv)
 {
     int r = pcap_next_ex(pfv->pcap_handle, &pfv->first_pkt_hdr, &pfv->first_pkt_data);
     if (r <= 0 || pfv->first_pkt_hdr == NULL) {
-        SCLogError(SC_ERR_PCAP_OPEN_OFFLINE,
-                "failed to get first packet timestamp. pcap_next_ex(): %d", r);
+        SCLogError("failed to get first packet timestamp. pcap_next_ex(): %d", r);
         return false;
     }
     /* timestamp in pfv->first_pkt_hdr may not be 'struct timeval' so
@@ -202,13 +199,13 @@ TmEcode InitPcapFile(PcapFileFileVars *pfv)
     char errbuf[PCAP_ERRBUF_SIZE] = "";
 
     if(unlikely(pfv->filename == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Filename was null");
+        SCLogError("Filename was null");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     pfv->pcap_handle = pcap_open_offline(pfv->filename, errbuf);
     if (pfv->pcap_handle == NULL) {
-        SCLogError(SC_ERR_FOPEN, "%s", errbuf);
+        SCLogError("%s", errbuf);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -216,14 +213,14 @@ TmEcode InitPcapFile(PcapFileFileVars *pfv)
         SCLogInfo("using bpf-filter \"%s\"", pfv->shared->bpf_string);
 
         if (pcap_compile(pfv->pcap_handle, &pfv->filter, pfv->shared->bpf_string, 1, 0) < 0) {
-            SCLogError(SC_ERR_BPF, "bpf compilation error %s for %s",
-                       pcap_geterr(pfv->pcap_handle), pfv->filename);
+            SCLogError("bpf compilation error %s for %s", pcap_geterr(pfv->pcap_handle),
+                    pfv->filename);
             SCReturnInt(TM_ECODE_FAILED);
         }
 
         if (pcap_setfilter(pfv->pcap_handle, &pfv->filter) < 0) {
-            SCLogError(SC_ERR_BPF,"could not set bpf filter %s for %s",
-                       pcap_geterr(pfv->pcap_handle), pfv->filename);
+            SCLogError("could not set bpf filter %s for %s", pcap_geterr(pfv->pcap_handle),
+                    pfv->filename);
             pcap_freecode(&pfv->filter);
             SCReturnInt(TM_ECODE_FAILED);
         }
@@ -268,9 +265,8 @@ TmEcode ValidateLinkType(int datalink, DecoderFunc *DecoderFn)
             break;
 
         default:
-            SCLogError(SC_ERR_UNIMPLEMENTED,
-                    "datalink type %"PRId32" not (yet) supported in module PcapFile.",
-                    datalink);
+            SCLogError(
+                    "datalink type %" PRId32 " not (yet) supported in module PcapFile.", datalink);
             SCReturnInt(TM_ECODE_FAILED);
     }
 
index 67987102e2b0b19a3348064911a6e6d697daf2c3..5730d4ae85c6ca185d11a0eed3326b2459e0fb89 100644 (file)
@@ -157,7 +157,7 @@ TmEcode ReceivePcapFileLoop(ThreadVars *tv, void *data, void *slot)
     SCEnter();
 
     if(unlikely(data == NULL)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "pcap file reader thread failed to initialize");
+        SCLogError("pcap file reader thread failed to initialize");
 
         PcapFileExit(TM_ECODE_FAILED, NULL);
 
@@ -200,7 +200,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
     const char *tmp_bpf_string = NULL;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "error: initdata == NULL");
+        SCLogError("error: initdata == NULL");
 
         SCReturnInt(TM_ECODE_OK);
     }
@@ -218,7 +218,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
             ptv->shared.tenant_id = (uint32_t)tenant;
             SCLogInfo("tenant %u", ptv->shared.tenant_id);
         } else {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "tenant out of range");
+            SCLogError("tenant out of range");
         }
     }
 
@@ -227,7 +227,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
     } else {
         ptv->shared.bpf_string = SCStrdup(tmp_bpf_string);
         if (unlikely(ptv->shared.bpf_string == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate bpf_string");
+            SCLogError("Failed to allocate bpf_string");
 
             CleanupPcapFileThreadVars(ptv);
 
@@ -252,7 +252,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
         SCLogDebug("argument %s was a file", (char *)initdata);
         PcapFileFileVars *pv = SCMalloc(sizeof(PcapFileFileVars));
         if (unlikely(pv == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate file vars");
+            SCLogError("Failed to allocate file vars");
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_OK);
         }
@@ -260,7 +260,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
 
         pv->filename = SCStrdup((char *)initdata);
         if (unlikely(pv->filename == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate filename");
+            SCLogError("Failed to allocate filename");
             CleanupPcapFileFileVars(pv);
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_OK);
@@ -272,8 +272,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
             ptv->is_directory = 0;
             ptv->behavior.file = pv;
         } else {
-            SCLogWarning(SC_ERR_PCAP_DISPATCH,
-                         "Failed to init pcap file %s, skipping", pv->filename);
+            SCLogWarning("Failed to init pcap file %s, skipping", pv->filename);
             CleanupPcapFileFileVars(pv);
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_OK);
@@ -282,7 +281,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
         SCLogInfo("Argument %s was a directory", (char *)initdata);
         PcapFileDirectoryVars *pv = SCMalloc(sizeof(PcapFileDirectoryVars));
         if (unlikely(pv == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate directory vars");
+            SCLogError("Failed to allocate directory vars");
             closedir(directory);
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_OK);
@@ -291,7 +290,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
 
         pv->filename = SCStrdup((char*)initdata);
         if (unlikely(pv->filename == NULL)) {
-            SCLogError(SC_ENOMEM, "Failed to allocate filename");
+            SCLogError("Failed to allocate filename");
             CleanupPcapFileDirectoryVars(pv);
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_OK);
@@ -311,8 +310,8 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
         }
 
         if (pv->should_recurse == true && pv->should_loop == true) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Error, --pcap-file-continuous and --pcap-file-recursive "
-                                                "cannot be used together.");
+            SCLogError("Error, --pcap-file-continuous and --pcap-file-recursive "
+                       "cannot be used together.");
             CleanupPcapFileDirectoryVars(pv);
             CleanupPcapFileThreadVars(ptv);
             SCReturnInt(TM_ECODE_FAILED);
@@ -325,7 +324,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
                 pv->delay = (time_t)delay;
                 SCLogDebug("delay %lu", pv->delay);
             } else {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "delay out of range");
+                SCLogError("delay out of range");
             }
         }
 
@@ -336,7 +335,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d
                 pv->poll_interval = (time_t)poll_interval;
                 SCLogDebug("poll-interval %lu", pv->delay);
             } else {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "poll-interval out of range");
+                SCLogError("poll-interval out of range");
             }
         }
 
@@ -378,11 +377,10 @@ void ReceivePcapFileThreadExitStats(ThreadVars *tv, void *data)
             SC_ATOMIC_GET(pcap_g.invalid_checksums)) {
             uint64_t chrate = pcap_g.cnt / SC_ATOMIC_GET(pcap_g.invalid_checksums);
             if (chrate < CHECKSUM_INVALID_RATIO)
-                SCLogWarning(SC_ERR_INVALID_CHECKSUM,
-                         "1/%" PRIu64 "th of packets have an invalid checksum,"
-                                 " consider setting pcap-file.checksum-checks variable to no"
-                                 " or use '-k none' option on command line.",
-                         chrate);
+                SCLogWarning("1/%" PRIu64 "th of packets have an invalid checksum,"
+                             " consider setting pcap-file.checksum-checks variable to no"
+                             " or use '-k none' option on command line.",
+                        chrate);
             else
                 SCLogInfo("1/%" PRIu64 "th of packets have an invalid checksum",
                       chrate);
index 9f59cde2848249c5f1eb6a3c6e3e881c20bac28d..da3570515722c39d8bde8b6077f84bb60abe71b4 100644 (file)
@@ -218,14 +218,12 @@ static int PcapTryReopen(PcapThreadVars *ptv)
         if (pcap_compile(ptv->pcap_handle, &ptv->filter,
                     (char *)ptv->bpf_filter, 1, 0) < 0)
         {
-            SCLogError(SC_ERR_BPF, "bpf compilation error %s",
-                    pcap_geterr(ptv->pcap_handle));
+            SCLogError("bpf compilation error %s", pcap_geterr(ptv->pcap_handle));
             return -1;
         }
 
         if (pcap_setfilter(ptv->pcap_handle, &ptv->filter) < 0) {
-            SCLogError(SC_ERR_BPF, "could not set bpf filter %s",
-                    pcap_geterr(ptv->pcap_handle));
+            SCLogError("could not set bpf filter %s", pcap_geterr(ptv->pcap_handle));
             return -1;
         }
     }
@@ -334,8 +332,7 @@ static TmEcode ReceivePcapLoop(ThreadVars *tv, void *data, void *slot)
             TmThreadsCaptureHandleTimeout(tv, NULL);
         } else if (unlikely(r < 0)) {
             int dbreak = 0;
-            SCLogError(SC_ERR_PCAP_DISPATCH, "error code %" PRId32 " %s",
-                       r, pcap_geterr(ptv->pcap_handle));
+            SCLogError("error code %" PRId32 " %s", r, pcap_geterr(ptv->pcap_handle));
             do {
                 usleep(PCAP_RECONNECT_TIMEOUT);
                 if (suricata_ctl_flags != 0) {
@@ -348,7 +345,7 @@ static TmEcode ReceivePcapLoop(ThreadVars *tv, void *data, void *slot)
                 break;
             }
         } else if (ptv->cb_result == TM_ECODE_FAILED) {
-            SCLogError(SC_ERR_PCAP_DISPATCH, "Pcap callback PcapCallbackLoop failed");
+            SCLogError("Pcap callback PcapCallbackLoop failed");
             SCReturnInt(TM_ECODE_FAILED);
         }
 
@@ -395,7 +392,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
     PcapIfaceConfig *pcapconfig = (PcapIfaceConfig *)initdata;
 
     if (initdata == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -409,7 +406,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
 
     ptv->livedev = LiveGetDevice(pcapconfig->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "unable to find Live device");
+        SCLogError("unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -431,12 +428,12 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
     ptv->pcap_handle = pcap_create((char *)pcapconfig->iface, errbuf);
     if (ptv->pcap_handle == NULL) {
         if (strlen(errbuf)) {
-            SCLogError(SC_ERR_PCAP_CREATE, "could not create a new "
-                    "pcap handler for %s, error %s",
+            SCLogError("could not create a new "
+                       "pcap handler for %s, error %s",
                     (char *)pcapconfig->iface, errbuf);
         } else {
-            SCLogError(SC_ERR_PCAP_CREATE, "could not create a new "
-                    "pcap handler for %s",
+            SCLogError("could not create a new "
+                       "pcap handler for %s",
                     (char *)pcapconfig->iface);
         }
         SCFree(ptv);
@@ -454,8 +451,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
         /* set Snaplen. Must be called before pcap_activate */
         int pcap_set_snaplen_r = pcap_set_snaplen(ptv->pcap_handle, ptv->pcap_snaplen);
         if (pcap_set_snaplen_r != 0) {
-            SCLogError(SC_ERR_PCAP_SET_SNAPLEN, "could not set snaplen, "
-                    "error: %s", pcap_geterr(ptv->pcap_handle));
+            SCLogError("could not set snaplen, "
+                       "error: %s",
+                    pcap_geterr(ptv->pcap_handle));
             SCFree(ptv);
             pcapconfig->DerefFunc(pcapconfig);
             SCReturnInt(TM_ECODE_FAILED);
@@ -467,8 +465,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
     /* set Promisc, and Timeout. Must be called before pcap_activate */
     int pcap_set_promisc_r = pcap_set_promisc(ptv->pcap_handle, pcapconfig->promisc);
     if (pcap_set_promisc_r != 0) {
-        SCLogError(SC_ERR_PCAP_SET_PROMISC, "could not set promisc mode, "
-                "error %s", pcap_geterr(ptv->pcap_handle));
+        SCLogError("could not set promisc mode, "
+                   "error %s",
+                pcap_geterr(ptv->pcap_handle));
         SCFree(ptv);
         pcapconfig->DerefFunc(pcapconfig);
         SCReturnInt(TM_ECODE_FAILED);
@@ -476,8 +475,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
 
     int pcap_set_timeout_r = pcap_set_timeout(ptv->pcap_handle, LIBPCAP_COPYWAIT);
     if (pcap_set_timeout_r != 0) {
-        SCLogError(SC_ERR_PCAP_SET_TIMEOUT, "could not set timeout, "
-                "error %s", pcap_geterr(ptv->pcap_handle));
+        SCLogError("could not set timeout, "
+                   "error %s",
+                pcap_geterr(ptv->pcap_handle));
         SCFree(ptv);
         pcapconfig->DerefFunc(pcapconfig);
         SCReturnInt(TM_ECODE_FAILED);
@@ -491,8 +491,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
         int pcap_set_buffer_size_r = pcap_set_buffer_size(ptv->pcap_handle,
                 ptv->pcap_buffer_size);
         if (pcap_set_buffer_size_r != 0) {
-            SCLogError(SC_ERR_PCAP_SET_BUFF_SIZE, "could not set "
-                    "pcap buffer size, error %s", pcap_geterr(ptv->pcap_handle));
+            SCLogError("could not set "
+                       "pcap buffer size, error %s",
+                    pcap_geterr(ptv->pcap_handle));
             SCFree(ptv);
             pcapconfig->DerefFunc(pcapconfig);
             SCReturnInt(TM_ECODE_FAILED);
@@ -503,8 +504,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
     /* activate the handle */
     int pcap_activate_r = pcap_activate(ptv->pcap_handle);
     if (pcap_activate_r != 0) {
-        SCLogError(SC_ERR_PCAP_ACTIVATE_HANDLE, "could not activate the "
-                "pcap handler, error %s", pcap_geterr(ptv->pcap_handle));
+        SCLogError("could not activate the "
+                   "pcap handler, error %s",
+                pcap_geterr(ptv->pcap_handle));
         SCFree(ptv);
         pcapconfig->DerefFunc(pcapconfig);
         SCReturnInt(TM_ECODE_FAILED);
@@ -520,8 +522,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
         if (pcap_compile(ptv->pcap_handle, &ptv->filter,
                     (char *)ptv->bpf_filter, 1, 0) < 0)
         {
-            SCLogError(SC_ERR_BPF, "bpf compilation error %s",
-                    pcap_geterr(ptv->pcap_handle));
+            SCLogError("bpf compilation error %s", pcap_geterr(ptv->pcap_handle));
 
             SCMutexUnlock(&pcap_bpf_compile_lock);
             SCFree(ptv);
@@ -530,8 +531,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
         }
 
         if (pcap_setfilter(ptv->pcap_handle, &ptv->filter) < 0) {
-            SCLogError(SC_ERR_BPF, "could not set bpf filter %s",
-                    pcap_geterr(ptv->pcap_handle));
+            SCLogError("could not set bpf filter %s", pcap_geterr(ptv->pcap_handle));
 
             SCMutexUnlock(&pcap_bpf_compile_lock);
             SCFree(ptv);
@@ -573,8 +573,7 @@ static void ReceivePcapThreadExitStats(ThreadVars *tv, void *data)
     struct pcap_stat pcap_s;
 
     if (pcap_stats(ptv->pcap_handle, &pcap_s) < 0) {
-        SCLogError(SC_ERR_STAT,"(%s) Failed to get pcap_stats: %s",
-                tv->name, pcap_geterr(ptv->pcap_handle));
+        SCLogError("(%s) Failed to get pcap_stats: %s", tv->name, pcap_geterr(ptv->pcap_handle));
         SCLogInfo("(%s) Packets %" PRIu64 ", bytes %" PRIu64 "", tv->name,
                 ptv->pkts, ptv->bytes);
     } else {
index 2077811f6d9d530cb540366e3128cd16c2511732..ce211f83dceb2adf4b67736de47b1fcaed731f60 100644 (file)
@@ -95,8 +95,9 @@ void TmModuleDecodePfringRegister (void)
  */
 TmEcode NoPfringSupportExit(ThreadVars *tv, const void *initdata, void **data)
 {
-    SCLogError(SC_ERR_NO_PF_RING,"Error creating thread %s: you do not have support for pfring "
-               "enabled please recompile with --enable-pfring", tv->name);
+    SCLogError("Error creating thread %s: you do not have support for pfring "
+               "enabled please recompile with --enable-pfring",
+            tv->name);
     exit(EXIT_FAILURE);
 }
 
@@ -261,8 +262,8 @@ static inline void PfringProcessPacket(void *user, struct pfring_pkthdr *h, Pack
         p->vlan_idx = 1;
 
         if (!ptv->vlan_hdr_warned) {
-            SCLogWarning(SC_ERR_PF_RING_VLAN, "no VLAN header in the raw "
-                                              "packet. See ticket #2355.");
+            SCLogWarning("no VLAN header in the raw "
+                         "packet. See ticket #2355.");
             ptv->vlan_hdr_warned = true;
         }
     }
@@ -357,7 +358,7 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot)
      * the threads have called pfring_set_cluster(). */
     int rc = pfring_enable_ring(ptv->pd);
     if (rc != 0) {
-        SCLogError(SC_ERR_PF_RING_OPEN, "pfring_enable_ring failed returned %d ", rc);
+        SCLogError("pfring_enable_ring failed returned %d ", rc);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -435,7 +436,7 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot)
             TmThreadsCaptureHandleTimeout(tv, p);
 
         } else {
-            SCLogError(SC_ERR_PF_RING_RECV,"pfring_recv error  %" PRId32 "", r);
+            SCLogError("pfring_recv error  %" PRId32 "", r);
             TmqhOutputPacketpool(ptv->tv, p);
             SCReturnInt(TM_ECODE_FAILED);
         }
@@ -507,14 +508,14 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
 
     ptv->interface = SCStrdup(pfconf->iface);
     if (unlikely(ptv->interface == NULL)) {
-        SCLogError(SC_ENOMEM, "Unable to allocate device string");
+        SCLogError("Unable to allocate device string");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     ptv->livedev = LiveGetDevice(pfconf->iface);
     if (ptv->livedev == NULL) {
-        SCLogError(SC_EINVAL, "Unable to find Live device");
+        SCLogError("Unable to find Live device");
         SCFree(ptv);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -536,8 +537,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_EINVAL, "Can't use rxonly checksum-checks on DNA interface,"
-                                    " resetting to auto");
+            SCLogWarning("Can't use rxonly checksum-checks on DNA interface,"
+                         " resetting to auto");
             ptv->checksum_mode = CHECKSUM_VALIDATION_AUTO;
         } else {
             opflag |= PF_RING_LONG_HEADER;
@@ -553,10 +554,9 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
 
     ptv->pd = pfring_open(ptv->interface, (uint32_t)default_packet_size, opflag);
     if (ptv->pd == NULL) {
-        SCLogError(SC_ERR_PF_RING_OPEN,"Failed to open %s: pfring_open error."
-                " Check if %s exists and pf_ring module is loaded.",
-                ptv->interface,
-                ptv->interface);
+        SCLogError("Failed to open %s: pfring_open error."
+                   " Check if %s exists and pf_ring module is loaded.",
+                ptv->interface, ptv->interface);
         pfconf->DerefFunc(pfconf);
         SCFree(ptv);
         return TM_ECODE_FAILED;
@@ -579,8 +579,9 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
         rc = pfring_set_cluster(ptv->pd, ptv->cluster_id, ptv->ctype);
 
         if (rc != 0) {
-            SCLogError(SC_ERR_PF_RING_SET_CLUSTER_FAILED, "pfring_set_cluster "
-                    "returned %d for cluster-id: %d", rc, ptv->cluster_id);
+            SCLogError("pfring_set_cluster "
+                       "returned %d for cluster-id: %d",
+                    rc, ptv->cluster_id);
             if (rc != PF_RING_ERROR_NOT_SUPPORTED || (pfconf->flags & PFRING_CONF_FLAGS_CLUSTER)) {
                 /* cluster is mandatory as explicitly specified in the configuration */
                 pfconf->DerefFunc(pfconf);
@@ -602,14 +603,14 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
     if (pfconf->bpf_filter) {
         ptv->bpf_filter = SCStrdup(pfconf->bpf_filter);
         if (unlikely(ptv->bpf_filter == NULL)) {
-            SCLogError(SC_ENOMEM, "Set PF_RING bpf filter failed.");
+            SCLogError("Set PF_RING bpf filter failed.");
         } else {
             SCMutexLock(&pfring_bpf_set_filter_lock);
             rc = pfring_set_bpf_filter(ptv->pd, ptv->bpf_filter);
             SCMutexUnlock(&pfring_bpf_set_filter_lock);
 
             if (rc < 0) {
-                SCLogError(SC_EINVAL, "Failed to compile BPF \"%s\"", ptv->bpf_filter);
+                SCLogError("Failed to compile BPF \"%s\"", ptv->bpf_filter);
                 return TM_ECODE_FAILED;
             }
         }
@@ -640,8 +641,9 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
         rc = pfring_set_cluster(ptv->pd, ptv->cluster_id, CLUSTER_FLOW_5_TUPLE);
 
         if (rc != 0) {
-            SCLogError(SC_ERR_PF_RING_SET_CLUSTER_FAILED, "pfring_set_cluster "
-                    "returned %d for cluster-id: %d", rc, ptv->cluster_id);
+            SCLogError("pfring_set_cluster "
+                       "returned %d for cluster-id: %d",
+                    rc, ptv->cluster_id);
             pfconf->DerefFunc(pfconf);
             return TM_ECODE_FAILED;
         }
index 1cade18373b94f0388a8dfb17c35a787b65dca13..c210c4373fd60c1ada5b0285c73073f28900f7ad 100644 (file)
@@ -81,10 +81,8 @@ void TmModuleDecodeWinDivertRegister(void)
 TmEcode NoWinDivertSupportExit(ThreadVars *tv, const void *initdata,
                                void **data)
 {
-    SCLogError(
-            SC_ERR_WINDIVERT_NOSUPPORT,
-            "Error creating thread %s: you do not have support for WinDivert "
-            "enabled; please recompile with --enable-windivert",
+    SCLogError("Error creating thread %s: you do not have support for WinDivert "
+               "enabled; please recompile with --enable-windivert",
             tv->name);
     exit(EXIT_FAILURE);
 }
@@ -196,15 +194,13 @@ static const char *WinDivertGetErrorString(DWORD error_code)
 /**
  * \brief logs a WinDivert error at Error level.
  */
-#define WinDivertLogError(err_code)                                            \
-    do {                                                                       \
-        const char *win_err_str = Win32GetErrorString((err_code), NULL);       \
-        SCLogError(SC_ERR_WINDIVERT_GENERIC,                                   \
-                   "WinDivertOpen failed, error %" PRId32 " (0x%08" PRIx32     \
-                   "): %s %s",                                                 \
-                   (uint32_t)(err_code), (uint32_t)(err_code), win_err_str,    \
-                   WinDivertGetErrorString(err_code));                         \
-        LocalFree((LPVOID)win_err_str);                                        \
+#define WinDivertLogError(err_code)                                                                \
+    do {                                                                                           \
+        const char *win_err_str = Win32GetErrorString((err_code), NULL);                           \
+        SCLogError("WinDivertOpen failed, error %" PRId32 " (0x%08" PRIx32 "): %s %s",             \
+                (uint32_t)(err_code), (uint32_t)(err_code), win_err_str,                           \
+                WinDivertGetErrorString(err_code));                                                \
+        LocalFree((LPVOID)win_err_str);                                                            \
     } while (0);
 
 /**
@@ -267,20 +263,17 @@ int WinDivertRegisterQueue(bool forward, char *filter_str)
     bool valid = WinDivertHelperCheckFilter(filter_str, layer, &error_str,
                                             &error_pos);
     if (!valid) {
-        SCLogWarning(
-                SC_ERR_WINDIVERT_INVALID_FILTER,
-                "Invalid filter \"%s\" supplied to WinDivert: %s at position "
-                "%" PRId32 "",
+        SCLogWarning("Invalid filter \"%s\" supplied to WinDivert: %s at position "
+                     "%" PRId32 "",
                 filter_str, error_str, error_pos);
-        SCReturnInt(SC_ERR_WINDIVERT_INVALID_FILTER);
+        SCReturnInt(-1);
     }
 
     /* initialize the queue */
     SCMutexLock(&g_wd_init_lock);
 
     if (g_wd_num >= WINDIVERT_MAX_QUEUE) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "Too many WinDivert queues specified %" PRId32 "", g_wd_num);
+        SCLogError("Too many WinDivert queues specified %" PRId32 "", g_wd_num);
         ret = -1;
         goto unlock;
     }
@@ -305,9 +298,8 @@ int WinDivertRegisterQueue(bool forward, char *filter_str)
     size_t copy_len =
             strlcpy(wd_qv->filter_str, filter_str, sizeof(wd_qv->filter_str));
     if (filter_len > copy_len) {
-        SCLogWarning(SC_ERR_WINDIVERT_TOOLONG_FILTER,
-                     "Queue length exceeds storage by %" PRId32 " bytes",
-                     (int32_t)(filter_len - copy_len));
+        SCLogWarning("Queue length exceeds storage by %" PRId32 " bytes",
+                (int32_t)(filter_len - copy_len));
         ret = -1;
         goto unlock;
     }
@@ -526,14 +518,14 @@ TmEcode ReceiveWinDivertThreadInit(ThreadVars *tv, const void *initdata,
     WinDivertThreadVars *wd_tv = (WinDivertThreadVars *)initdata;
 
     if (wd_tv == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "initdata == NULL");
+        SCLogError("initdata == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     WinDivertQueueVars *wd_qv = WinDivertGetQueue(wd_tv->thread_num);
 
     if (wd_qv == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "queue == NULL");
+        SCLogError("queue == NULL");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -549,8 +541,7 @@ TmEcode ReceiveWinDivertThreadInit(ThreadVars *tv, const void *initdata,
     if (WinDivertCollectFilterDevices(wd_tv, wd_qv) == TM_ECODE_OK) {
         WinDivertDisableOffloading(wd_tv);
     } else {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failed to obtain network devices for WinDivert filter");
+        SCLogWarning("Failed to obtain network devices for WinDivert filter");
     }
 
     /* we open now so that we can immediately start handling packets,
@@ -643,8 +634,7 @@ static bool WinDivertIfaceMatchFilter(const char *filter_string, int if_index)
     if (!match) {
         int err = GetLastError();
         if (err != 0) {
-            SCLogWarning(SC_ERR_WINDIVERT_GENERIC,
-                         "Failed to evaluate filter: 0x%" PRIx32, err);
+            SCLogWarning("Failed to evaluate filter: 0x%" PRIx32, err);
         }
     }
 
@@ -716,7 +706,7 @@ void ReceiveWinDivertThreadExitStats(ThreadVars *tv, void *data)
     WinDivertThreadVars *wd_tv = (WinDivertThreadVars *)data;
     WinDivertQueueVars *wd_qv = WinDivertGetQueue(wd_tv->thread_num);
     if (wd_qv == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "queue == NULL");
+        SCLogError("queue == NULL");
         SCReturn;
     }
 
@@ -939,8 +929,7 @@ static TmEcode WinDivertCloseHelper(WinDivertThreadVars *wd_tv)
     }
 
     if (!WinDivertClose(wd_qv->filter_handle)) {
-        SCLogError(SC_ERR_FATAL, "WinDivertClose failed: error %" PRIu32 "",
-                   (uint32_t)(GetLastError()));
+        SCLogError("WinDivertClose failed: error %" PRIu32 "", (uint32_t)(GetLastError()));
         ret = TM_ECODE_FAILED;
         goto unlock;
     }
index 4dc2cbd76a9a18a7ae6b4a5077ca5080c3f569ec..f4f9955f40e6bb332820893f31ab0787ac56a853 100644 (file)
@@ -270,8 +270,8 @@ static void *TcpSegmentPoolAlloc(void)
 
         seg->pcap_hdr_storage = SCCalloc(1, sizeof(TcpSegmentPcapHdrStorage));
         if (seg->pcap_hdr_storage == NULL) {
-            SCLogError(SC_ENOMEM, "Unable to allocate memory for "
-                                  "TcpSegmentPcapHdrStorage");
+            SCLogError("Unable to allocate memory for "
+                       "TcpSegmentPcapHdrStorage");
             SCFree(seg);
             return NULL;
         } else {
@@ -279,9 +279,9 @@ static void *TcpSegmentPoolAlloc(void)
             seg->pcap_hdr_storage->pkt_hdr =
                     SCCalloc(1, sizeof(uint8_t) * TCPSEG_PKT_HDR_DEFAULT_SIZE);
             if (seg->pcap_hdr_storage->pkt_hdr == NULL) {
-                SCLogError(SC_ENOMEM, "Unable to allocate memory for "
-                                      "packet header data within "
-                                      "TcpSegmentPcapHdrStorage");
+                SCLogError("Unable to allocate memory for "
+                           "packet header data within "
+                           "TcpSegmentPcapHdrStorage");
                 SCFree(seg->pcap_hdr_storage);
                 SCFree(seg);
                 return NULL;
@@ -460,8 +460,9 @@ static int StreamTcpReassemblyConfig(bool quiet)
     if (seg) {
         uint32_t prealloc = 0;
         if (StringParseUint32(&prealloc, 10, (uint16_t)strlen(seg->val), seg->val) < 0) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "segment-prealloc of "
-                    "%s is invalid", seg->val);
+            SCLogError("segment-prealloc of "
+                       "%s is invalid",
+                    seg->val);
             return -1;
         }
         segment_prealloc = prealloc;
@@ -553,8 +554,7 @@ TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv)
     }
     SCMutexUnlock(&segment_thread_pool_mutex);
     if (ra_ctx->segment_thread_pool_id < 0 || segment_thread_pool == NULL) {
-        SCLogError(sc_errno,
-                "failed to setup/expand stream segment pool. Expand stream.reassembly.memcap?");
+        SCLogError("failed to setup/expand stream segment pool. Expand stream.reassembly.memcap?");
         StreamTcpReassembleFreeThreadCtx(ra_ctx);
         SCReturnPtr(NULL, "TcpReassemblyThreadCtx");
     }
index ee729f5a16219e27d4a28a678bbd10e6fbfed0f9..50aad5390b7f1063b0a0388d765da15f4f89b162 100644 (file)
@@ -371,9 +371,9 @@ void StreamTcpInitConfig(bool quiet)
     SC_ATOMIC_INIT(stream_config.reassembly_memcap);
 
     if ((ConfGetInt("stream.max-sessions", &value)) == 1) {
-        SCLogWarning(SC_WARN_OPTION_OBSOLETE, "max-sessions is obsolete. "
-            "Number of concurrent sessions is now only limited by Flow and "
-            "TCP stream engine memcaps.");
+        SCLogWarning("max-sessions is obsolete. "
+                     "Number of concurrent sessions is now only limited by Flow and "
+                     "TCP stream engine memcaps.");
     }
 
     if ((ConfGetInt("stream.prealloc-sessions", &value)) == 1) {
@@ -399,9 +399,9 @@ void StreamTcpInitConfig(bool quiet)
     if (ConfGet("stream.memcap", &temp_stream_memcap_str) == 1) {
         uint64_t stream_memcap_copy;
         if (ParseSizeStringU64(temp_stream_memcap_str, &stream_memcap_copy) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing stream.memcap "
+            SCLogError("Error parsing stream.memcap "
                        "from conf file - %s.  Killing engine",
-                       temp_stream_memcap_str);
+                    temp_stream_memcap_str);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(stream_config.memcap, stream_memcap_copy);
@@ -517,10 +517,10 @@ void StreamTcpInitConfig(bool quiet)
         uint64_t stream_reassembly_memcap_copy;
         if (ParseSizeStringU64(temp_stream_reassembly_memcap_str,
                                &stream_reassembly_memcap_copy) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "stream.reassembly.memcap "
                        "from conf file - %s.  Killing engine",
-                       temp_stream_reassembly_memcap_str);
+                    temp_stream_reassembly_memcap_str);
             exit(EXIT_FAILURE);
         } else {
             SC_ATOMIC_SET(stream_config.reassembly_memcap, stream_reassembly_memcap_copy);
@@ -538,10 +538,10 @@ void StreamTcpInitConfig(bool quiet)
     if (ConfGet("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) {
         if (ParseSizeStringU32(temp_stream_reassembly_depth_str,
                                &stream_config.reassembly_depth) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "stream.reassembly.depth "
                        "from conf file - %s.  Killing engine",
-                       temp_stream_reassembly_depth_str);
+                    temp_stream_reassembly_depth_str);
             exit(EXIT_FAILURE);
         }
     } else {
@@ -564,15 +564,14 @@ void StreamTcpInitConfig(bool quiet)
         const char *temp_rdrange;
         if (ConfGet("stream.reassembly.randomize-chunk-range", &temp_rdrange) == 1) {
             if (ParseSizeStringU16(temp_rdrange, &rdrange) < 0) {
-                SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
-                        "stream.reassembly.randomize-chunk-range "
-                        "from conf file - %s.  Killing engine",
+                SCLogError("Error parsing "
+                           "stream.reassembly.randomize-chunk-range "
+                           "from conf file - %s.  Killing engine",
                         temp_rdrange);
                 exit(EXIT_FAILURE);
             } else if (rdrange >= 100) {
-                           FatalError(SC_ERR_FATAL,
-                                      "stream.reassembly.randomize-chunk-range "
-                                      "must be lower than 100");
+                FatalError("stream.reassembly.randomize-chunk-range "
+                           "must be lower than 100");
             }
         }
     }
@@ -582,10 +581,10 @@ void StreamTcpInitConfig(bool quiet)
                 &temp_stream_reassembly_toserver_chunk_size_str) == 1) {
         if (ParseSizeStringU16(temp_stream_reassembly_toserver_chunk_size_str,
                                &stream_config.reassembly_toserver_chunk_size) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "stream.reassembly.toserver-chunk-size "
                        "from conf file - %s.  Killing engine",
-                       temp_stream_reassembly_toserver_chunk_size_str);
+                    temp_stream_reassembly_toserver_chunk_size_str);
             exit(EXIT_FAILURE);
         }
     } else {
@@ -604,10 +603,10 @@ void StreamTcpInitConfig(bool quiet)
                 &temp_stream_reassembly_toclient_chunk_size_str) == 1) {
         if (ParseSizeStringU16(temp_stream_reassembly_toclient_chunk_size_str,
                                &stream_config.reassembly_toclient_chunk_size) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
+            SCLogError("Error parsing "
                        "stream.reassembly.toclient-chunk-size "
                        "from conf file - %s.  Killing engine",
-                       temp_stream_reassembly_toclient_chunk_size_str);
+                    temp_stream_reassembly_toclient_chunk_size_str);
             exit(EXIT_FAILURE);
         }
     } else {
@@ -5466,7 +5465,7 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
     }
     SCMutexUnlock(&ssn_pool_mutex);
     if (stt->ssn_pool_id < 0 || ssn_pool == NULL) {
-        SCLogError(sc_errno, "failed to setup/expand stream session pool. Expand stream.memcap?");
+        SCLogError("failed to setup/expand stream session pool. Expand stream.memcap?");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
index 59cc251f111ae9add85fa72189974ccc2559219c..7fea5ba55c9e3cd5044ac5c43f0c0a0954677b13 100644 (file)
@@ -45,10 +45,10 @@ int StreamSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback Ca
             break;
 #ifdef DEBUG
         case IPPROTO_UDP:
-            SCLogWarning(SC_ERR_UNKNOWN_PROTOCOL, "UDP is currently unsupported");
+            SCLogWarning("UDP is currently unsupported");
             break;
         default:
-            SCLogWarning(SC_ERR_UNKNOWN_PROTOCOL, "This protocol is currently unsupported");
+            SCLogWarning("This protocol is currently unsupported");
             break;
 #endif
     }
@@ -70,10 +70,10 @@ int StreamSegmentForSession(
             break;
 #ifdef DEBUG
         case IPPROTO_UDP:
-            SCLogWarning(SC_ERR_UNKNOWN_PROTOCOL, "UDP is currently unsupported");
+            SCLogWarning("UDP is currently unsupported");
             break;
         default:
-            SCLogWarning(SC_ERR_UNKNOWN_PROTOCOL, "This protocol is currently unsupported");
+            SCLogWarning("This protocol is currently unsupported");
             break;
 #endif
     }
index ab8b542e32b895baf6eee43ac3e753b2604dc8a5..400924cbd7e072668068a9cc5146812a0b8b0e0d 100644 (file)
@@ -298,7 +298,7 @@ static void SignalHandlerUnexpected(int sig_num, siginfo_t *info, void *context)
             temp += cw;
         }
     }
-    SCLogError(SC_ERR_SIGNAL, "%s", msg);
+    SCLogError("%s", msg);
 
 terminate:
     // Propagate signal to watchers, if any
@@ -411,7 +411,7 @@ static void OnNotifyRunning(void)
 {
 #if HAVE_LIBSYSTEMD
     if (sd_notify(0, "READY=1") < 0) {
-        SCLogWarning(SC_ERR_SYSCALL, "failed to notify systemd");
+        SCLogWarning("failed to notify systemd");
         /* Please refer to:
          * https://www.freedesktop.org/software/systemd/man/sd_notify.html#Return%20Value
          * for discussion on why failure should not be considered an error */
@@ -455,8 +455,7 @@ static int SetBpfString(int argc, char *argv[])
         return TM_ECODE_OK;
 
     if (EngineModeIsIPS()) {
-        SCLogError(SC_ERR_NOT_SUPPORTED,
-                   "BPF filter not available in IPS mode."
+        SCLogError("BPF filter not available in IPS mode."
                    " Use firewall filtering if possible.");
         return TM_ECODE_FAILED;
     }
@@ -477,7 +476,7 @@ static int SetBpfString(int argc, char *argv[])
 
     if(strlen(bpf_filter) > 0) {
         if (ConfSetFinal("bpf-filter", bpf_filter) != 1) {
-            SCLogError(SC_ERR_FATAL, "Failed to set bpf filter.");
+            SCLogError("Failed to set bpf filter.");
             SCFree(bpf_filter);
             return TM_ECODE_FAILED;
         }
@@ -502,14 +501,13 @@ static void SetBpfStringFromFile(char *filename)
     size_t nm = 0;
 
     if (EngineModeIsIPS()) {
-                   FatalError(SC_ERR_FATAL,
-                              "BPF filter not available in IPS mode."
-                              " Use firewall filtering if possible.");
+        FatalError("BPF filter not available in IPS mode."
+                   " Use firewall filtering if possible.");
     }
 
     fp = fopen(filename, "r");
     if (fp == NULL) {
-        SCLogError(SC_ERR_FOPEN, "Failed to open file %s", filename);
+        SCLogError("Failed to open file %s", filename);
         exit(EXIT_FAILURE);
     }
 
@@ -518,21 +516,21 @@ static void SetBpfStringFromFile(char *filename)
 #else
     if (fstat(fileno(fp), &st) != 0) {
 #endif /* OS_WIN32 */
-        SCLogError(SC_ERR_FOPEN, "Failed to stat file %s", filename);
+        SCLogError("Failed to stat file %s", filename);
         exit(EXIT_FAILURE);
     }
     bpf_len = st.st_size + 1;
 
     bpf_filter = SCMalloc(bpf_len);
     if (unlikely(bpf_filter == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to allocate buffer for bpf filter in file %s", filename);
+        SCLogError("Failed to allocate buffer for bpf filter in file %s", filename);
         exit(EXIT_FAILURE);
     }
     memset(bpf_filter, 0x00, bpf_len);
 
     nm = fread(bpf_filter, 1, bpf_len - 1, fp);
     if ((ferror(fp) != 0) || (nm != (bpf_len - 1))) {
-        SCLogError(SC_ERR_BPF, "Failed to read complete BPF file %s", filename);
+        SCLogError("Failed to read complete BPF file %s", filename);
         SCFree(bpf_filter);
         fclose(fp);
         exit(EXIT_FAILURE);
@@ -566,7 +564,7 @@ static void SetBpfStringFromFile(char *filename)
         }
         if (strlen(bpf_filter) > 0) {
             if(ConfSetFinal("bpf-filter", bpf_filter) != 1) {
-                SCLogError(SC_ERR_FOPEN, "ERROR: Failed to set bpf filter!");
+                SCLogError("ERROR: Failed to set bpf filter!");
                 SCFree(bpf_filter);
                 exit(EXIT_FAILURE);
             }
@@ -973,7 +971,7 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         if (strlen(pcap_dev) == 0) {
             int ret = LiveBuildDeviceList("pcap");
             if (ret == 0) {
-                SCLogError(SC_ERR_INITIALIZATION, "No interface found in config for pcap");
+                SCLogError("No interface found in config for pcap");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -982,7 +980,7 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         /* iface has been set on command line */
         if (strlen(pcap_dev)) {
             if (ConfSetFinal("pfring.live-interface", pcap_dev) != 1) {
-                SCLogError(SC_ERR_INITIALIZATION, "Failed to set pfring.live-interface");
+                SCLogError("Failed to set pfring.live-interface");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         } else {
@@ -994,8 +992,7 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         char iface_selector[] = "dpdk.interfaces";
         int ret = LiveBuildDeviceList(iface_selector);
         if (ret == 0) {
-            SCLogError(
-                    SC_ERR_INITIALIZATION, "No interface found in config for %s", iface_selector);
+            SCLogError("No interface found in config for %s", iface_selector);
             SCReturnInt(TM_ECODE_FAILED);
         }
 #endif
@@ -1004,13 +1001,13 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         /* iface has been set on command line */
         if (strlen(pcap_dev)) {
             if (ConfSetFinal("af-packet.live-interface", pcap_dev) != 1) {
-                SCLogError(SC_ERR_INITIALIZATION, "Failed to set af-packet.live-interface");
+                SCLogError("Failed to set af-packet.live-interface");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         } else {
             int ret = LiveBuildDeviceList("af-packet");
             if (ret == 0) {
-                SCLogError(SC_ERR_INITIALIZATION, "No interface found in config for af-packet");
+                SCLogError("No interface found in config for af-packet");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -1020,13 +1017,13 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         /* iface has been set on command line */
         if (strlen(pcap_dev)) {
             if (ConfSetFinal("af-xdp.live-interface", pcap_dev) != 1) {
-                SCLogError(SC_ERR_INITIALIZATION, "Failed to set af-xdp.live-interface");
+                SCLogError("Failed to set af-xdp.live-interface");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         } else {
             int ret = LiveBuildDeviceList("af-xdp");
             if (ret == 0) {
-                SCLogError(SC_ERR_INITIALIZATION, "No interface found in config for af-xdp");
+                SCLogError("No interface found in config for af-xdp");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -1036,13 +1033,13 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
         /* iface has been set on command line */
         if (strlen(pcap_dev)) {
             if (ConfSetFinal("netmap.live-interface", pcap_dev) != 1) {
-                SCLogError(SC_ERR_INITIALIZATION, "Failed to set netmap.live-interface");
+                SCLogError("Failed to set netmap.live-interface");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         } else {
             int ret = LiveBuildDeviceList("netmap");
             if (ret == 0) {
-                SCLogError(SC_ERR_INITIALIZATION, "No interface found in config for netmap");
+                SCLogError("No interface found in config for netmap");
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
@@ -1051,7 +1048,7 @@ static TmEcode ParseInterfacesList(const int runmode, char *pcap_dev)
     } else if (runmode == RUNMODE_NFLOG) {
         int ret = LiveBuildDeviceListCustom("nflog", "group");
         if (ret == 0) {
-            SCLogError(SC_ERR_INITIALIZATION, "No group found in config for nflog");
+            SCLogError("No group found in config for nflog");
             SCReturnInt(TM_ECODE_FAILED);
         }
 #endif
@@ -1179,16 +1176,16 @@ static int ParseCommandLineAfpacket(SCInstance *suri, const char *in_arg)
             SCLogInfo("Multiple af-packet option without interface on each is useless");
         }
     } else {
-        SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                "has been specified");
+        SCLogError("more than one run mode "
+                   "has been specified");
         PrintUsage(suri->progname);
         return TM_ECODE_FAILED;
     }
     return TM_ECODE_OK;
 #else
-    SCLogError(SC_ERR_NO_AF_PACKET,"AF_PACKET not enabled. On Linux "
-            "host, make sure to pass --enable-af-packet to "
-            "configure when building.");
+    SCLogError("AF_PACKET not enabled. On Linux "
+               "host, make sure to pass --enable-af-packet to "
+               "configure when building.");
     return TM_ECODE_FAILED;
 #endif
 }
@@ -1210,16 +1207,16 @@ static int ParseCommandLineAfxdp(SCInstance *suri, const char *in_arg)
             SCLogInfo("Multiple af-xdp options without interface on each is useless");
         }
     } else {
-        SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                             "has been specified");
+        SCLogError("more than one run mode "
+                   "has been specified");
         PrintUsage(suri->progname);
         return TM_ECODE_FAILED;
     }
     return TM_ECODE_OK;
 #else
-    SCLogError(SC_ERR_NO_AF_XDP, "AF_XDP not enabled. On Linux "
-                                 "host, make sure correct libraries are installed,"
-                                 " see documentation for information.");
+    SCLogError("AF_XDP not enabled. On Linux "
+               "host, make sure correct libraries are installed,"
+               " see documentation for information.");
     return TM_ECODE_FAILED;
 #endif
 }
@@ -1232,16 +1229,16 @@ static int ParseCommandLineDpdk(SCInstance *suri, const char *in_arg)
     } else if (suri->run_mode == RUNMODE_DPDK) {
         SCLogInfo("Multiple dpdk options have no effect on Suricata");
     } else {
-        SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                             "has been specified");
+        SCLogError("more than one run mode "
+                   "has been specified");
         PrintUsage(suri->progname);
         return TM_ECODE_FAILED;
     }
     return TM_ECODE_OK;
 #else
-    SCLogError(SC_ERR_NO_DPDK, "DPDK not enabled. On Linux "
-                               "host, make sure to pass --enable-dpdk to "
-                               "configure when building.");
+    SCLogError("DPDK not enabled. On Linux "
+               "host, make sure to pass --enable-dpdk to "
+               "configure when building.");
     return TM_ECODE_FAILED;
 #endif
 }
@@ -1250,8 +1247,7 @@ static int ParseCommandLinePcapLive(SCInstance *suri, const char *in_arg)
 {
 #if defined(OS_WIN32) && !defined(HAVE_LIBWPCAP)
     /* If running on Windows without Npcap, bail early as live capture is not supported. */
-    FatalError(SC_ERR_FATAL,
-            "Live capture not available. To support live capture compile against Npcap.");
+    FatalError("Live capture not available. To support live capture compile against Npcap.");
 #endif
     memset(suri->pcap_dev, 0, sizeof(suri->pcap_dev));
 
@@ -1268,7 +1264,7 @@ static int ParseCommandLinePcapLive(SCInstance *suri, const char *in_arg)
         if (strcmp(suri->pcap_dev, in_arg) != 0) {
             SCLogInfo("translated %s to pcap device %s", in_arg, suri->pcap_dev);
         } else if (strlen(suri->pcap_dev) > 0 && isdigit((unsigned char)suri->pcap_dev[0])) {
-            SCLogError(SC_ERR_PCAP_TRANSLATE, "failed to find a pcap device for IP %s", in_arg);
+            SCLogError("failed to find a pcap device for IP %s", in_arg);
             return TM_ECODE_FAILED;
         }
     }
@@ -1281,8 +1277,8 @@ static int ParseCommandLinePcapLive(SCInstance *suri, const char *in_arg)
     } else if (suri->run_mode == RUNMODE_PCAP_DEV) {
         LiveRegisterDeviceName(suri->pcap_dev);
     } else {
-        SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                "has been specified");
+        SCLogError("more than one run mode "
+                   "has been specified");
         PrintUsage(suri->progname);
         return TM_ECODE_FAILED;
     }
@@ -1418,8 +1414,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     LiveRegisterDeviceName(optarg);
                 }
 #else
-                SCLogError(SC_ERR_NO_PF_RING,"PF_RING not enabled. Make sure "
-                        "to pass --enable-pfring to configure when building.");
+                SCLogError("PF_RING not enabled. Make sure "
+                           "to pass --enable-pfring to configure when building.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_PFRING */
             }
@@ -1430,8 +1426,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     return TM_ECODE_FAILED;
                 }
 #else
-                SCLogError(SC_ERR_NO_PF_RING,"PF_RING not enabled. Make sure "
-                        "to pass --enable-pfring to configure when building.");
+                SCLogError("PF_RING not enabled. Make sure "
+                           "to pass --enable-pfring to configure when building.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_PFRING */
             }
@@ -1442,8 +1438,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     return TM_ECODE_FAILED;
                 }
 #else
-                SCLogError(SC_ERR_NO_PF_RING,"PF_RING not enabled. Make sure "
-                        "to pass --enable-pfring to configure when building.");
+                SCLogError("PF_RING not enabled. Make sure "
+                           "to pass --enable-pfring to configure when building.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_PFRING */
             }
@@ -1484,14 +1480,14 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                         break;
                     }
                 } else {
-                    SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                            "has been specified");
+                    SCLogError("more than one run mode "
+                               "has been specified");
                     PrintUsage(argv[0]);
                     return TM_ECODE_FAILED;
                 }
 #else
-                    SCLogError(SC_ERR_NO_NETMAP, "NETMAP not enabled.");
-                    return TM_ECODE_FAILED;
+                SCLogError("NETMAP not enabled.");
+                return TM_ECODE_FAILED;
 #endif
             } else if (strcmp((long_opts[option_index]).name, "nflog") == 0) {
 #ifdef HAVE_NFLOG
@@ -1500,7 +1496,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     LiveBuildDeviceListCustom("nflog", "group");
                 }
 #else
-                SCLogError(SC_ERR_NFLOG_NOSUPPORT, "NFLOG not enabled.");
+                SCLogError("NFLOG not enabled.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_NFLOG */
             } else if (strcmp((long_opts[option_index]).name, "pcap") == 0) {
@@ -1527,8 +1523,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
 
                     }
                 } else {
-                    SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                            "has been specified");
+                    SCLogError("more than one run mode "
+                               "has been specified");
                     PrintUsage(argv[0]);
                     return TM_ECODE_FAILED;
                 }
@@ -1575,7 +1571,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             else if(strcmp((long_opts[option_index]).name, "pidfile") == 0) {
                 suri->pid_filename = SCStrdup(optarg);
                 if (suri->pid_filename == NULL) {
-                    SCLogError(SC_ENOMEM, "strdup failed: %s", strerror(errno));
+                    SCLogError("strdup failed: %s", strerror(errno));
                     return TM_ECODE_FAILED;
                 }
             }
@@ -1592,8 +1588,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
 #endif /* UNITTESTS */
             } else if (strcmp((long_opts[option_index]).name, "user") == 0) {
 #ifndef HAVE_LIBCAP_NG
-                SCLogError(SC_ERR_LIBCAP_NG_REQUIRED, "libcap-ng is required to"
-                        " drop privileges, but it was not compiled into Suricata.");
+                SCLogError("libcap-ng is required to"
+                           " drop privileges, but it was not compiled into Suricata.");
                 return TM_ECODE_FAILED;
 #else
                 suri->user_name = optarg;
@@ -1601,8 +1597,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
 #endif /* HAVE_LIBCAP_NG */
             } else if (strcmp((long_opts[option_index]).name, "group") == 0) {
 #ifndef HAVE_LIBCAP_NG
-                SCLogError(SC_ERR_LIBCAP_NG_REQUIRED, "libcap-ng is required to"
-                        " drop privileges, but it was not compiled into Suricata.");
+                SCLogError("libcap-ng is required to"
+                           " drop privileges, but it was not compiled into Suricata.");
                 return TM_ECODE_FAILED;
 #else
                 suri->group_name = optarg;
@@ -1620,23 +1616,22 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     suri->run_mode = RUNMODE_DAG;
                 }
                 else if (suri->run_mode != RUNMODE_DAG) {
-                    SCLogError(SC_ERR_MULTIPLE_RUN_MODE,
-                        "more than one run mode has been specified");
+                    SCLogError("more than one run mode has been specified");
                     PrintUsage(argv[0]);
                     return TM_ECODE_FAILED;
                 }
                 LiveRegisterDeviceName(optarg);
 #else
-                SCLogError(SC_ERR_DAG_REQUIRED, "libdag and a DAG card are required"
-                                               " to receive packets using --dag.");
+                SCLogError("libdag and a DAG card are required"
+                           " to receive packets using --dag.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_DAG */
             } else if (strcmp((long_opts[option_index]).name, "napatech") == 0) {
 #ifdef HAVE_NAPATECH
                 suri->run_mode = RUNMODE_NAPATECH;
 #else
-                SCLogError(SC_ERR_NAPATECH_REQUIRED, "libntapi and a Napatech adapter are required"
-                                                     " to capture packets using --napatech.");
+                SCLogError("libntapi and a Napatech adapter are required"
+                           " to capture packets using --napatech.");
                 return TM_ECODE_FAILED;
 #endif /* HAVE_NAPATECH */
             } else if (strcmp((long_opts[option_index]).name, "pcap-buffer-size") == 0) {
@@ -1646,8 +1641,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     return TM_ECODE_FAILED;
                 }
 #else
-                SCLogError(SC_ERR_NO_PCAP_SET_BUFFER_SIZE, "The version of libpcap you have"
-                        " doesn't support setting buffer size.");
+                SCLogError("The version of libpcap you have"
+                           " doesn't support setting buffer size.");
 #endif /* HAVE_PCAP_SET_BUFF */
             } else if (strcmp((long_opts[option_index]).name, "build-info") == 0) {
                 suri->run_mode = RUNMODE_PRINT_BUILDINFO;
@@ -1664,8 +1659,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                         exit(EXIT_FAILURE);
                     }
                 } else {
-                    SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                                        "has been specified");
+                    SCLogError("more than one run mode "
+                               "has been specified");
                     PrintUsage(argv[0]);
                     exit(EXIT_FAILURE);
                 }
@@ -1681,13 +1676,14 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                         exit(EXIT_FAILURE);
                     }
                 } else {
-                    SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                                        "has been specified");
+                    SCLogError("more than one run mode "
+                               "has been specified");
                     PrintUsage(argv[0]);
                     exit(EXIT_FAILURE);
                 }
 #else
-                SCLogError(SC_ERR_WINDIVERT_NOSUPPORT,"WinDivert not enabled. Make sure to pass --enable-windivert to configure when building.");
+                SCLogError("WinDivert not enabled. Make sure to pass --enable-windivert to "
+                           "configure when building.");
                 return TM_ECODE_FAILED;
 #endif /* WINDIVERT */
             } else if(strcmp((long_opts[option_index]).name, "reject-dev") == 0) {
@@ -1701,8 +1697,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     g_reject_dev_mtu = (uint16_t)mtu;
                 }
 #else
-                SCLogError(SC_ERR_LIBNET_NOT_ENABLED,
-                        "Libnet 1.1 support not enabled. Compile Suricata with libnet support.");
+                SCLogError("Libnet 1.1 support not enabled. Compile Suricata with libnet support.");
                 return TM_ECODE_FAILED;
 #endif
             }
@@ -1711,8 +1706,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     /* Quick validation. */
                     char *val = strchr(optarg, '=');
                     if (val == NULL) {
-                                FatalError(SC_ERR_FATAL,
-                                           "Invalid argument for --set, must be key=val.");
+                        FatalError("Invalid argument for --set, must be key=val.");
                     }
                     if (!ConfSetFromString(optarg, 1)) {
                         fprintf(stderr, "Failed to set configuration value %s.",
@@ -1723,36 +1717,37 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             }
             else if (strcmp((long_opts[option_index]).name, "pcap-file-continuous") == 0) {
                 if (ConfSetFinal("pcap-file.continuous", "true") != 1) {
-                    SCLogError(SC_ERR_CMD_LINE, "Failed to set pcap-file.continuous");
+                    SCLogError("Failed to set pcap-file.continuous");
                     return TM_ECODE_FAILED;
                 }
             }
             else if (strcmp((long_opts[option_index]).name, "pcap-file-delete") == 0) {
                 if (ConfSetFinal("pcap-file.delete-when-done", "true") != 1) {
-                    SCLogError(SC_ERR_CMD_LINE, "Failed to set pcap-file.delete-when-done");
+                    SCLogError("Failed to set pcap-file.delete-when-done");
                     return TM_ECODE_FAILED;
                 }
             }
             else if (strcmp((long_opts[option_index]).name, "pcap-file-recursive") == 0) {
                 if (ConfSetFinal("pcap-file.recursive", "true") != 1) {
-                    SCLogError(SC_ERR_CMD_LINE, "ERROR: Failed to set pcap-file.recursive");
+                    SCLogError("ERROR: Failed to set pcap-file.recursive");
                     return TM_ECODE_FAILED;
                 }
             }
             else if (strcmp((long_opts[option_index]).name, "data-dir") == 0) {
                 if (optarg == NULL) {
-                    SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -d");
+                    SCLogError("no option argument (optarg) for -d");
                     return TM_ECODE_FAILED;
                 }
 
                 if (ConfigSetDataDirectory(optarg) != TM_ECODE_OK) {
-                    SCLogError(SC_ERR_FATAL, "Failed to set data directory.");
+                    SCLogError("Failed to set data directory.");
                     return TM_ECODE_FAILED;
                 }
                 if (ConfigCheckDataDirectory(optarg) != TM_ECODE_OK) {
-                    SCLogError(SC_ERR_LOGDIR_CMDLINE, "The data directory \"%s\""
-                            " supplied at the commandline (-d %s) doesn't "
-                            "exist. Shutting down the engine.", optarg, optarg);
+                    SCLogError("The data directory \"%s\""
+                               " supplied at the commandline (-d %s) doesn't "
+                               "exist. Shutting down the engine.",
+                            optarg, optarg);
                     return TM_ECODE_FAILED;
                 }
                 suri->set_datadir = true;
@@ -1763,7 +1758,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                     suri->strict_rule_parsing_string = SCStrdup(optarg);
                 }
                 if (suri->strict_rule_parsing_string == NULL) {
-                    FatalError(SC_ENOMEM, "failed to duplicate 'strict' string");
+                    FatalError("failed to duplicate 'strict' string");
                 }
             } else {
                 int r = ExceptionSimulationCommandlineParser(
@@ -1792,7 +1787,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             return TM_ECODE_OK;
         case 'i':
             if (optarg == NULL) {
-                SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -i");
+                SCLogError("no option argument (optarg) for -i");
                 return TM_ECODE_FAILED;
             }
 #ifdef HAVE_AF_PACKET
@@ -1809,24 +1804,26 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
 #ifdef HAVE_NETMAP
             i++;
 #endif
-            SCLogWarning(SC_WARN_FASTER_CAPTURE_AVAILABLE, "faster capture "
-                    "option%s %s available:"
+            SCLogWarning("faster capture "
+                         "option%s %s available:"
 #ifdef HAVE_PFRING
-                    " PF_RING (--pfring-int=%s)"
+                         " PF_RING (--pfring-int=%s)"
 #endif
 #ifdef HAVE_NETMAP
-                    " NETMAP (--netmap=%s)"
+                         " NETMAP (--netmap=%s)"
 #endif
-                    ". Use --pcap=%s to suppress this warning",
+                         ". Use --pcap=%s to suppress this warning",
                     i == 1 ? "" : "s", i == 1 ? "is" : "are"
 #ifdef HAVE_PFRING
-                    , optarg
+                    ,
+                    optarg
 #endif
 #ifdef HAVE_NETMAP
-                    , optarg
+                    ,
+                    optarg
 #endif
-                    , optarg
-                    );
+                    ,
+                    optarg);
 #endif /* have faster methods */
             if (ParseCommandLinePcapLive(suri, optarg) != TM_ECODE_OK) {
                 return TM_ECODE_FAILED;
@@ -1835,24 +1832,26 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             break;
         case 'l':
             if (optarg == NULL) {
-                SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -l");
+                SCLogError("no option argument (optarg) for -l");
                 return TM_ECODE_FAILED;
             }
 
             if (ConfigSetLogDirectory(optarg) != TM_ECODE_OK) {
-                SCLogError(SC_ERR_FATAL, "Failed to set log directory.");
+                SCLogError("Failed to set log directory.");
                 return TM_ECODE_FAILED;
             }
             if (ConfigCheckLogDirectoryExists(optarg) != TM_ECODE_OK) {
-                SCLogError(SC_ERR_LOGDIR_CMDLINE, "The logging directory \"%s\""
-                        " supplied at the commandline (-l %s) doesn't "
-                        "exist. Shutting down the engine.", optarg, optarg);
+                SCLogError("The logging directory \"%s\""
+                           " supplied at the commandline (-l %s) doesn't "
+                           "exist. Shutting down the engine.",
+                        optarg, optarg);
                 return TM_ECODE_FAILED;
             }
             if (!IsLogDirectoryWritable(optarg)) {
-                SCLogError(SC_ERR_LOGDIR_CMDLINE, "The logging directory \"%s\""
-                        " supplied at the commandline (-l %s) is not "
-                        "writable. Shutting down the engine.", optarg, optarg);
+                SCLogError("The logging directory \"%s\""
+                           " supplied at the commandline (-l %s) is not "
+                           "writable. Shutting down the engine.",
+                        optarg, optarg);
                 return TM_ECODE_FAILED;
             }
             suri->set_logdir = true;
@@ -1869,13 +1868,14 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                 if (NFQParseAndRegisterQueues(optarg) == -1)
                     return TM_ECODE_FAILED;
             } else {
-                SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                                     "has been specified");
+                SCLogError("more than one run mode "
+                           "has been specified");
                 PrintUsage(argv[0]);
                 return TM_ECODE_FAILED;
             }
 #else
-            SCLogError(SC_ERR_NFQ_NOSUPPORT,"NFQUEUE not enabled. Make sure to pass --enable-nfqueue to configure when building.");
+            SCLogError("NFQUEUE not enabled. Make sure to pass --enable-nfqueue to configure when "
+                       "building.");
             return TM_ECODE_FAILED;
 #endif /* NFQ */
             break;
@@ -1890,13 +1890,14 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                 if (IPFWRegisterQueue(optarg) == -1)
                     return TM_ECODE_FAILED;
             } else {
-                SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                                     "has been specified");
+                SCLogError("more than one run mode "
+                           "has been specified");
                 PrintUsage(argv[0]);
                 return TM_ECODE_FAILED;
             }
 #else
-            SCLogError(SC_ERR_IPFW_NOSUPPORT,"IPFW not enabled. Make sure to pass --enable-ipfw to configure when building.");
+            SCLogError("IPFW not enabled. Make sure to pass --enable-ipfw to configure when "
+                       "building.");
             return TM_ECODE_FAILED;
 #endif /* IPFW */
             break;
@@ -1905,8 +1906,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             if (suri->run_mode == RUNMODE_UNKNOWN) {
                 suri->run_mode = RUNMODE_PCAP_FILE;
             } else {
-                SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode "
-                                                     "has been specified");
+                SCLogError("more than one run mode "
+                           "has been specified");
                 PrintUsage(argv[0]);
                 return TM_ECODE_FAILED;
             }
@@ -1917,25 +1918,25 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             struct stat buf;
             if (stat(optarg, &buf) != 0) {
 #endif /* OS_WIN32 */
-                SCLogError(SC_ERR_INITIALIZATION, "ERROR: Pcap file does not exist\n");
+                SCLogError("ERROR: Pcap file does not exist\n");
                 return TM_ECODE_FAILED;
             }
             if (ConfSetFinal("pcap-file.file", optarg) != 1) {
-                SCLogError(SC_ERR_INITIALIZATION, "ERROR: Failed to set pcap-file.file\n");
+                SCLogError("ERROR: Failed to set pcap-file.file\n");
                 return TM_ECODE_FAILED;
             }
 
             break;
         case 's':
             if (suri->sig_file != NULL) {
-                SCLogError(SC_ERR_CMD_LINE, "can't have multiple -s options or mix -s and -S.");
+                SCLogError("can't have multiple -s options or mix -s and -S.");
                 return TM_ECODE_FAILED;
             }
             suri->sig_file = optarg;
             break;
         case 'S':
             if (suri->sig_file != NULL) {
-                SCLogError(SC_ERR_CMD_LINE, "can't have multiple -S options or mix -s and -S.");
+                SCLogError("can't have multiple -S options or mix -s and -S.");
                 return TM_ECODE_FAILED;
             }
             suri->sig_file = optarg;
@@ -1946,8 +1947,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             if (suri->run_mode == RUNMODE_UNKNOWN) {
                 suri->run_mode = RUNMODE_UNITTEST;
             } else {
-                SCLogError(SC_ERR_MULTIPLE_RUN_MODE, "more than one run mode has"
-                                                     " been specified");
+                SCLogError("more than one run mode has"
+                           " been specified");
                 PrintUsage(argv[0]);
                 return TM_ECODE_FAILED;
             }
@@ -1969,7 +1970,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             return TM_ECODE_OK;
         case 'F':
             if (optarg == NULL) {
-                SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -F");
+                SCLogError("no option argument (optarg) for -F");
                 return TM_ECODE_FAILED;
             }
 
@@ -1980,7 +1981,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             break;
         case 'k':
             if (optarg == NULL) {
-                SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -k");
+                SCLogError("no option argument (optarg) for -k");
                 return TM_ECODE_FAILED;
             }
             if (!strcmp("all", optarg))
@@ -1988,7 +1989,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             else if (!strcmp("none", optarg))
                 suri->checksum_validation = 0;
             else {
-                SCLogError(SC_ERR_INITIALIZATION, "option '%s' invalid for -k", optarg);
+                SCLogError("option '%s' invalid for -k", optarg);
                 return TM_ECODE_FAILED;
             }
             break;
@@ -1999,7 +2000,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
     }
 
     if (suri->disabled_detect && suri->sig_file != NULL) {
-        SCLogError(SC_ERR_INITIALIZATION, "can't use -s/-S when detection is disabled");
+        SCLogError("can't use -s/-S when detection is disabled");
         return TM_ECODE_FAILED;
     }
 
@@ -2042,7 +2043,7 @@ static int WindowsInitService(int argc, char **argv)
             *p = '\0';
         }
         if (!SetCurrentDirectory(path)) {
-            SCLogError(SC_ERR_FATAL, "Can't set current directory to: %s", path);
+            SCLogError("Can't set current directory to: %s", path);
             return -1;
         }
         SCLogInfo("Current directory is set to: %s", path);
@@ -2052,7 +2053,7 @@ static int WindowsInitService(int argc, char **argv)
     /* Windows socket subsystem initialization */
     WSADATA wsaData;
     if (0 != WSAStartup(MAKEWORD(2, 2), &wsaData)) {
-        SCLogError(SC_ERR_FATAL, "Can't initialize Windows sockets: %d", WSAGetLastError());
+        SCLogError("Can't initialize Windows sockets: %d", WSAGetLastError());
         return -1;
     }
 
@@ -2073,7 +2074,7 @@ static int MayDaemonize(SCInstance *suri)
         /* The pid file name may be in config memory, but is needed later. */
         suri->pid_filename = SCStrdup(pid_filename);
         if (suri->pid_filename == NULL) {
-            SCLogError(SC_ENOMEM, "strdup failed: %s", strerror(errno));
+            SCLogError("strdup failed: %s", strerror(errno));
             return TM_ECODE_FAILED;
         }
     }
@@ -2092,12 +2093,10 @@ static int MayDaemonize(SCInstance *suri)
         if (SCPidfileCreate(suri->pid_filename) != 0) {
             SCFree(suri->pid_filename);
             suri->pid_filename = NULL;
-            SCLogError(SC_ERR_PIDFILE_DAEMON,
-                    "Unable to create PID file, concurrent run of"
-                    " Suricata can occur.");
-            SCLogError(SC_ERR_PIDFILE_DAEMON,
-                    "PID file creation WILL be mandatory for daemon mode"
-                    " in future version");
+            SCLogError("Unable to create PID file, concurrent run of"
+                       " Suricata can occur.");
+            SCLogError("PID file creation WILL be mandatory for daemon mode"
+                       " in future version");
         }
     }
 
@@ -2125,7 +2124,7 @@ static int InitRunAs(SCInstance *suri)
     if (suri->do_setuid == TRUE) {
         if (SCGetUserID(suri->user_name, suri->group_name,
                         &suri->userid, &suri->groupid) != 0) {
-            SCLogError(SC_ERR_UID_FAILED, "failed in getting user ID");
+            SCLogError("failed in getting user ID");
             return TM_ECODE_FAILED;
         }
 
@@ -2133,7 +2132,7 @@ static int InitRunAs(SCInstance *suri)
     /* Get the suricata group ID to given group ID */
     } else if (suri->do_setgid == TRUE) {
         if (SCGetGroupID(suri->group_name, &suri->groupid) != 0) {
-            SCLogError(SC_ERR_GID_FAILED, "failed in getting group ID");
+            SCLogError("failed in getting group ID");
             return TM_ECODE_FAILED;
         }
 
@@ -2376,7 +2375,7 @@ static void SetupDelayedDetect(SCInstance *suri)
 static int LoadSignatures(DetectEngineCtx *de_ctx, SCInstance *suri)
 {
     if (SigLoadSignatures(de_ctx, suri->sig_file, suri->sig_file_exclusive) < 0) {
-        SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed.");
+        SCLogError("Loading signatures failed.");
         if (de_ctx->failure_fatal)
             return TM_ECODE_FAILED;
     }
@@ -2391,9 +2390,9 @@ static int ConfigGetCaptureValue(SCInstance *suri)
     if (ConfGetInt("max-pending-packets", &max_pending_packets) != 1)
         max_pending_packets = DEFAULT_MAX_PENDING_PACKETS;
     if (max_pending_packets >= 65535) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                "Maximum max-pending-packets setting is 65534. "
-                "Please check %s for errors", suri->conf_filename);
+        SCLogError("Maximum max-pending-packets setting is 65534. "
+                   "Please check %s for errors",
+                suri->conf_filename);
         return TM_ECODE_FAILED;
     }
 
@@ -2457,9 +2456,9 @@ static int ConfigGetCaptureValue(SCInstance *suri)
         }
     } else {
         if (ParseSizeStringU32(temp_default_packet_size, &default_packet_size) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing max-pending-packets "
+            SCLogError("Error parsing max-pending-packets "
                        "from conf file - %s.  Killing engine",
-                       temp_default_packet_size);
+                    temp_default_packet_size);
             return TM_ECODE_FAILED;
         }
     }
@@ -2504,7 +2503,7 @@ void PostConfLoadedDetectSetup(SCInstance *suri)
         if (mt_enabled)
             (void)ConfGetBool("multi-detect.default", &default_tenant);
         if (DetectEngineMultiTenantSetup(suri->unix_socket_enabled) == -1) {
-            FatalError(SC_ERR_FATAL, "initializing multi-detect "
+            FatalError("initializing multi-detect "
                        "detection engine contexts failed.");
         }
         if (suri->delayed_detect && suri->run_mode != RUNMODE_CONF_TEST) {
@@ -2515,7 +2514,7 @@ void PostConfLoadedDetectSetup(SCInstance *suri)
             de_ctx = DetectEngineCtxInit();
         }
         if (de_ctx == NULL) {
-            FatalError(SC_ERR_FATAL, "initializing detection engine "
+            FatalError("initializing detection engine "
                        "context failed.");
         }
 
@@ -2593,13 +2592,13 @@ static void SetupUserMode(SCInstance *suri)
         if (suri->set_logdir == false) {
             /* override log dir to current work dir" */
             if (ConfigSetLogDirectory((char *)".") != TM_ECODE_OK) {
-                FatalError(SC_ERR_LOGDIR_CONFIG, "could not set USER mode logdir");
+                FatalError("could not set USER mode logdir");
             }
         }
         if (suri->set_datadir == false) {
             /* override data dir to current work dir" */
             if (ConfigSetDataDirectory((char *)".") != TM_ECODE_OK) {
-                FatalError(SC_ERR_LOGDIR_CONFIG, "could not set USER mode datadir");
+                FatalError("could not set USER mode datadir");
             }
         }
     }
@@ -2713,15 +2712,12 @@ int PostConfLoadedSetup(SCInstance *suri)
     IPPairBitInitCtx();
 
     if (DetectAddressTestConfVars() < 0) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                "basic address vars test failed. Please check %s for errors",
-                suri->conf_filename);
+        SCLogError(
+                "basic address vars test failed. Please check %s for errors", suri->conf_filename);
         SCReturnInt(TM_ECODE_FAILED);
     }
     if (DetectPortTestConfVars() < 0) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                "basic port vars test failed. Please check %s for errors",
-                suri->conf_filename);
+        SCLogError("basic port vars test failed. Please check %s for errors", suri->conf_filename);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -2747,15 +2743,17 @@ int PostConfLoadedSetup(SCInstance *suri)
     suri->log_dir = ConfigGetLogDirectory();
 
     if (ConfigCheckLogDirectoryExists(suri->log_dir) != TM_ECODE_OK) {
-        SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
-                "supplied by %s (default-log-dir) doesn't exist. "
-                "Shutting down the engine", suri->log_dir, suri->conf_filename);
+        SCLogError("The logging directory \"%s\" "
+                   "supplied by %s (default-log-dir) doesn't exist. "
+                   "Shutting down the engine",
+                suri->log_dir, suri->conf_filename);
         SCReturnInt(TM_ECODE_FAILED);
     }
     if (!IsLogDirectoryWritable(suri->log_dir)) {
-        SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
-                "supplied by %s (default-log-dir) is not writable. "
-                "Shutting down the engine", suri->log_dir, suri->conf_filename);
+        SCLogError("The logging directory \"%s\" "
+                   "supplied by %s (default-log-dir) is not writable. "
+                   "Shutting down the engine",
+                suri->log_dir, suri->conf_filename);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -2846,7 +2844,7 @@ int InitGlobal(void)
 #ifndef OS_WIN32
     UtilSignalHandlerSetup(SIGUSR2, SIG_IGN);
     if (UtilSignalBlock(SIGUSR2)) {
-        SCLogError(SC_ERR_INITIALIZATION, "SIGUSR2 initialization error");
+        SCLogError("SIGUSR2 initialization error");
         return EXIT_FAILURE;
     }
 #endif
@@ -2964,7 +2962,7 @@ int SuricataMain(int argc, char **argv)
 
     /* Wait till all the threads have been initialized */
     if (TmThreadWaitOnThreadInit() == TM_ECODE_FAILED) {
-        FatalError(SC_ERR_FATAL, "Engine initialization failed, "
+        FatalError("Engine initialization failed, "
                    "aborting...");
     }
 
@@ -2975,7 +2973,7 @@ int SuricataMain(int argc, char **argv)
 
 #if defined(SC_ADDRESS_SANITIZER)
     if (limit_nproc) {
-        SCLogWarning(SC_ERR_SYSCONF,
+        SCLogWarning(
                 "\"security.limit-noproc\" (setrlimit()) not set when using address sanitizer");
         limit_nproc = 0;
     }
@@ -2985,15 +2983,15 @@ int SuricataMain(int argc, char **argv)
 #if defined(HAVE_SYS_RESOURCE_H)
 #ifdef linux
         if (geteuid() == 0) {
-            SCLogWarning(SC_ERR_SYSCONF, "setrlimit has no effet when running as root.");
+            SCLogWarning("setrlimit has no effet when running as root.");
         }
 #endif
         struct rlimit r = { 0, 0 };
         if (setrlimit(RLIMIT_NPROC, &r) != 0) {
-            SCLogWarning(SC_ERR_SYSCONF, "setrlimit failed to prevent process creation.");
+            SCLogWarning("setrlimit failed to prevent process creation.");
         }
 #else
-        SCLogWarning(SC_ERR_SYSCONF, "setrlimit unavailable.");
+        SCLogWarning("setrlimit unavailable.");
 #endif
     }
 
index f19717fd4c217c86be4be0ad86c9697e84413dd9..496de10d0c297fc5e71a422fe3d9bc43f1a676b9 100644 (file)
@@ -1065,13 +1065,12 @@ 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_EINVAL, "Error in making the conf full name");
+        SCLogError("Error in making the conf full name");
         goto end;
     }
 
     if (ConfGet(conf_var_full_name, &conf_var_value) != 1) {
-        SCLogError(SC_ERR_UNKNOWN_VALUE, "Error in getting conf value for conf name %s",
-                conf_var_full_name);
+        SCLogError("Error in getting conf value for conf name %s", conf_var_full_name);
         goto end;
     }
 
index 57d32bb1e7897e983690a51e4d4f8c1e0483ae7c..e49270112537ae70b00f1563c1c269b483360fa0 100644 (file)
@@ -91,8 +91,9 @@ TmModule *TmModuleGetById(int id)
 {
 
     if (id < 0 || id >= TMM_SIZE) {
-        SCLogError(SC_ERR_TM_MODULES_ERROR, "Threading module with the id "
-                   "\"%d\" doesn't exist", id);
+        SCLogError("Threading module with the id "
+                   "\"%d\" doesn't exist",
+                id);
         return NULL;
     }
 
@@ -179,8 +180,9 @@ void TmModuleRegisterTests(void)
 
         if (t->RegisterTests == NULL) {
             if (coverage_unittests)
-                SCLogWarning(SC_WARN_NO_UNITTESTS, "threading module %s has no unittest "
-                        "registration function.", t->name);
+                SCLogWarning("threading module %s has no unittest "
+                             "registration function.",
+                        t->name);
         } else {
             t->RegisterTests();
             g_ut_covered++;
index 248cd71d9017cc3f6f926facc943ee25539c7c14..e184ec9827db39326f92b7f67a5ed678ccd65de3 100644 (file)
@@ -36,18 +36,18 @@ Tmq *TmqCreateQueue(const char *name)
 {
     Tmq *q = SCCalloc(1, sizeof(*q));
     if (q == NULL)
-        FatalError(SC_ENOMEM, "SCCalloc failed");
+        FatalError("SCCalloc failed");
 
     q->name = SCStrdup(name);
     if (q->name == NULL)
-        FatalError(SC_ENOMEM, "SCStrdup failed");
+        FatalError("SCStrdup failed");
 
     q->id = tmq_id++;
     q->is_packet_pool = (strcmp(q->name, "packetpool") == 0);
     if (!q->is_packet_pool) {
         q->pq = PacketQueueAlloc();
         if (q->pq == NULL)
-            FatalError(SC_ENOMEM, "PacketQueueAlloc failed");
+            FatalError("PacketQueueAlloc failed");
     }
 
     TAILQ_INSERT_HEAD(&tmq_list, q, next);
@@ -106,12 +106,12 @@ void TmValidateQueueState(void)
     TAILQ_FOREACH(tmq, &tmq_list, next) {
         SCMutexLock(&tmq->pq->mutex_q);
         if (tmq->reader_cnt == 0) {
-            SCLogError(SC_ERR_THREAD_QUEUE, "queue \"%s\" doesn't have a reader (id %d max %u)",
-                    tmq->name, tmq->id, tmq_id);
+            SCLogError("queue \"%s\" doesn't have a reader (id %d max %u)", tmq->name, tmq->id,
+                    tmq_id);
             err = true;
         } else if (tmq->writer_cnt == 0) {
-            SCLogError(SC_ERR_THREAD_QUEUE, "queue \"%s\" doesn't have a writer (id %d, max %u)",
-                    tmq->name, tmq->id, tmq_id);
+            SCLogError("queue \"%s\" doesn't have a writer (id %d, max %u)", tmq->name, tmq->id,
+                    tmq_id);
             err = true;
         }
         SCMutexUnlock(&tmq->pq->mutex_q);
@@ -123,5 +123,5 @@ void TmValidateQueueState(void)
     return;
 
 error:
-    FatalError(SC_ERR_FATAL, "fatal error during threading setup");
+    FatalError("fatal error during threading setup");
 }
index 1bea0fd00b04bb2dfcd52c0ccca3068d3d4d3d33..1ad132865fed38a75fc8bd865fc1227621ab823c 100644 (file)
@@ -241,10 +241,10 @@ static void *TmThreadsSlotPktAcqLoop(void *td)
 
     /* check if we are setup properly */
     if (s == NULL || s->PktAcqLoop == NULL || tv->tmqh_in == NULL || tv->tmqh_out == NULL) {
-        SCLogError(SC_ERR_FATAL, "TmSlot or ThreadVars badly setup: s=%p,"
-                                 " PktAcqLoop=%p, tmqh_in=%p,"
-                                 " tmqh_out=%p",
-                   s, s ? s->PktAcqLoop : NULL, tv->tmqh_in, tv->tmqh_out);
+        SCLogError("TmSlot or ThreadVars badly setup: s=%p,"
+                   " PktAcqLoop=%p, tmqh_in=%p,"
+                   " tmqh_out=%p",
+                s, s ? s->PktAcqLoop : NULL, tv->tmqh_in, tv->tmqh_out);
         TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
         pthread_exit((void *) -1);
         return NULL;
@@ -282,7 +282,7 @@ static void *TmThreadsSlotPktAcqLoop(void *td)
         } else if (slot->tm_id == TMM_FLOWWORKER) {
             tv->stream_pq_local = SCCalloc(1, sizeof(PacketQueue));
             if (tv->stream_pq_local == NULL)
-                FatalError(SC_ENOMEM, "failed to alloc PacketQueue");
+                FatalError("failed to alloc PacketQueue");
             SCMutexInit(&tv->stream_pq_local->mutex_q, NULL);
             tv->stream_pq = tv->stream_pq_local;
             tv->tm_flowworker = slot;
@@ -412,7 +412,7 @@ static void *TmThreadsSlotVar(void *td)
         } else if (s->tm_id == TMM_FLOWWORKER) {
             tv->stream_pq_local = SCCalloc(1, sizeof(PacketQueue));
             if (tv->stream_pq_local == NULL)
-                FatalError(SC_ENOMEM, "failed to alloc PacketQueue");
+                FatalError("failed to alloc PacketQueue");
             SCMutexInit(&tv->stream_pq_local->mutex_q, NULL);
             tv->stream_pq = tv->stream_pq_local;
             tv->tm_flowworker = s;
@@ -764,8 +764,9 @@ void TmThreadSetPrio(ThreadVars *tv)
 #ifndef __CYGWIN__
 #ifdef OS_WIN32
        if (0 == SetThreadPriority(GetCurrentThread(), tv->thread_priority)) {
-        SCLogError(SC_ERR_THREAD_NICE_PRIO, "Error setting priority for "
-                   "thread %s: %s", tv->name, strerror(errno));
+            SCLogError("Error setting priority for "
+                       "thread %s: %s",
+                    tv->name, strerror(errno));
     } else {
         SCLogDebug("Priority set to %"PRId32" for thread %s",
                    tv->thread_priority, tv->name);
@@ -773,9 +774,9 @@ void TmThreadSetPrio(ThreadVars *tv)
 #else
     int ret = nice(tv->thread_priority);
     if (ret == -1) {
-        SCLogError(SC_ERR_THREAD_NICE_PRIO, "Error setting nice value %d "
-                   "for thread %s: %s", tv->thread_priority, tv->name,
-                   strerror(errno));
+        SCLogError("Error setting nice value %d "
+                   "for thread %s: %s",
+                tv->thread_priority, tv->name, strerror(errno));
     } else {
         SCLogDebug("Nice value set to %"PRId32" for thread %s",
                    tv->thread_priority, tv->name);
@@ -809,7 +810,7 @@ TmEcode TmThreadSetCPU(ThreadVars *tv, uint8_t type)
         return TM_ECODE_OK;
 
     if (type > MAX_CPU_SET) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid cpu type family");
+        SCLogError("invalid cpu type family");
         return TM_ECODE_FAILED;
     }
 
@@ -822,7 +823,7 @@ TmEcode TmThreadSetCPU(ThreadVars *tv, uint8_t type)
 int TmThreadGetNbThreads(uint8_t type)
 {
     if (type >= MAX_CPU_SET) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid cpu type family");
+        SCLogError("invalid cpu type family");
         return 0;
     }
 
@@ -1001,7 +1002,7 @@ ThreadVars *TmThreadCreate(const char *name, const char *inq_name, const char *i
     return tv;
 
 error:
-    SCLogError(SC_ERR_THREAD_CREATE, "failed to setup a thread");
+    SCLogError("failed to setup a thread");
 
     if (tv != NULL)
         SCFree(tv);
@@ -1273,8 +1274,8 @@ static void TmThreadDrainPacketThreads(void)
 again:
     gettimeofday(&cur_ts, NULL);
     if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-        SCLogWarning(SC_ERR_SHUTDOWN, "unable to get all packet threads "
-                "to process their packets in time");
+        SCLogWarning("unable to get all packet threads "
+                     "to process their packets in time");
         return;
     }
 
@@ -1340,8 +1341,9 @@ void TmThreadDisableReceiveThreads(void)
 again:
     gettimeofday(&cur_ts, NULL);
     if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-        FatalError(SC_ERR_FATAL, "Engine unable to disable detect "
-                "thread - \"%s\". Killing engine", tv->name);
+        FatalError("Engine unable to disable detect "
+                   "thread - \"%s\". Killing engine",
+                tv->name);
     }
 
     SCMutexLock(&tv_root_lock);
@@ -1479,8 +1481,8 @@ void TmThreadDisablePacketThreads(void)
 again:
     gettimeofday(&cur_ts, NULL);
     if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-        FatalError(SC_ERR_FATAL, "Engine unable to disable packet  "
-                "threads. Killing engine");
+        FatalError("Engine unable to disable packet  "
+                   "threads. Killing engine");
     }
 
     /* loop through the packet threads and kill them */
@@ -1606,7 +1608,7 @@ void TmThreadSetGroupName(ThreadVars *tv, const char *name)
 
     thread_group_name = SCStrdup(name);
     if (unlikely(thread_group_name == NULL)) {
-        SCLogError(SC_ERR_RUNMODE, "error allocating memory");
+        SCLogError("error allocating memory");
         return;
     }
     tv->thread_group_name = thread_group_name;
@@ -1641,7 +1643,7 @@ TmEcode TmThreadSpawn(ThreadVars *tv)
 {
     pthread_attr_t attr;
     if (tv->tm_func == NULL) {
-        FatalError(SC_ERR_TM_THREADS_ERROR, "No thread function set");
+        FatalError("No thread function set");
     }
 
     /* Initialize and set thread detached attribute */
@@ -1653,16 +1655,14 @@ TmEcode TmThreadSpawn(ThreadVars *tv)
     if (threading_set_stack_size) {
         SCLogDebug("Setting per-thread stack size to %" PRIu64, threading_set_stack_size);
         if (pthread_attr_setstacksize(&attr, (size_t)threading_set_stack_size)) {
-            FatalError(SC_ERR_TM_THREADS_ERROR,
-                    "Unable to increase stack size to %" PRIu64 " in thread attributes",
+            FatalError("Unable to increase stack size to %" PRIu64 " in thread attributes",
                     threading_set_stack_size);
         }
     }
 
     int rc = pthread_create(&tv->t, &attr, tv->tm_func, (void *)tv);
     if (rc) {
-        FatalError(SC_ERR_THREAD_CREATE,
-                "Unable to create thread with pthread_create() is %" PRId32, rc);
+        FatalError("Unable to create thread with pthread_create() is %" PRId32, rc);
     }
 
 #if DEBUG && HAVE_PTHREAD_GETATTR_NP
@@ -1697,8 +1697,7 @@ TmEcode TmThreadSpawn(ThreadVars *tv)
 void TmThreadInitMC(ThreadVars *tv)
 {
     if ( (tv->ctrl_mutex = SCMalloc(sizeof(*tv->ctrl_mutex))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in TmThreadInitMC.  "
+        FatalError("Fatal error encountered in TmThreadInitMC.  "
                    "Exiting...");
     }
 
@@ -1708,13 +1707,12 @@ void TmThreadInitMC(ThreadVars *tv)
     }
 
     if ( (tv->ctrl_cond = SCMalloc(sizeof(*tv->ctrl_cond))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in TmThreadInitMC.  "
+        FatalError("Fatal error encountered in TmThreadInitMC.  "
                    "Exiting...");
     }
 
     if (SCCtrlCondInit(tv->ctrl_cond, NULL) != 0) {
-        FatalError(SC_ERR_FATAL, "Error initializing the tv->cond condition "
+        FatalError("Error initializing the tv->cond condition "
                    "variable");
     }
 
@@ -1805,9 +1803,8 @@ again:
             if (TmThreadsCheckFlag(tv, (THV_FAILED | THV_CLOSED | THV_DEAD))) {
                 SCMutexUnlock(&tv_root_lock);
 
-                SCLogError(SC_ERR_THREAD_INIT,
-                        "thread \"%s\" failed to "
-                        "start: flags %04x",
+                SCLogError("thread \"%s\" failed to "
+                           "start: flags %04x",
                         tv->name, SC_ATOMIC_GET(tv->flags));
                 return TM_ECODE_FAILED;
             }
@@ -1819,9 +1816,8 @@ again:
                  * THV_INIT_DONE to THV_RUNNING */
                 gettimeofday(&cur_ts, NULL);
                 if ((cur_ts.tv_sec - start_ts.tv_sec) > 60) {
-                    SCLogError(SC_ERR_THREAD_INIT,
-                            "thread \"%s\" failed to "
-                            "start in time: flags %04x",
+                    SCLogError("thread \"%s\" failed to "
+                               "start in time: flags %04x",
                             tv->name, SC_ATOMIC_GET(tv->flags));
                     return TM_ECODE_FAILED;
                 }
@@ -1913,7 +1909,7 @@ void TmThreadCheckThreadState(void)
         ThreadVars *tv = tv_root[i];
         while (tv) {
             if (TmThreadsCheckFlag(tv, THV_FAILED)) {
-                FatalError(SC_ERR_FATAL, "thread %s failed", tv->name);
+                FatalError("thread %s failed", tv->name);
             }
             tv = tv->next;
         }
@@ -1944,9 +1940,9 @@ again:
             if (TmThreadsCheckFlag(tv, (THV_CLOSED|THV_DEAD))) {
                 SCMutexUnlock(&tv_root_lock);
 
-                SCLogError(SC_ERR_THREAD_INIT, "thread \"%s\" failed to "
-                        "initialize: flags %04x", tv->name,
-                        SC_ATOMIC_GET(tv->flags));
+                SCLogError("thread \"%s\" failed to "
+                           "initialize: flags %04x",
+                        tv->name, SC_ATOMIC_GET(tv->flags));
                 return TM_ECODE_FAILED;
             }
 
@@ -1955,9 +1951,9 @@ again:
 
                 gettimeofday(&cur_ts, NULL);
                 if ((cur_ts.tv_sec - start_ts.tv_sec) > 120) {
-                    SCLogError(SC_ERR_THREAD_INIT, "thread \"%s\" failed to "
-                            "initialize in time: flags %04x", tv->name,
-                            SC_ATOMIC_GET(tv->flags));
+                    SCLogError("thread \"%s\" failed to "
+                               "initialize in time: flags %04x",
+                            tv->name, SC_ATOMIC_GET(tv->flags));
                     return TM_ECODE_FAILED;
                 }
 
@@ -1969,14 +1965,16 @@ again:
 
             if (TmThreadsCheckFlag(tv, THV_FAILED)) {
                 SCMutexUnlock(&tv_root_lock);
-                SCLogError(SC_ERR_THREAD_INIT, "thread \"%s\" failed to "
-                        "initialize.", tv->name);
+                SCLogError("thread \"%s\" failed to "
+                           "initialize.",
+                        tv->name);
                 return TM_ECODE_FAILED;
             }
             if (TmThreadsCheckFlag(tv, THV_CLOSED)) {
                 SCMutexUnlock(&tv_root_lock);
-                SCLogError(SC_ERR_THREAD_INIT, "thread \"%s\" closed on "
-                        "initialization.", tv->name);
+                SCLogError("thread \"%s\" closed on "
+                           "initialization.",
+                        tv->name);
                 return TM_ECODE_FAILED;
             }
 
@@ -2263,7 +2261,7 @@ uint16_t TmThreadsGetWorkerThreadMax()
     if (thread_max < 1)
         thread_max = 1;
     if (thread_max > 1024) {
-        SCLogWarning(SC_ERR_RUNMODE, "limited number of 'worker' threads to 1024. Wanted %d", thread_max);
+        SCLogWarning("limited number of 'worker' threads to 1024. Wanted %d", thread_max);
         thread_max = 1024;
     }
     return (uint16_t)thread_max;
index a02c930f101f0ff6fbac508fd5f55a1add0b05b6..83dec496271f280eb6932440dff7fd4d3206a5d8 100644 (file)
@@ -67,9 +67,9 @@ void TmqhFlowRegister(void)
         } else if (strcasecmp(scheduler, "ippair") == 0) {
             tmqh_table[TMQH_FLOW].OutHandler = TmqhOutputFlowIPPair;
         } else {
-            SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid entry \"%s\" "
+            SCLogError("Invalid entry \"%s\" "
                        "for autofp-scheduler in conf.  Killing engine.",
-                       scheduler);
+                    scheduler);
             exit(EXIT_FAILURE);
         }
     } else {
index a7d33b8b6dd67d1e22b0de77cb61ac2d6a6b452b..bf69b9932442f4525f9333d7a52a2171b631d24c 100644 (file)
@@ -304,8 +304,7 @@ void PacketPoolInit(void)
     for (i = 0; i < max_pending_packets; i++) {
         Packet *p = PacketGetFromAlloc();
         if (unlikely(p == NULL)) {
-            FatalError(SC_ERR_FATAL,
-                       "Fatal error encountered while allocating a packet. Exiting...");
+            FatalError("Fatal error encountered while allocating a packet. Exiting...");
         }
         PacketPoolStorePacket(p);
     }
@@ -501,8 +500,9 @@ void PacketPoolPostRunmodes(void)
     extern intmax_t max_pending_packets;
     intmax_t pending_packets = max_pending_packets;
     if (pending_packets < RESERVED_PACKETS) {
-        FatalError(SC_ERR_INVALID_ARGUMENT, "'max-pending-packets' setting "
-                "must be at least %d", RESERVED_PACKETS);
+        FatalError("'max-pending-packets' setting "
+                   "must be at least %d",
+                RESERVED_PACKETS);
     }
     uint32_t threads = TmThreadCountThreadsByTmmFlags(TM_FLAG_DETECT_TM);
     if (threads == 0)
index 31e1cbf517cb1330b7e43c26371d7d79e1b97260..f931185865f02a4d6f7cf240c9cc25b128c6687f 100644 (file)
@@ -143,9 +143,7 @@ static int UnixNew(UnixCommand * this)
             if (ret != 0) {
                 int err = errno;
                 if (err != EEXIST) {
-                    SCLogError(SC_ERR_INITIALIZATION,
-                            "Cannot create socket directory %s: %s",
-                            SOCKET_PATH, strerror(err));
+                    SCLogError("Cannot create socket directory %s: %s", SOCKET_PATH, strerror(err));
                     return 0;
                 }
             } else {
@@ -167,9 +165,8 @@ static int UnixNew(UnixCommand * this)
     /* create socket */
     this->socket = socket(AF_UNIX, SOCK_STREAM, 0);
     if (this->socket == -1) {
-        SCLogWarning(SC_ERR_OPENING_FILE,
-                     "Unix Socket: unable to create UNIX socket %s: %s",
-                     addr.sun_path, strerror(errno));
+        SCLogWarning(
+                "Unix Socket: unable to create UNIX socket %s: %s", addr.sun_path, strerror(errno));
         return 0;
     }
     this->select_max = this->socket + 1;
@@ -178,16 +175,13 @@ static int UnixNew(UnixCommand * this)
     ret = setsockopt(this->socket, SOL_SOCKET, SO_REUSEADDR,
                      (char *) &on, sizeof(on));
     if ( ret != 0 ) {
-        SCLogWarning(SC_ERR_INITIALIZATION,
-                     "Cannot set sockets options: %s.",  strerror(errno));
+        SCLogWarning("Cannot set sockets options: %s.", strerror(errno));
     }
 
     /* bind socket */
     ret = bind(this->socket, (struct sockaddr *) &addr, len);
     if (ret == -1) {
-        SCLogWarning(SC_ERR_INITIALIZATION,
-                     "Unix socket: UNIX socket bind(%s) error: %s",
-                     sockettarget, strerror(errno));
+        SCLogWarning("Unix socket: UNIX socket bind(%s) error: %s", sockettarget, strerror(errno));
         return 0;
     }
 
@@ -198,18 +192,13 @@ static int UnixNew(UnixCommand * this)
     ret = chmod(sockettarget, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
     if (ret == -1) {
         int err = errno;
-        SCLogWarning(SC_ERR_INITIALIZATION,
-                     "Unable to change permission on socket: %s (%d)",
-                     strerror(err),
-                     err);
+        SCLogWarning("Unable to change permission on socket: %s (%d)", strerror(err), err);
     }
 #endif
 
     /* listen */
     if (listen(this->socket, 1) == -1) {
-        SCLogWarning(SC_ERR_INITIALIZATION,
-                     "Command server: UNIX socket listen() error: %s",
-                     strerror(errno));
+        SCLogWarning("Command server: UNIX socket listen() error: %s", strerror(errno));
         return 0;
     }
     return 1;
@@ -220,7 +209,7 @@ static void UnixCommandSetMaxFD(UnixCommand *this)
     UnixClient *item;
 
     if (this == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Unix command is NULL, warn devel");
+        SCLogError("Unix command is NULL, warn devel");
         return;
     }
 
@@ -236,12 +225,12 @@ static UnixClient *UnixClientAlloc(void)
 {
     UnixClient *uclient = SCMalloc(sizeof(UnixClient));
     if (unlikely(uclient == NULL)) {
-        SCLogError(SC_ENOMEM, "Can't allocate new client");
+        SCLogError("Can't allocate new client");
         return NULL;
     }
     uclient->mbuf = MemBufferCreateNew(CLIENT_BUFFER_SIZE);
     if (uclient->mbuf == NULL) {
-        SCLogError(sc_errno, "Can't allocate new client send buffer");
+        SCLogError("Can't allocate new client send buffer");
         SCFree(uclient);
         return NULL;
     }
@@ -272,7 +261,7 @@ static void UnixCommandClose(UnixCommand  *this, int fd)
     }
 
     if (found == 0) {
-        SCLogError(SC_EINVAL, "No fd found in client list");
+        SCLogError("No fd found in client list");
         return;
     }
 
@@ -302,7 +291,7 @@ static int UnixCommandSendJSONToClient(UnixClient *client, json_t *js)
             JSON_PRESERVE_ORDER|JSON_COMPACT|JSON_ENSURE_ASCII|
             JSON_ESCAPE_SLASH);
     if (r != 0) {
-        SCLogWarning(SC_ERR_SOCKET, "unable to serialize JSON object");
+        SCLogWarning("unable to serialize JSON object");
         return -1;
     }
 
@@ -316,9 +305,9 @@ static int UnixCommandSendJSONToClient(UnixClient *client, json_t *js)
     if (send(client->fd, (const char *)MEMBUFFER_BUFFER(client->mbuf),
                 MEMBUFFER_OFFSET(client->mbuf), MSG_NOSIGNAL) == -1)
     {
-        SCLogWarning(SC_ERR_SOCKET, "unable to send block of size "
-                "%"PRIuMAX": %s", (uintmax_t)MEMBUFFER_OFFSET(client->mbuf),
-                strerror(errno));
+        SCLogWarning("unable to send block of size "
+                     "%" PRIuMAX ": %s",
+                (uintmax_t)MEMBUFFER_OFFSET(client->mbuf), strerror(errno));
         return -1;
     }
 
@@ -427,7 +416,7 @@ static int UnixCommandAccept(UnixCommand *this)
     uclient->version = client_version;
 
     if (UnixCommandSendJSONToClient(uclient, server_msg) != 0) {
-        SCLogWarning(SC_ERR_SOCKET, "Unable to send command");
+        SCLogWarning("Unable to send command");
 
         UnixClientFree(uclient);
         json_decref(server_msg);
@@ -554,15 +543,14 @@ static void UnixCommandRun(UnixCommand * this, UnixClient *client)
             if (ret == 0) {
                 SCLogDebug("Unix socket: lost connection with client");
             } else {
-                SCLogError(SC_ERR_SOCKET, "Unix socket: error on recv() from client: %s",
-                        strerror(errno));
+                SCLogError("Unix socket: error on recv() from client: %s", strerror(errno));
             }
             UnixCommandClose(this, client->fd);
             return;
         }
         if (ret >= (int)(sizeof(buffer)-1)) {
-            SCLogError(SC_ERR_SOCKET, "Command server: client command is too long, "
-                    "disconnect him.");
+            SCLogError("Command server: client command is too long, "
+                       "disconnect him.");
             UnixCommandClose(this, client->fd);
         }
         buffer[ret] = 0;
@@ -576,8 +564,7 @@ static void UnixCommandRun(UnixCommand * this, UnixClient *client)
                 if (ret == 0) {
                     SCLogDebug("Unix socket: lost connection with client");
                 } else {
-                    SCLogError(SC_ERR_SOCKET, "Unix socket: error on recv() from client: %s",
-                            strerror(errno));
+                    SCLogError("Unix socket: error on recv() from client: %s", strerror(errno));
                 }
                 UnixCommandClose(this, client->fd);
                 return;
@@ -657,7 +644,7 @@ static int UnixMain(UnixCommand * this)
         if (errno == EINTR) {
             return 1;
         }
-        SCLogError(SC_ERR_SOCKET, "Command server: select() fatal error: %s", strerror(errno));
+        SCLogError("Command server: select() fatal error: %s", strerror(errno));
         return 0;
     }
 
@@ -967,30 +954,30 @@ TmEcode UnixManagerRegisterCommand(const char * keyword,
     Command *lcmd = NULL;
 
     if (Func == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function");
+        SCLogError("Null function");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     if (keyword == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Null keyword");
+        SCLogError("Null keyword");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     TAILQ_FOREACH(lcmd, &command.commands, next) {
         if (!strcmp(keyword, lcmd->name)) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "%s already registered", keyword);
+            SCLogError("%s already registered", keyword);
             SCReturnInt(TM_ECODE_FAILED);
         }
     }
 
     cmd = SCMalloc(sizeof(Command));
     if (unlikely(cmd == NULL)) {
-        SCLogError(SC_ENOMEM, "Can't alloc cmd");
+        SCLogError("Can't alloc cmd");
         SCReturnInt(TM_ECODE_FAILED);
     }
     cmd->name = SCStrdup(keyword);
     if (unlikely(cmd->name == NULL)) {
-        SCLogError(SC_ENOMEM, "Can't alloc cmd name");
+        SCLogError("Can't alloc cmd name");
         SCFree(cmd);
         SCReturnInt(TM_ECODE_FAILED);
     }
@@ -1020,13 +1007,13 @@ TmEcode UnixManagerRegisterBackgroundTask(TmEcode (*Func)(void *),
     Task *task = NULL;
 
     if (Func == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function");
+        SCLogError("Null function");
         SCReturnInt(TM_ECODE_FAILED);
     }
 
     task = SCMalloc(sizeof(Task));
     if (unlikely(task == NULL)) {
-        SCLogError(SC_ENOMEM, "Can't alloc task");
+        SCLogError("Can't alloc task");
         SCReturnInt(TM_ECODE_FAILED);
     }
     task->Func = Func;
@@ -1045,11 +1032,9 @@ int UnixManagerInit(void)
             SCLogDebug("ConfGetBool could not load the value.");
         }
         if (failure_fatal) {
-                    FatalError(SC_ERR_FATAL,
-                               "Unable to create unix command socket");
+            FatalError("Unable to create unix command socket");
         } else {
-            SCLogWarning(SC_ERR_INITIALIZATION,
-                    "Unable to create unix command socket");
+            SCLogWarning("Unable to create unix command socket");
             return -1;
         }
     }
@@ -1134,7 +1119,7 @@ static TmEcode UnixManager(ThreadVars *th_v, void *thread_data)
     while (1) {
         ret = UnixMain(&command);
         if (ret == 0) {
-            SCLogError(SC_ERR_FATAL, "Fatal error on unix socket");
+            SCLogError("Fatal error on unix socket");
         }
 
         if ((ret == 0) || (TmThreadsCheckFlag(th_v, THV_KILL))) {
@@ -1169,14 +1154,14 @@ void UnixManagerThreadSpawn(int mode)
                                           "UnixManager", 0);
 
     if (tv_unixmgr == NULL) {
-        FatalError(SC_ERR_FATAL, "TmThreadsCreate failed");
+        FatalError("TmThreadsCreate failed");
     }
     if (TmThreadSpawn(tv_unixmgr) != TM_ECODE_OK) {
-        FatalError(SC_ERR_FATAL, "TmThreadSpawn failed");
+        FatalError("TmThreadSpawn failed");
     }
     if (mode == 1) {
         if (TmThreadsCheckFlag(tv_unixmgr, THV_RUNNING_DONE)) {
-            FatalError(SC_ERR_FATAL, "Unix socket init failed");
+            FatalError("Unix socket init failed");
         }
     }
     return;
@@ -1249,7 +1234,7 @@ again:
 
 void UnixManagerThreadSpawn(int mode)
 {
-    SCLogError(SC_ERR_UNIMPLEMENTED, "Unix socket is not compiled");
+    SCLogError("Unix socket is not compiled");
     return;
 }
 
index aab447564db68cd31dd0cd4856ec278178c58739..4d26c7e54dd6ca31f6f72c4910c16a342cc284ef 100644 (file)
@@ -116,27 +116,30 @@ int ActionInitConfig()
             SCLogDebug("Loading action order : %s", action->val);
             action_flag = ActionAsciiToFlag(action->val);
             if (action_flag == 0) {
-                SCLogError(SC_ERR_ACTION_ORDER, "action-order, invalid action: \"%s\". Please, use"
-                       " \"pass\",\"drop\",\"alert\",\"reject\". You have"
-                       " to specify all of them, without quotes and without"
-                       " capital letters", action->val);
+                SCLogError("action-order, invalid action: \"%s\". Please, use"
+                           " \"pass\",\"drop\",\"alert\",\"reject\". You have"
+                           " to specify all of them, without quotes and without"
+                           " capital letters",
+                        action->val);
                 goto error;
             }
 
             if (actions_used & action_flag) {
-                SCLogError(SC_ERR_ACTION_ORDER, "action-order, action already set: \"%s\". Please,"
-                       " use \"pass\",\"drop\",\"alert\",\"reject\". You"
-                       " have to specify all of them, without quotes and"
-                       " without capital letters", action->val);
+                SCLogError("action-order, action already set: \"%s\". Please,"
+                           " use \"pass\",\"drop\",\"alert\",\"reject\". You"
+                           " have to specify all of them, without quotes and"
+                           " without capital letters",
+                        action->val);
                 goto error;
             }
 
             if (order >= 4) {
-                SCLogError(SC_ERR_ACTION_ORDER, "action-order, you have already specified all the "
-                       "possible actions plus \"%s\". Please, use \"pass\","
-                       "\"drop\",\"alert\",\"reject\". You have to specify"
-                       " all of them, without quotes and without capital"
-                       " letters", action->val);
+                SCLogError("action-order, you have already specified all the "
+                           "possible actions plus \"%s\". Please, use \"pass\","
+                           "\"drop\",\"alert\",\"reject\". You have to specify"
+                           " all of them, without quotes and without capital"
+                           " letters",
+                        action->val);
                 goto error;
             }
             actions_used |= action_flag;
@@ -144,10 +147,10 @@ int ActionInitConfig()
         }
     }
     if (order < 4) {
-        SCLogError(SC_ERR_ACTION_ORDER, "action-order, the config didn't specify all of the "
-               "actions. Please, use \"pass\",\"drop\",\"alert\","
-               "\"reject\". You have to specify all of them, without"
-               " quotes and without capital letters");
+        SCLogError("action-order, the config didn't specify all of the "
+                   "actions. Please, use \"pass\",\"drop\",\"alert\","
+                   "\"reject\". You have to specify all of them, without"
+                   " quotes and without capital letters");
         goto error;
     }
 
index 302ab2d9c5918b9d302aa1d1dd8a9862370f42e8..704ed49b9680d96d5d88a9d3c84e04e38a1c1990 100644 (file)
@@ -114,41 +114,27 @@ void BuildCpusetWithCallback(const char *name, ConfNode *node,
             char *end;
             a = strtoul(lnode->val, &end, 10);
             if (end != sep) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "%s: invalid cpu range (start invalid): \"%s\"",
-                        name,
-                        lnode->val);
+                SCLogError("%s: invalid cpu range (start invalid): \"%s\"", name, lnode->val);
                 exit(EXIT_FAILURE);
             }
             b = strtol(sep + 1, &end, 10);
             if (end != sep + strlen(sep)) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "%s: invalid cpu range (end invalid): \"%s\"",
-                        name,
-                        lnode->val);
+                SCLogError("%s: invalid cpu range (end invalid): \"%s\"", name, lnode->val);
                 exit(EXIT_FAILURE);
             }
             if (a > b) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "%s: invalid cpu range (bad order): \"%s\"",
-                        name,
-                        lnode->val);
+                SCLogError("%s: invalid cpu range (bad order): \"%s\"", name, lnode->val);
                 exit(EXIT_FAILURE);
             }
             if (b > max) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                           "%s: upper bound (%ld) of cpu set is too high, only %d cpu(s)",
-                           name,
-                           b, max + 1);
+                SCLogError("%s: upper bound (%ld) of cpu set is too high, only %d cpu(s)", name, b,
+                        max + 1);
             }
         } else {
             char *end;
             a = strtoul(lnode->val, &end, 10);
             if (end != lnode->val + strlen(lnode->val)) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                        "%s: invalid cpu range (not an integer): \"%s\"",
-                        name,
-                        lnode->val);
+                SCLogError("%s: invalid cpu range (not an integer): \"%s\"", name, lnode->val);
                 exit(EXIT_FAILURE);
             }
             b = a;
@@ -210,7 +196,7 @@ void AffinitySetupLoadFromConfig()
         ConfNode *nprio = NULL;
 
         if (taf == NULL) {
-            FatalError(SC_ERR_FATAL, "unknown cpu-affinity type");
+            FatalError("unknown cpu-affinity type");
         } else {
             SCLogConfig("Found affinity definition for \"%s\"", setname);
         }
@@ -257,7 +243,7 @@ void AffinitySetupLoadFromConfig()
                 } else if (!strcmp(node->val, "high")) {
                     taf->prio = PRIO_HIGH;
                 } else {
-                    FatalError(SC_ERR_FATAL, "unknown cpu_affinity prio");
+                    FatalError("unknown cpu_affinity prio");
                 }
                 SCLogConfig("Using default prio '%s' for set '%s'",
                         node->val, setname);
@@ -271,18 +257,19 @@ void AffinitySetupLoadFromConfig()
             } else if (!strcmp(node->val, "balanced")) {
                 taf->mode_flag = BALANCED_AFFINITY;
             } else {
-                FatalError(SC_ERR_FATAL, "unknown cpu_affinity node");
+                FatalError("unknown cpu_affinity node");
             }
         }
 
         node = ConfNodeLookupChild(affinity->head.tqh_first, "threads");
         if (node != NULL) {
             if (StringParseUint32(&taf->nb_threads, 10, 0, (const char *)node->val) < 0) {
-                FatalError(SC_ERR_INVALID_ARGUMENT, "invalid value for threads "
-                           "count: '%s'", node->val);
+                FatalError("invalid value for threads "
+                           "count: '%s'",
+                        node->val);
             }
             if (! taf->nb_threads) {
-                FatalError(SC_ERR_FATAL, "bad value for threads count");
+                FatalError("bad value for threads count");
             }
         }
     }
@@ -308,8 +295,8 @@ uint16_t AffinityGetNextCPU(ThreadsAffinityType *taf)
         }
     }
     if (iter == 2) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "cpu_set does not contain "
-                "available cpus, cpu affinity conf is invalid");
+        SCLogError("cpu_set does not contain "
+                   "available cpus, cpu affinity conf is invalid");
     }
     taf->lcpu = ncpu + 1;
     if (taf->lcpu >= UtilCpuGetNumProcessorsOnline())
index 4579d4a923e734a5ba96173dacd564d9ebb1bbe7..2dd94f6eac3bc5f99840f5e846cf1ccae53abac9 100644 (file)
@@ -33,9 +33,8 @@ MemBuffer *MemBufferCreateNew(uint32_t size)
 {
     sc_errno = SC_OK;
     if (size > MAX_LIMIT) {
-        SCLogWarning(SC_EINVAL,
-                "Mem buffer asked to create "
-                "buffer with size greater than API limit - %d",
+        SCLogWarning("Mem buffer asked to create "
+                     "buffer with size greater than API limit - %d",
                 MAX_LIMIT);
         sc_errno = SC_EINVAL;
         return NULL;
@@ -64,8 +63,9 @@ MemBuffer *MemBufferCreateNew(uint32_t size)
  */
 int MemBufferExpand(MemBuffer **buffer, uint32_t expand_by) {
     if (((*buffer)->size + expand_by) > MAX_LIMIT) {
-        SCLogWarning(SC_ERR_MEM_BUFFER_API, "Mem buffer asked to create "
-                     "buffer with size greater than API limit - %d", MAX_LIMIT);
+        SCLogWarning("Mem buffer asked to create "
+                     "buffer with size greater than API limit - %d",
+                MAX_LIMIT);
         return -1;
     }
 
index 72ed4bf583cc7c63a47336993f9beb759b368fc5..d2f39fb2d2113e52de1a05a919bbc6503a102728 100644 (file)
@@ -224,7 +224,7 @@ int ByteExtractString(uint64_t *res, int base, size_t len, const char *str, bool
         return -1;
     }
     else if (strict && *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Extra characters following numeric value");
+        SCLogError("Extra characters following numeric value");
         return -1;
     }
 
@@ -325,8 +325,9 @@ int StringParseUint32(uint32_t *res, int base, size_t len, const char *str)
     *res = (uint32_t)i64;
 
     if ((uint64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UINT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                i64, (uintmax_t)UINT_MAX);
         return -1;
     }
 
@@ -348,8 +349,9 @@ int StringParseUint16(uint16_t *res, int base, size_t len, const char *str)
     *res = (uint16_t)i64;
 
     if ((uint64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)USHRT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                i64, (uintmax_t)USHRT_MAX);
         return -1;
     }
 
@@ -371,8 +373,9 @@ int StringParseUint8(uint8_t *res, int base, size_t len, const char *str)
     *res = (uint8_t)i64;
 
     if ((uint64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UCHAR_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                i64, (uintmax_t)UCHAR_MAX);
         return -1;
     }
 
@@ -418,8 +421,9 @@ int StringParseU32RangeCheck(
     }
 
     if ((uint64_t)(*res) != u64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIuMAX ")", u64, (uintmax_t)UINT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                u64, (uintmax_t)UINT_MAX);
         return -1;
     }
 
@@ -446,8 +450,9 @@ int StringParseU16RangeCheck(
     }
 
     if ((uint64_t)(*res) != u64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIuMAX ")", u64, (uintmax_t)USHRT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                u64, (uintmax_t)USHRT_MAX);
         return -1;
     }
 
@@ -474,8 +479,9 @@ int StringParseU8RangeCheck(
     }
 
     if ((uint64_t)(*res) != u64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIuMAX ")", u64, (uintmax_t)UCHAR_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIu64 " > %" PRIuMAX ")",
+                u64, (uintmax_t)UCHAR_MAX);
         return -1;
     }
 
@@ -497,7 +503,7 @@ int ByteExtractStringSigned(int64_t *res, int base, size_t len, const char *str,
     char strbuf[24];
 
     if (len > 23) {
-        SCLogError(SC_ERR_ARG_LEN_LONG, "len too large (23 max)");
+        SCLogError("len too large (23 max)");
         return -1;
     }
 
@@ -512,14 +518,14 @@ int ByteExtractStringSigned(int64_t *res, int base, size_t len, const char *str,
     *res = strtoll(ptr, &endptr, base);
 
     if (errno == ERANGE) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range");
+        SCLogError("Numeric value out of range");
         return -1;
     } else if (endptr == str) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Invalid numeric value");
+        SCLogError("Invalid numeric value");
         return -1;
     }
     else if (strict && len && *endptr != '\0') {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Extra characters following numeric value");
+        SCLogError("Extra characters following numeric value");
         return -1;
     }
 
@@ -549,8 +555,9 @@ int ByteExtractStringInt32(int32_t *res, int base, size_t len, const char *str)
     *res = (int32_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)INT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)INT_MAX);
         return -1;
     }
 
@@ -573,8 +580,9 @@ int ByteExtractStringInt16(int16_t *res, int base, size_t len, const char *str)
     *res = (int16_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)SHRT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)SHRT_MAX);
         return -1;
     }
 
@@ -597,8 +605,9 @@ int ByteExtractStringInt8(int8_t *res, int base, size_t len, const char *str)
     *res = (int8_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)CHAR_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)CHAR_MAX);
         return -1;
     }
 
@@ -626,8 +635,9 @@ int StringParseInt32(int32_t *res, int base, size_t len, const char *str)
     *res = (int32_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)INT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)INT_MAX);
         return -1;
     }
 
@@ -650,8 +660,9 @@ int StringParseInt16(int16_t *res, int base, size_t len, const char *str)
     *res = (int16_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)SHRT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)SHRT_MAX);
         return -1;
     }
 
@@ -674,8 +685,9 @@ int StringParseInt8(int8_t *res, int base, size_t len, const char *str)
     *res = (int8_t)i64;
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)CHAR_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)CHAR_MAX);
         return -1;
     }
 
@@ -722,8 +734,9 @@ int StringParseI32RangeCheck(
     }
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)INT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)INT_MAX);
         return -1;
     }
 
@@ -751,8 +764,9 @@ int StringParseI16RangeCheck(
     }
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)SHRT_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)SHRT_MAX);
         return -1;
     }
 
@@ -780,8 +794,9 @@ int StringParseI8RangeCheck(
     }
 
     if ((int64_t)(*res) != i64) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)CHAR_MAX);
+        SCLogError("Numeric value out of range "
+                   "(%" PRIi64 " > %" PRIiMAX ")\n",
+                i64, (intmax_t)CHAR_MAX);
         return -1;
     }
 
index 4a81be55f50ed31f1c8748b8269cf8f35df6306b..19aae0ce93a67fb949f85a9558a8de61204f45d5 100644 (file)
@@ -72,9 +72,8 @@ void SCClassConfInit(void)
     if (regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogWarning(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogWarning("pcre2 compile of \"%s\" failed at "
+                     "offset %d: %s",
                 DETECT_CLASSCONFIG_REGEX, (int)eo, errbuffer);
         return;
     }
@@ -119,7 +118,7 @@ static FILE *SCClassConfInitContextAndLocalResources(DetectEngineCtx *de_ctx, FI
                                           SCClassConfClasstypeHashCompareFunc,
                                           SCClassConfClasstypeHashFree);
     if (de_ctx->class_conf_ht == NULL) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "Error initializing the hash "
+        SCLogError("Error initializing the hash "
                    "table");
         return NULL;
     }
@@ -135,8 +134,7 @@ static FILE *SCClassConfInitContextAndLocalResources(DetectEngineCtx *de_ctx, FI
             if (RunmodeIsUnittests())
                 return NULL; // silently fail
 #endif
-            SCLogWarning(SC_ERR_FOPEN, "could not open: \"%s\": %s",
-                    filename, strerror(errno));
+            SCLogWarning("could not open: \"%s\": %s", filename, strerror(errno));
             return NULL;
         }
     }
@@ -213,7 +211,7 @@ static char *SCClassConfStringToLowercase(const char *str)
     char *temp_str = NULL;
 
     if ( (new_str = SCStrdup(str)) == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
         return NULL;
     }
 
@@ -252,9 +250,8 @@ int SCClassConfAddClasstype(DetectEngineCtx *de_ctx, char *rawstr, uint16_t inde
 
     ret = pcre2_match(regex, (PCRE2_SPTR8)rawstr, strlen(rawstr), 0, 0, regex_match, NULL);
     if (ret < 0) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE,
-                "Invalid Classtype in "
-                "classification.config file %s: \"%s\"",
+        SCLogError("Invalid Classtype in "
+                   "classification.config file %s: \"%s\"",
                 SCClassConfGetConfFilename(de_ctx), rawstr);
         goto error;
     }
@@ -404,7 +401,7 @@ static SCClassConfClasstype *SCClassConfAllocClasstype(uint16_t classtype_id,
 
     if (classtype_desc != NULL &&
         (ct->classtype_desc = SCStrdup(classtype_desc)) == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
 
         SCClassConfDeAllocClasstype(ct);
         return NULL;
@@ -535,15 +532,14 @@ bool SCClassConfLoadClassficationConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
             return false;
         }
 #endif
-        SCLogError(SC_ERR_OPENING_FILE, "please check the \"classification-file\" "
-                "option in your suricata.yaml file");
+        SCLogError("please check the \"classification-file\" "
+                   "option in your suricata.yaml file");
         return false;
     }
 
     bool ret = true;
     if (!SCClassConfParseFile(de_ctx, fd)) {
-        SCLogWarning(SC_WARN_CLASSIFICATION_CONFIG,
-                "Error loading classification configuration from %s",
+        SCLogWarning("Error loading classification configuration from %s",
                 SCClassConfGetConfFilename(de_ctx));
         ret = false;
     }
index 9807db0cae4d0f444999901909d0786570961322..47ee431c8c2a873f125320424ac0e1979b9ca8c4 100644 (file)
@@ -151,7 +151,7 @@ int ConfUnixSocketIsEnable(void)
     }
 
     if (value == NULL) {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "malformed value for unix-command.enabled: NULL");
+        SCLogError("malformed value for unix-command.enabled: NULL");
         return 0;
     }
 
index ba00a9fca5f96e1fab570ef09d3e07c7242edac0..a131abcf836c59826b92f15c303cf7912014b754 100644 (file)
@@ -99,7 +99,7 @@ int32_t CoredumpLoadConfig (void)
         return 1;
     }
     if (dump_size_config == NULL) {
-        SCLogError (SC_ERR_INVALID_YAML_CONF_ENTRY, "malformed value for coredump.max-dump: NULL");
+        SCLogError("malformed value for coredump.max-dump: NULL");
         return 0;
     }
     if (strcasecmp (dump_size_config, "unlimited") == 0) {
index 2fcd435079dcbdc365fba48ed15bc6bf45dd02ab..97546ccd3f3b6ad50271b630da18581cbae5a710 100644 (file)
@@ -62,8 +62,9 @@ uint16_t UtilCpuGetNumProcessorsConfigured(void)
        long nprocs = -1;
     nprocs = sysconf(_SC_NPROCESSORS_CONF);
     if (nprocs < 1) {
-        SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus "
-                   "configured (%s)", strerror(errno));
+        SCLogError("Couldn't retrieve the number of cpus "
+                   "configured (%s)",
+                strerror(errno));
         return 0;
     }
 
@@ -80,21 +81,20 @@ uint16_t UtilCpuGetNumProcessorsConfigured(void)
     const char* envvar = getenv("NUMBER_OF_PROCESSORS");
     if (envvar != NULL) {
         if (StringParseInt64(&nprocs, 10, 0, envvar) < 0) {
-            SCLogWarning(SC_EINVAL,
-                    "Invalid value for number of "
-                    "processors: %s",
+            SCLogWarning("Invalid value for number of "
+                         "processors: %s",
                     envvar);
             return 0;
         }
     }
     if (nprocs < 1) {
-        SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus "
+        SCLogError("Couldn't retrieve the number of cpus "
                    "configured from the NUMBER_OF_PROCESSORS environment variable");
         return 0;
     }
     return (uint16_t)nprocs;
 #else
-    SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the number of cpus "
+    SCLogError("Couldn't retrieve the number of cpus "
                "configured, sysconf macro unavailable");
     return 0;
 #endif
@@ -111,8 +111,9 @@ uint16_t UtilCpuGetNumProcessorsOnline(void)
     long nprocs = -1;
     nprocs = sysconf(_SC_NPROCESSORS_ONLN);
     if (nprocs < 1) {
-        SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus "
-                   "online (%s)", strerror(errno));
+        SCLogError("Couldn't retrieve the number of cpus "
+                   "online (%s)",
+                strerror(errno));
         return 0;
     }
 
@@ -127,7 +128,7 @@ uint16_t UtilCpuGetNumProcessorsOnline(void)
 #elif OS_WIN32
        return UtilCpuGetNumProcessorsConfigured();
 #else
-    SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the number of cpus online, "
+    SCLogError("Couldn't retrieve the number of cpus online, "
                "synconf macro unavailable");
     return 0;
 #endif
@@ -146,8 +147,9 @@ uint16_t UtilCpuGetNumProcessorsMax(void)
     long nprocs = -1;
     nprocs = sysconf(_SC_NPROCESSORS_MAX);
     if (nprocs < 1) {
-        SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the maximum number of cpus "
-                   "allowed by the system (%s)", strerror(errno));
+        SCLogError("Couldn't retrieve the maximum number of cpus "
+                   "allowed by the system (%s)",
+                strerror(errno));
         return 0;
     }
 
@@ -159,7 +161,7 @@ uint16_t UtilCpuGetNumProcessorsMax(void)
 
     return (uint16_t)nprocs;
 #else
-    SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the maximum number of cpus allowed by "
+    SCLogError("Couldn't retrieve the maximum number of cpus allowed by "
                "the system, synconf macro unavailable");
     return 0;
 #endif
index 085df077e6863736ca27a27b4f7961a823be8b00..250b6e9a24104c94b93e488318f4225e3b38d2aa 100644 (file)
@@ -70,7 +70,7 @@ static void WaitForChild (pid_t pid)
         if (waitpid(pid, &status, WNOHANG)) {
             /* Check if the child is still there, otherwise the parent should exit */
             if (WIFEXITED(status) || WIFSIGNALED(status)) {
-                FatalError(SC_ERR_FATAL, "Child died unexpectedly");
+                FatalError("Child died unexpectedly");
             }
         }
         /* sigsuspend(); */
@@ -121,26 +121,25 @@ void Daemonize (void)
 
     if (pid < 0) {
         /* Fork error */
-        FatalError(SC_ERR_FATAL, "Error forking the process");
+        FatalError("Error forking the process");
     } else if (pid == 0) {
         /* Child continues here */
         const char *daemondir;
 
         sid = setsid();
         if (sid < 0) {
-            FatalError(SC_ERR_FATAL, "Error creating new session");
+            FatalError("Error creating new session");
         }
 
         if (ConfGet("daemon-directory", &daemondir) == 1) {
             if ((chdir(daemondir)) < 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Error changing to working directory");
+                FatalError("Error changing to working directory");
             }
         }
 #ifndef OS_WIN32
         else {
             if (chdir("/") < 0) {
-                SCLogError(SC_ERR_DAEMON, "Error changing to working directory '/'");
+                SCLogError("Error changing to working directory '/'");
             }
         }
 #endif
@@ -180,10 +179,10 @@ int CheckValidDaemonModes (int daemon, int mode)
     if (daemon) {
         switch (mode) {
             case RUNMODE_PCAP_FILE:
-                SCLogError(SC_ERR_INVALID_RUNMODE, "ERROR: pcap offline mode cannot run as daemon");
+                SCLogError("ERROR: pcap offline mode cannot run as daemon");
                 return 0;
             case RUNMODE_UNITTEST:
-                SCLogError(SC_ERR_INVALID_RUNMODE, "ERROR: unittests cannot run as daemon");
+                SCLogError("ERROR: unittests cannot run as daemon");
                 return 0;
             default:
                 SCLogDebug("Allowed mode");
index ee3d566d8d07cbea783aa6b145085b3e8d8e555a..e539f5ea00d0e64de840723475d61734da2f5da3 100644 (file)
@@ -865,8 +865,7 @@ void SCLogAddToFGFFileList(SCLogFGFilterFile *fgf_file,
     SCLogFGFilterLine *fgf_line_temp = NULL;
 
     if ( (fgf_file_temp = SCMalloc(sizeof(SCLogFGFilterFile))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
     }
     memset(fgf_file_temp, 0, sizeof(SCLogFGFilterFile));
 
@@ -876,8 +875,7 @@ void SCLogAddToFGFFileList(SCLogFGFilterFile *fgf_file,
     }
 
     if ( (fgf_func_temp = SCMalloc(sizeof(SCLogFGFilterFunc))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
     }
     memset(fgf_func_temp, 0, sizeof(SCLogFGFilterFunc));
 
@@ -887,8 +885,7 @@ void SCLogAddToFGFFileList(SCLogFGFilterFile *fgf_file,
     }
 
     if ( (fgf_line_temp = SCMalloc(sizeof(SCLogFGFilterLine))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFFileList. Exiting...");
     }
     memset(fgf_line_temp, 0, sizeof(SCLogFGFilterLine));
 
@@ -929,8 +926,7 @@ void SCLogAddToFGFFuncList(SCLogFGFilterFile *fgf_file,
     SCLogFGFilterLine *fgf_line_temp = NULL;
 
     if ( (fgf_func_temp = SCMalloc(sizeof(SCLogFGFilterFunc))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFFuncList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFFuncList. Exiting...");
     }
     memset(fgf_func_temp, 0, sizeof(SCLogFGFilterFunc));
 
@@ -940,8 +936,7 @@ void SCLogAddToFGFFuncList(SCLogFGFilterFile *fgf_file,
     }
 
     if ( (fgf_line_temp = SCMalloc(sizeof(SCLogFGFilterLine))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFFuncList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFFuncList. Exiting...");
     }
     memset(fgf_line_temp, 0, sizeof(SCLogFGFilterLine));
 
@@ -978,8 +973,7 @@ void SCLogAddToFGFLineList(SCLogFGFilterFunc *fgf_func,
     SCLogFGFilterLine *fgf_line_temp = NULL;
 
     if ( (fgf_line_temp = SCMalloc(sizeof(SCLogFGFilterLine))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAddToFGFLineList. Exiting...");
+        FatalError("Fatal error encountered in SCLogAddToFGFLineList. Exiting...");
     }
     memset(fgf_line_temp, 0, sizeof(SCLogFGFilterLine));
 
index befa8f3ae9493f380f1a2d1d01004813aef63f94..db2cd2489c2dc656efe1665954ffaa412754ae41 100644 (file)
@@ -192,8 +192,7 @@ static inline void SCLogPrintToSyslog(int syslog_log_level, const char *msg)
 /**
  */
 static int SCLogMessageJSON(struct timeval *tval, char *buffer, size_t buffer_size,
-        SCLogLevel log_level, const char *file,
-        unsigned line, const char *function, SCError error_code,
+        SCLogLevel log_level, const char *file, unsigned line, const char *function,
         const char *message)
 {
     json_t *js = json_object();
@@ -216,11 +215,6 @@ static int SCLogMessageJSON(struct timeval *tval, char *buffer, size_t buffer_si
 
     json_object_set_new(js, "event_type", json_string("engine"));
 
-    if (error_code > 0) {
-        json_object_set_new(ejs, "error_code", json_integer(error_code));
-        json_object_set_new(ejs, "error", json_string(SCErrorToString(error_code)));
-    }
-
     if (message)
         json_object_set_new(ejs, "message", json_string(message));
 
@@ -263,17 +257,15 @@ error:
  *
  * \retval SC_OK on success; else an error code
  */
-static SCError SCLogMessageGetBuffer(
-        struct timeval *tval, int color, SCLogOPType type,
-                     char *buffer, size_t buffer_size,
-                     const char *log_format,
-
-                     const SCLogLevel log_level, const char *file,
-                     const unsigned int line, const char *function,
-                     const SCError error_code, const char *message)
+static SCError SCLogMessageGetBuffer(struct timeval *tval, int color, SCLogOPType type,
+        char *buffer, size_t buffer_size, const char *log_format,
+
+        const SCLogLevel log_level, const char *file, const unsigned int line, const char *function,
+        const char *message)
 {
     if (type == SC_LOG_OP_TYPE_JSON)
-        return SCLogMessageJSON(tval, buffer, buffer_size, log_level, file, line, function, error_code, message);
+        return SCLogMessageJSON(
+                tval, buffer, buffer_size, log_level, file, line, function, message);
 
     char *temp = buffer;
     const char *s = NULL;
@@ -445,20 +437,8 @@ static SCError SCLogMessageGetBuffer(
         return SC_OK;
     }
 
-    if (error_code != SC_OK) {
-        cw = snprintf(temp, SC_LOG_MAX_LOG_MSG_LEN - (temp - buffer),
-                "[%sERRCODE%s: %s%s%s(%s%d%s)] - ", yellow, reset, red, SCErrorToString(error_code), reset, yellow, error_code, reset);
-        if (cw < 0) {
-            return SC_ERR_SPRINTF;
-        }
-        temp += cw;
-        if ((temp - buffer) > SC_LOG_MAX_LOG_MSG_LEN) {
-            return SC_OK;
-        }
-    }
-
     const char *hi = "";
-    if (error_code > SC_OK)
+    if (log_level <= SC_LOG_ERROR)
         hi = red;
     else if (log_level <= SC_LOG_NOTICE)
         hi = yellow;
@@ -512,9 +492,8 @@ static int SCLogReopen(SCLogOPIfaceCtx *op_iface_ctx)
  *
  * \retval SC_OK on success; else an error code
  */
-SCError SCLogMessage(const SCLogLevel log_level, const char *file,
-                     const unsigned int line, const char *function,
-                     const SCError error_code, const char *message)
+SCError SCLogMessage(const SCLogLevel log_level, const char *file, const unsigned int line,
+        const char *function, const char *message)
 {
     char buffer[SC_LOG_MAX_LOG_MSG_LEN] = "";
     SCLogOPIfaceCtx *op_iface_ctx = NULL;
@@ -539,22 +518,18 @@ SCError SCLogMessage(const SCLogLevel log_level, const char *file,
         switch (op_iface_ctx->iface) {
             case SC_LOG_OP_IFACE_CONSOLE:
                 if (SCLogMessageGetBuffer(&tval, op_iface_ctx->use_color, op_iface_ctx->type,
-                                          buffer, sizeof(buffer),
-                                          op_iface_ctx->log_format ?
-                                              op_iface_ctx->log_format : sc_log_config->log_format,
-                                          log_level, file, line, function,
-                                          error_code, message) == 0)
-                {
+                            buffer, sizeof(buffer),
+                            op_iface_ctx->log_format ? op_iface_ctx->log_format
+                                                     : sc_log_config->log_format,
+                            log_level, file, line, function, message) == 0) {
                     SCLogPrintToStream((log_level == SC_LOG_ERROR)? stderr: stdout, buffer);
                 }
                 break;
             case SC_LOG_OP_IFACE_FILE:
                 if (SCLogMessageGetBuffer(&tval, 0, op_iface_ctx->type, buffer, sizeof(buffer),
-                                          op_iface_ctx->log_format ?
-                                              op_iface_ctx->log_format : sc_log_config->log_format,
-                                          log_level, file, line, function,
-                                          error_code, message) == 0)
-                {
+                            op_iface_ctx->log_format ? op_iface_ctx->log_format
+                                                     : sc_log_config->log_format,
+                            log_level, file, line, function, message) == 0) {
                     int r = 0;
                     SCMutexLock(&op_iface_ctx->fp_mutex);
                     if (op_iface_ctx->rotation_flag) {
@@ -566,18 +541,16 @@ SCError SCLogMessage(const SCLogLevel log_level, const char *file,
 
                     /* report error outside of lock to avoid recursion */
                     if (r == -1) {
-                        SCLogError(SC_ERR_FOPEN, "re-opening file \"%s\" failed: %s",
-                                op_iface_ctx->file, strerror(errno));
+                        SCLogError("re-opening file \"%s\" failed: %s", op_iface_ctx->file,
+                                strerror(errno));
                     }
                 }
                 break;
             case SC_LOG_OP_IFACE_SYSLOG:
                 if (SCLogMessageGetBuffer(&tval, 0, op_iface_ctx->type, buffer, sizeof(buffer),
-                                          op_iface_ctx->log_format ?
-                                              op_iface_ctx->log_format : sc_log_config->log_format,
-                                          log_level, file, line, function,
-                                          error_code, message) == 0)
-                {
+                            op_iface_ctx->log_format ? op_iface_ctx->log_format
+                                                     : sc_log_config->log_format,
+                            log_level, file, line, function, message) == 0) {
                     SCLogPrintToSyslog(SCLogMapLogLevelToSyslogLevel(log_level), buffer);
                 }
                 break;
@@ -604,12 +577,11 @@ void SCLog(int x, const char *file, const char *func, const int line,
         va_start(ap, fmt);
         vsnprintf(msg, sizeof(msg), fmt, ap);
         va_end(ap);
-        SCLogMessage(x, file, line, func, SC_OK, msg);
+        SCLogMessage(x, file, line, func, msg);
     }
 }
 
-void SCLogErr(int x, const char *file, const char *func, const int line,
-        const int err, const char *fmt, ...)
+void SCLogErr(int x, const char *file, const char *func, const int line, const char *fmt, ...)
 {
     if (sc_log_global_log_level >= x &&
             (sc_log_fg_filters_present == 0 ||
@@ -623,7 +595,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
         va_start(ap, fmt);
         vsnprintf(msg, sizeof(msg), fmt, ap);
         va_end(ap);
-        SCLogMessage(x, file, line, func, err, msg);
+        SCLogMessage(x, file, line, func, msg);
     }
 }
 
@@ -658,8 +630,7 @@ SCLogOPBuffer *SCLogAllocLogOPBuffer(void)
 
     if ( (buffer = SCMalloc(sc_log_config->op_ifaces_cnt *
                           sizeof(SCLogOPBuffer))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogAllocLogOPBuffer. Exiting...");
+        FatalError("Fatal error encountered in SCLogAllocLogOPBuffer. Exiting...");
     }
 
     SCLogOPIfaceCtx *op_iface_ctx = sc_log_config->op_ifaces;
@@ -684,8 +655,7 @@ static inline SCLogOPIfaceCtx *SCLogAllocLogOPIfaceCtx(void)
     SCLogOPIfaceCtx *iface_ctx = NULL;
 
     if ( (iface_ctx = SCMalloc(sizeof(SCLogOPIfaceCtx))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogallocLogOPIfaceCtx. Exiting...");
+        FatalError("Fatal error encountered in SCLogallocLogOPIfaceCtx. Exiting...");
     }
     memset(iface_ctx, 0, sizeof(SCLogOPIfaceCtx));
 
@@ -708,8 +678,7 @@ static inline SCLogOPIfaceCtx *SCLogInitFileOPIface(const char *file, uint32_t u
 {
     SCLogOPIfaceCtx *iface_ctx = SCLogAllocLogOPIfaceCtx();
     if (iface_ctx == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogInitFileOPIface. Exiting...");
+        FatalError("Fatal error encountered in SCLogInitFileOPIface. Exiting...");
     }
 
     if (file == NULL) {
@@ -727,8 +696,7 @@ static inline SCLogOPIfaceCtx *SCLogInitFileOPIface(const char *file, uint32_t u
 #ifndef OS_WIN32
     if (userid != 0 || groupid != 0) {
         if (fchown(fileno(iface_ctx->file_d), userid, groupid) == -1) {
-            SCLogWarning(SC_WARN_CHOWN, "Failed to change ownership of file %s: %s", file,
-                    strerror(errno));
+            SCLogWarning("Failed to change ownership of file %s: %s", file, strerror(errno));
         }
     }
 #endif
@@ -782,8 +750,7 @@ static inline SCLogOPIfaceCtx *SCLogInitConsoleOPIface(const char *log_format,
     SCLogOPIfaceCtx *iface_ctx = SCLogAllocLogOPIfaceCtx();
 
     if (iface_ctx == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogInitConsoleOPIface. Exiting...");
+        FatalError("Fatal error encountered in SCLogInitConsoleOPIface. Exiting...");
     }
 
     iface_ctx->iface = SC_LOG_OP_IFACE_CONSOLE;
@@ -848,8 +815,7 @@ static inline SCLogOPIfaceCtx *SCLogInitSyslogOPIface(int facility,
     SCLogOPIfaceCtx *iface_ctx = SCLogAllocLogOPIfaceCtx();
 
     if ( iface_ctx == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogInitSyslogOPIface. Exiting...");
+        FatalError("Fatal error encountered in SCLogInitSyslogOPIface. Exiting...");
     }
 
     iface_ctx->iface = SC_LOG_OP_IFACE_SYSLOG;
@@ -1284,14 +1250,13 @@ void SCLogInitLogModule(SCLogInitData *sc_lid)
 
 #if defined (OS_WIN32)
     if (SCMutexInit(&sc_log_stream_lock, NULL) != 0) {
-        FatalError(SC_ERR_FATAL, "Failed to initialize log mutex.");
+        FatalError("Failed to initialize log mutex.");
     }
 #endif /* OS_WIN32 */
 
     /* sc_log_config is a global variable */
     if ( (sc_log_config = SCMalloc(sizeof(SCLogConfig))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCLogInitLogModule. Exiting...");
+        FatalError("Fatal error encountered in SCLogInitLogModule. Exiting...");
     }
     memset(sc_log_config, 0, sizeof(SCLogConfig));
 
@@ -1341,8 +1306,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
         SCLogLevel default_log_level =
             SCMapEnumNameToValue(default_log_level_s, sc_log_level_map);
         if (default_log_level == -1) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid default log level: %s",
-                default_log_level_s);
+            SCLogError("Invalid default log level: %s", default_log_level_s);
             exit(EXIT_FAILURE);
         }
         sc_lid->global_log_level = MAX(min_level, default_log_level);
@@ -1392,8 +1356,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
         if (level_s != NULL) {
             level = SCMapEnumNameToValue(level_s, sc_log_level_map);
             if (level == -1) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid log level: %s",
-                    level_s);
+                SCLogError("Invalid log level: %s", level_s);
                 exit(EXIT_FAILURE);
             }
             max_level = MAX(max_level, level);
@@ -1408,8 +1371,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
         else if (strcmp(output->name, "file") == 0) {
             const char *filename = ConfNodeLookupChildValue(output, "filename");
             if (filename == NULL) {
-                    FatalError(SC_ERR_FATAL,
-                               "Logging to file requires a filename");
+                FatalError("Logging to file requires a filename");
             }
             char *path = NULL;
             if (!(PathIsAbsolute(filename))) {
@@ -1418,7 +1380,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
                 path = SCStrdup(filename);
             }
             if (path == NULL)
-                FatalError(SC_ERR_FATAL, "failed to setup output to file");
+                FatalError("failed to setup output to file");
             have_logging = 1;
             op_iface_ctx = SCLogInitFileOPIface(path, userid, groupid, format, level, type);
             SCFree(path);
@@ -1430,9 +1392,10 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
             if (facility_s != NULL) {
                 facility = SCMapEnumNameToValue(facility_s, SCSyslogGetFacilityMap());
                 if (facility == -1) {
-                    SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid syslog "
-                            "facility: \"%s\", now using \"%s\" as syslog "
-                            "facility", facility_s, SC_LOG_DEF_SYSLOG_FACILITY_STR);
+                    SCLogWarning("Invalid syslog "
+                                 "facility: \"%s\", now using \"%s\" as syslog "
+                                 "facility",
+                            facility_s, SC_LOG_DEF_SYSLOG_FACILITY_STR);
                     facility = SC_LOG_DEF_SYSLOG_FACILITY;
                 }
             }
@@ -1441,8 +1404,9 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
             op_iface_ctx = SCLogInitSyslogOPIface(facility, format, level, type);
         }
         else {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid logging method: %s, "
-                "ignoring", output->name);
+            SCLogWarning("Invalid logging method: %s, "
+                         "ignoring",
+                    output->name);
         }
         if (op_iface_ctx != NULL) {
             SCLogAppendOPIfaceCtx(op_iface_ctx, sc_lid);
@@ -1450,8 +1414,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
     }
 
     if (daemon && (have_logging == 0)) {
-        SCLogError(SC_ERR_MISSING_CONFIG_PARAM,
-                   "NO logging compatible with daemon mode selected,"
+        SCLogError("NO logging compatible with daemon mode selected,"
                    " suricata won't be able to log. Please update "
                    " 'logging.outputs' in the YAML.");
     }
index f4986a1081c83093d16c34866a2193eec7529522..52ac19b01a75990c0ee6308e2d7787aea3bd1cfd 100644 (file)
@@ -204,8 +204,8 @@ extern int sc_log_module_cleaned;
 
 void SCLog(int x, const char *file, const char *func, const int line,
         const char *fmt, ...) ATTR_FMT_PRINTF(5,6);
-void SCLogErr(int x, const char *file, const char *func, const int line,
-        const int err, const char *fmt, ...) ATTR_FMT_PRINTF(6,7);
+void SCLogErr(int x, const char *file, const char *func, const int line, const char *fmt, ...)
+        ATTR_FMT_PRINTF(5, 6);
 
 /**
  * \brief Macro used to log INFORMATIONAL messages.
@@ -239,11 +239,9 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
  *                  warning message
  * \retval ...      Takes as argument(s), a printf style format message
  */
-#define SCLogWarning(err_code, ...) SCLogErr(SC_LOG_WARNING, \
-        __FILE__, __FUNCTION__, __LINE__, \
-        err_code, __VA_ARGS__)
-#define SCLogWarningRaw(err_code, file, func, line, ...) \
-    SCLogErr(SC_LOG_WARNING, (file), (func), (line), err_code, __VA_ARGS__)
+#define SCLogWarning(...) SCLogErr(SC_LOG_WARNING, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
+#define SCLogWarningRaw(file, func, line, ...)                                                     \
+    SCLogErr(SC_LOG_WARNING, (file), (func), (line), __VA_ARGS__)
 
 /**
  * \brief Macro used to log ERROR messages.
@@ -252,11 +250,9 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
  *                  error message
  * \retval ...      Takes as argument(s), a printf style format message
  */
-#define SCLogError(err_code, ...) SCLogErr(SC_LOG_ERROR, \
-        __FILE__, __FUNCTION__, __LINE__, \
-        err_code, __VA_ARGS__)
-#define SCLogErrorRaw(err_code, file, func, line, ...) SCLogErr(SC_LOG_ERROR, \
-        (file), (func), (line), err_code, __VA_ARGS__)
+#define SCLogError(...) SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
+#define SCLogErrorRaw(file, func, line, ...)                                                       \
+    SCLogErr(SC_LOG_ERROR, (file), (func), (line), __VA_ARGS__)
 
 /**
  * \brief Macro used to log CRITICAL messages.
@@ -265,9 +261,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
  *                  critical message
  * \retval ...      Takes as argument(s), a printf style format message
  */
-#define SCLogCritical(err_code, ...) SCLogErr(SC_LOG_CRITICAL, \
-        __FILE__, __FUNCTION__, __LINE__, \
-        err_code, __VA_ARGS__)
+#define SCLogCritical(...) SCLogErr(SC_LOG_CRITICAL, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
 /**
  * \brief Macro used to log ALERT messages.
  *
@@ -275,9 +269,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
  *                  alert message
  * \retval ...      Takes as argument(s), a printf style format message
  */
-#define SCLogAlert(err_code, ...) SCLogErr(SC_LOG_ALERT, \
-        __FILE__, __FUNCTION__, __LINE__, \
-        err_code, __VA_ARGS__)
+#define SCLogAlert(...) SCLogErr(SC_LOG_ALERT, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
 /**
  * \brief Macro used to log EMERGENCY messages.
  *
@@ -285,10 +277,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
  *                  emergency message
  * \retval ...      Takes as argument(s), a printf style format message
  */
-#define SCLogEmerg(err_code, ...) SCLogErr(SC_LOG_EMERGENCY, \
-        __FILE__, __FUNCTION__, __LINE__, \
-        err_code, __VA_ARGS__)
-
+#define SCLogEmerg(...) SCLogErr(SC_LOG_EMERGENCY, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
 
 /* Avoid the overhead of using the debugging subsystem, in production mode */
 #ifndef DEBUG
@@ -527,28 +516,29 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
 
 #endif /* DEBUG */
 
-#define FatalError(x, ...) do {                                             \
-    SCLogError(x, __VA_ARGS__);                                             \
-    exit(EXIT_FAILURE);                                                     \
-} while(0)
+#define FatalError(...)                                                                            \
+    do {                                                                                           \
+        SCLogError(__VA_ARGS__);                                                                   \
+        exit(EXIT_FAILURE);                                                                        \
+    } while (0)
 
 /** \brief Fatal error IF we're starting up, and configured to consider
  *         errors to be fatal errors */
 #if !defined(__clang_analyzer__)
-#define FatalErrorOnInit(x, ...)                                                                   \
+#define FatalErrorOnInit(...)                                                                      \
     do {                                                                                           \
         SC_ATOMIC_EXTERN(unsigned int, engine_stage);                                              \
         int init_errors_fatal = 0;                                                                 \
         (void)ConfGetBool("engine.init-failure-fatal", &init_errors_fatal);                        \
         if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) {                 \
-            SCLogError(x, __VA_ARGS__);                                                            \
+            SCLogError(__VA_ARGS__);                                                               \
             exit(EXIT_FAILURE);                                                                    \
         }                                                                                          \
-        SCLogWarning(x, __VA_ARGS__);                                                              \
+        SCLogWarning(__VA_ARGS__);                                                                 \
     } while (0)
 /* make it simpler for scan-build */
 #else
-#define FatalErrorOnInit(x, ...) FatalError(x, __VA_ARGS__)
+#define FatalErrorOnInit(...) FatalError(__VA_ARGS__)
 #endif
 
 #define BOOL2STR(b) (b) ? "true" : "false"
@@ -561,8 +551,8 @@ void SCLogInitLogModule(SCLogInitData *);
 
 void SCLogDeInitLogModule(void);
 
-SCError SCLogMessage(const SCLogLevel, const char *, const unsigned int,
-                     const char *, const SCError, const char *message);
+SCError SCLogMessage(
+        const SCLogLevel, const char *, const unsigned int, const char *, const char *message);
 
 SCLogOPBuffer *SCLogAllocLogOPBuffer(void);
 
index d12d2420d8a743592a2552acfc3403ea27c13790..b10b7378559c187edc551aa506701ada9f961437 100644 (file)
@@ -133,7 +133,7 @@ void MimeDecSetConfig(MimeDecConfig *config)
             mime_dec_config.header_value_depth = MAX_HEADER_VALUE;
         }
     } else {
-        SCLogWarning(SC_ERR_MISSING_CONFIG_PARAM, "Invalid null configuration parameters");
+        SCLogWarning("Invalid null configuration parameters");
     }
 }
 
index 59c5d656fa122bf3744528160d658f0082e44cdf..1b68e520548b97643d743ee517b77b76c234a95b 100644 (file)
@@ -65,13 +65,13 @@ static int SigStringAddSig(SigString *sig, const char *sig_file,
 
     sig->filename = SCStrdup(sig_file);
     if (sig->filename == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
         return 0;
     }
 
     sig->sig_str = SCStrdup(sig_str);
     if (sig->sig_str == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
         SCFree(sig->filename);
         return 0;
     }
@@ -79,7 +79,7 @@ static int SigStringAddSig(SigString *sig, const char *sig_file,
     if (sig_error) {
         sig->sig_error = SCStrdup(sig_error);
         if (sig->sig_error == NULL) {
-            SCLogError(SC_ENOMEM, "Error allocating memory");
+            SCLogError("Error allocating memory");
             SCFree(sig->filename);
             SCFree(sig->sig_str);
             return 0;
index 48a4616b0c0af8bc45b8c2cb9692397fc157f589..e49ec8917ed832b52c1412fbf95844bef31f663e 100644 (file)
@@ -288,7 +288,7 @@ LiveDevice *LiveGetDevice(const char *name)
     LiveDevice *pd;
 
     if (name == NULL) {
-        SCLogWarning(SC_EINVAL, "Name of device should not be null");
+        SCLogWarning("Name of device should not be null");
         return NULL;
     }
 
@@ -509,7 +509,7 @@ int LiveDevUseBypass(LiveDevice *dev)
 {
     BypassInfo *bpinfo = SCCalloc(1, sizeof(*bpinfo));
     if (bpinfo == NULL) {
-        SCLogError(SC_ENOMEM, "Can't allocate bypass info structure");
+        SCLogError("Can't allocate bypass info structure");
         return -1;
     }
 
index ac5dd03a207bd0bda22a1749e76204fb8004c7a2..3d6e1339f833b0818bfdeafe63ef8d3eb1dfe6fb 100644 (file)
@@ -53,7 +53,7 @@ static int i40eDeviceEnableSymHash(
     retval = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_HASH);
 #pragma GCC diagnostic pop
     if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "RTE_ETH_FILTER_HASH not supported on port: %s", port_name);
+        SCLogError("RTE_ETH_FILTER_HASH not supported on port: %s", port_name);
         return retval;
     }
 
@@ -71,7 +71,7 @@ static int i40eDeviceEnableSymHash(
 #pragma GCC diagnostic pop
 
     if (retval < 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "Cannot set global hash configurations on port %s", port_name);
+        SCLogError("Cannot set global hash configurations on port %s", port_name);
         return retval;
     }
 
@@ -91,7 +91,7 @@ static int i40eDeviceSetSymHash(int port_id, const char *port_name, int enable)
 #pragma GCC diagnostic pop
 
     if (ret < 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "RTE_ETH_FILTER_HASH not supported on port: %s", port_name);
+        SCLogError("RTE_ETH_FILTER_HASH not supported on port: %s", port_name);
         return ret;
     }
 
@@ -103,8 +103,7 @@ static int i40eDeviceSetSymHash(int port_id, const char *port_name, int enable)
 #pragma GCC diagnostic pop
 
     if (ret < 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "Cannot set symmetric hash enable per port on port %s",
-                port_name);
+        SCLogError("Cannot set symmetric hash enable per port on port %s", port_name);
         return ret;
     }
 
@@ -166,8 +165,8 @@ static int i40eDeviceSetRSSFlowQueues(
     rss_action_conf.key = NULL;
 
     if (nb_rx_queues < 1) {
-        FatalError(SC_ERR_DPDK_CONF, "The number of queues for RSS configuration must be "
-                                     "configured with a positive number");
+        FatalError("The number of queues for RSS configuration must be "
+                   "configured with a positive number");
     }
 
     rss_action_conf.queue_num = nb_rx_queues;
@@ -181,11 +180,10 @@ static int i40eDeviceSetRSSFlowQueues(
 
     flow = rte_flow_create(port_id, &attr, pattern, action, &flow_error);
     if (flow == NULL) {
-        SCLogError(SC_ERR_DPDK_CONF, "Error when creating rte_flow rule on %s: %s", port_name,
-                flow_error.message);
+        SCLogError("Error when creating rte_flow rule on %s: %s", port_name, flow_error.message);
         int ret = rte_flow_validate(port_id, &attr, pattern, action, &flow_error);
-        SCLogError(SC_ERR_DPDK_CONF, "Error on rte_flow validation for port %s: %s errmsg: %s",
-                port_name, rte_strerror(-ret), flow_error.message);
+        SCLogError("Error on rte_flow validation for port %s: %s errmsg: %s", port_name,
+                rte_strerror(-ret), flow_error.message);
         return ret;
     } else {
         SCLogInfo("RTE_FLOW queue region created for port %s", port_name);
@@ -217,11 +215,10 @@ static int i40eDeviceCreateRSSFlow(int port_id, const char *port_name,
 
     flow = rte_flow_create(port_id, &attr, pattern, action, &flow_error);
     if (flow == NULL) {
-        SCLogError(SC_ERR_DPDK_CONF, "Error when creating rte_flow rule on %s: %s", port_name,
-                flow_error.message);
+        SCLogError("Error when creating rte_flow rule on %s: %s", port_name, flow_error.message);
         int ret = rte_flow_validate(port_id, &attr, pattern, action, &flow_error);
-        SCLogError(SC_ERR_DPDK_CONF, "Error on rte_flow validation for port %s: %s errmsg: %s",
-                port_name, rte_strerror(-ret), flow_error.message);
+        SCLogError("Error on rte_flow validation for port %s: %s errmsg: %s", port_name,
+                rte_strerror(-ret), flow_error.message);
         return ret;
     } else {
         SCLogInfo("RTE_FLOW flow rule created for port %s", port_name);
@@ -328,7 +325,7 @@ static int i40eDeviceSetRSSWithFlows(int port_id, const char *port_name, int nb_
 
     retval = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
     if (retval != 0) {
-        SCLogError(SC_ERR_DPDK_CONF, "Unable to get RSS hash configuration of port %s", port_name);
+        SCLogError("Unable to get RSS hash configuration of port %s", port_name);
         return retval;
     }
 
@@ -339,8 +336,7 @@ static int i40eDeviceSetRSSWithFlows(int port_id, const char *port_name, int nb_
     if (retval != 0) {
         retval = rte_flow_flush(port_id, &flush_error);
         if (retval != 0) {
-            SCLogError(SC_ERR_DPDK_CONF,
-                    "Unable to flush rte_flow rules of %s: %s Flush error msg: %s", port_name,
+            SCLogError("Unable to flush rte_flow rules of %s: %s Flush error msg: %s", port_name,
                     rte_strerror(-retval), flush_error.message);
         }
         return retval;
@@ -359,7 +355,7 @@ int i40eDeviceSetRSS(int port_id, int nb_rx_queues)
 
     retval = rte_eth_dev_get_name_by_port(port_id, port_name);
     if (unlikely(retval != 0)) {
-        SCLogError(SC_ERR_STAT, "Failed to convert port id %d to the interface name: %s", port_id,
+        SCLogError("Failed to convert port id %d to the interface name: %s", port_id,
                 strerror(-retval));
         return retval;
     }
index 29479c1a2b01f5f8f5f24f02128df5d09a5f934c..8f72f8dc2fff21da7dd0e7f81a6eaac66def03bb 100644 (file)
@@ -31,7 +31,7 @@ void DPDKCleanupEAL(void)
     if (run_mode == RUNMODE_DPDK) {
         int retval = rte_eal_cleanup();
         if (retval != 0)
-            SCLogError(SC_ERR_DPDK_EAL_DEINIT, "EAL cleanup failed: %s", strerror(-retval));
+            SCLogError("EAL cleanup failed: %s", strerror(-retval));
     }
 #endif
 }
@@ -45,8 +45,8 @@ void DPDKCloseDevice(LiveDevice *ldev)
     if (run_mode == RUNMODE_DPDK) {
         retval = rte_eth_dev_get_port_by_name(ldev->dev, &port_id);
         if (retval < 0) {
-            SCLogError(SC_ERR_DPDK_EAL_DEINIT, "Unable to get port id of \"%s\", error: %s",
-                    ldev->dev, rte_strerror(-retval));
+            SCLogError(
+                    "Unable to get port id of \"%s\", error: %s", ldev->dev, rte_strerror(-retval));
             return;
         }
 
index ee31526ec313f49607b8478e0fc5e98da4dc6083..07280922fa083a6c632ee594308dc885296885c0 100644 (file)
@@ -98,15 +98,11 @@ static void BpfMapsInfoFree(void *bpf)
                     ret = unlink(pinnedpath);
                     if (ret == -1) {
                         int error = errno;
-                        SCLogWarning(SC_ERR_SYSCALL,
-                                     "Unable to remove %s: %s (%d)",
-                                     pinnedpath,
-                                     strerror(error),
-                                     error);
+                        SCLogWarning(
+                                "Unable to remove %s: %s (%d)", pinnedpath, strerror(error), error);
                     }
                 } else {
-                    SCLogWarning(SC_ERR_SPRINTF, "Unable to remove map %s",
-                                 bpfinfo->array[i].name);
+                    SCLogWarning("Unable to remove map %s", bpfinfo->array[i].name);
                 }
             }
             SCFree(bpfinfo->array[i].name);
@@ -130,10 +126,7 @@ void EBPFDeleteKey(int fd, void *key)
 {
     int ret = bpf_map_delete_elem(fd, key);
     if (ret < 0) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Unable to delete entry: %s (%d)",
-                     strerror(errno),
-                     errno);
+        SCLogWarning("Unable to delete entry: %s (%d)", strerror(errno), errno);
     }
 }
 
@@ -210,15 +203,14 @@ static int EBPFLoadPinnedMaps(LiveDevice *livedev, struct ebpf_timeout_config *c
         /* Get flow v6 table */
         fd_v6 = EBPFLoadPinnedMapsFile(livedev, "flow_table_v6");
         if (fd_v6 < 0) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                    "Found a flow_table_v4 map but no flow_table_v6 map");
+            SCLogWarning("Found a flow_table_v4 map but no flow_table_v6 map");
             return fd_v6;
         }
     }
 
     struct bpf_maps_info *bpf_map_data = SCCalloc(1, sizeof(*bpf_map_data));
     if (bpf_map_data == NULL) {
-        SCLogError(SC_ENOMEM, "Can't allocate bpf map array");
+        SCLogError("Can't allocate bpf map array");
         return -1;
     }
 
@@ -288,7 +280,7 @@ alloc_error:
         SCFree(bpf_map_data->array[i].name);
     }
     bpf_map_data->last = 0;
-    SCLogError(SC_ENOMEM, "Can't allocate bpf map name");
+    SCLogError("Can't allocate bpf map name");
     return -1;
 }
 
@@ -328,7 +320,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
     }
 
     if (! path) {
-        SCLogError(SC_EINVAL, "No file defined to load eBPF from");
+        SCLogError("No file defined to load eBPF from");
         return -1;
     }
 
@@ -336,7 +328,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
      * locked memory so we set it to unlimited to avoid a ENOPERM error */
     struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
     if (setrlimit(RLIMIT_MEMLOCK, &r) != 0) {
-        SCLogError(SC_ENOMEM, "Unable to lock memory: %s (%d)", strerror(errno), errno);
+        SCLogError("Unable to lock memory: %s (%d)", strerror(errno), errno);
         return -1;
     }
 
@@ -347,7 +339,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_EINVAL, "Unable to load eBPF objects in '%s': %s", path, err_buf);
+        SCLogError("Unable to load eBPF objects in '%s': %s", path, err_buf);
         return -1;
     }
 
@@ -390,21 +382,19 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
     }
 
     if (found == false) {
-        SCLogError(SC_EINVAL, "No section '%s' in '%s' file. Will not be able to use the file",
-                section, path);
+        SCLogError("No section '%s' in '%s' file. Will not be able to use the file", section, path);
         return -1;
     }
 
     err = bpf_object__load(bpfobj);
     if (err < 0) {
         if (err == -EPERM) {
-            SCLogError(SC_ERR_SYSCALL,
-                    "Permission issue when loading eBPF object"
-                    " (check libbpf error on stdout)");
+            SCLogError("Permission issue when loading eBPF object"
+                       " (check libbpf error on stdout)");
         } else {
             char buf[129];
             libbpf_strerror(err, buf, sizeof(buf));
-            SCLogError(SC_EINVAL, "Unable to load eBPF object: %s (%d)", buf, err);
+            SCLogError("Unable to load eBPF object: %s (%d)", buf, err);
         }
         return -1;
     }
@@ -414,14 +404,14 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
      * that we use bpf_maps_info:: */
     struct bpf_maps_info *bpf_map_data = SCCalloc(1, sizeof(*bpf_map_data));
     if (bpf_map_data == NULL) {
-        SCLogError(SC_ENOMEM, "Can't allocate bpf map array");
+        SCLogError("Can't allocate bpf map array");
         return -1;
     }
 
     /* Store the maps in bpf_maps_info:: */
     bpf_map__for_each(map, bpfobj) {
         if (bpf_map_data->last == BPF_MAP_MAX_COUNT) {
-            SCLogError(SC_ERR_NOT_SUPPORTED, "Too many BPF maps in eBPF files");
+            SCLogError("Too many BPF maps in eBPF files");
             break;
         }
         SCLogDebug("Got a map '%s' with fd '%d'", bpf_map__name(map), bpf_map__fd(map));
@@ -430,7 +420,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
         snprintf(bpf_map_data->array[bpf_map_data->last].iface, IFNAMSIZ,
                  "%s", iface);
         if (!bpf_map_data->array[bpf_map_data->last].name) {
-            SCLogError(SC_ENOMEM, "Unable to duplicate map name");
+            SCLogError("Unable to duplicate map name");
             BpfMapsInfoFree(bpf_map_data);
             return -1;
         }
@@ -443,7 +433,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
                     bpf_map_data->array[bpf_map_data->last].name);
             int ret = bpf_obj_pin(bpf_map_data->array[bpf_map_data->last].fd, buf);
             if (ret != 0) {
-                SCLogWarning(SC_ERR_AFP_CREATE, "Can not pin: %s", strerror(errno));
+                SCLogWarning("Can not pin: %s", strerror(errno));
             }
             /* Don't unlink pinned maps in XDP mode to avoid a state reset */
             if (config->flags & EBPF_XDP_CODE) {
@@ -464,7 +454,7 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
      * (XDP case). */
     pfd = bpf_program__fd(bpfprog);
     if (pfd == -1) {
-        SCLogError(SC_EINVAL, "Unable to find %s section", section);
+        SCLogError("Unable to find %s section", section);
         return -1;
     }
 
@@ -486,7 +476,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_EINVAL, "Unknown interface '%s'", iface);
+        SCLogError("Unknown interface '%s'", iface);
         return -1;
     }
 #ifdef HAVE_BPF_XDP_ATTACH
@@ -498,7 +488,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_EINVAL, "Unable to set XDP on '%s': %s (%d)", iface, buf, err);
+        SCLogError("Unable to set XDP on '%s': %s (%d)", iface, buf, err);
         return -1;
     }
 #endif
@@ -816,7 +806,7 @@ static int EBPFForEachFlowV6Table(ThreadVars *th_v,
     uint64_t hash_cnt = 0;
 
     if (tcfg->cpus_count == 0) {
-        SCLogWarning(SC_EINVAL, "CPU count should not be 0");
+        SCLogWarning("CPU count should not be 0");
         return 0;
     }
 
@@ -943,23 +933,23 @@ static int EBPFAddCPUToMap(const char *iface, uint32_t i)
     int ret;
 
     if (cpumap < 0) {
-        SCLogError(SC_ERR_AFP_CREATE, "Can't find cpu_map");
+        SCLogError("Can't find cpu_map");
         return -1;
     }
     ret = bpf_map_update_elem(cpumap, &i, &queue_size, 0);
     if (ret) {
-        SCLogError(SC_ERR_AFP_CREATE, "Create CPU entry failed (err:%d)", ret);
+        SCLogError("Create CPU entry failed (err:%d)", ret);
         return -1;
     }
     int cpus_available = EBPFGetMapFDByName(iface, "cpus_available");
     if (cpus_available < 0) {
-        SCLogError(SC_ERR_AFP_CREATE, "Can't find cpus_available map");
+        SCLogError("Can't find cpus_available map");
         return -1;
     }
 
     ret = bpf_map_update_elem(cpus_available, &g_redirect_iface_cpu_counter, &i, 0);
     if (ret) {
-        SCLogError(SC_ERR_AFP_CREATE, "Create CPU entry failed (err:%d)", ret);
+        SCLogError("Create CPU entry failed (err:%d)", ret);
         return -1;
     }
     return 0;
@@ -968,7 +958,7 @@ static int EBPFAddCPUToMap(const char *iface, uint32_t i)
 static void EBPFRedirectMapAddCPU(int i, void *data)
 {
     if (EBPFAddCPUToMap(data, i) < 0) {
-        SCLogError(SC_EINVAL, "Unable to add CPU %d to set", i);
+        SCLogError("Unable to add CPU %d to set", i);
     } else {
         g_redirect_iface_cpu_counter++;
     }
@@ -979,7 +969,7 @@ void EBPFBuildCPUSet(ConfNode *node, char *iface)
     uint32_t key0 = 0;
     int mapfd = EBPFGetMapFDByName(iface, "cpus_count");
     if (mapfd < 0) {
-        SCLogError(SC_EINVAL, "Unable to find 'cpus_count' map");
+        SCLogError("Unable to find 'cpus_count' map");
         return;
     }
     g_redirect_iface_cpu_counter = 0;
@@ -1011,29 +1001,29 @@ int EBPFSetPeerIface(const char *iface, const char *out_iface)
 {
     int mapfd = EBPFGetMapFDByName(iface, "tx_peer");
     if (mapfd < 0) {
-        SCLogError(SC_EINVAL, "Unable to find 'tx_peer' map");
+        SCLogError("Unable to find 'tx_peer' map");
         return -1;
     }
     int intmapfd = EBPFGetMapFDByName(iface, "tx_peer_int");
     if (intmapfd < 0) {
-        SCLogError(SC_EINVAL, "Unable to find 'tx_peer_int' map");
+        SCLogError("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_EINVAL, "No iface '%s'", out_iface);
+        SCLogError("No iface '%s'", out_iface);
         return -1;
     }
     int ret = bpf_map_update_elem(mapfd, &key0, &peer_index, BPF_ANY);
     if (ret) {
-        SCLogError(SC_ERR_AFP_CREATE, "Create peer entry failed (err:%d)", ret);
+        SCLogError("Create peer entry failed (err:%d)", ret);
         return -1;
     }
     ret = bpf_map_update_elem(intmapfd, &key0, &peer_index, BPF_ANY);
     if (ret) {
-        SCLogError(SC_ERR_AFP_CREATE, "Create peer entry failed (err:%d)", ret);
+        SCLogError("Create peer entry failed (err:%d)", ret);
         return -1;
     }
     return 0;
index 2b0eaf379015e45933f38aff26f4cc0efc8a545c..8fb7ace473fe7a236a824e0ce0fc1de363e4fb8f 100644 (file)
@@ -100,7 +100,7 @@ enum ExceptionPolicy ExceptionPolicyParse(const char *option, const bool support
             policy = EXCEPTION_POLICY_IGNORE;
             SCLogConfig("%s: %s", option, value_str);
         } else {
-            FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
+            FatalErrorOnInit(
                     "\"%s\" is not a valid exception policy value. Valid options are drop-flow, "
                     "pass-flow, bypass, drop-packet, pass-packet or ignore.",
                     value_str);
@@ -109,8 +109,7 @@ enum ExceptionPolicy ExceptionPolicyParse(const char *option, const bool support
         if (!support_flow) {
             if (policy == EXCEPTION_POLICY_DROP_FLOW || policy == EXCEPTION_POLICY_PASS_FLOW ||
                     policy == EXCEPTION_POLICY_BYPASS_FLOW) {
-                SCLogWarning(SC_WARN_COMPATIBILITY,
-                        "flow actions not supported for %s, defaulting to \"ignore\"", option);
+                SCLogWarning("flow actions not supported for %s, defaulting to \"ignore\"", option);
                 policy = EXCEPTION_POLICY_IGNORE;
             }
         }
index 3ffba673f361914107c99867d3fd90904904c647..d395fc12a9f1b7d07eca2b4f167909f476a95792 100644 (file)
@@ -176,8 +176,8 @@ void FileForceHashParseCfg(ConfNode *conf)
     /* legacy option */
     const char *force_md5 = ConfNodeLookupChildValue(conf, "force-md5");
     if (force_md5 != NULL) {
-        SCLogWarning(SC_ERR_DEPRECATED_CONF, "deprecated 'force-md5' option "
-                "found. Please use 'force-hash: [md5]' instead");
+        SCLogWarning("deprecated 'force-md5' option "
+                     "found. Please use 'force-hash: [md5]' instead");
 
         if (ConfValIsTrue(force_md5)) {
             if (g_disable_hashing) {
@@ -491,7 +491,7 @@ FileContainer *FileContainerAlloc(void)
 {
     FileContainer *new = SCMalloc(sizeof(FileContainer));
     if (unlikely(new == NULL)) {
-        SCLogError(SC_ENOMEM, "Error allocating mem");
+        SCLogError("Error allocating mem");
         return NULL;
     }
     memset(new, 0, sizeof(FileContainer));
@@ -552,7 +552,7 @@ static File *FileAlloc(const uint8_t *name, uint16_t name_len)
 {
     File *new = SCMalloc(sizeof(File));
     if (unlikely(new == NULL)) {
-        SCLogError(SC_ENOMEM, "Error allocating mem");
+        SCLogError("Error allocating mem");
         return NULL;
     }
     memset(new, 0, sizeof(File));
index 73ab69e235c9b21d5568919d43b0b098eb3690a0..4c1f2edf159791ab33a950e2654957718fc48cb7 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_EINVAL, "attempt to insert element out of hash array\n");
+        SCLogWarning("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_EINVAL, "attempt to access element out of hash array\n");
+        SCLogWarning("attempt to access element out of hash array\n");
         return NULL;
     }
 
index 08d1ff18139e701f73aaf19687835ddcafbd889a..c0dd93b80cfcbcb7627856d6acc8c7390c14cf04 100644 (file)
@@ -48,7 +48,7 @@ int SCKernelVersionIsAtLeast(int major, int minor)
 
     /* get local version */
     if (uname(&kuname) != 0) {
-        SCLogError(SC_EINVAL, "Invalid uname return: %s", strerror(errno));
+        SCLogError("Invalid uname return: %s", strerror(errno));
         return 0;
     }
 
@@ -59,9 +59,8 @@ int SCKernelVersionIsAtLeast(int major, int minor)
     if (version_regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 VERSION_REGEX, (int)eo, errbuffer);
         goto error;
     }
@@ -71,12 +70,12 @@ int SCKernelVersionIsAtLeast(int major, int minor)
             version_regex_match, NULL);
 
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Version did not cut");
+        SCLogError("Version did not cut");
         goto error;
     }
 
     if (ret < 3) {
-        SCLogError(SC_ERR_PCRE_MATCH, "Version major and minor not found (ret %d)", ret);
+        SCLogError("Version major and minor not found (ret %d)", ret);
         goto error;
     }
 
@@ -84,11 +83,11 @@ int SCKernelVersionIsAtLeast(int major, int minor)
 
     bool err = false;
     if (StringParseInt32(&kmajor, 10, 0, (const char *)list[1]) < 0) {
-        SCLogError(SC_EINVAL, "Invalid value for kmajor: '%s'", list[1]);
+        SCLogError("Invalid value for kmajor: '%s'", list[1]);
         err = true;
     }
     if (StringParseInt32(&kminor, 10, 0, (const char *)list[2]) < 0) {
-        SCLogError(SC_EINVAL, "Invalid value for kminor: '%s'", list[2]);
+        SCLogError("Invalid value for kminor: '%s'", list[2]);
         err = true;
     }
 
@@ -111,7 +110,7 @@ error:
 
 int SCKernelVersionIsAtLeast(int major, int minor)
 {
-    SCLogError(SC_ERR_NOT_SUPPORTED, "OS compare is not supported on Windows");
+    SCLogError("OS compare is not supported on Windows");
     return 0;
 }
 
index a9ede07755b5aaef3d7a8a9f661132a02fa87361..02b3ee72a263c891b89b740ec4e8f4adb90f9dfd 100644 (file)
@@ -78,12 +78,12 @@ static void *SCHInfoAllocUserDataOSPolicy(const char *host_os)
     int *user_data = NULL;
 
     if ( (user_data = SCMalloc(sizeof(int))) == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory. Exiting");
+        FatalError("Error allocating memory. Exiting");
     }
 
     /* the host os flavour that has to be sent as user data */
     if ( (*user_data = SCMapEnumNameToValue(host_os, sc_hinfo_os_policy_map)) == -1) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "Invalid enum map inside "
+        SCLogError("Invalid enum map inside "
                    "SCHInfoAddHostOSInfo()");
         SCFree(user_data);
         return NULL;
@@ -132,7 +132,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
 
     if (host_os == NULL || host_os_ip_range == NULL ||
             strlen(host_os_ip_range) == 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid arguments");
+        SCLogError("Invalid arguments");
         return -1;
     }
 
@@ -142,7 +142,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
 
     /* the host os flavour that has to be sent as user data */
     if ( (user_data = SCHInfoAllocUserDataOSPolicy(host_os)) == NULL) {
-        SCLogError(SC_ERR_INVALID_ENUM_MAP, "Invalid enum map inside");
+        SCLogError("Invalid enum map inside");
         return -1;
     }
 
@@ -156,7 +156,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
     }
 
     if ( (ip_str = SCStrdup(host_os_ip_range)) == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
 
     /* check if we have more addresses in the host_os_ip_range */
@@ -175,7 +175,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
     if (strchr(ip_str, ':') == NULL) {
         /* if we are here, we have an IPV4 address */
         if ( (ipv4_addr = ValidateIPV4Address(ip_str)) == NULL) {
-            SCLogError(SC_ERR_INVALID_IPV4_ADDR, "Invalid IPV4 address");
+            SCLogError("Invalid IPV4 address");
             SCHInfoFreeUserDataOSPolicy(user_data);
             SCFree(ip_str);
             return -1;
@@ -187,7 +187,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
         } else {
             if (StringParseU8RangeCheck(&netmask_value, 10, 0, (const char *)netmask_str, 0, 32) <
                     0) {
-                SCLogError(SC_ERR_INVALID_IP_NETBLOCK, "Invalid IPV4 Netblock");
+                SCLogError("Invalid IPV4 Netblock");
                 SCHInfoFreeUserDataOSPolicy(user_data);
                 SCFree(ipv4_addr);
                 SCFree(ip_str);
@@ -201,7 +201,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
     } else {
         /* if we are here, we have an IPV6 address */
         if ( (ipv6_addr = ValidateIPV6Address(ip_str)) == NULL) {
-            SCLogError(SC_ERR_INVALID_IPV6_ADDR, "Invalid IPV6 address inside");
+            SCLogError("Invalid IPV6 address inside");
             SCHInfoFreeUserDataOSPolicy(user_data);
             SCFree(ip_str);
             return -1;
@@ -213,7 +213,7 @@ int SCHInfoAddHostOSInfo(const char *host_os, const char *host_os_ip_range, int
         } else {
             if (StringParseU8RangeCheck(&netmask_value, 10, 0, (const char *)netmask_str, 0, 128) <
                     0) {
-                SCLogError(SC_ERR_INVALID_IP_NETBLOCK, "Invalid IPV6 Netblock");
+                SCLogError("Invalid IPV6 Netblock");
                 SCHInfoFreeUserDataOSPolicy(user_data);
                 SCFree(ipv6_addr);
                 SCFree(ip_str);
@@ -256,7 +256,7 @@ int SCHInfoGetHostOSFlavour(const char *ip_addr_str)
 
     if (strchr(ip_addr_str, ':') != NULL) {
         if ( (ipv6_addr = ValidateIPV6Address(ip_addr_str)) == NULL) {
-            SCLogError(SC_ERR_INVALID_IPV4_ADDR, "Invalid IPV4 address");
+            SCLogError("Invalid IPV4 address");
             return -1;
         }
 
@@ -268,7 +268,7 @@ int SCHInfoGetHostOSFlavour(const char *ip_addr_str)
             return *((int *)user_data);
     } else {
         if ( (ipv4_addr = ValidateIPV4Address(ip_addr_str)) == NULL) {
-            SCLogError(SC_ERR_INVALID_IPV4_ADDR, "Invalid IPV4 address");
+            SCLogError("Invalid IPV4 address");
             return -1;
         }
 
@@ -346,9 +346,9 @@ void SCHInfoLoadFromConfig(void)
             if (host->val != NULL && strchr(host->val, ':') != NULL)
                 is_ipv4 = 0;
             if (SCHInfoAddHostOSInfo(policy->name, host->val, is_ipv4) == -1) {
-                SCLogError(SC_ERR_INVALID_ARGUMENT,
-                    "Failed to add host \"%s\" with policy \"%s\" to host "
-                    "info database", host->val, policy->name);
+                SCLogError("Failed to add host \"%s\" with policy \"%s\" to host "
+                           "info database",
+                        host->val, policy->name);
                 exit(EXIT_FAILURE);
             }
         }
index c5eb0a26a6bd85145666ef30fc9b305b3503bd62..260749250b217a58ffdcabc789b3883ea39ed334 100644 (file)
@@ -101,9 +101,8 @@ int GetIfaceMTU(const char *pcap_dev)
     }
 
     if (ioctl(fd, SIOCGIFMTU, (char *)&ifr) < 0) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                "Failure when trying to get MTU via ioctl for '%s': %s (%d)",
-                pcap_dev, strerror(errno), errno);
+        SCLogWarning("Failure when trying to get MTU via ioctl for '%s': %s (%d)", pcap_dev,
+                strerror(errno), errno);
         close(fd);
         return -1;
     }
@@ -166,9 +165,7 @@ int GetIfaceFlags(const char *ifname)
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 
     if (ioctl(fd, SIOCGIFFLAGS, &ifr) == -1) {
-        SCLogError(SC_ERR_SYSCALL,
-                   "Unable to get flags for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to get flags for iface \"%s\": %s", ifname, strerror(errno));
         close(fd);
         return -1;
     }
@@ -209,9 +206,7 @@ int SetIfaceFlags(const char *ifname, int flags)
 #endif
 
     if (ioctl(fd, SIOCSIFFLAGS, &ifr) == -1) {
-        SCLogError(SC_ERR_SYSCALL,
-                   "Unable to set flags for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to set flags for iface \"%s\": %s", ifname, strerror(errno));
         close(fd);
         return -1;
     }
@@ -235,9 +230,7 @@ int GetIfaceCaps(const char *ifname)
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 
     if (ioctl(fd, SIOCGIFCAP, &ifr) == -1) {
-        SCLogError(SC_ERR_SYSCALL,
-                   "Unable to get caps for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to get caps for iface \"%s\": %s", ifname, strerror(errno));
         close(fd);
         return -1;
     }
@@ -261,9 +254,7 @@ int SetIfaceCaps(const char *ifname, int caps)
     ifr.ifr_reqcap = caps;
 
     if (ioctl(fd, SIOCSIFCAP, &ifr) == -1) {
-        SCLogError(SC_ERR_SYSCALL,
-                   "Unable to set caps for iface \"%s\": %s",
-                   ifname, strerror(errno));
+        SCLogError("Unable to set caps for iface \"%s\": %s", ifname, strerror(errno));
         close(fd);
         return -1;
     }
@@ -290,9 +281,8 @@ static int GetEthtoolValue(const char *dev, int cmd, uint32_t *value)
     ethv.cmd = cmd;
     ifr.ifr_data = (void *) &ethv;
     if (ioctl(fd, SIOCETHTOOL, (char *)&ifr) < 0) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                  "Failure when trying to get feature via ioctl for '%s': %s (%d)",
-                  dev, strerror(errno), errno);
+        SCLogWarning("Failure when trying to get feature via ioctl for '%s': %s (%d)", dev,
+                strerror(errno), errno);
         close(fd);
         return -1;
     }
@@ -318,9 +308,8 @@ static int SetEthtoolValue(const char *dev, int cmd, uint32_t value)
     ethv.data = value;
     ifr.ifr_data = (void *) &ethv;
     if (ioctl(fd, SIOCETHTOOL, (char *)&ifr) < 0) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                  "Failure when trying to set feature via ioctl for '%s': %s (%d)",
-                  dev, strerror(errno), errno);
+        SCLogWarning("Failure when trying to set feature via ioctl for '%s': %s (%d)", dev,
+                strerror(errno), errno);
         close(fd);
         return -1;
     }
@@ -352,9 +341,9 @@ static int GetIfaceOffloadingLinux(const char *dev, int csum, int other)
         if (csum_ret == 0)
             SCLogPerf("NIC offloading on %s: RX %s TX %s", dev, rx, tx);
         else {
-            SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                    "NIC offloading on %s: RX %s TX %s. Run: "
-                    "ethtool -K %s rx off tx off", dev, rx, tx, dev);
+            SCLogWarning("NIC offloading on %s: RX %s TX %s. Run: "
+                         "ethtool -K %s rx off tx off",
+                    dev, rx, tx, dev);
             ret = 1;
         }
     }
@@ -399,9 +388,9 @@ static int GetIfaceOffloadingLinux(const char *dev, int csum, int other)
             SCLogPerf("NIC offloading on %s: SG: %s, GRO: %s, LRO: %s, "
                     "TSO: %s, GSO: %s", dev, sg, gro, lro, tso, gso);
         } else {
-            SCLogWarning(SC_ERR_NIC_OFFLOADING, "NIC offloading on %s: SG: %s, "
-                    " GRO: %s, LRO: %s, TSO: %s, GSO: %s. Run: "
-                    "ethtool -K %s sg off gro off lro off tso off gso off",
+            SCLogWarning("NIC offloading on %s: SG: %s, "
+                         " GRO: %s, LRO: %s, TSO: %s, GSO: %s. Run: "
+                         "ethtool -K %s sg off gro off lro off tso off gso off",
                     dev, sg, gro, lro, tso, gso, dev);
             ret = 1;
         }
@@ -545,24 +534,22 @@ static int GetIfaceOffloadingBSD(const char *ifname)
     SCLogDebug("if_caps %X", if_caps);
 
     if (if_caps & IFCAP_RXCSUM) {
-        SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                "Using %s with RXCSUM activated can lead to capture "
-                "problems. Run: ifconfig %s -rxcsum", ifname, ifname);
+        SCLogWarning("Using %s with RXCSUM activated can lead to capture "
+                     "problems. Run: ifconfig %s -rxcsum",
+                ifname, ifname);
         ret = 1;
     }
 #ifdef IFCAP_TOE
     if (if_caps & (IFCAP_TSO|IFCAP_TOE|IFCAP_LRO)) {
-        SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                "Using %s with TSO, TOE or LRO activated can lead to "
-                "capture problems. Run: ifconfig %s -tso -toe -lro",
+        SCLogWarning("Using %s with TSO, TOE or LRO activated can lead to "
+                     "capture problems. Run: ifconfig %s -tso -toe -lro",
                 ifname, ifname);
         ret = 1;
     }
 #else
     if (if_caps & (IFCAP_TSO|IFCAP_LRO)) {
-        SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                "Using %s with TSO or LRO activated can lead to "
-                "capture problems. Run: ifconfig %s -tso -lro",
+        SCLogWarning("Using %s with TSO or LRO activated can lead to "
+                     "capture problems. Run: ifconfig %s -tso -lro",
                 ifname, ifname);
         ret = 1;
     }
@@ -743,9 +730,7 @@ int GetIfaceRSSQueuesNum(const char *pcap_dev)
     (void)strlcpy(ifr.ifr_name, pcap_dev, sizeof(ifr.ifr_name));
     fd = socket(AF_INET, SOCK_DGRAM, 0);
     if (fd == -1) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                "Failure when opening socket for ioctl: %s (%d)",
-                strerror(errno), errno);
+        SCLogWarning("Failure when opening socket for ioctl: %s (%d)", strerror(errno), errno);
         return -1;
     }
 
@@ -754,9 +739,8 @@ int GetIfaceRSSQueuesNum(const char *pcap_dev)
 
     if (ioctl(fd, SIOCETHTOOL, (char *)&ifr) < 0) {
         if (errno != ENOTSUP) {
-            SCLogWarning(SC_ERR_SYSCALL,
-                         "Failure when trying to get number of RSS queue ioctl for '%s': %s (%d)",
-                         pcap_dev, strerror(errno), errno);
+            SCLogWarning("Failure when trying to get number of RSS queue ioctl for '%s': %s (%d)",
+                    pcap_dev, strerror(errno), errno);
         }
         close(fd);
         return 0;
index 36df15027decae3f10c6d38303bfca3f513b2858..72c425acd3e607e1dbca1f1d4dc376144da0adce 100644 (file)
@@ -135,8 +135,7 @@ struct in_addr *ValidateIPV4Address(const char *addr_str)
         return NULL;
 
     if ( (addr = SCMalloc(sizeof(struct in_addr))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in ValidateIPV4Address. Exiting...");
+        FatalError("Fatal error encountered in ValidateIPV4Address. Exiting...");
     }
 
     if (inet_pton(AF_INET, addr_str, addr) <= 0) {
@@ -165,8 +164,7 @@ struct in6_addr *ValidateIPV6Address(const char *addr_str)
         return NULL;
 
     if ( (addr = SCMalloc(sizeof(struct in6_addr))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in ValidateIPV6Address. Exiting...");
+        FatalError("Fatal error encountered in ValidateIPV6Address. Exiting...");
     }
 
     if (inet_pton(AF_INET6, addr_str, addr) <= 0) {
index eeadecd4030369359505672cdede751b270b6152..b361b3e74e3978dbb4acdf9dfbc1502abf46e434 100644 (file)
@@ -83,7 +83,7 @@ static int Ja3BufferResizeIfFull(JA3Buffer *buffer, uint32_t len)
         buffer->size *= 2;
         char *tmp = SCRealloc(buffer->data, buffer->size);
         if (tmp == NULL) {
-            SCLogError(SC_ENOMEM, "Error resizing JA3 buffer");
+            SCLogError("Error resizing JA3 buffer");
             return -1;
         }
         buffer->data = tmp;
@@ -106,7 +106,7 @@ static int Ja3BufferResizeIfFull(JA3Buffer *buffer, uint32_t len)
 int Ja3BufferAppendBuffer(JA3Buffer **buffer1, JA3Buffer **buffer2)
 {
     if (*buffer1 == NULL || *buffer2 == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Buffers should not be NULL");
+        SCLogError("Buffers should not be NULL");
         return -1;
     }
 
@@ -170,14 +170,14 @@ static uint32_t NumberOfDigits(uint32_t num)
 int Ja3BufferAddValue(JA3Buffer **buffer, uint32_t value)
 {
     if (*buffer == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Buffer should not be NULL");
+        SCLogError("Buffer should not be NULL");
         return -1;
     }
 
     if ((*buffer)->data == NULL) {
         (*buffer)->data = SCMalloc(JA3_BUFFER_INITIAL_SIZE);
         if ((*buffer)->data == NULL) {
-            SCLogError(SC_ENOMEM, "Error allocating memory for JA3 data");
+            SCLogError("Error allocating memory for JA3 data");
             Ja3BufferFree(buffer);
             return -1;
         }
@@ -214,18 +214,18 @@ int Ja3BufferAddValue(JA3Buffer **buffer, uint32_t value)
 char *Ja3GenerateHash(JA3Buffer *buffer)
 {
     if (buffer == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Buffer should not be NULL");
+        SCLogError("Buffer should not be NULL");
         return NULL;
     }
 
     if (buffer->data == NULL) {
-        SCLogError(SC_EINVAL, "Buffer data should not be NULL");
+        SCLogError("Buffer data should not be NULL");
         return NULL;
     }
 
     char *ja3_hash = SCMalloc(SC_MD5_HEX_LEN + 1);
     if (ja3_hash == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocating memory for JA3 hash");
+        SCLogError("Error allocating memory for JA3 hash");
         return NULL;
     }
 
@@ -248,8 +248,7 @@ int Ja3IsDisabled(const char *type)
     bool is_enabled = SSLJA3IsEnabled();
     if (is_enabled == 0) {
         if (strcmp(type, "rule") != 0) {
-            SCLogWarning(SC_WARN_JA3_DISABLED, "JA3 is disabled, skipping %s",
-                    type);
+            SCLogWarning("JA3 is disabled, skipping %s", type);
         }
         return 1;
     }
index 4c6c3dba47ae162ea8acc1fcd1858a194ae33777..120e21686775d9e2d94d2f160c3f6676ac8bbb73 100644 (file)
@@ -90,7 +90,7 @@ static inline struct landlock_ruleset *LandlockCreateRuleset(void)
 {
     struct landlock_ruleset *ruleset = SCCalloc(1, sizeof(struct landlock_ruleset));
     if (ruleset == NULL) {
-        SCLogError(SC_ENOMEM, "Can't alloc landlock ruleset");
+        SCLogError("Can't alloc landlock ruleset");
         return NULL;
     }
 
@@ -104,8 +104,7 @@ static inline struct landlock_ruleset *LandlockCreateRuleset(void)
     }
     if (abi < 2) {
         if (RequiresFeature(FEATURE_OUTPUT_FILESTORE)) {
-            SCLogError(SC_ERR_NOT_SUPPORTED,
-                    "Landlock disabled: need Linux 5.19+ for file store support");
+            SCLogError("Landlock disabled: need Linux 5.19+ for file store support");
             SCFree(ruleset);
             return NULL;
         } else {
@@ -116,7 +115,7 @@ static inline struct landlock_ruleset *LandlockCreateRuleset(void)
     ruleset->fd = landlock_create_ruleset(&ruleset->attr, sizeof(ruleset->attr), 0);
     if (ruleset->fd < 0) {
         SCFree(ruleset);
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Can't create landlock ruleset");
+        SCLogError("Can't create landlock ruleset");
         return NULL;
     }
     return ruleset;
@@ -125,13 +124,11 @@ static inline struct landlock_ruleset *LandlockCreateRuleset(void)
 static inline void LandlockEnforceRuleset(struct landlock_ruleset *ruleset)
 {
     if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1) {
-        SCLogError(
-                SC_ERR_CONF_YAML_ERROR, "Can't self restrict (prctl phase): %s", strerror(errno));
+        SCLogError("Can't self restrict (prctl phase): %s", strerror(errno));
         return;
     }
     if (landlock_restrict_self(ruleset->fd, 0)) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Can't self restrict (landlock phase): %s",
-                strerror(errno));
+        SCLogError("Can't self restrict (landlock phase): %s", strerror(errno));
     }
 }
 
@@ -144,13 +141,13 @@ static int LandlockSandboxingAddRule(
 
     int dir_fd = open(directory, O_PATH | O_CLOEXEC | O_DIRECTORY);
     if (dir_fd == -1) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Can't open %s", directory);
+        SCLogError("Can't open %s", directory);
         return -1;
     }
     path_beneath.parent_fd = dir_fd;
 
     if (landlock_add_rule(ruleset->fd, LANDLOCK_RULE_PATH_BENEATH, &path_beneath, 0)) {
-        SCLogError(SC_ERR_CONF_YAML_ERROR, "Can't add write rule: %s", strerror(errno));
+        SCLogError("Can't add write rule: %s", strerror(errno));
         close(dir_fd);
         return -1;
     }
@@ -186,7 +183,7 @@ void LandlockSandboxing(SCInstance *suri)
     }
     struct landlock_ruleset *ruleset = LandlockCreateRuleset();
     if (ruleset == NULL) {
-        SCLogError(SC_ERR_NOT_SUPPORTED, "Kernel does not support Landlock");
+        SCLogError("Kernel does not support Landlock");
         return;
     }
 
@@ -209,7 +206,7 @@ void LandlockSandboxing(SCInstance *suri)
                     LandlockSandboxingReadPath(ruleset, dirname(file_name));
                 }
             } else {
-                SCLogError(SC_ERR_OPENING_FILE, "Can't open pcap file");
+                SCLogError("Can't open pcap file");
             }
             SCFree(file_name);
         }
@@ -255,9 +252,8 @@ void LandlockSandboxing(SCInstance *suri)
     ConfNode *read_dirs = ConfGetNode("security.landlock.directories.read");
     if (read_dirs) {
         if (!ConfNodeIsSequence(read_dirs)) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                    "Invalid security.landlock.directories.read configuration section: "
-                    "expected a list of directory names.");
+            SCLogWarning("Invalid security.landlock.directories.read configuration section: "
+                         "expected a list of directory names.");
         } else {
             ConfNode *directory;
             TAILQ_FOREACH (directory, &read_dirs->head, next) {
@@ -268,9 +264,8 @@ void LandlockSandboxing(SCInstance *suri)
     ConfNode *write_dirs = ConfGetNode("security.landlock.directories.write");
     if (write_dirs) {
         if (!ConfNodeIsSequence(write_dirs)) {
-            SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                    "Invalid security.landlock.directories.write configuration section: "
-                    "expected a list of directory names.");
+            SCLogWarning("Invalid security.landlock.directories.write configuration section: "
+                         "expected a list of directory names.");
         } else {
             ConfNode *directory;
             TAILQ_FOREACH (directory, &write_dirs->head, next) {
index 57aad70378e4b6bac3c38f6070a49df01586eac6..0cfb2974ee18a74431a0d37cdf8e551cc56828df 100644 (file)
@@ -60,7 +60,7 @@ static SCLogRedisContext *SCLogRedisContextAlloc(void)
 {
     SCLogRedisContext* ctx = (SCLogRedisContext*) SCCalloc(1, sizeof(SCLogRedisContext));
     if (ctx == NULL) {
-        FatalError(SC_ERR_FATAL, "Unable to allocate redis context");
+        FatalError("Unable to allocate redis context");
     }
     ctx->sync = NULL;
 #if HAVE_LIBEVENT
@@ -85,7 +85,7 @@ static SCLogRedisContext *SCLogRedisContextAsyncAlloc(void)
 {
     SCLogRedisContext* ctx = (SCLogRedisContext*) SCCalloc(1, sizeof(SCLogRedisContext));
     if (unlikely(ctx == NULL)) {
-        FatalError(SC_ERR_FATAL, "Unable to allocate redis context");
+        FatalError("Unable to allocate redis context");
     }
 
     ctx->sync = NULL;
@@ -140,7 +140,7 @@ static void SCRedisAsyncEchoCommandCallback(redisAsyncContext *ac, void *r, void
     } else {
        ctx->connected = 0;
        if (ctx->tried == 0) {
-          SCLogWarning(SC_ERR_SOCKET, "Failed to connect to Redis... (will keep trying)");
+           SCLogWarning("Failed to connect to Redis... (will keep trying)");
        }
        ctx->tried = time(NULL);
     }
@@ -215,13 +215,13 @@ static int SCConfLogReopenAsyncRedis(LogFileCtx *log_ctx)
     }
 
     if (ctx->async == NULL) {
-        SCLogError(SC_ENOMEM, "Error allocate redis async.");
+        SCLogError("Error allocate redis async.");
         ctx->tried = time(NULL);
         return -1;
     }
 
     if (ctx->async != NULL && ctx->async->err) {
-        SCLogError(SC_ERR_SOCKET, "Error setting to redis async: [%s].", ctx->async->errstr);
+        SCLogError("Error setting to redis async: [%s].", ctx->async->errstr);
         ctx->tried = time(NULL);
         return -1;
     }
@@ -309,12 +309,12 @@ static int SCConfLogReopenSyncRedis(LogFileCtx *log_ctx)
         ctx->sync = redisConnectUnix(redis_server);
     }
     if (ctx->sync == NULL) {
-        SCLogError(SC_ERR_SOCKET, "Error connecting to redis server.");
+        SCLogError("Error connecting to redis server.");
         ctx->tried = time(NULL);
         return -1;
     }
     if (ctx->sync->err) {
-        SCLogError(SC_ERR_SOCKET, "Error connecting to redis server: [%s].", ctx->sync->errstr);
+        SCLogError("Error connecting to redis server: [%s].", ctx->sync->errstr);
         redisFree(ctx->sync);
         ctx->sync = NULL;
         ctx->tried = time(NULL);
@@ -387,7 +387,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
                             }
                             break;
                         default:
-                            SCLogWarning(SC_EINVAL, "Unsupported error code %d", redis->err);
+                            SCLogWarning("Unsupported error code %d", redis->err);
                             return -1;
                     }
                 }
@@ -404,7 +404,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
         if (reply) {
             switch (reply->type) {
                 case REDIS_REPLY_ERROR:
-                    SCLogWarning(SC_ERR_SOCKET, "Redis error: %s", reply->str);
+                    SCLogWarning("Redis error: %s", reply->str);
                     SCConfLogReopenSyncRedis(file_ctx);
                     break;
                 case REDIS_REPLY_INTEGER:
@@ -412,7 +412,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
                     ret = 0;
                     break;
                 default:
-                    SCLogError(SC_EINVAL, "Redis default triggered with %d", reply->type);
+                    SCLogError("Redis default triggered with %d", reply->type);
                     SCConfLogReopenSyncRedis(file_ctx);
                     break;
             }
@@ -462,7 +462,7 @@ int SCConfLogOpenRedis(ConfNode *redis_node, void *lf_ctx)
     LogFileCtx *log_ctx = lf_ctx;
 
     if (log_ctx->threaded) {
-        FatalError(SC_ERR_FATAL, "redis does not support threaded output");
+        FatalError("redis does not support threaded output");
     }
 
     const char *redis_port = NULL;
@@ -493,7 +493,7 @@ int SCConfLogOpenRedis(ConfNode *redis_node, void *lf_ctx)
 
 #ifndef HAVE_LIBEVENT
     if (is_async) {
-        SCLogWarning(SC_ERR_NO_REDIS_ASYNC, "async option not available.");
+        SCLogWarning("async option not available.");
     }
     is_async = 0;
 #endif //ifndef HAVE_LIBEVENT
@@ -527,15 +527,15 @@ int SCConfLogOpenRedis(ConfNode *redis_node, void *lf_ctx)
     } else if(!strcmp(redis_mode,"channel") || !strcmp(redis_mode,"publish")) {
         log_ctx->redis_setup.command = redis_publish_cmd;
     } else {
-        FatalError(SC_ERR_FATAL, "Invalid redis mode");
+        FatalError("Invalid redis mode");
     }
 
     /* store server params for reconnection */
     if (!log_ctx->redis_setup.server) {
-        FatalError(SC_ERR_FATAL, "Error allocating redis server string");
+        FatalError("Error allocating redis server string");
     }
     if (StringParseUint16(&log_ctx->redis_setup.port, 10, 0, (const char *)redis_port) < 0) {
-        FatalError(SC_EINVAL, "Invalid value for redis port: %s", redis_port);
+        FatalError("Invalid value for redis port: %s", redis_port);
     }
     log_ctx->Close = SCLogFileCloseRedis;
 
index b9731ad35110b7f683fdb61eb02c4030a30b76ef..9dfa662daa1b7c1b152bedc2d6bea4b6e92d33b5 100644 (file)
@@ -85,9 +85,8 @@ SCLogOpenUnixSocketFp(const char *path, int sock_type, int log_err)
 
 err:
     if (log_err)
-        SCLogWarning(SC_ERR_SOCKET,
-            "Error connecting to socket \"%s\": %s (will keep trying)",
-            path, strerror(errno));
+        SCLogWarning(
+                "Error connecting to socket \"%s\": %s (will keep trying)", path, strerror(errno));
 
     if (s >= 0)
         close(s);
@@ -103,9 +102,8 @@ static int SCLogUnixSocketReconnect(LogFileCtx *log_ctx)
 {
     int disconnected = 0;
     if (log_ctx->fp) {
-        SCLogWarning(SC_ERR_SOCKET,
-            "Write error on Unix socket \"%s\": %s; reconnecting...",
-            log_ctx->filename, strerror(errno));
+        SCLogWarning("Write error on Unix socket \"%s\": %s; reconnecting...", log_ctx->filename,
+                strerror(errno));
         fclose(log_ctx->fp);
         log_ctx->fp = NULL;
         log_ctx->reconn_timer = 0;
@@ -129,8 +127,7 @@ static int SCLogUnixSocketReconnect(LogFileCtx *log_ctx)
         /* Connected at last (or reconnected) */
         SCLogNotice("Reconnected socket \"%s\"", log_ctx->filename);
     } else if (disconnected) {
-        SCLogWarning(SC_ERR_SOCKET, "Reconnect failed: %s (will keep trying)",
-            strerror(errno));
+        SCLogWarning("Reconnect failed: %s (will keep trying)", strerror(errno));
     }
 
     return log_ctx->fp ? 1 : 0;
@@ -221,7 +218,7 @@ static int SCLogFileWriteNoLock(const char *buffer, int buffer_len, LogFileCtx *
         if (1 != SCFwriteUnlocked(buffer, buffer_len, 1, log_ctx->fp)) {
             /* Only the first error is logged */
             if (!log_ctx->output_errors) {
-                SCLogError(SC_ERR_LOG_OUTPUT, "%s error while writing to %s",
+                SCLogError("%s error while writing to %s",
                         SCFerrorUnlocked(log_ctx->fp) ? strerror(errno) : "unknown error",
                         log_ctx->filename);
             }
@@ -270,7 +267,7 @@ static int SCLogFileWrite(const char *buffer, int buffer_len, LogFileCtx *log_ct
             if (1 != fwrite(buffer, buffer_len, 1, log_ctx->fp)) {
                 /* Only the first error is logged */
                 if (!log_ctx->output_errors) {
-                    SCLogError(SC_ERR_LOG_OUTPUT, "%s error while writing to %s",
+                    SCLogError("%s error while writing to %s",
                             ferror(log_ctx->fp) ? strerror(errno) : "unknown error",
                             log_ctx->filename);
                 }
@@ -314,8 +311,8 @@ static void SCLogFileCloseNoLock(LogFileCtx *log_ctx)
         fclose(log_ctx->fp);
 
     if (log_ctx->output_errors) {
-        SCLogError(SC_ERR_LOG_OUTPUT, "There were %" PRIu64 " output errors to %s",
-                log_ctx->output_errors, log_ctx->filename);
+        SCLogError("There were %" PRIu64 " output errors to %s", log_ctx->output_errors,
+                log_ctx->filename);
     }
 }
 
@@ -331,20 +328,20 @@ bool SCLogOpenThreadedFile(
 {
         parent_ctx->threads = SCCalloc(1, sizeof(LogThreadedFileCtx));
         if (!parent_ctx->threads) {
-            SCLogError(SC_ENOMEM, "Unable to allocate threads container");
+            SCLogError("Unable to allocate threads container");
             return false;
         }
 
         parent_ctx->threads->append = SCStrdup(append == NULL ? DEFAULT_LOG_MODE_APPEND : append);
         if (!parent_ctx->threads->append) {
-            SCLogError(SC_ENOMEM, "Unable to allocate threads append setting");
+            SCLogError("Unable to allocate threads append setting");
             goto error_exit;
         }
 
         parent_ctx->threads->slot_count = slot_count;
         parent_ctx->threads->lf_slots = SCCalloc(slot_count, sizeof(LogFileCtx *));
         if (!parent_ctx->threads->lf_slots) {
-            SCLogError(SC_ENOMEM, "Unable to allocate thread slots");
+            SCLogError("Unable to allocate thread slots");
             goto error_exit;
         }
         SCLogDebug("Allocated %d file context pointers for threaded array",
@@ -401,8 +398,7 @@ SCLogOpenFileFp(const char *path, const char *append_setting, uint32_t mode)
     }
 
     if (ret == NULL) {
-        SCLogError(SC_ERR_FOPEN, "Error opening file: \"%s\": %s",
-                   filename, strerror(errno));
+        SCLogError("Error opening file: \"%s\": %s", filename, strerror(errno));
     } else {
         if (mode != 0) {
 #ifdef OS_WIN32
@@ -411,8 +407,7 @@ SCLogOpenFileFp(const char *path, const char *append_setting, uint32_t mode)
             int r = fchmod(fileno(ret), (mode_t)mode);
 #endif
             if (r < 0) {
-                SCLogWarning(SC_WARN_CHMOD, "Could not chmod %s to %o: %s",
-                             filename, mode, strerror(errno));
+                SCLogWarning("Could not chmod %s to %o: %s", filename, mode, strerror(errno));
             }
         }
     }
@@ -441,15 +436,13 @@ SCConfLogOpenGeneric(ConfNode *conf,
 
     // Arg check
     if (conf == NULL || log_ctx == NULL || default_filename == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "SCConfLogOpenGeneric(conf %p, ctx %p, default %p) "
+        SCLogError("SCConfLogOpenGeneric(conf %p, ctx %p, default %p) "
                    "missing an argument",
-                   conf, log_ctx, default_filename);
+                conf, log_ctx, default_filename);
         return -1;
     }
     if (log_ctx->fp != NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT,
-                   "SCConfLogOpenGeneric: previously initialized Log CTX "
+        SCLogError("SCConfLogOpenGeneric: previously initialized Log CTX "
                    "encountered");
         return -1;
     }
@@ -489,8 +482,7 @@ SCConfLogOpenGeneric(ConfNode *conf,
         else {
             log_ctx->rotate_interval = SCParseTimeSizeString(rotate_int);
             if (log_ctx->rotate_interval == 0) {
-                           FatalError(SC_ERR_FATAL,
-                                      "invalid rotate-interval value");
+                FatalError("invalid rotate-interval value");
             }
             log_ctx->rotate_time = now + log_ctx->rotate_interval;
         }
@@ -540,7 +532,7 @@ SCConfLogOpenGeneric(ConfNode *conf,
 #ifdef BUILD_WITH_UNIXSOCKET
     if (log_ctx->threaded) {
         if (strcasecmp(filetype, "unix_stream") == 0 || strcasecmp(filetype, "unix_dgram") == 0) {
-            FatalError(SC_ERR_FATAL, "Socket file types do not support threaded output");
+            FatalError("Socket file types do not support threaded output");
         }
     }
 #endif
@@ -579,14 +571,14 @@ SCConfLogOpenGeneric(ConfNode *conf,
             OutputRegisterFileRotationFlag(&log_ctx->rotation_flag);
         }
     } else {
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid entry for "
+        SCLogError("Invalid entry for "
                    "%s.filetype.  Expected \"regular\" (default), \"unix_stream\", "
                    "or \"unix_dgram\"",
-                   conf->name);
+                conf->name);
     }
     log_ctx->filename = SCStrdup(log_path);
     if (unlikely(log_ctx->filename == NULL)) {
-        SCLogError(SC_ENOMEM, "Failed to allocate memory for filename");
+        SCLogError("Failed to allocate memory for filename");
         return -1;
     }
 
@@ -618,8 +610,7 @@ int SCConfLogReopen(LogFileCtx *log_ctx)
     }
 
     if (log_ctx->filename == NULL) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-            "Can't re-open LogFileCtx without a filename.");
+        SCLogWarning("Can't re-open LogFileCtx without a filename.");
         return -1;
     }
 
@@ -695,7 +686,7 @@ LogFileCtx *LogFileEnsureExists(LogFileCtx *parent_ctx, int thread_id)
 
     if (new_array == NULL) {
         SCMutexUnlock(&parent_ctx->threads->mutex);
-        SCLogError(SC_ENOMEM, "Unable to increase file context array size to %d", new_size);
+        SCLogError("Unable to increase file context array size to %d", new_size);
         return NULL;
     }
 
@@ -727,9 +718,8 @@ static bool LogFileThreadedName(
 
     const char *base = SCBasename(original_name);
     if (!base) {
-        FatalError(SC_ERR_FATAL,
-                "Invalid filename for threaded mode \"%s\"; "
-                "no basename found.",
+        FatalError("Invalid filename for threaded mode \"%s\"; "
+                   "no basename found.",
                 original_name);
     }
 
@@ -752,9 +742,8 @@ static bool LogFileThreadedName(
         if (strlen(tname) && strlen(ext)) {
             snprintf(threaded_name, len, "%s.%u.%s", tname, unique_id, ext);
         } else {
-            FatalError(SC_ERR_FATAL,
-                    "Invalid filename for threaded mode \"%s\"; "
-                    "filenames must include an extension, e.g: \"name.ext\"",
+            FatalError("Invalid filename for threaded mode \"%s\"; "
+                       "filenames must include an extension, e.g: \"name.ext\"",
                     original_name);
         }
         SCFree(tname);
@@ -774,7 +763,7 @@ static bool LogFileNewThreadedCtx(LogFileCtx *parent_ctx, const char *log_path,
 {
     LogFileCtx *thread = SCCalloc(1, sizeof(LogFileCtx));
     if (!thread) {
-        SCLogError(SC_ENOMEM, "Unable to allocate thread file context slot %d", thread_id);
+        SCLogError("Unable to allocate thread file context slot %d", thread_id);
         return false;
     }
 
@@ -782,7 +771,7 @@ static bool LogFileNewThreadedCtx(LogFileCtx *parent_ctx, const char *log_path,
     if (parent_ctx->type == LOGFILE_TYPE_FILE) {
         char fname[LOGFILE_NAME_MAX];
         if (!LogFileThreadedName(log_path, fname, sizeof(fname), SC_ATOMIC_ADD(eve_file_id, 1))) {
-            SCLogError(sc_errno, "Unable to create threaded filename for log");
+            SCLogError("Unable to create threaded filename for log");
             goto error;
         }
         SCLogDebug("Thread open -- using name %s [replaces %s]", fname, log_path);
@@ -792,7 +781,7 @@ static bool LogFileNewThreadedCtx(LogFileCtx *parent_ctx, const char *log_path,
         }
         thread->filename = SCStrdup(fname);
         if (!thread->filename) {
-            SCLogError(SC_ENOMEM, "Unable to duplicate filename for context slot %d", thread_id);
+            SCLogError("Unable to duplicate filename for context slot %d", thread_id);
             goto error;
         }
         thread->is_regular = true;
index 604c99e4b6a2e5ae89047eae29a06fa6ab3d52d0..334a01cea275930ef1f6ac3d51e5ba8dcc5eb6bc 100644 (file)
@@ -758,7 +758,7 @@ static int LuaCallbackLogWarning(lua_State *luastate)
     lua_getstack(luastate, 1, &ar);
     lua_getinfo(luastate, "nSl", &ar);
     const char *funcname = ar.name ? ar.name : ar.what;
-    SCLogWarningRaw(SC_WARN_LUA_SCRIPT, ar.short_src, funcname, ar.currentline, "%s", msg);
+    SCLogWarningRaw(ar.short_src, funcname, ar.currentline, "%s", msg);
     return 0;
 }
 
@@ -771,7 +771,7 @@ static int LuaCallbackLogError(lua_State *luastate)
     lua_getstack(luastate, 1, &ar);
     lua_getinfo(luastate, "nSl", &ar);
     const char *funcname = ar.name ? ar.name : ar.what;
-    SCLogErrorRaw(SC_ERR_LUA_SCRIPT, ar.short_src, funcname, ar.currentline, "%s", msg);
+    SCLogErrorRaw(ar.short_src, funcname, ar.currentline, "%s", msg);
     return 0;
 }
 
index 949cf618fe01680b6bd540aa46cdab3d2e9856c3..acaf7b8223c955cb960c4d3d0173c371d7503894 100644 (file)
@@ -91,7 +91,7 @@ int LuajitSetupStatesPool(void)
 
         luajit_states = PoolInit(0, cnt, 0, LuaStatePoolAlloc, NULL, NULL, NULL, LuaStatePoolFree);
         if (luajit_states == NULL) {
-            SCLogError(SC_ERR_LUA_ERROR, "luastate pool init failed, lua/luajit keywords won't work");
+            SCLogError("luastate pool init failed, lua/luajit keywords won't work");
             retval = -1;
         }
 
@@ -128,10 +128,9 @@ lua_State *LuajitGetState(void)
         s = (lua_State *)PoolGet(luajit_states);
         if (s != NULL) {
             if (luajit_states_cnt == luajit_states_size) {
-                SCLogWarning(SC_WARN_LUA_SCRIPT,
-                        "luajit states pool size %d "
-                        "reached. Increase luajit.states config option. "
-                        "See tickets #1577 and #1955",
+                SCLogWarning("luajit states pool size %d "
+                             "reached. Increase luajit.states config option. "
+                             "See tickets #1577 and #1955",
                         luajit_states_size);
             }
 
index efa74ce0f080d5cb02b3bd215c2532dfd041d9c2..5343808c0e0644114587cfd8550643af44e89c4e 100644 (file)
@@ -95,7 +95,7 @@ MacSet *MacSetInit(int size)
     }
     ms = SCCalloc(1, sizeof(*ms));
     if (unlikely(ms == NULL)) {
-        SCLogError(SC_ENOMEM, "Unable to allocate MacSet memory");
+        SCLogError("Unable to allocate MacSet memory");
         return NULL;
     }
     (void) SC_ATOMIC_ADD(flow_memuse, (sizeof(*ms)));
@@ -133,8 +133,8 @@ static inline void MacUpdateEntry(MacSet *ms, uint8_t *addr, int side, ThreadVar
                     }
                     ms->buf[side] = SCCalloc(ms->size, sizeof(MacAddr));
                     if (unlikely(ms->buf[side] == NULL)) {
-                        SCLogError(SC_ENOMEM, "Unable to allocate "
-                                              "MacSet memory");
+                        SCLogError("Unable to allocate "
+                                   "MacSet memory");
                         return;
                     }
                     (void) SC_ATOMIC_ADD(flow_memuse, (ms->size * sizeof(MacAddr)));
index e742d18def22390d440d81d4daa21aa2fdf7ece0..63c991cc92d8a09072f9cddd44544c3cc514da78 100644 (file)
@@ -46,8 +46,7 @@ magic_t MagicInitContext(void)
 
     ctx = magic_open(0);
     if (ctx == NULL) {
-        SCLogError(SC_ERR_MAGIC_OPEN, "magic_open failed: %s",
-                magic_error(ctx));
+        SCLogError("magic_open failed: %s", magic_error(ctx));
         goto error;
     }
 
@@ -65,8 +64,7 @@ magic_t MagicInitContext(void)
             SCLogConfig("using magic-file %s", filename);
 
             if ( (fd = fopen(filename, "r")) == NULL) {
-                SCLogWarning(SC_ERR_FOPEN, "Error opening file: \"%s\": %s",
-                        filename, strerror(errno));
+                SCLogWarning("Error opening file: \"%s\": %s", filename, strerror(errno));
                 goto error;
             }
             fclose(fd);
@@ -74,8 +72,7 @@ magic_t MagicInitContext(void)
     }
 
     if (magic_load(ctx, filename) != 0) {
-        SCLogError(SC_ERR_MAGIC_LOAD, "magic_load failed: %s",
-                magic_error(ctx));
+        SCLogError("magic_load failed: %s", magic_error(ctx));
         goto error;
     }
     return ctx;
@@ -113,7 +110,7 @@ char *MagicThreadLookup(magic_t *ctx, const uint8_t *buf, uint32_t buflen)
         if (result != NULL) {
             magic = SCStrdup(result);
             if (unlikely(magic == NULL)) {
-                SCLogError(SC_ENOMEM, "Unable to dup magic");
+                SCLogError("Unable to dup magic");
             }
         }
     }
index 2f612fabd7703f48fe202f6f3cd84158000b20e4..babdfa3f5671616e5819c8efc0818a3bcb574713 100644 (file)
@@ -32,11 +32,10 @@ void *SCMallocFunc(const size_t sz)
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
             uintmax_t scmalloc_size_ = (uintmax_t)sz;
-            SCLogError(SC_ENOMEM,
-                    "SCMalloc failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes",
+            SCLogError("SCMalloc failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes",
                     strerror(errno), scmalloc_size_);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
     return ptrmem;
@@ -47,11 +46,10 @@ void *SCReallocFunc(void *ptr, const size_t size)
     void *ptrmem = realloc(ptr, size);
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
-            SCLogError(SC_ENOMEM,
-                    "SCRealloc failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes",
+            SCLogError("SCRealloc failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes",
                     strerror(errno), (uintmax_t)size);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
     return ptrmem;
@@ -62,11 +60,10 @@ void *SCCallocFunc(const size_t nm, const size_t sz)
     void *ptrmem = calloc(nm, sz);
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
-            SCLogError(SC_ENOMEM,
-                    "SCCalloc failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes",
+            SCLogError("SCCalloc failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes",
                     strerror(errno), (uintmax_t)nm * sz);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
     return ptrmem;
@@ -78,11 +75,10 @@ char *SCStrdupFunc(const char *s)
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
             size_t _scstrdup_len = strlen(s);
-            SCLogError(SC_ENOMEM,
-                    "SCStrdup failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes",
+            SCLogError("SCStrdup failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes",
                     strerror(errno), (uintmax_t)_scstrdup_len);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
     return ptrmem;
@@ -101,11 +97,10 @@ char *SCStrndupFunc(const char *s, size_t n)
 #endif
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
-            SCLogError(SC_ENOMEM,
-                    "SCStrndup failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes",
+            SCLogError("SCStrndup failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes",
                     strerror(errno), (uintmax_t)(n + 1));
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
     return ptrmem;
@@ -117,11 +112,10 @@ void *SCMallocAlignedFunc(const size_t size, const size_t align)
     void *ptrmem = _mm_malloc(size, align);
     if (unlikely(ptrmem == NULL)) {
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
-            SCLogError(SC_ENOMEM,
-                    "SCMallocAligned(posix_memalign) failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes, alignment %" PRIuMAX,
+            SCLogError("SCMallocAligned(posix_memalign) failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes, alignment %" PRIuMAX,
                     strerror(errno), (uintmax_t)size, (uintmax_t)align);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
 #else
@@ -133,11 +127,10 @@ void *SCMallocAlignedFunc(const size_t size, const size_t align)
             ptrmem = NULL;
         }
         if (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT) {
-            SCLogError(SC_ENOMEM,
-                    "SCMallocAligned(posix_memalign) failed: %s, while trying "
-                    "to allocate %" PRIuMAX " bytes, alignment %" PRIuMAX,
+            SCLogError("SCMallocAligned(posix_memalign) failed: %s, while trying "
+                       "to allocate %" PRIuMAX " bytes, alignment %" PRIuMAX,
                     strerror(errno), (uintmax_t)size, (uintmax_t)align);
-            FatalError(SC_ERR_FATAL, "Out of memory. The engine cannot be initialized. Exiting...");
+            FatalError("Out of memory. The engine cannot be initialized. Exiting...");
         }
     }
 #endif
index 32816f8e3335345a1490b8149678a54aac0c83d2..38c4f9dd8d062a97360dfd577809fcc66c5c0335 100644 (file)
@@ -43,9 +43,8 @@ void ParseSizeInit(void)
     if (parse_regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 PARSE_REGEX, (int)eo, errbuffer);
         exit(EXIT_FAILURE);
     }
@@ -71,13 +70,12 @@ static int ParseSizeString(const char *size, double *res)
     *res = 0;
 
     if (size == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS,"invalid size argument - NULL. Valid size "
+        SCLogError("invalid size argument - NULL. Valid size "
                    "argument should be in the format - \n"
                    "xxx <- indicates it is just bytes\n"
                    "xxxkb or xxxKb or xxxKB or xxxkB <- indicates kilobytes\n"
                    "xxxmb or xxxMb or xxxMB or xxxmB <- indicates megabytes\n"
-                   "xxxgb or xxxGb or xxxGB or xxxgB <- indicates gigabytes.\n"
-                           );
+                   "xxxgb or xxxGb or xxxGB or xxxgB <- indicates gigabytes.\n");
         retval = -2;
         goto end;
     }
@@ -86,13 +84,13 @@ static int ParseSizeString(const char *size, double *res)
             parse_regex, (PCRE2_SPTR8)size, strlen(size), 0, 0, parse_regex_match, NULL);
 
     if (!(pcre2_match_ret == 2 || pcre2_match_ret == 3)) {
-        SCLogError(SC_ERR_PCRE_MATCH, "invalid size argument - %s. Valid size "
+        SCLogError("invalid size argument - %s. Valid size "
                    "argument should be in the format - \n"
                    "xxx <- indicates it is just bytes\n"
                    "xxxkb or xxxKb or xxxKB or xxxkB <- indicates kilobytes\n"
                    "xxxmb or xxxMb or xxxMB or xxxmB <- indicates megabytes\n"
                    "xxxgb or xxxGb or xxxGB or xxxgB <- indicates gigabytes.\n",
-                   size);
+                size);
         retval = -2;
         goto end;
     }
@@ -100,7 +98,7 @@ static int ParseSizeString(const char *size, double *res)
     size_t copylen = sizeof(str);
     r = pcre2_substring_copy_bynumber(parse_regex_match, 1, (PCRE2_UCHAR8 *)str, &copylen);
     if (r < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         retval = -2;
         goto end;
     }
@@ -109,11 +107,11 @@ static int ParseSizeString(const char *size, double *res)
     errno = 0;
     *res = strtod(str_ptr, &endptr);
     if (errno == ERANGE) {
-        SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range");
+        SCLogError("Numeric value out of range");
         retval = -1;
         goto end;
     } else if (endptr == str_ptr) {
-        SCLogError(SC_ERR_INVALID_NUMERIC_VALUE, "Invalid numeric value");
+        SCLogError("Invalid numeric value");
         retval = -1;
         goto end;
     }
@@ -123,7 +121,7 @@ static int ParseSizeString(const char *size, double *res)
         r = pcre2_substring_copy_bynumber(parse_regex_match, 2, (PCRE2_UCHAR8 *)str2, &copylen);
 
         if (r < 0) {
-            SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+            SCLogError("pcre2_substring_copy_bynumber failed");
             retval = -2;
             goto end;
         }
index 5bd2d03e1bca0fb0c3aa539d7c0b1fa7b5961f05..a3d398d92f0a0af87e07f2bc69f4996be72bee41 100644 (file)
                  etc.
  * \param value Default value to be printed.
  */
-#define WarnInvalidConfEntry(param_name, format, value) do {            \
-        SCLogWarning(SC_ERR_INVALID_YAML_CONF_ENTRY,                    \
-                     "Invalid conf entry found for "                    \
-                     "\"%s\".  Using default value of \"" format "\".", \
-                     param_name, value);                                \
+#define WarnInvalidConfEntry(param_name, format, value)                                            \
+    do {                                                                                           \
+        SCLogWarning("Invalid conf entry found for "                                               \
+                     "\"%s\".  Using default value of \"" format "\".",                            \
+                param_name, value);                                                                \
     } while (0)
 
 /* size string parsing API */
index 2011a76896c84458bda03a407db9aacaaa54cc00..d48ec11b99d0cdbd26e355ec3185bf71cdb08b40 100644 (file)
@@ -149,7 +149,7 @@ static inline int SCACBSInitNewState(MpmCtx *mpm_ctx)
     if (ptmp == NULL) {
         SCFree(ctx->goto_table);
         ctx->goto_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->goto_table = ptmp;
 
@@ -164,7 +164,7 @@ static inline int SCACBSInitNewState(MpmCtx *mpm_ctx)
     if (ptmp == NULL) {
         SCFree(ctx->output_table);
         ctx->output_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->output_table = ptmp;
 
@@ -206,7 +206,7 @@ static void SCACBSSetOutputState(int32_t state, uint32_t pid, MpmCtx *mpm_ctx)
     if (ptmp == NULL) {
         SCFree(output_state->pids);
         output_state->pids = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     output_state->pids = ptmp;
 
@@ -310,7 +310,7 @@ static inline void SCACBSEnqueue(StateQueue *q, int32_t state)
         q->top = 0;
 
     if (q->top == q->bot) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "Just ran out of space in the queue.  "
+        SCLogCritical("Just ran out of space in the queue.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -324,7 +324,7 @@ static inline int32_t SCACBSDequeue(StateQueue *q)
         q->bot = 0;
 
     if (q->bot == q->top) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "StateQueue behaving weirdly.  "
+        SCLogCritical("StateQueue behaving weirdly.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -398,7 +398,7 @@ static inline void SCACBSClubOutputStates(int32_t dst_state, int32_t src_state,
             if (ptmp == NULL) {
                 SCFree(output_dst_state->pids);
                 output_dst_state->pids = NULL;
-                FatalError(SC_ERR_FATAL, "Error allocating memory");
+                FatalError("Error allocating memory");
             }
             else {
                 output_dst_state->pids = ptmp;
@@ -432,7 +432,7 @@ static inline void SCACBSCreateFailureTable(MpmCtx *mpm_ctx)
      * every state(SCACBSCtx->state_count) */
     ctx->failure_table = SCMalloc(ctx->state_count * sizeof(int32_t));
     if (ctx->failure_table == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(ctx->failure_table, 0, ctx->state_count * sizeof(int32_t));
 
@@ -484,7 +484,7 @@ static inline void SCACBSCreateDeltaTable(MpmCtx *mpm_ctx)
         ctx->state_table_u16 = SCMalloc(ctx->state_count *
                                         sizeof(SC_AC_BS_STATE_TYPE_U16) * 256);
         if (ctx->state_table_u16 == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_u16, 0,
                ctx->state_count * sizeof(SC_AC_BS_STATE_TYPE_U16) * 256);
@@ -526,7 +526,7 @@ static inline void SCACBSCreateDeltaTable(MpmCtx *mpm_ctx)
         ctx->state_table_u32 = SCMalloc(ctx->state_count *
                                         sizeof(SC_AC_BS_STATE_TYPE_U32) * 256);
         if (ctx->state_table_u32 == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_u32, 0,
                ctx->state_count * sizeof(SC_AC_BS_STATE_TYPE_U32) * 256);
@@ -694,7 +694,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
                  256 * sizeof(SC_AC_BS_STATE_TYPE_U16) * 1);
         ctx->state_table_mod = SCMalloc(size);
         if (ctx->state_table_mod == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_mod, 0, size);
 
@@ -705,7 +705,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
          * directly to access its state data */
         ctx->state_table_mod_pointers = SCMalloc(ctx->state_count * sizeof(uint8_t *));
         if (ctx->state_table_mod_pointers == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_mod_pointers, 0,
                ctx->state_count * sizeof(uint8_t *));
@@ -766,7 +766,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
                  256 * sizeof(SC_AC_BS_STATE_TYPE_U32) * 1);
         ctx->state_table_mod = SCMalloc(size);
         if (ctx->state_table_mod == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_mod, 0, size);
 
@@ -777,7 +777,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
          * directly to access its state data */
         ctx->state_table_mod_pointers = SCMalloc(ctx->state_count * sizeof(uint8_t *));
         if (ctx->state_table_mod_pointers == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_mod_pointers, 0,
                ctx->state_count * sizeof(uint8_t *));
@@ -918,7 +918,7 @@ int SCACBSPreparePatterns(MpmCtx *mpm_ctx)
     /* handle no case patterns */
     ctx->pid_pat_list = SCMalloc((mpm_ctx->max_pat_id + 1)* sizeof(SCACBSPatternList));
     if (ctx->pid_pat_list == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(ctx->pid_pat_list, 0, (mpm_ctx->max_pat_id + 1) * sizeof(SCACBSPatternList));
 
@@ -926,7 +926,7 @@ int SCACBSPreparePatterns(MpmCtx *mpm_ctx)
         if (!(ctx->parray[i]->flags & MPM_PATTERN_FLAG_NOCASE)) {
             ctx->pid_pat_list[ctx->parray[i]->id].cs = SCMalloc(ctx->parray[i]->len);
             if (ctx->pid_pat_list[ctx->parray[i]->id].cs == NULL) {
-                FatalError(SC_ERR_FATAL, "Error allocating memory");
+                FatalError("Error allocating memory");
             }
             memcpy(ctx->pid_pat_list[ctx->parray[i]->id].cs,
                    ctx->parray[i]->original_pat, ctx->parray[i]->len);
index 9ce885b922694abc9beb0ef0b781a3a16c34a90a..771b8a9371d7c01ca214bd4456f861021ab4c1d5 100644 (file)
@@ -238,7 +238,7 @@ static void SCACTileReallocOutputTable(SCACTileCtx *ctx, int new_state_count)
     if (ptmp == NULL) {
         SCFree(ctx->output_table);
         ctx->output_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->output_table = ptmp;
 }
@@ -251,7 +251,7 @@ static void SCACTileReallocState(SCACTileCtx *ctx, int new_state_count)
     if (ptmp == NULL) {
         SCFree(ctx->goto_table);
         ctx->goto_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->goto_table = ptmp;
 
@@ -324,7 +324,7 @@ static void SCACTileSetOutputState(int32_t state, MpmPatternIndex pindex, MpmCtx
     if (ptmp == NULL) {
         SCFree(output_state->patterns);
         output_state->patterns = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     output_state->patterns = ptmp;
 
@@ -427,7 +427,7 @@ static inline void SCACTileEnqueue(StateQueue *q, int32_t state)
         q->top = 0;
 
     if (q->top == q->bot) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "Just ran out of space in the queue.  "
+        SCLogCritical("Just ran out of space in the queue.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -439,7 +439,7 @@ static inline int32_t SCACTileDequeue(StateQueue *q)
         q->bot = 0;
 
     if (q->bot == q->top) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "StateQueue behaving weirdly.  "
+        SCLogCritical("StateQueue behaving weirdly.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -484,7 +484,7 @@ static void SCACTileClubOutputStates(int32_t dst_state,
             if (ptmp == NULL) {
                 SCFree(output_dst_state->patterns);
                 output_dst_state->patterns = NULL;
-                FatalError(SC_ERR_FATAL, "Error allocating memory");
+                FatalError("Error allocating memory");
             }
             output_dst_state->patterns = ptmp;
 
@@ -516,7 +516,7 @@ static void SCACTileCreateFailureTable(MpmCtx *mpm_ctx)
      * every state(SCACTileCtx->state_count) */
     ctx->failure_table = SCMalloc(ctx->state_count * sizeof(int32_t));
     if (ctx->failure_table == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(ctx->failure_table, 0, ctx->state_count * sizeof(int32_t));
 
@@ -561,7 +561,7 @@ static void SCACTileSetState1Byte(SCACTileCtx *ctx, int state, int aa,
     uint8_t encoded_next_state = (uint8_t)next_state;
 
     if (next_state == SC_AC_TILE_FAIL) {
-        FatalError(SC_ERR_FATAL, "Error FAIL state in output");
+        FatalError("Error FAIL state in output");
     }
 
     if (outputs == 0)
@@ -581,7 +581,7 @@ static void SCACTileSetState2Bytes(SCACTileCtx *ctx, int state, int aa,
     uint16_t encoded_next_state = (uint16_t)next_state;
 
     if (next_state == SC_AC_TILE_FAIL) {
-        FatalError(SC_ERR_FATAL, "Error FAIL state in output");
+        FatalError("Error FAIL state in output");
     }
 
     if (outputs == 0)
@@ -600,7 +600,7 @@ static void SCACTileSetState4Bytes(SCACTileCtx *ctx, int state, int aa,
     uint32_t encoded_next_state = next_state;
 
     if (next_state == SC_AC_TILE_FAIL) {
-        FatalError(SC_ERR_FATAL, "Error FAIL state in output");
+        FatalError("Error FAIL state in output");
     }
 
     if (outputs == 0)
@@ -717,7 +717,7 @@ static void SCACTileClubOutputStatePresenceWithDeltaTable(MpmCtx *mpm_ctx)
     int size = ctx->state_count * ctx->bytes_per_state * ctx->alphabet_storage;
     void *state_table = SCMalloc(size);
     if (unlikely(state_table == NULL)) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(state_table, 0, size);
     ctx->state_table = state_table;
@@ -923,7 +923,7 @@ int SCACTilePreparePatterns(MpmCtx *mpm_ctx)
     size_t mem_size = string_space_needed + pattern_list_size;
     void *mem_block = SCCalloc(1, mem_size);
     if (mem_block == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     mpm_ctx->memory_cnt++;
     mpm_ctx->memory_size += mem_size;
index 5a13d3ae6f6b077cffc86125e6d5bfed98de4388..fae8b83f16bd406d309245280d84c1c2b300c014 100644 (file)
@@ -127,9 +127,8 @@ static inline size_t SCACCheckSafeSizetMult(size_t a, size_t b)
 {
     /* check for safety of multiplication operation */
     if (b > 0 && a > SIZE_MAX / b) {
-        SCLogError(SC_EINVAL,
-                "%" PRIuMAX " * %" PRIuMAX " > %" PRIuMAX
-                " would overflow size_t calculating buffer size",
+        SCLogError("%" PRIuMAX " * %" PRIuMAX " > %" PRIuMAX
+                   " would overflow size_t calculating buffer size",
                 (uintmax_t)a, (uintmax_t)b, (uintmax_t)SIZE_MAX);
         exit(EXIT_FAILURE);
     }
@@ -156,7 +155,7 @@ static inline int SCACReallocState(SCACCtx *ctx, uint32_t cnt)
     if (ptmp == NULL) {
         SCFree(ctx->goto_table);
         ctx->goto_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->goto_table = ptmp;
 
@@ -173,7 +172,7 @@ static inline int SCACReallocState(SCACCtx *ctx, uint32_t cnt)
     if (ptmp == NULL) {
         SCFree(ctx->output_table);
         ctx->output_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->output_table = ptmp;
 
@@ -211,7 +210,7 @@ static void SCACShrinkState(SCACCtx *ctx)
     if (ptmp == NULL) {
         SCFree(ctx->output_table);
         ctx->output_table = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     ctx->output_table = ptmp;
 }
@@ -271,7 +270,7 @@ static void SCACSetOutputState(int32_t state, uint32_t pid, MpmCtx *mpm_ctx)
     if (ptmp == NULL) {
         SCFree(output_state->pids);
         output_state->pids = NULL;
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     output_state->pids = ptmp;
 
@@ -396,7 +395,7 @@ static inline void SCACEnqueue(StateQueue *q, int32_t state)
         q->top = 0;
 
     if (q->top == q->bot) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "Just ran out of space in the queue.  "
+        SCLogCritical("Just ran out of space in the queue.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -410,7 +409,7 @@ static inline int32_t SCACDequeue(StateQueue *q)
         q->bot = 0;
 
     if (q->bot == q->top) {
-        SCLogCritical(SC_ERR_AHO_CORASICK, "StateQueue behaving weirdly.  "
+        SCLogCritical("StateQueue behaving weirdly.  "
                       "Fatal Error.  Exiting.  Please file a bug report on this");
         exit(EXIT_FAILURE);
     }
@@ -484,7 +483,7 @@ static inline void SCACClubOutputStates(int32_t dst_state, int32_t src_state,
             if (ptmp == NULL) {
                 SCFree(output_dst_state->pids);
                 output_dst_state->pids = NULL;
-                FatalError(SC_ERR_FATAL, "Error allocating memory");
+                FatalError("Error allocating memory");
             }
             output_dst_state->pids = ptmp;
 
@@ -516,7 +515,7 @@ static inline void SCACCreateFailureTable(MpmCtx *mpm_ctx)
      * every state(SCACCtx->state_count) */
     ctx->failure_table = SCMalloc(ctx->state_count * sizeof(int32_t));
     if (ctx->failure_table == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(ctx->failure_table, 0, ctx->state_count * sizeof(int32_t));
 
@@ -568,7 +567,7 @@ static inline void SCACCreateDeltaTable(MpmCtx *mpm_ctx)
         ctx->state_table_u16 = SCMalloc(ctx->state_count *
                                         sizeof(SC_AC_STATE_TYPE_U16) * 256);
         if (ctx->state_table_u16 == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_u16, 0,
                ctx->state_count * sizeof(SC_AC_STATE_TYPE_U16) * 256);
@@ -612,7 +611,7 @@ static inline void SCACCreateDeltaTable(MpmCtx *mpm_ctx)
         ctx->state_table_u32 = SCMalloc(ctx->state_count *
                                         sizeof(SC_AC_STATE_TYPE_U32) * 256);
         if (ctx->state_table_u32 == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(ctx->state_table_u32, 0,
                ctx->state_count * sizeof(SC_AC_STATE_TYPE_U32) * 256);
@@ -808,7 +807,7 @@ int SCACPreparePatterns(MpmCtx *mpm_ctx)
     /* handle no case patterns */
     ctx->pid_pat_list = SCMalloc((mpm_ctx->max_pat_id + 1)* sizeof(SCACPatternList));
     if (ctx->pid_pat_list == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     memset(ctx->pid_pat_list, 0, (mpm_ctx->max_pat_id + 1) * sizeof(SCACPatternList));
 
@@ -816,7 +815,7 @@ int SCACPreparePatterns(MpmCtx *mpm_ctx)
         if (!(ctx->parray[i]->flags & MPM_PATTERN_FLAG_NOCASE)) {
             ctx->pid_pat_list[ctx->parray[i]->id].cs = SCMalloc(ctx->parray[i]->len);
             if (ctx->pid_pat_list[ctx->parray[i]->id].cs == NULL) {
-                FatalError(SC_ERR_FATAL, "Error allocating memory");
+                FatalError("Error allocating memory");
             }
             memcpy(ctx->pid_pat_list[ctx->parray[i]->id].cs,
                    ctx->parray[i]->original_pat, ctx->parray[i]->len);
index 0271da80b2986b21892acdc31491b03b0c4d1886..65fda758e0f12493498609bd58896cedcdbc91fa 100644 (file)
@@ -108,7 +108,7 @@ static void SCHSSetAllocators(void)
 {
     hs_error_t err = hs_set_allocator(SCHSMalloc, SCHSFree);
     if (err != HS_SUCCESS) {
-        FatalError(SC_ERR_FATAL, "Failed to set Hyperscan allocator.");
+        FatalError("Failed to set Hyperscan allocator.");
     }
 }
 
@@ -281,7 +281,7 @@ static int SCHSAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen,
     }
 
     if (patlen == 0) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "pattern length 0");
+        SCLogWarning("pattern length 0");
         return 0;
     }
 
@@ -692,9 +692,9 @@ int SCHSPreparePatterns(MpmCtx *mpm_ctx)
                                &compile_err);
 
     if (err != HS_SUCCESS) {
-        SCLogError(SC_ERR_FATAL, "failed to compile hyperscan database");
+        SCLogError("failed to compile hyperscan database");
         if (compile_err) {
-            SCLogError(SC_ERR_FATAL, "compile error: %s", compile_err->message);
+            SCLogError("compile error: %s", compile_err->message);
         }
         hs_free_compile_error(compile_err);
         SCMutexUnlock(&g_db_table_mutex);
@@ -707,14 +707,14 @@ int SCHSPreparePatterns(MpmCtx *mpm_ctx)
     err = hs_alloc_scratch(pd->hs_db, &g_scratch_proto);
     SCMutexUnlock(&g_scratch_proto_mutex);
     if (err != HS_SUCCESS) {
-        SCLogError(SC_ERR_FATAL, "failed to allocate scratch");
+        SCLogError("failed to allocate scratch");
         SCMutexUnlock(&g_db_table_mutex);
         goto error;
     }
 
     err = hs_database_size(pd->hs_db, &ctx->hs_db_size);
     if (err != HS_SUCCESS) {
-        SCLogError(SC_ERR_FATAL, "failed to query database size");
+        SCLogError("failed to query database size");
         SCMutexUnlock(&g_db_table_mutex);
         goto error;
     }
@@ -784,12 +784,12 @@ void SCHSInitThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx)
     SCMutexUnlock(&g_scratch_proto_mutex);
 
     if (err != HS_SUCCESS) {
-        FatalError(SC_ERR_FATAL, "Unable to clone scratch prototype");
+        FatalError("Unable to clone scratch prototype");
     }
 
     err = hs_scratch_size(ctx->scratch, &ctx->scratch_size);
     if (err != HS_SUCCESS) {
-        FatalError(SC_ERR_FATAL, "Unable to query scratch size");
+        FatalError("Unable to query scratch size");
     }
 
     mpm_thread_ctx->memory_cnt++;
@@ -950,7 +950,7 @@ uint32_t SCHSSearch(const MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx,
         /* An error value (other than HS_SCAN_TERMINATED) from hs_scan()
          * indicates that it was passed an invalid database or scratch region,
          * which is not something we can recover from at scan time. */
-        SCLogError(SC_ERR_FATAL, "Hyperscan returned error %d", err);
+        SCLogError("Hyperscan returned error %d", err);
         exit(EXIT_FAILURE);
     } else {
         ret = cctx.match_count;
index 2cd1b9a6902eae1a30aef6775eff2aa57d1f375b..555286b8e964c31fcec481945f45570015a93876 100644 (file)
@@ -63,7 +63,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(
     if (de_ctx->mpm_ctx_factory_container == NULL) {
         de_ctx->mpm_ctx_factory_container = SCCalloc(1, sizeof(MpmCtxFactoryContainer));
         if (de_ctx->mpm_ctx_factory_container == NULL) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         de_ctx->mpm_ctx_factory_container->max_id = ENGINE_SGH_MPM_FACTORY_CONTEXT_START_ID_RANGE;
     }
@@ -80,7 +80,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(
 
     MpmCtxFactoryItem *nitem = SCCalloc(1, sizeof(MpmCtxFactoryItem));
     if (unlikely(nitem == NULL)) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     nitem->name = name;
     nitem->sm_list = sm_list;
@@ -89,14 +89,14 @@ int32_t MpmFactoryRegisterMpmCtxProfile(
     /* toserver */
     nitem->mpm_ctx_ts = SCCalloc(1, sizeof(MpmCtx));
     if (nitem->mpm_ctx_ts == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     nitem->mpm_ctx_ts->flags |= MPMCTX_FLAGS_GLOBAL;
 
     /* toclient */
     nitem->mpm_ctx_tc = SCCalloc(1, sizeof(MpmCtx));
     if (nitem->mpm_ctx_tc == NULL) {
-        FatalError(SC_ERR_FATAL, "Error allocating memory");
+        FatalError("Error allocating memory");
     }
     nitem->mpm_ctx_tc->flags |= MPMCTX_FLAGS_GLOBAL;
 
@@ -132,12 +132,12 @@ MpmCtx *MpmFactoryGetMpmCtxForProfile(const DetectEngineCtx *de_ctx, int32_t id,
     if (id == MPM_CTX_FACTORY_UNIQUE_CONTEXT) {
         MpmCtx *mpm_ctx = SCMalloc(sizeof(MpmCtx));
         if (unlikely(mpm_ctx == NULL)) {
-            FatalError(SC_ERR_FATAL, "Error allocating memory");
+            FatalError("Error allocating memory");
         }
         memset(mpm_ctx, 0, sizeof(MpmCtx));
         return mpm_ctx;
     } else if (id < -1) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid argument - %d\n", id);
+        SCLogError("Invalid argument - %d\n", id);
         return NULL;
     } else if (id >= de_ctx->mpm_ctx_factory_container->max_id) {
         /* this id does not exist */
@@ -432,7 +432,7 @@ int MpmAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen,
                mpm_ctx, patlen, pid);
 
     if (patlen == 0) {
-        SCLogWarning(SC_ERR_INVALID_ARGUMENTS, "pattern length 0");
+        SCLogWarning("pattern length 0");
         return 0;
     }
 
@@ -576,8 +576,9 @@ void MpmRegisterTests(void)
             mpm_table[i].RegisterUnittests();
         } else {
             if (coverage_unittests)
-                SCLogWarning(SC_WARN_NO_UNITTESTS, "mpm module %s has no "
-                        "unittest registration function.", mpm_table[i].name);
+                SCLogWarning("mpm module %s has no "
+                             "unittest registration function.",
+                        mpm_table[i].name);
         }
     }
 
index 05aa4a8f091f289a9cb2684121c335b872a5abbb..b8e0baa678ce4ee34a04a34e83c6df8e49aa1c67 100644 (file)
@@ -67,13 +67,13 @@ int NapatechGetNumAdapters(void)
 
     if (num_adapters == -1) {
         if ((status = NT_InfoOpen(&hInfo, "InfoStream")) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+            NAPATECH_ERROR(status);
             exit(EXIT_FAILURE);
         }
 
         hInfoSys.cmd = NT_INFO_CMD_READ_SYSTEM;
         if ((status = NT_InfoRead(hInfo, &hInfoSys)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_OPEN_FAILED, status);
+            NAPATECH_ERROR(status);
             exit(EXIT_FAILURE);
         }
 
@@ -116,7 +116,9 @@ int NapatechVerifyBypassSupport(void)
         snprintf(flow_name, sizeof(flow_name), "Flow stream %d", adapter );
         SCLogInfo("Opening flow programming stream:  %s\n", flow_name);
         if ((status = NT_FlowOpen_Attr(&hFlowStream, flow_name, &attr)) != NT_SUCCESS) {
-            SCLogWarning(SC_WARN_COMPATIBILITY, "Napatech bypass functionality not supported by the FPGA version on adapter %d - disabling support.", adapter);
+            SCLogWarning("Napatech bypass functionality not supported by the FPGA version on "
+                         "adapter %d - disabling support.",
+                    adapter);
             bypass_supported = 0;
             return 0;
         }
@@ -158,7 +160,7 @@ static void UpdateFlowStats(
         hStat.u.flowData_v0.clear = clear_stats;
         hStat.u.flowData_v0.adapterNo = adapter;
         if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+            NAPATECH_ERROR(status);
             exit(1);
         }
         programed = hStat.u.flowData_v0.learnDone;
@@ -233,7 +235,7 @@ static uint16_t TestStreamConfig(
         stat.u.usageData_v0.streamid = (uint8_t) stream_config[inst].stream_id;
 
         if ((status = NT_StatRead(hstat_stream, &stat)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+            NAPATECH_ERROR(status);
             return 0;
         }
 
@@ -292,7 +294,7 @@ static uint32_t UpdateStreamStats(ThreadVars *tv,
     /* Query the system to get the number of streams currently instantiated */
     hStreamInfo.cmd = NT_INFO_CMD_READ_STREAM;
     if ((status = NT_InfoRead(hInfo, &hStreamInfo)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -322,7 +324,7 @@ static uint32_t UpdateStreamStats(ThreadVars *tv,
         hStat.u.usageData_v0.streamid = (uint8_t) stream_config[inst_id].stream_id;
 
         if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+            NAPATECH_ERROR(status);
             return 0;
         }
 
@@ -406,7 +408,7 @@ static uint32_t UpdateStreamStats(ThreadVars *tv,
             SCLogInfo("Statistics timed out - will retry next time.");
             return 0;
         } else {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+            NAPATECH_ERROR(status);
             return 0;
         }
     }
@@ -497,12 +499,12 @@ static void *NapatechStatsLoop(void *arg)
 
     /* Open the info and Statistics */
     if ((status = NT_InfoOpen(&hInfo, "StatsLoopInfoStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return NULL;
     }
 
     if ((status = NT_StatOpen(&hstat_stream, "StatsLoopStatsStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return NULL;
     }
 
@@ -518,7 +520,7 @@ static void *NapatechStatsLoop(void *arg)
 #endif /* !NAPATECH_ENABLE_BYPASS */
 
     if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return 0;
     }
 
@@ -555,8 +557,7 @@ static void *NapatechStatsLoop(void *arg)
         for (int i = 0; i < stream_cnt; ++i) {
             char *pkts_buf = SCCalloc(1, 32);
             if (unlikely(pkts_buf == NULL)) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Failed to allocate memory for NAPATECH stream counter.");
+                FatalError("Failed to allocate memory for NAPATECH stream counter.");
             }
 
             snprintf(pkts_buf, 32, "napa%d.pkts", stream_config[i].stream_id);
@@ -564,24 +565,21 @@ static void *NapatechStatsLoop(void *arg)
 
             char *byte_buf = SCCalloc(1, 32);
             if (unlikely(byte_buf == NULL)) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Failed to allocate memory for NAPATECH stream counter.");
+                FatalError("Failed to allocate memory for NAPATECH stream counter.");
             }
             snprintf(byte_buf, 32, "napa%d.bytes", stream_config[i].stream_id);
             stream_counters[i].byte = StatsRegisterCounter(byte_buf, tv);
 
             char *drop_pkts_buf = SCCalloc(1, 32);
             if (unlikely(drop_pkts_buf == NULL)) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Failed to allocate memory for NAPATECH stream counter.");
+                FatalError("Failed to allocate memory for NAPATECH stream counter.");
             }
             snprintf(drop_pkts_buf, 32, "napa%d.drop_pkts", stream_config[i].stream_id);
             stream_counters[i].drop_pkts = StatsRegisterCounter(drop_pkts_buf, tv);
 
             char *drop_byte_buf = SCCalloc(1, 32);
             if (unlikely(drop_byte_buf == NULL)) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Failed to allocate memory for NAPATECH stream counter.");
+                FatalError("Failed to allocate memory for NAPATECH stream counter.");
             }
             snprintf(drop_byte_buf, 32, "napa%d.drop_byte", stream_config[i].stream_id);
             stream_counters[i].drop_byte = StatsRegisterCounter(drop_byte_buf, tv);
@@ -640,8 +638,8 @@ static void *NapatechStatsLoop(void *arg)
 
     if (!NapatechIsAutoConfigEnabled() && (num_active < stream_cnt)) {
         SCLogInfo("num_active: %d,  stream_cnt: %d", num_active, stream_cnt);
-        SCLogWarning(SC_ERR_NAPATECH_CONFIG_STREAM,
-                "Some or all of the configured streams are not created.  Proceeding with active streams.");
+        SCLogWarning("Some or all of the configured streams are not created.  Proceeding with "
+                     "active streams.");
     }
 
     TmThreadsSetFlag(tv, THV_INIT_DONE);
@@ -669,13 +667,13 @@ static void *NapatechStatsLoop(void *arg)
 
     /* CLEAN UP NT Resources and Close the info stream */
     if ((status = NT_InfoClose(hInfo)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return NULL;
     }
 
     /* Close the statistics stream */
     if ((status = NT_StatClose(hstat_stream)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return NULL;
     }
 
@@ -748,36 +746,31 @@ static uint32_t CountWorkerThreads(void)
                     if (strncmp(lnode->val, "all", 4) == 0) {
                         /* check that the sting in the config file is correctly specified */
                         if (cpu_spec != CONFIG_SPECIFIER_UNDEFINED) {
-                                    FatalError(SC_ERR_FATAL,
-                                               "Only one Napatech port specifier type allowed.");
+                            FatalError("Only one Napatech port specifier type allowed.");
                         }
                         cpu_spec = CONFIG_SPECIFIER_RANGE;
                         worker_count = UtilCpuGetNumProcessorsConfigured();
                     } else if ((end_str = strchr(lnode->val, '-'))) {
                         /* check that the sting in the config file is correctly specified */
                         if (cpu_spec != CONFIG_SPECIFIER_UNDEFINED) {
-                                    FatalError(SC_ERR_FATAL,
-                                               "Only one Napatech port specifier type allowed.");
+                            FatalError("Only one Napatech port specifier type allowed.");
                         }
                         cpu_spec = CONFIG_SPECIFIER_RANGE;
 
 
                         if (StringParseUint8(&start, 10, end_str - lnode->val, (const char *)lnode->val) < 0) {
-                            FatalError(SC_EINVAL,
-                                    "Napatech invalid"
-                                    " worker range start: '%s'",
+                            FatalError("Napatech invalid"
+                                       " worker range start: '%s'",
                                     lnode->val);
                         }
                         if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
-                            FatalError(SC_EINVAL,
-                                    "Napatech invalid"
-                                    " worker range end: '%s'",
+                            FatalError("Napatech invalid"
+                                       " worker range end: '%s'",
                                     (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
                         }
                         if (end < start) {
-                            FatalError(SC_EINVAL,
-                                    "Napatech invalid"
-                                    " worker range start: '%d' is greater than end: '%d'",
+                            FatalError("Napatech invalid"
+                                       " worker range start: '%d' is greater than end: '%d'",
                                     start, end);
                         }
                         worker_count = end - start + 1;
@@ -785,8 +778,8 @@ static uint32_t CountWorkerThreads(void)
                     } else {
                         /* check that the sting in the config file is correctly specified */
                         if (cpu_spec == CONFIG_SPECIFIER_RANGE) {
-                                    FatalError(SC_ERR_FATAL,
-                                               "Napatech port range specifiers cannot be combined with individual stream specifiers.");
+                            FatalError("Napatech port range specifiers cannot be combined with "
+                                       "individual stream specifiers.");
                         }
                         cpu_spec = CONFIG_SPECIFIER_INDIVIDUAL;
                         ++worker_count;
@@ -835,19 +828,19 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
     }
 
     if ((status = NT_InfoOpen(&info_stream, "SuricataStreamInfo")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+        NAPATECH_ERROR(status);
         return -1;
     }
 
     if ((status = NT_StatOpen(&hstat_stream, "StatsStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+        NAPATECH_ERROR(status);
         return -1;
     }
 
     if (use_all_streams) {
         info.cmd = NT_INFO_CMD_READ_STREAM;
         if ((status = NT_InfoRead(info_stream, &info)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+            NAPATECH_ERROR(status);
             return -1;
         }
 
@@ -868,7 +861,7 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
             if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
                 /* Get the status code as text */
                 NT_ExplainError(status, error_buffer, sizeof (error_buffer));
-                SCLogError(SC_ERR_NAPATECH_INIT_FAILED, "NT_StatRead() failed: %s\n", error_buffer);
+                SCLogError("NT_StatRead() failed: %s\n", error_buffer);
                 return -1;
             }
 
@@ -892,10 +885,10 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
             /* When not using the default streams we need to
              * parse the array of streams from the conf */
             if ((ntstreams = ConfGetNode("napatech.streams")) == NULL) {
-                SCLogError(SC_ERR_RUNMODE, "Failed retrieving napatech.streams from Config");
+                SCLogError("Failed retrieving napatech.streams from Config");
                 if (NapatechIsAutoConfigEnabled() && (set_cpu_affinity == 0)) {
-                    SCLogError(SC_ERR_RUNMODE,
-                            "if set-cpu-affinity: no in conf then napatech.streams must be defined");
+                    SCLogError("if set-cpu-affinity: no in conf then napatech.streams must be "
+                               "defined");
                 }
                 exit(EXIT_FAILURE);
             }
@@ -909,43 +902,38 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
             {
 
                 if (stream == NULL) {
-                    SCLogError(SC_ERR_NAPATECH_INIT_FAILED, "Couldn't Parse Stream Configuration");
+                    SCLogError("Couldn't Parse Stream Configuration");
                     return -1;
                 }
 
                 char *end_str = strchr(stream->val, '-');
                 if (end_str) {
                     if (stream_spec != CONFIG_SPECIFIER_UNDEFINED) {
-                        SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG,
-                                "Only one Napatech stream range specifier allowed.");
+                        SCLogError("Only one Napatech stream range specifier allowed.");
                         return -1;
                     }
                     stream_spec = CONFIG_SPECIFIER_RANGE;
 
                     if (StringParseUint8(&start, 10, end_str - stream->val,
                                 (const char *)stream->val) < 0) {
-                        FatalError(SC_EINVAL,
-                                "Napatech invalid "
-                                "stream id start: '%s'",
+                        FatalError("Napatech invalid "
+                                   "stream id start: '%s'",
                                 stream->val);
                     }
                     if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
-                        FatalError(SC_EINVAL,
-                                "Napatech invalid "
-                                "stream id end: '%s'",
+                        FatalError("Napatech invalid "
+                                   "stream id end: '%s'",
                                 (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
                     }
                 } else {
                     if (stream_spec == CONFIG_SPECIFIER_RANGE) {
-                                FatalError(SC_ERR_FATAL,
-                                           "Napatech range and individual specifiers cannot be combined.");
+                        FatalError("Napatech range and individual specifiers cannot be combined.");
                     }
                     stream_spec = CONFIG_SPECIFIER_INDIVIDUAL;
                     if (StringParseUint8(&stream_config[instance_cnt].stream_id,
                                           10, 0, (const char *)stream->val) < 0) {
-                        FatalError(SC_EINVAL,
-                                "Napatech invalid "
-                                "stream id: '%s'",
+                        FatalError("Napatech invalid "
+                                   "stream id: '%s'",
                                 stream->val);
                     }
                     start = stream_config[instance_cnt].stream_id;
@@ -967,7 +955,7 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
                     (uint8_t) stream_config[instance_cnt].stream_id;
 
             if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-                NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+                NAPATECH_ERROR(status);
                 return -1;
             }
 
@@ -980,12 +968,12 @@ int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
 
     /* Close the statistics stream */
     if ((status = NT_StatClose(hstat_stream)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return -1;
     }
 
     if ((status = NT_InfoClose(info_stream)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         return -1;
     }
 
@@ -1016,19 +1004,19 @@ static void *NapatechBufMonitorLoop(void *arg)
 
     /* Open the info and Statistics */
     if ((status = NT_InfoOpen(&hInfo, "InfoStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
     if ((status = NT_StatOpen(&hstat_stream, "StatsStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
     /* Read the info on all streams instantiated in the system */
     hStreamInfo.cmd = NT_INFO_CMD_READ_STREAM;
     if ((status = NT_InfoRead(hInfo, &hStreamInfo)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1050,7 +1038,7 @@ static void *NapatechBufMonitorLoop(void *arg)
         /* Read the info on all streams instantiated in the system */
         hStreamInfo.cmd = NT_INFO_CMD_READ_STREAM;
         if ((status = NT_InfoRead(hInfo, &hStreamInfo)) != NT_SUCCESS) {
-            NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+            NAPATECH_ERROR(status);
             exit(EXIT_FAILURE);
         }
 
@@ -1070,7 +1058,7 @@ static void *NapatechBufMonitorLoop(void *arg)
                 hStat.u.usageData_v0.streamid = (uint8_t) stream_id;
 
                 if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-                    NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+                    NAPATECH_ERROR(status);
                     exit(EXIT_FAILURE);
                 }
 
@@ -1174,13 +1162,13 @@ static void *NapatechBufMonitorLoop(void *arg)
     }
 
     if ((status = NT_InfoClose(hInfo)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
     /* Close the statistics stream */
     if ((status = NT_StatClose(hstat_stream)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1202,13 +1190,11 @@ void NapatechStartStats(void)
             "custom", NapatechStatsLoop, 0);
 
     if (stats_tv == NULL) {
-                FatalError(SC_ERR_FATAL,
-                           "Error creating a thread for NapatechStats - Killing engine.");
+        FatalError("Error creating a thread for NapatechStats - Killing engine.");
     }
 
     if (TmThreadSpawn(stats_tv) != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Failed to spawn thread for NapatechStats - Killing engine.");
+        FatalError("Failed to spawn thread for NapatechStats - Killing engine.");
     }
 
 #ifdef NAPATECH_ENABLE_BYPASS
@@ -1223,13 +1209,11 @@ void NapatechStartStats(void)
             "custom", NapatechBufMonitorLoop, 0);
 
     if (buf_monitor_tv == NULL) {
-                FatalError(SC_ERR_FATAL,
-                           "Error creating a thread for NapatechBufMonitor - Killing engine.");
+        FatalError("Error creating a thread for NapatechBufMonitor - Killing engine.");
     }
 
     if (TmThreadSpawn(buf_monitor_tv) != 0) {
-                FatalError(SC_ERR_FATAL,
-                           "Failed to spawn thread for NapatechBufMonitor - Killing engine.");
+        FatalError("Failed to spawn thread for NapatechBufMonitor - Killing engine.");
     }
 
 
@@ -1247,7 +1231,7 @@ bool NapatechSetupNuma(uint32_t stream, uint32_t numa)
     NtNtplInfo_t ntpl_info;
 
     if ((status = NT_ConfigOpen(&hconfig, "ConfigStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+        NAPATECH_ERROR(status);
         return false;
     }
 
@@ -1279,7 +1263,7 @@ static uint32_t NapatechSetHashmode(void)
 
     /* Issue the NTPL command */
     if ((status = NT_ConfigOpen(&hconfig, "ConfigStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+        NAPATECH_ERROR(status);
         return false;
     }
 
@@ -1305,7 +1289,7 @@ static uint32_t GetStreamNUMAs(uint32_t stream_id, int stream_numas[])
         stream_numas[i] = -1;
 
     if ((status = NT_StatOpen(&hstat_stream, "StatsStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1318,7 +1302,7 @@ static uint32_t GetStreamNUMAs(uint32_t stream_id, int stream_numas[])
     hStat.u.usageData_v0.streamid = (uint8_t) stream_id;
 
     if ((status = NT_StatRead(hstat_stream, &hStat)) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1355,7 +1339,7 @@ uint32_t NapatechDeleteFilters(void)
     NtNtplInfo_t ntpl_info;
 
     if ((status = NT_ConfigOpen(&hconfig, "ConfigStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1407,7 +1391,7 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
     NapatechSetHashmode();
 
     if ((status = NT_ConfigOpen(&hconfig, "ConfigStream")) != NT_SUCCESS) {
-        NAPATECH_ERROR(SC_ERR_NAPATECH_INIT_FAILED, status);
+        NAPATECH_ERROR(status);
         exit(EXIT_FAILURE);
     }
 
@@ -1448,7 +1432,7 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
      * the array of streams from the conf
      */
     if ((ntports = ConfGetNode("napatech.ports")) == NULL) {
-        FatalError(SC_ERR_FATAL, "Failed retrieving napatech.ports from Conf");
+        FatalError("Failed retrieving napatech.ports from Conf");
     }
 
     /* Loop through all ports in the array */
@@ -1462,8 +1446,7 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
     TAILQ_FOREACH(port, &ntports->head, next)
     {
         if (port == NULL) {
-                    FatalError(SC_ERR_FATAL,
-                               "Couldn't Parse Port Configuration");
+            FatalError("Couldn't Parse Port Configuration");
         }
 
         if (NapatechUseHWBypass()) {
@@ -1476,8 +1459,8 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
 
                 if (ports_spec.first[iteration] == ports_spec.second[iteration]) {
                     if (is_inline) {
-                                FatalError(SC_ERR_FATAL,
-                                           "Error with napatec.ports in conf file.  When running in inline mode the two ports specifying a segment must be different.");
+                        FatalError("Error with napatec.ports in conf file.  When running in inline "
+                                   "mode the two ports specifying a segment must be different.");
                     } else {
                         /* SPAN port configuration */
                         is_span_port[ports_spec.first[iteration]] = 1;
@@ -1494,15 +1477,13 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
                 }
 
                 if (NapatechGetAdapter(ports_spec.first[iteration]) != NapatechGetAdapter(ports_spec.first[iteration])) {
-                    SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG,
-                            "Invalid napatech.ports specification in conf file.");
-                    SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG,
-                            "Two ports on a segment must reside on the same adapter.  port %d is on adapter %d, port %d is on adapter %d.",
+                    SCLogError("Invalid napatech.ports specification in conf file.");
+                    SCLogError("Two ports on a segment must reside on the same adapter.  port %d "
+                               "is on adapter %d, port %d is on adapter %d.",
                             ports_spec.first[iteration],
                             NapatechGetAdapter(ports_spec.first[iteration]),
                             ports_spec.second[iteration],
-                            NapatechGetAdapter(ports_spec.second[iteration])
-                            );
+                            NapatechGetAdapter(ports_spec.second[iteration]));
                     exit(EXIT_FAILURE);
                 }
 
@@ -1529,16 +1510,15 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
                     strlcat(ports_spec.str, temp, sizeof(ports_spec.str));
                 }
             } else {
-                        FatalError(SC_ERR_FATAL,
-                                   "When using hardware flow bypass ports must be specified as segments. E.g. ports: [0-1, 0-2]");
+                FatalError("When using hardware flow bypass ports must be specified as segments. "
+                           "E.g. ports: [0-1, 0-2]");
             }
 #endif
         } else { // !NapatechUseHWBypass()
             if (strncmp(port->val, "all", 3) == 0) {
                 /* check that the sting in the config file is correctly specified */
                 if (stream_spec != CONFIG_SPECIFIER_UNDEFINED) {
-                            FatalError(SC_ERR_FATAL,
-                                       "Only one Napatech port specifier type is allowed.");
+                    FatalError("Only one Napatech port specifier type is allowed.");
                 }
                 stream_spec = CONFIG_SPECIFIER_RANGE;
 
@@ -1547,8 +1527,8 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
             } else if (strchr(port->val, '-')) {
                 /* check that the sting in the config file is correctly specified */
                 if (stream_spec != CONFIG_SPECIFIER_UNDEFINED) {
-                            FatalError(SC_ERR_FATAL,
-                                       "Only one Napatech port specifier is allowed when hardware bypass is disabled. (E.g. ports: [0-4], NOT ports: [0-1,2-3])");
+                    FatalError("Only one Napatech port specifier is allowed when hardware bypass "
+                               "is disabled. (E.g. ports: [0-4], NOT ports: [0-1,2-3])");
                 }
                 stream_spec = CONFIG_SPECIFIER_RANGE;
 
@@ -1558,8 +1538,8 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
             } else {
                 /* check that the sting in the config file is correctly specified */
                 if (stream_spec == CONFIG_SPECIFIER_RANGE) {
-                            FatalError(SC_ERR_FATAL,
-                                       "Napatech port range specifiers cannot be combined with individual stream specifiers.");
+                    FatalError("Napatech port range specifiers cannot be combined with individual "
+                               "stream specifiers.");
                 }
                 stream_spec = CONFIG_SPECIFIER_INDIVIDUAL;
 
@@ -1809,8 +1789,7 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
         }
     } else {
         if (is_inline) {
-                    FatalError(SC_ERR_FATAL,
-                               "Napatech Inline operation not supported by this FPGA version.");
+            FatalError("Napatech Inline operation not supported by this FPGA version.");
         }
 
         if (NapatechIsAutoConfigEnabled()){
index 7937bd80e1d03c77fef0b729af87fd366aa56f07..45d4ddf6789db3a2c90a50f5a0be2142094385c6 100644 (file)
@@ -62,29 +62,26 @@ typedef struct NapatechCurrentStats_
 
 extern void NapatechStartStats(void);
 
-#define NAPATECH_ERROR(err_type, status) {  \
-    char errorBuffer[1024]; \
-    NT_ExplainError((status), errorBuffer, sizeof (errorBuffer) - 1); \
-    SCLogError((err_type), "Napatech Error: %s", errorBuffer);   \
+#define NAPATECH_ERROR(status)                                                                     \
+    {                                                                                              \
+        char errorBuffer[1024];                                                                    \
+        NT_ExplainError((status), errorBuffer, sizeof(errorBuffer) - 1);                           \
+        SCLogError("Napatech Error: %s", errorBuffer);                                             \
     }
 
-#define NAPATECH_NTPL_ERROR(ntpl_cmd, ntpl_info, status) { \
-    char errorBuffer[1024]; \
-    NT_ExplainError(status, errorBuffer, sizeof (errorBuffer) - 1); \
-    SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
-               "     NTPL failed: %s", errorBuffer); \
-    SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
-               "         cmd: %s", ntpl_cmd); \
-    if (strncmp(ntpl_info.u.errorData.errBuffer[0], "", 256) != 0) \
-        SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
-                   "         %s", ntpl_info.u.errorData.errBuffer[0]); \
-    if (strncmp(ntpl_info.u.errorData.errBuffer[1], "", 256) != 0) \
-        SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
-                   "         %s", ntpl_info.u.errorData.errBuffer[1]); \
-    if (strncmp(ntpl_info.u.errorData.errBuffer[2], "", 256) != 0) \
-        SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
-                   "         %s", ntpl_info.u.errorData.errBuffer[2]); \
-}
+#define NAPATECH_NTPL_ERROR(ntpl_cmd, ntpl_info, status)                                           \
+    {                                                                                              \
+        char errorBuffer[1024];                                                                    \
+        NT_ExplainError(status, errorBuffer, sizeof(errorBuffer) - 1);                             \
+        SCLogError("     NTPL failed: %s", errorBuffer);                                           \
+        SCLogError("         cmd: %s", ntpl_cmd);                                                  \
+        if (strncmp(ntpl_info.u.errorData.errBuffer[0], "", 256) != 0)                             \
+            SCLogError("         %s", ntpl_info.u.errorData.errBuffer[0]);                         \
+        if (strncmp(ntpl_info.u.errorData.errBuffer[1], "", 256) != 0)                             \
+            SCLogError("         %s", ntpl_info.u.errorData.errBuffer[1]);                         \
+        if (strncmp(ntpl_info.u.errorData.errBuffer[2], "", 256) != 0)                             \
+            SCLogError("         %s", ntpl_info.u.errorData.errBuffer[2]);                         \
+    }
 
 // #define ENABLE_NT_DEBUG
 #ifdef ENABLE_NT_DEBUG
index d2aff4a668af674144f7a6fd78bc48d50755f62f..ad78f4f67866790609c62dfea1c974b84e42fd10 100644 (file)
@@ -89,12 +89,12 @@ TmEcode PathJoin (char *out_buf, uint16_t buf_len, const char *const dir, const
     uint16_t max_path_len = MAX(buf_len, PATH_MAX);
     int bytes_written = snprintf(out_buf, max_path_len, "%s%c%s", dir, DIRECTORY_SEPARATOR, fname);
     if (bytes_written <= 0) {
-        SCLogError(SC_ERR_SPRINTF, "Could not join filename to path");
+        SCLogError("Could not join filename to path");
         SCReturnInt(TM_ECODE_FAILED);
     }
     char *tmp_buf = SCRealPath(out_buf, NULL);
     if (tmp_buf == NULL) {
-        SCLogError(SC_ERR_SPRINTF, "Error resolving path: %s", strerror(errno));
+        SCLogError("Error resolving path: %s", strerror(errno));
         SCReturnInt(TM_ECODE_FAILED);
     }
     memset(out_buf, 0, buf_len);
index 9642fe8cf779ecce42a33c61c0cfb74541c357d9..1cbae0eb7a5d9e3829e70580cefb8e3a7f7b59bf 100644 (file)
@@ -48,26 +48,25 @@ int SCPidfileCreate(const char *pidfile)
 
     size_t len = snprintf(val, sizeof(val), "%"PRIuMAX"\n", (uintmax_t)getpid());
     if (len <= 0) {
-        SCLogError(SC_ERR_PIDFILE_SNPRINTF, "Pid error (%s)", strerror(errno));
+        SCLogError("Pid error (%s)", strerror(errno));
         SCReturnInt(-1);
     }
 
     pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644);
     if (pidfd < 0) {
-        SCLogError(SC_ERR_PIDFILE_OPEN, "unable to set pidfile '%s': %s",
-                   pidfile,
-                   strerror(errno));
+        SCLogError("unable to set pidfile '%s': %s", pidfile, strerror(errno));
         SCReturnInt(-1);
     }
 
     ssize_t r = write(pidfd, val, (unsigned int)len);
     if (r == -1) {
-        SCLogError(SC_ERR_PIDFILE_WRITE, "unable to write pidfile: %s", strerror(errno));
+        SCLogError("unable to write pidfile: %s", strerror(errno));
         close(pidfd);
         SCReturnInt(-1);
     } else if ((size_t)r != len) {
-        SCLogError(SC_ERR_PIDFILE_WRITE, "unable to write pidfile: wrote"
-                " %"PRIdMAX" of %"PRIuMAX" bytes.", (intmax_t)r, (uintmax_t)len);
+        SCLogError("unable to write pidfile: wrote"
+                   " %" PRIdMAX " of %" PRIuMAX " bytes.",
+                (intmax_t)r, (uintmax_t)len);
         close(pidfd);
         SCReturnInt(-1);
     }
@@ -111,8 +110,7 @@ int SCPidfileTestRunning(const char *pid_filename)
     pf = fopen(pid_filename, "r");
     if (pf == NULL) {
         if (access(pid_filename, F_OK) == 0) {
-            SCLogError(SC_ERR_INITIALIZATION, "pid file '%s' exists and can not be read. Aborting!",
-                    pid_filename);
+            SCLogError("pid file '%s' exists and can not be read. Aborting!", pid_filename);
             return -1;
         } else {
             return 0;
@@ -122,17 +120,15 @@ int SCPidfileTestRunning(const char *pid_filename)
 #ifndef OS_WIN32
     pid_t pidv;
     if (fscanf(pf, "%d", &pidv) == 1 && kill(pidv, 0) == 0) {
-        SCLogError(SC_ERR_INITIALIZATION,
-                "pid file '%s' exists and Suricata appears to be running. "
-                "Aborting!",
+        SCLogError("pid file '%s' exists and Suricata appears to be running. "
+                   "Aborting!",
                 pid_filename);
     } else
 #endif
     {
-        SCLogError(SC_ERR_INITIALIZATION,
-                "pid file '%s' exists but appears stale. "
-                "Make sure Suricata is not running and then remove %s. "
-                "Aborting!",
+        SCLogError("pid file '%s' exists but appears stale. "
+                   "Make sure Suricata is not running and then remove %s. "
+                   "Aborting!",
                 pid_filename, pid_filename);
     }
 
index f2e5e4a1cfd51bca46ee7d9490bbc5e6042236c5..3a08aa8876ad2a48fc9ca50c81e7e89b4d5ae6b1 100644 (file)
@@ -54,7 +54,7 @@ bool RegisterPlugin(SCPlugin *plugin, void *lib)
 
     PluginListNode *node = SCCalloc(1, sizeof(*node));
     if (node == NULL) {
-        SCLogError(SC_ENOMEM, "Failed to allocate memory for plugin");
+        SCLogError("Failed to allocate memory for plugin");
         return false;
     }
     node->plugin = plugin;
@@ -76,13 +76,13 @@ static void InitPlugin(char *path)
 
         SCPluginRegisterFunc plugin_register = dlsym(lib, "SCPluginRegister");
         if (plugin_register == NULL) {
-            SCLogError(SC_ERR_PLUGIN, "Plugin does not export SCPluginRegister function: %s", path);
+            SCLogError("Plugin does not export SCPluginRegister function: %s", path);
             dlclose(lib);
             return;
         }
 
         if (!RegisterPlugin(plugin_register(), lib)) {
-            SCLogError(SC_ERR_PLUGIN, "Plugin registration failed: %s", path);
+            SCLogError("Plugin registration failed: %s", path);
             dlclose(lib);
             return;
         }
@@ -99,16 +99,14 @@ void SCPluginsLoad(const char *capture_plugin_name, const char *capture_plugin_a
     TAILQ_FOREACH(plugin, &conf->head, next) {
         struct stat statbuf;
         if (stat(plugin->val, &statbuf) == -1) {
-            SCLogError(SC_ERR_STAT, "Bad plugin path: %s: %s",
-                plugin->val, strerror(errno));
+            SCLogError("Bad plugin path: %s: %s", plugin->val, strerror(errno));
             continue;
         }
         if (S_ISDIR(statbuf.st_mode)) {
             // coverity[toctou : FALSE]
             DIR *dir = opendir(plugin->val);
             if (dir == NULL) {
-                SCLogError(SC_ERR_DIR_OPEN, "Failed to open plugin directory %s: %s",
-                    plugin->val, strerror(errno));
+                SCLogError("Failed to open plugin directory %s: %s", plugin->val, strerror(errno));
                 continue;
             }
             struct dirent *entry = NULL;
@@ -128,8 +126,7 @@ void SCPluginsLoad(const char *capture_plugin_name, const char *capture_plugin_a
     if (run_mode == RUNMODE_PLUGIN) {
         SCCapturePlugin *capture = SCPluginFindCaptureByName(capture_plugin_name);
         if (capture == NULL) {
-            FatalError(SC_ERR_PLUGIN, "No capture plugin found with name %s",
-                    capture_plugin_name);
+            FatalError("No capture plugin found with name %s", capture_plugin_name);
         }
         capture->Init(capture_plugin_args, RUNMODE_PLUGIN, TMM_RECEIVEPLUGIN,
                 TMM_DECODEPLUGIN);
@@ -167,8 +164,7 @@ bool SCRegisterEveFileType(SCEveFileType *plugin)
 {
     /* First check that the name doesn't conflict with a built-in filetype. */
     if (IsBuiltinTypeName(plugin->name)) {
-        SCLogError(SC_ERR_LOG_OUTPUT, "Eve file type name conflicts with built-in type: %s",
-                plugin->name);
+        SCLogError("Eve file type name conflicts with built-in type: %s", plugin->name);
         return false;
     }
 
@@ -176,8 +172,7 @@ bool SCRegisterEveFileType(SCEveFileType *plugin)
     SCEveFileType *existing = NULL;
     TAILQ_FOREACH (existing, &output_types, entries) {
         if (strcmp(existing->name, plugin->name) == 0) {
-            SCLogError(SC_ERR_LOG_OUTPUT,
-                    "Eve file type name conflicts with previously registered type: %s",
+            SCLogError("Eve file type name conflicts with previously registered type: %s",
                     plugin->name);
             return false;
         }
index 5b19a0d5dbae3d72ccb46d4e55b0c6c8a771923a..162b523fce9ed667eab91469839c4ba2dad7f38d 100644 (file)
@@ -97,7 +97,7 @@ error:
 int PoolThreadExpand(PoolThread *pt)
 {
     if (pt == NULL || pt->array == NULL || pt->size == 0) {
-        SCLogError(SC_EINVAL, "pool grow failed");
+        SCLogError("pool grow failed");
         return -1;
     }
 
@@ -108,7 +108,7 @@ int PoolThreadExpand(PoolThread *pt)
     if (ptmp == NULL) {
         SCFree(pt->array);
         pt->array = NULL;
-        SCLogError(SC_EINVAL, "pool grow failed");
+        SCLogError("pool grow failed");
         return -1;
     }
     pt->array = ptmp;
@@ -138,7 +138,7 @@ int PoolThreadExpand(PoolThread *pt)
             settings.Cleanup, settings.Free);
     SCMutexUnlock(&e->lock);
     if (e->pool == NULL) {
-        SCLogError(SC_EINVAL, "pool grow failed");
+        SCLogError("pool grow failed");
         return -1;
     }
 
index dd81be1cf3c1008d9cb57e921e58fc967d1b6042..c00aa6528c64ea8ff590095ca1a58e1aab429000 100644 (file)
@@ -83,8 +83,8 @@ PrefilterAddSidsResize(PrefilterRuleStore *pmq, uint32_t new_size)
                                          new_size * sizeof(SigIntId));
         if (unlikely(new_array == NULL)) {
 
-            SCLogError(SC_ENOMEM, "Failed to realloc PatternMatchQueue"
-                                  " rule ID array. Some signature ID matches lost");
+            SCLogError("Failed to realloc PatternMatchQueue"
+                       " rule ID array. Some signature ID matches lost");
             return 0;
         }
     }
index 47a9bec1b3b8c9b220d6c7c34fb5e676958b4641..94444a61102caad8e140772ae5fc55c6641cbd4a 100644 (file)
@@ -257,7 +257,7 @@ static const char *PrintInetIPv6(const void *src, char *dst, socklen_t size)
 
     /* current IPv6 format is fixed size */
     if (size < 8 * 5) {
-        SCLogWarning(SC_ERR_ARG_LEN_LONG, "Too small buffer to write IPv6 address");
+        SCLogWarning("Too small buffer to write IPv6 address");
         return NULL;
     }
     memset(dst, 0, size);
@@ -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_EINVAL, "Unsupported protocol: %d", af);
+            SCLogError("Unsupported protocol: %d", af);
     }
     return NULL;
 }
index c1086549c192c782b24545ca29fea1e4b809379a..386c059ce20fd05a6e5ba292202e99af14482d7a 100644 (file)
@@ -86,7 +86,7 @@ void SCDropMainThreadCaps(uint32_t userid, uint32_t groupid)
     if (capng_change_id(userid, groupid, CAPNG_DROP_SUPP_GRP |
             CAPNG_CLEAR_BOUNDING) < 0)
     {
-        FatalError(SC_ERR_FATAL, "capng_change_id for main thread"
+        FatalError("capng_change_id for main thread"
                    " failed");
     }
 
@@ -156,17 +156,17 @@ int SCGetUserID(const char *user_name, const char *group_name, uint32_t *uid, ui
     /* Get the user ID */
     if (isdigit((unsigned char)user_name[0]) != 0) {
         if (ByteExtractStringUint32(&userid, 10, 0, (const char *)user_name) < 0) {
-            FatalError(SC_ERR_UID_FAILED, "invalid user id value: '%s'", user_name);
+            FatalError("invalid user id value: '%s'", user_name);
         }
         pw = getpwuid(userid);
        if (pw == NULL) {
-            FatalError(SC_ERR_FATAL, "unable to get the user ID, "
-                       "check if user exist!!");
+           FatalError("unable to get the user ID, "
+                      "check if user exist!!");
         }
     } else {
         pw = getpwnam(user_name);
         if (pw == NULL) {
-            FatalError(SC_ERR_FATAL, "unable to get the user ID, "
+            FatalError("unable to get the user ID, "
                        "check if user exist!!");
         }
         userid = pw->pw_uid;
@@ -178,12 +178,12 @@ int SCGetUserID(const char *user_name, const char *group_name, uint32_t *uid, ui
 
         if (isdigit((unsigned char)group_name[0]) != 0) {
             if (ByteExtractStringUint32(&groupid, 10, 0, (const char *)group_name) < 0) {
-                FatalError(SC_ERR_GID_FAILED, "invalid group id: '%s'", group_name);
+                FatalError("invalid group id: '%s'", group_name);
             }
         } else {
             gp = getgrnam(group_name);
             if (gp == NULL) {
-                FatalError(SC_ERR_FATAL, "unable to get the group"
+                FatalError("unable to get the group"
                            " ID, check if group exist!!");
             }
             groupid = gp->gr_gid;
@@ -219,12 +219,12 @@ int SCGetGroupID(const char *group_name, uint32_t *gid)
     /* Get the group ID */
     if (isdigit((unsigned char)group_name[0]) != 0) {
         if (ByteExtractStringUint32(&grpid, 10, 0, (const char *)group_name) < 0) {
-            FatalError(SC_ERR_GID_FAILED, "invalid group id: '%s'", group_name);
+            FatalError("invalid group id: '%s'", group_name);
         }
     } else {
         gp = getgrnam(group_name);
         if (gp == NULL) {
-            FatalError(SC_ERR_FATAL, "unable to get the group ID,"
+            FatalError("unable to get the group ID,"
                        " check if group exist!!");
         }
         grpid = gp->gr_gid;
@@ -244,8 +244,9 @@ int SCPledge(void)
     int ret = pledge("stdio rpath wpath cpath fattr unix dns bpf", NULL);
 
     if (ret != 0) {
-        SCLogError(SC_ERR_PLEDGE_FAILED, "unable to pledge,"
-                " check permissions!! ret=%i errno=%i", ret, errno);
+        SCLogError("unable to pledge,"
+                   " check permissions!! ret=%i errno=%i",
+                ret, errno);
         exit(EXIT_FAILURE);
     }
 
index 03f4d0243dc901a3b993a3b2a6d4c1246170c60a..b21eb433e7985455b86dd8454340d875bc3a7880 100644 (file)
@@ -159,8 +159,7 @@ SCProfilingKeywordDump(DetectEngineCtx *de_ctx)
         fp = fopen(profiling_file_name, profiling_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", profiling_file_name,
-                    strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_file_name, strerror(errno));
             return;
         }
     } else {
@@ -247,8 +246,7 @@ static SCProfileKeywordDetectCtx *SCProfilingKeywordInitCtx(void)
         memset(ctx, 0x00, sizeof(SCProfileKeywordDetectCtx));
 
         if (pthread_mutex_init(&ctx->data_m, NULL) != 0) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to initialize hash table mutex.");
+            FatalError("Failed to initialize hash table mutex.");
         }
     }
 
index a50570f74662f4a836de1c59d3f240be40f79fa2..c54e834cc4158d2a3560321fcfb104d1bd5bd458 100644 (file)
@@ -163,8 +163,7 @@ static void SCProfilingListLocks(void)
         fp = fopen(profiling_locks_file_name, profiling_locks_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s",
-                    profiling_locks_file_name, strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_locks_file_name, strerror(errno));
             return;
         }
     } else {
index 526cc2c873693b0c18d23295f0d77c3e3959e5fa..861079a101b95fa507193089d0a84099996d9578 100644 (file)
@@ -157,8 +157,7 @@ SCProfilingPrefilterDump(DetectEngineCtx *de_ctx)
         fp = fopen(profiling_file_name, profiling_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", profiling_file_name,
-                    strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_file_name, strerror(errno));
             return;
         }
     } else {
@@ -216,8 +215,7 @@ static SCProfilePrefilterDetectCtx *SCProfilingPrefilterInitCtx(void)
         memset(ctx, 0x00, sizeof(SCProfilePrefilterDetectCtx));
 
         if (pthread_mutex_init(&ctx->data_m, NULL) != 0) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to initialize hash table mutex.");
+            FatalError("Failed to initialize hash table mutex.");
         }
     }
 
index d1d03962c97fa323412df2f443fcf83aaa274722..90dd5372a1961c22a010b3dfbf2daeeb2a48b416 100644 (file)
@@ -228,8 +228,7 @@ SCProfilingSghDump(DetectEngineCtx *de_ctx)
         fp = fopen(profiling_file_name, profiling_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", profiling_file_name,
-                    strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_file_name, strerror(errno));
             return;
         }
     } else {
@@ -282,7 +281,7 @@ static SCProfileSghDetectCtx *SCProfilingSghInitCtx(void)
     SCProfileSghDetectCtx *ctx = SCCalloc(1, sizeof(SCProfileSghDetectCtx));
     if (ctx != NULL) {
         if (pthread_mutex_init(&ctx->data_m, NULL) != 0) {
-                    FatalError(SC_ERR_FATAL, "Failed to initialize mutex.");
+            FatalError("Failed to initialize mutex.");
         }
     }
 
index 3b00d8d95e38de9667afabce9ab30acc2ae01ee5..e32e0d01310369742c53c6d16d73d3356057626d 100644 (file)
@@ -144,8 +144,7 @@ void SCProfilingRulesGlobalInit(void)
                     SET_ONE(SC_PROFILING_RULES_SORT_BY_MAX_TICKS);
                 }
                 else {
-                    SCLogError(SC_ERR_INVALID_ARGUMENT,
-                            "Invalid profiling sort order: %s", val);
+                    SCLogError("Invalid profiling sort order: %s", val);
                     exit(EXIT_FAILURE);
                 }
             }
@@ -154,7 +153,7 @@ void SCProfilingRulesGlobalInit(void)
             if (val != NULL) {
                 if (StringParseUint32(&profiling_rules_limit, 10,
                             (uint16_t)strlen(val), val) <= 0) {
-                    SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid limit: %s", val);
+                    SCLogError("Invalid limit: %s", val);
                     exit(EXIT_FAILURE);
                 }
             }
@@ -425,8 +424,7 @@ SCProfilingRuleDump(SCProfileDetectCtx *rules_ctx)
         fp = fopen(profiling_file_name, profiling_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", profiling_file_name,
-                    strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_file_name, strerror(errno));
             return;
         }
     } else {
@@ -436,7 +434,7 @@ SCProfilingRuleDump(SCProfileDetectCtx *rules_ctx)
     int summary_size = sizeof(SCProfileSummary) * rules_ctx->size;
     SCProfileSummary *summary = SCMalloc(summary_size);
     if (unlikely(summary == NULL)) {
-        SCLogError(SC_ENOMEM, "Error allocating memory for profiling summary");
+        SCLogError("Error allocating memory for profiling summary");
         return;
     }
 
@@ -571,8 +569,7 @@ static SCProfileDetectCtx *SCProfilingRuleInitCtx(void)
         memset(ctx, 0x00, sizeof(SCProfileDetectCtx));
 
         if (pthread_mutex_init(&ctx->data_m, NULL) != 0) {
-                    FatalError(SC_ERR_FATAL,
-                               "Failed to initialize hash table mutex.");
+            FatalError("Failed to initialize hash table mutex.");
         }
     }
 
index aadbe66ac5501ca0a0e20d2c9d51a4016b055174..5f162da9c51385a33496bf2fce01279c7130fe47 100644 (file)
@@ -154,8 +154,7 @@ SCProfilingInit(void)
             profiling_packets_enabled = 1;
 
             if (pthread_mutex_init(&packet_profile_lock, NULL) != 0) {
-                        FatalError(SC_ERR_FATAL,
-                                   "Failed to initialize packet profiling mutex.");
+                FatalError("Failed to initialize packet profiling mutex.");
             }
             memset(&packet_profile_data4, 0, sizeof(packet_profile_data4));
             memset(&packet_profile_data6, 0, sizeof(packet_profile_data6));
@@ -202,7 +201,7 @@ SCProfilingInit(void)
 
                 profiling_csv_file_name = SCMalloc(PATH_MAX);
                 if (unlikely(profiling_csv_file_name == NULL)) {
-                    FatalError(SC_ERR_FATAL, "out of memory");
+                    FatalError("out of memory");
                 }
                 snprintf(profiling_csv_file_name, PATH_MAX, "%s/%s", log_dir, filename);
 
@@ -224,7 +223,8 @@ SCProfilingInit(void)
     if (conf != NULL) {
         if (ConfNodeChildValueIsTrue(conf, "enabled")) {
 #ifndef PROFILE_LOCKING
-            SCLogWarning(SC_WARN_PROFILE, "lock profiling not compiled in. Add --enable-profiling-locks to configure.");
+            SCLogWarning(
+                    "lock profiling not compiled in. Add --enable-profiling-locks to configure.");
 #else
             profiling_locks_enabled = 1;
 
@@ -236,7 +236,7 @@ SCProfilingInit(void)
 
                 profiling_locks_file_name = SCMalloc(PATH_MAX);
                 if (unlikely(profiling_locks_file_name == NULL)) {
-                    FatalError(SC_ERR_FATAL, "can't duplicate file name");
+                    FatalError("can't duplicate file name");
                 }
 
                 snprintf(profiling_locks_file_name, PATH_MAX, "%s/%s", log_dir, filename);
@@ -354,8 +354,7 @@ void SCProfilingDumpPacketStats(void)
         fp = fopen(profiling_packets_file_name, profiling_packets_file_mode);
 
         if (fp == NULL) {
-            SCLogError(SC_ERR_FOPEN, "failed to open %s: %s",
-                    profiling_packets_file_name, strerror(errno));
+            SCLogError("failed to open %s: %s", profiling_packets_file_name, strerror(errno));
             return;
         }
     } else {
index b54f764d3a857cd938cdc0c9b2f3596bd31bebf2..c0f745f5f71e6e6fbe70491367aede21c0205d0c 100644 (file)
@@ -40,16 +40,16 @@ void SCProfilingPrintPacketProfile(Packet *);
 void SCProfilingAddPacket(Packet *);
 int SCProfileRuleStart(Packet *p);
 
-#define RULE_PROFILING_START(p) \
-    uint64_t profile_rule_start_ = 0; \
-    uint64_t profile_rule_end_ = 0; \
-    if (profiling_rules_enabled && SCProfileRuleStart((p))) { \
-        if (profiling_rules_entered > 0) { \
-            SCLogError(SC_ERR_FATAL, "Re-entered profiling, exiting."); \
-            exit(1); \
-        } \
-        profiling_rules_entered++; \
-        profile_rule_start_ = UtilCpuGetTicks(); \
+#define RULE_PROFILING_START(p)                                                                    \
+    uint64_t profile_rule_start_ = 0;                                                              \
+    uint64_t profile_rule_end_ = 0;                                                                \
+    if (profiling_rules_enabled && SCProfileRuleStart((p))) {                                      \
+        if (profiling_rules_entered > 0) {                                                         \
+            SCLogError("Re-entered profiling, exiting.");                                          \
+            exit(1);                                                                               \
+        }                                                                                          \
+        profiling_rules_entered++;                                                                 \
+        profile_rule_start_ = UtilCpuGetTicks();                                                   \
     }
 
 #define RULE_PROFILING_END(ctx, r, m, p) \
@@ -67,16 +67,16 @@ extern thread_local int profiling_keyword_entered;
     (ctx)->keyword_perf_list = (list); \
 }
 
-#define KEYWORD_PROFILING_START \
-    uint64_t profile_keyword_start_ = 0; \
-    uint64_t profile_keyword_end_ = 0; \
-    if (profiling_keyword_enabled) { \
-        if (profiling_keyword_entered > 0) { \
-            SCLogError(SC_ERR_FATAL, "Re-entered profiling, exiting."); \
-            abort(); \
-        } \
-        profiling_keyword_entered++; \
-        profile_keyword_start_ = UtilCpuGetTicks(); \
+#define KEYWORD_PROFILING_START                                                                    \
+    uint64_t profile_keyword_start_ = 0;                                                           \
+    uint64_t profile_keyword_end_ = 0;                                                             \
+    if (profiling_keyword_enabled) {                                                               \
+        if (profiling_keyword_entered > 0) {                                                       \
+            SCLogError("Re-entered profiling, exiting.");                                          \
+            abort();                                                                               \
+        }                                                                                          \
+        profiling_keyword_entered++;                                                               \
+        profile_keyword_start_ = UtilCpuGetTicks();                                                \
     }
 
 /* we allow this macro to be called if profiling_keyword_entered == 0,
@@ -285,7 +285,7 @@ extern thread_local int profiling_prefilter_entered;
     uint64_t profile_prefilter_end_ = 0;                                                           \
     if (profiling_prefilter_enabled) {                                                             \
         if (profiling_prefilter_entered > 0) {                                                     \
-            SCLogError(SC_ERR_FATAL, "Re-entered profiling, exiting.");                            \
+            SCLogError("Re-entered profiling, exiting.");                                          \
             abort();                                                                               \
         }                                                                                          \
         profiling_prefilter_entered++;                                                             \
index b7a54ea171d04755ce04ca93fed4e8d0ee36e6d1..41423c9477d65ecbd6c6668983f4c4ed8aa489ab 100644 (file)
@@ -385,21 +385,20 @@ static void ProtoNameAddEntry(const char *proto_name, const uint8_t proto_number
 {
     ProtoNameHashEntry *proto_ent = SCCalloc(1, sizeof(ProtoNameHashEntry));
     if (!proto_ent) {
-        FatalError(SC_ERR_HASH_TABLE_INIT, "Unable to allocate protocol hash entry");
+        FatalError("Unable to allocate protocol hash entry");
     }
 
     proto_ent->name = SCStrdup(proto_name);
     if (!proto_ent->name)
-        FatalError(SC_ENOMEM, "Unable to allocate memory for protocol name entries");
+        FatalError("Unable to allocate memory for protocol name entries");
 
     proto_ent->number = proto_number;
 
     SCLogDebug("new protocol entry: name: \"%s\"; protocol number: %d", proto_ent->name,
             proto_ent->number);
     if (0 != HashTableAdd(proto_ht, proto_ent, 0)) {
-        FatalError(SC_ERR_HASH_ADD,
-                "Unable to add entry to proto hash table for "
-                "name: \"%s\"; number: %d",
+        FatalError("Unable to add entry to proto hash table for "
+                   "name: \"%s\"; number: %d",
                 proto_ent->name, proto_ent->number);
     }
     return;
@@ -421,7 +420,7 @@ void SCProtoNameInit(void)
     proto_ht =
             HashTableInit(256, ProtoNameHashFunc, ProtoNameHashCompareFunc, ProtoNameHashFreeFunc);
     if (proto_ht == NULL) {
-        FatalError(SC_ERR_HASH_TABLE_INIT, "Unable to initialize protocol name/number table");
+        FatalError("Unable to initialize protocol name/number table");
     }
 
     for (uint16_t i = 0; i < ARRAY_SIZE(known_proto); i++) {
index 0de3ef19fe1a53ed4a4d01b462999b8d679f7a33..6192bd480b2571745fb4acefccc8fedb052263af 100644 (file)
@@ -48,7 +48,7 @@ static SCRadixUserData *SCRadixAllocSCRadixUserData(uint8_t netmask, void *user)
 {
     SCRadixUserData *user_data = SCMalloc(sizeof(SCRadixUserData));
     if (unlikely(user_data == NULL)) {
-        SCLogError(SC_ENOMEM, "Error allocating memory");
+        SCLogError("Error allocating memory");
         return NULL;
     }
 
@@ -89,7 +89,7 @@ static void SCRadixAppendToSCRadixUserDataList(SCRadixUserData *new,
     SCRadixUserData *prev = NULL;
 
     if (new == NULL || list == NULL) {
-        FatalError(SC_ERR_FATAL, "new or list supplied as NULL");
+        FatalError("new or list supplied as NULL");
     }
 
     /* add to the list in descending order.  The reason we do this is for
@@ -133,13 +133,12 @@ static SCRadixPrefix *SCRadixCreatePrefix(uint8_t *key_stream,
     SCRadixPrefix *prefix = NULL;
 
     if ((key_bitlen % 8 != 0)) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Invalid argument bitlen - %d",
-                   key_bitlen);
+        SCLogError("Invalid argument bitlen - %d", key_bitlen);
         return NULL;
     }
 
     if (key_stream == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Argument \"stream\" NULL");
+        SCLogError("Argument \"stream\" NULL");
         return NULL;
     }
 
@@ -188,7 +187,7 @@ static void SCRadixAddNetmaskUserDataToPrefix(SCRadixPrefix *prefix,
                                               void *user)
 {
     if (prefix == NULL || user == NULL) {
-        FatalError(SC_ERR_FATAL, "prefix or user NULL");
+        FatalError("prefix or user NULL");
     }
 
     SCRadixAppendToSCRadixUserDataList(SCRadixAllocSCRadixUserData(netmask, user),
@@ -211,7 +210,7 @@ static void SCRadixRemoveNetmaskUserDataFromPrefix(SCRadixPrefix *prefix,
     SCRadixUserData *temp = NULL, *prev = NULL;
 
     if (prefix == NULL) {
-        FatalError(SC_ERR_FATAL, "prefix NULL");
+        FatalError("prefix NULL");
     }
 
     prev = temp = prefix->user_data;
@@ -247,7 +246,7 @@ static int SCRadixPrefixContainNetmask(SCRadixPrefix *prefix, uint8_t netmask)
     SCRadixUserData *user_data = NULL;
 
     if (prefix == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "prefix is NULL");
+        SCLogError("prefix is NULL");
         goto no_match;
     }
 
@@ -275,7 +274,7 @@ static int SCRadixPrefixNetmaskCount(SCRadixPrefix *prefix)
     uint32_t count = 0;
 
     if (prefix == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "prefix is NULL");
+        SCLogError("prefix is NULL");
         return 0;
     }
 
@@ -309,7 +308,7 @@ static int SCRadixPrefixContainNetmaskAndSetUserData(SCRadixPrefix *prefix,
     SCRadixUserData *user_data = NULL;
 
     if (prefix == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "prefix is NULL");
+        SCLogError("prefix is NULL");
         goto no_match;
     }
 
@@ -385,7 +384,7 @@ static inline SCRadixNode *SCRadixCreateNode(void)
     SCRadixNode *node = NULL;
 
     if ( (node = SCMalloc(sizeof(SCRadixNode))) == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in SCRadixCreateNode. Mem not allocated...");
+        SCLogError("Fatal error encountered in SCRadixCreateNode. Mem not allocated...");
         return NULL;
     }
     memset(node, 0, sizeof(SCRadixNode));
@@ -428,8 +427,7 @@ SCRadixTree *SCRadixCreateRadixTree(void (*Free)(void*), void (*PrintData)(void*
     SCRadixTree *tree = NULL;
 
     if ( (tree = SCMalloc(sizeof(SCRadixTree))) == NULL) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in SCRadixCreateRadixTree. Exiting...");
+        FatalError("Fatal error encountered in SCRadixCreateRadixTree. Exiting...");
     }
     memset(tree, 0, sizeof(SCRadixTree));
 
@@ -508,7 +506,7 @@ static SCRadixNode *SCRadixAddKey(
     uint16_t j = 0;
 
     if (tree == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Argument \"tree\" NULL");
+        SCLogError("Argument \"tree\" NULL");
         return NULL;
     }
 
@@ -520,7 +518,7 @@ static SCRadixNode *SCRadixAddKey(
         SCRadixPrefix *prefix = NULL;
         if ( (prefix = SCRadixCreatePrefix(key_stream, key_bitlen, user,
                         netmask)) == NULL) {
-            SCLogError(SC_ERR_RADIX_TREE_GENERIC, "Error creating prefix");
+            SCLogError("Error creating prefix");
             return NULL;
         }
         node = SCRadixCreateNode();
@@ -547,7 +545,7 @@ static SCRadixNode *SCRadixAddKey(
                                                         sizeof(uint8_t)))) == NULL) {
             SCFree(node->netmasks);
             node->netmasks = NULL;
-            SCLogError(SC_ENOMEM, "Fatal error encountered in SCRadixAddKey. Mem not allocated");
+            SCLogError("Fatal error encountered in SCRadixAddKey. Mem not allocated");
             return NULL;
         }
         node->netmasks = ptmp;
@@ -671,7 +669,7 @@ static SCRadixNode *SCRadixAddKey(
                                                                 sizeof(uint8_t)))) == NULL) {
                     SCFree(node->netmasks);
                     node->netmasks = NULL;
-                    SCLogError(SC_ERR_FATAL, "Fatal error encountered in SCRadixAddKey. Mem not allocated...");
+                    SCLogError("Fatal error encountered in SCRadixAddKey. Mem not allocated...");
                     return NULL;
                 }
                 node->netmasks = ptmp;
@@ -704,7 +702,7 @@ static SCRadixNode *SCRadixAddKey(
     SCRadixPrefix *prefix = NULL;
     if ( (prefix = SCRadixCreatePrefix(key_stream, key_bitlen, user,
                     netmask)) == NULL) {
-        SCLogError(SC_ERR_RADIX_TREE_GENERIC, "Error creating prefix");
+        SCLogError("Error creating prefix");
         return NULL;
     }
     new_node = SCRadixCreateNode();
@@ -751,8 +749,7 @@ static SCRadixNode *SCRadixAddKey(
             if (i < node->netmask_cnt) {
                 if ( (inter_node->netmasks = SCMalloc((node->netmask_cnt - i) *
                                 sizeof(uint8_t))) == NULL) {
-                    SCLogError(SC_ENOMEM,
-                            "Fatal error encountered in SCRadixAddKey. Mem not allocated...");
+                    SCLogError("Fatal error encountered in SCRadixAddKey. Mem not allocated...");
                     SCRadixReleaseNode(inter_node, tree);
                     SCRadixReleaseNode(new_node, tree);
                     return NULL;
@@ -800,8 +797,7 @@ static SCRadixNode *SCRadixAddKey(
                                                         sizeof(uint8_t)))) == NULL) {
             SCFree(node->netmasks);
             node->netmasks = NULL;
-            FatalError(SC_ERR_FATAL,
-                       "Fatal error encountered in SCRadixAddKey. Exiting...");
+            FatalError("Fatal error encountered in SCRadixAddKey. Exiting...");
         }
         node->netmasks = ptmp;
 
@@ -1004,7 +1000,7 @@ SCRadixNode *SCRadixAddKeyIPV4String(const char *str, SCRadixTree *tree, void *u
         if (masked != ip) {
             char nstr[16];
             PrintInet(AF_INET, (void *)&masked, nstr, sizeof(nstr));
-            SCLogWarning(SC_ERR_INVALID_IP_NETBLOCK, "adding '%s' as '%s/%u'", str, nstr, netmask);
+            SCLogWarning("adding '%s' as '%s/%u'", str, nstr, netmask);
             ip = masked;
         }
 #if defined(DEBUG_VALIDATION) || defined(UNITTESTS)
@@ -1070,7 +1066,7 @@ SCRadixNode *SCRadixAddKeyIPV6String(const char *str, SCRadixTree *tree, void *u
         if (diff) {
             char nstr[64];
             PrintInet(AF_INET6, (void *)&addr.s6_addr, nstr, sizeof(nstr));
-            SCLogWarning(SC_ERR_INVALID_IP_NETBLOCK, "adding '%s' as '%s/%u'", str, nstr, netmask);
+            SCLogWarning("adding '%s' as '%s/%u'", str, nstr, netmask);
         }
 #if defined(DEBUG_VALIDATION) || defined(UNITTESTS)
         SCRadixValidateIPv6Key((uint8_t *)&addr.s6_addr, netmask);
@@ -1086,7 +1082,7 @@ static void SCRadixTransferNetmasksBWNodes(SCRadixNode *dest, SCRadixNode *src)
     void *ptmp = NULL;
 
     if (src == NULL || dest == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "src or dest NULL");
+        SCLogError("src or dest NULL");
         return;
     }
 
@@ -1125,7 +1121,7 @@ static void SCRadixRemoveNetblockEntry(SCRadixNode *node, uint8_t netmask)
     int i = 0;
 
     if (node == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENTS, "Invalid argument.  Node is NULL");
+        SCLogError("Invalid argument.  Node is NULL");
         return;
     }
 
index 5e41f58415968ff09e5dfebdfefb0319835260fa..e5ed88bfb44c5b82a9a880f260ace22c4514edf8 100644 (file)
@@ -63,9 +63,8 @@ void SCReferenceConfInit(void)
     if (regex == NULL) {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogWarning(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogWarning("pcre2 compile of \"%s\" failed at "
+                     "offset %d: %s",
                 SC_RCONF_REGEX, (int)eo, errbuffer);
         return;
     }
@@ -109,7 +108,7 @@ static FILE *SCRConfInitContextAndLocalResources(DetectEngineCtx *de_ctx, FILE *
                                               SCRConfReferenceHashCompareFunc,
                                               SCRConfReferenceHashFree);
     if (de_ctx->reference_conf_ht == NULL) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "Error initializing the hash "
+        SCLogError("Error initializing the hash "
                    "table");
         return NULL;
     }
@@ -126,8 +125,7 @@ static FILE *SCRConfInitContextAndLocalResources(DetectEngineCtx *de_ctx, FILE *
                 return NULL; // silently fail
             }
 #endif
-            SCLogError(SC_ERR_FOPEN, "Error opening file: \"%s\": %s", filename,
-                       strerror(errno));
+            SCLogError("Error opening file: \"%s\": %s", filename, strerror(errno));
             return NULL;
         }
     }
@@ -239,7 +237,7 @@ int SCRConfAddReference(DetectEngineCtx *de_ctx, const char *line)
 
     ret = pcre2_match(regex, (PCRE2_SPTR8)line, strlen(line), 0, 0, regex_match, NULL);
     if (ret < 0) {
-        SCLogError(SC_ERR_REFERENCE_CONFIG, "Invalid Reference Config in "
+        SCLogError("Invalid Reference Config in "
                    "reference.config file");
         goto error;
     }
@@ -248,7 +246,7 @@ int SCRConfAddReference(DetectEngineCtx *de_ctx, const char *line)
     size_t copylen = sizeof(system);
     ret = pcre2_substring_copy_bynumber(regex_match, 1, (PCRE2_UCHAR8 *)system, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber() failed");
+        SCLogError("pcre2_substring_copy_bynumber() failed");
         goto error;
     }
 
@@ -256,7 +254,7 @@ int SCRConfAddReference(DetectEngineCtx *de_ctx, const char *line)
     copylen = sizeof(url);
     ret = pcre2_substring_copy_bynumber(regex_match, 2, (PCRE2_UCHAR8 *)url, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber() failed");
+        SCLogError("pcre2_substring_copy_bynumber() failed");
         goto error;
     }
 
@@ -360,7 +358,7 @@ SCRConfReference *SCRConfAllocSCRConfReference(const char *system,
     SCRConfReference *ref = NULL;
 
     if (system == NULL) {
-        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid arguments.  system NULL");
+        SCLogError("Invalid arguments.  system NULL");
         return NULL;
     }
 
@@ -502,8 +500,8 @@ int SCRConfLoadReferenceConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
             return -1;
         }
 #endif
-        SCLogError(SC_ERR_OPENING_FILE, "please check the \"reference-config-file\" "
-                "option in your suricata.yaml file");
+        SCLogError("please check the \"reference-config-file\" "
+                   "option in your suricata.yaml file");
         return -1;
     }
 
index a48bb12e72c6e3ff6128f2a4daf843fd1a61c09e..e57a74dd244bfe4dfd2d824e785f3c4422e93083 100644 (file)
@@ -64,11 +64,11 @@ typedef struct ROHashTableOffsets_ {
 ROHashTable *ROHashInit(uint8_t hash_bits, uint16_t item_size)
 {
     if (item_size % 4 != 0 || item_size == 0) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "data size must be multiple of 4");
+        SCLogError("data size must be multiple of 4");
         return NULL;
     }
     if (hash_bits < 4 || hash_bits > 31) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "invalid hash_bits setting, valid range is 4-31");
+        SCLogError("invalid hash_bits setting, valid range is 4-31");
         return NULL;
     }
 
@@ -76,7 +76,7 @@ ROHashTable *ROHashInit(uint8_t hash_bits, uint16_t item_size)
 
     ROHashTable *table = SCMalloc(sizeof(ROHashTable) + size);
     if (unlikely(table == NULL)) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "failed to alloc memory");
+        SCLogError("failed to alloc memory");
         return NULL;
     }
     memset(table, 0, sizeof(ROHashTable) + size);
@@ -153,11 +153,11 @@ void *ROHashLookup(ROHashTable *table, void *data, uint16_t size)
 int ROHashInitQueueValue(ROHashTable *table, void *value, uint16_t size)
 {
     if (table->locked) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "can't add value to locked table");
+        SCLogError("can't add value to locked table");
         return 0;
     }
     if (table->item_size != size) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "wrong size for data %u != %u", size, table->item_size);
+        SCLogError("wrong size for data %u != %u", size, table->item_size);
         return 0;
     }
 
@@ -184,7 +184,7 @@ int ROHashInitQueueValue(ROHashTable *table, void *value, uint16_t size)
 int ROHashInitFinalize(ROHashTable *table)
 {
     if (table->locked) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "table already locked");
+        SCLogError("table already locked");
         return 0;
     }
 
@@ -202,7 +202,7 @@ int ROHashInitFinalize(ROHashTable *table)
     }
 
     if (table->items == 0) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "no items");
+        SCLogError("no items");
         return 0;
     }
 
@@ -210,7 +210,7 @@ int ROHashInitFinalize(ROHashTable *table)
     uint32_t newsize = table->items * table->item_size;
     table->data = SCMalloc(newsize);
     if (table->data == NULL) {
-        SCLogError(SC_ERR_HASH_TABLE_INIT, "failed to alloc memory");
+        SCLogError("failed to alloc memory");
         return 0;
     }
     memset(table->data, 0x00, newsize);
index b5eb68c4364ca4257023da3fd470a5865f0ffdc0..03935682bceac6e42b29ee923b40d3fb0031bd4d 100644 (file)
@@ -98,8 +98,9 @@ const char *SCRuleVarsGetConfVar(const DetectEngineCtx *de_ctx,
     }
 
     if (ConfGet(conf_var_full_name, &conf_var_full_name_value) != 1) {
-        SCLogError(SC_ERR_UNDEFINED_VAR, "Variable \"%s\" is not defined in "
-                                         "configuration file", conf_var_name);
+        SCLogError("Variable \"%s\" is not defined in "
+                   "configuration file",
+                conf_var_name);
         goto end;
     }
 
index 0089474fad507aa442b5d17e75227a06fc6c197d..b1cc292408210795b92230f594d70199098b57d0 100644 (file)
@@ -64,7 +64,7 @@ char *RunmodeAutoFpCreatePickupQueuesString(int n)
 
     char *queues = SCMalloc(queues_size);
     if (unlikely(queues == NULL)) {
-        SCLogError(SC_ENOMEM, "failed to alloc queues buffer: %s", strerror(errno));
+        SCLogError("failed to alloc queues buffer: %s", strerror(errno));
         return NULL;
     }
     memset(queues, 0x00, queues_size);
@@ -99,7 +99,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
 
     char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
     if (queues == NULL) {
-        FatalError(SC_ERR_RUNMODE, "RunmodeAutoFpCreatePickupQueuesString failed");
+        FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
     }
 
     if ((nlive <= 1) && (live_dev != NULL)) {
@@ -107,8 +107,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
 
         void *aconf = ConfigParser(live_dev);
         if (aconf == NULL) {
-            FatalError(SC_ERR_RUNMODE, "Failed to allocate config for %s",
-                   live_dev);
+            FatalError("Failed to allocate config for %s", live_dev);
         }
 
         int threads_count = ModThreadsCount(aconf);
@@ -123,27 +122,24 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
                         "packetpool", "packetpool",
                         queues, "flow", "pktacqloop");
             if (tv_receive == NULL) {
-                FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+                FatalError("TmThreadsCreate failed");
             }
             TmModule *tm_module = TmModuleGetByName(recv_mod_name);
             if (tm_module == NULL) {
-                FatalError(SC_ERR_RUNMODE,
-                    "TmModuleGetByName failed for %s",
-                    recv_mod_name);
+                FatalError("TmModuleGetByName failed for %s", recv_mod_name);
             }
             TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
 
             tm_module = TmModuleGetByName(decode_mod_name);
             if (tm_module == NULL) {
-                FatalError(SC_ERR_RUNMODE,
-                        "TmModuleGetByName %s failed", decode_mod_name);
+                FatalError("TmModuleGetByName %s failed", decode_mod_name);
             }
             TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
 
             TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
 
             if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
-                FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+                FatalError("TmThreadSpawn failed");
             }
         }
     } else { /* Multiple input device */
@@ -154,22 +150,20 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
             const char *visual_devname = LiveGetShortName(dev);
 
             if (dev == NULL) {
-                FatalError(SC_ERR_RUNMODE, "Failed to lookup live dev %d", lthread);
+                FatalError("Failed to lookup live dev %d", lthread);
             }
             SCLogDebug("dev %s", dev);
 
             void *aconf = ConfigParser(dev);
             if (aconf == NULL) {
-                FatalError(SC_ERR_RUNMODE, "Multidev: Failed to allocate config for %s (%d)",
-                       dev, lthread);
+                FatalError("Multidev: Failed to allocate config for %s (%d)", dev, lthread);
             }
 
             int threads_count = ModThreadsCount(aconf);
             for (int thread = 0; thread < threads_count; thread++) {
                 char *printable_threadname = SCMalloc(sizeof(char) * (strlen(thread_name)+5+strlen(dev)));
                 if (unlikely(printable_threadname == NULL)) {
-                    FatalError(SC_ENOMEM, "failed to alloc printable thread name: %s",
-                            strerror(errno));
+                    FatalError("failed to alloc printable thread name: %s", strerror(errno));
                 }
                 snprintf(tname, sizeof(tname), "%s#%02d-%s", thread_name,
                          thread+1, visual_devname);
@@ -182,25 +176,25 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
                             "packetpool", "packetpool",
                             queues, "flow", "pktacqloop");
                 if (tv_receive == NULL) {
-                    FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+                    FatalError("TmThreadsCreate failed");
                 }
                 tv_receive->printable_name = printable_threadname;
                 TmModule *tm_module = TmModuleGetByName(recv_mod_name);
                 if (tm_module == NULL) {
-                    FatalError(SC_ERR_RUNMODE, "TmModuleGetByName failed for %s", recv_mod_name);
+                    FatalError("TmModuleGetByName failed for %s", recv_mod_name);
                 }
                 TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
 
                 tm_module = TmModuleGetByName(decode_mod_name);
                 if (tm_module == NULL) {
-                    FatalError(SC_ERR_RUNMODE, "TmModuleGetByName %s failed", decode_mod_name);
+                    FatalError("TmModuleGetByName %s failed", decode_mod_name);
                 }
                 TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
 
                 TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
 
                 if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
-                    FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+                    FatalError("TmThreadSpawn failed");
                 }
             }
         }
@@ -218,11 +212,11 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
                                         "packetpool", "packetpool",
                                         "varslot");
         if (tv_detect_ncpu == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
         TmModule *tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
@@ -232,12 +226,12 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
 
         tm_module = TmModuleGetByName("RespondReject");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName RespondReject failed");
+            FatalError("TmModuleGetByName RespondReject failed");
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
         if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
     }
 
@@ -271,7 +265,7 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod
         const char *visual_devname = LiveGetShortName(live_dev);
         char *printable_threadname = SCMalloc(sizeof(char) * (strlen(thread_name)+5+strlen(live_dev)));
         if (unlikely(printable_threadname == NULL)) {
-            FatalError(SC_ENOMEM, "failed to alloc printable thread name: %s", strerror(errno));
+            FatalError("failed to alloc printable thread name: %s", strerror(errno));
             exit(EXIT_FAILURE);
         }
 
@@ -290,38 +284,38 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod
                 "packetpool", "packetpool",
                 "pktacqloop");
         if (tv == NULL) {
-            FatalError(SC_ERR_THREAD_CREATE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
         tv->printable_name = printable_threadname;
 
         tm_module = TmModuleGetByName(recv_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
+            FatalError("TmModuleGetByName failed for %s", recv_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, aconf);
 
         tm_module = TmModuleGetByName(decode_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
+            FatalError("TmModuleGetByName %s failed", decode_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         tm_module = TmModuleGetByName("RespondReject");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName RespondReject failed");
+            FatalError("TmModuleGetByName RespondReject failed");
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         TmThreadSetCPU(tv, WORKER_CPU_SET);
 
         if (TmThreadSpawn(tv) != TM_ECODE_OK) {
-            FatalError(SC_ERR_THREAD_SPAWN, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
     }
 
@@ -370,8 +364,7 @@ int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc ConfigParser,
     void *aconf;
 
     if (nlive > 1) {
-        FatalError(SC_ERR_RUNMODE,
-                "Can't use the 'single' runmode with multiple devices");
+        FatalError("Can't use the 'single' runmode with multiple devices");
     }
 
     if (live_dev != NULL) {
@@ -411,14 +404,14 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
 
     char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
     if (queues == NULL) {
-        FatalError(SC_ERR_RUNMODE, "RunmodeAutoFpCreatePickupQueuesString failed");
+        FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
     }
 
     /* create the threads */
     for (int i = 0; i < nqueue; i++) {
         const char *cur_queue = LiveGetDeviceName(i);
         if (cur_queue == NULL) {
-            FatalError(SC_ERR_RUNMODE, "invalid queue number");
+            FatalError("invalid queue number");
         }
         memset(tname, 0, sizeof(tname));
         snprintf(tname, sizeof(tname), "%s-%s", thread_name_autofp, cur_queue);
@@ -428,24 +421,24 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
                     "packetpool", "packetpool",
                     queues, "flow", "pktacqloop");
         if (tv_receive == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
         tm_module = TmModuleGetByName(recv_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName failed for %s", recv_mod_name);
+            FatalError("TmModuleGetByName failed for %s", recv_mod_name);
         }
         TmSlotSetFuncAppend(tv_receive, tm_module, (void *) ConfigParser(i));
 
         tm_module = TmModuleGetByName(decode_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName %s failed", decode_mod_name);
+            FatalError("TmModuleGetByName %s failed", decode_mod_name);
         }
         TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
 
         TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
 
         if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
 
     }
@@ -462,12 +455,12 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
                                         "verdict-queue", "simple",
                                         "varslot");
         if (tv_detect_ncpu == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
 
         tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
@@ -476,7 +469,7 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
         TmThreadSetGroupName(tv_detect_ncpu, "Detect");
 
         if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
     }
 
@@ -491,24 +484,24 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
                                         "packetpool", "packetpool",
                                         "varslot");
         if (tv_verdict == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
         tm_module = TmModuleGetByName(verdict_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName %s failed", verdict_mod_name);
+            FatalError("TmModuleGetByName %s failed", verdict_mod_name);
         }
         TmSlotSetFuncAppend(tv_verdict, tm_module, (void *)ConfigParser(i));
 
         tm_module = TmModuleGetByName("RespondReject");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for RespondReject failed");
+            FatalError("TmModuleGetByName for RespondReject failed");
         }
         TmSlotSetFuncAppend(tv_verdict, tm_module, NULL);
 
         TmThreadSetCPU(tv_verdict, VERDICT_CPU_SET);
 
         if (TmThreadSpawn(tv_verdict) != TM_ECODE_OK) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
     }
 
@@ -530,7 +523,7 @@ int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
         /* create the threads */
         const char *cur_queue = LiveGetDeviceName(i);
         if (cur_queue == NULL) {
-            FatalError(SC_ERR_RUNMODE, "invalid queue number");
+            FatalError("invalid queue number");
         }
 
         char tname[TM_THREAD_NAME_MAX];
@@ -542,43 +535,43 @@ int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
                 "packetpool", "packetpool",
                 "pktacqloop");
         if (tv == NULL) {
-            FatalError(SC_ERR_THREAD_CREATE, "TmThreadsCreate failed");
+            FatalError("TmThreadsCreate failed");
         }
 
         tm_module = TmModuleGetByName(recv_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
+            FatalError("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_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
+            FatalError("TmModuleGetByName %s failed", decode_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         tm_module = TmModuleGetByName("FlowWorker");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for FlowWorker failed");
+            FatalError("TmModuleGetByName for FlowWorker failed");
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         tm_module = TmModuleGetByName(verdict_mod_name);
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName %s failed", verdict_mod_name);
+            FatalError("TmModuleGetByName %s failed", verdict_mod_name);
         }
         TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
 
         tm_module = TmModuleGetByName("RespondReject");
         if (tm_module == NULL) {
-            FatalError(SC_ERR_RUNMODE, "TmModuleGetByName for RespondReject failed");
+            FatalError("TmModuleGetByName for RespondReject failed");
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         TmThreadSetCPU(tv, WORKER_CPU_SET);
 
         if (TmThreadSpawn(tv) != TM_ECODE_OK) {
-            FatalError(SC_ERR_RUNMODE, "TmThreadSpawn failed");
+            FatalError("TmThreadSpawn failed");
         }
     }
 
index df6742054ff14af010a03c985a78b460e19664bb..9983eec73ab731db4c89e13c9a8253984204220b 100644 (file)
@@ -79,8 +79,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
 {
     BmCtx *new = SCMalloc(sizeof(BmCtx) + sizeof(uint16_t) * (needle_len + 1));
     if (unlikely(new == NULL)) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in BoyerMooreCtxInit. Exiting...");
+        FatalError("Fatal error encountered in BoyerMooreCtxInit. Exiting...");
     }
 
     /* Prepare bad chars */
@@ -88,8 +87,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
 
     /* Prepare good Suffixes */
     if (PreBmGs(needle, needle_len, new->bmGs) == -1) {
-        FatalError(SC_ERR_FATAL,
-                   "Fatal error encountered in BooyerMooreCtxInit. Exiting...");
+        FatalError("Fatal error encountered in BooyerMooreCtxInit. Exiting...");
     }
 
 
index d637437f7c8661b32d2fd344b817fc29ac2ab93d..62862be230ca05acc69e5c9c54d6289020c24358 100644 (file)
@@ -81,8 +81,9 @@ static int HSBuildDatabase(const uint8_t *needle, uint16_t needle_len,
     hs_error_t err = hs_compile(expr, flags, HS_MODE_BLOCK, NULL, &db,
                                 &compile_err);
     if (err != HS_SUCCESS) {
-        SCLogError(SC_ERR_FATAL, "Unable to compile '%s' with Hyperscan, "
-                                 "returned %d.", expr, err);
+        SCLogError("Unable to compile '%s' with Hyperscan, "
+                   "returned %d.",
+                expr, err);
         exit(EXIT_FAILURE);
     }
 
@@ -94,8 +95,7 @@ static int HSBuildDatabase(const uint8_t *needle, uint16_t needle_len,
     if (err != HS_SUCCESS) {
         /* If scratch allocation failed, this is not recoverable:  other SPM
          * contexts may need this scratch space. */
-        SCLogError(SC_ERR_FATAL,
-                   "Unable to alloc scratch for Hyperscan, returned %d.", err);
+        SCLogError("Unable to alloc scratch for Hyperscan, returned %d.", err);
         exit(EXIT_FAILURE);
     }
     global_thread_ctx->ctx = scratch;
@@ -152,7 +152,7 @@ static uint8_t *HSScan(const SpmCtx *ctx, SpmThreadCtx *thread_ctx,
         /* An error value (other than HS_SCAN_TERMINATED) from hs_scan()
          * indicates that it was passed an invalid database or scratch region,
          * which is not something we can recover from at scan time. */
-        SCLogError(SC_ERR_FATAL, "Hyperscan returned fatal error %d.", err);
+        SCLogError("Hyperscan returned fatal error %d.", err);
         exit(EXIT_FAILURE);
     }
 
@@ -215,8 +215,7 @@ static SpmThreadCtx *HSMakeThreadCtx(const SpmGlobalThreadCtx *global_thread_ctx
         hs_scratch_t *scratch = NULL;
         hs_error_t err = hs_clone_scratch(global_thread_ctx->ctx, &scratch);
         if (err != HS_SUCCESS) {
-            SCLogError(SC_ERR_FATAL, "Unable to clone scratch (error %d).",
-                       err);
+            SCLogError("Unable to clone scratch (error %d).", err);
             exit(EXIT_FAILURE);
         }
         thread_ctx->ctx = scratch;
index 095132e0c02de54f08377b0a95f1c0d811758cf5..5352e64ad1ac486728e7ff5b82ee146db9f8ff89 100644 (file)
@@ -85,14 +85,13 @@ uint16_t SinglePatternMatchDefaultMatcher(void)
 
 #ifndef BUILD_HYPERSCAN
         if ((spm_algo != NULL) && (strcmp(spm_algo, "hs") == 0)) {
-            FatalError(SC_EINVAL, "Hyperscan (hs) support for spm-algo is "
-                                  "not compiled into Suricata.");
+            FatalError("Hyperscan (hs) support for spm-algo is "
+                       "not compiled into Suricata.");
         }
 #endif
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
-                   "Invalid spm algo supplied "
+        SCLogError("Invalid spm algo supplied "
                    "in the yaml conf file: \"%s\"",
-                   spm_algo);
+                spm_algo);
         exit(EXIT_FAILURE);
     }
 
index 8f61ed34f7798fd52035f292f0cd82285416a5d2..a0108d03a66a59b9cbcd9ec16d13bd4cab12680c 100644 (file)
@@ -109,9 +109,8 @@ 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_EINVAL,
-                    "storage for type \"%s\" with "
-                    "name \"%s\" already registered",
+            SCLogError("storage for type \"%s\" with "
+                       "name \"%s\" already registered",
                     StoragePrintType(type), name);
             return -1;
         }
index f9c9c399a72d5704338e5a320bc72ac99322d323..250a2d660dc1e5721e24fc3c77ae7a4507f67e98 100644 (file)
@@ -448,7 +448,7 @@ GrowToSize(StreamingBuffer *sb, uint32_t size)
     DEBUG_VALIDATE_BUG_ON(sb->buf_size > BIT_U32(30));
     if (size > BIT_U32(30)) { // 1GiB
         if (!g2s_warn_once) {
-            SCLogWarning(SC_ENOMEM,
+            SCLogWarning(
                     "StreamingBuffer::GrowToSize() tried to alloc %u bytes, exceeds limit of %lu",
                     size, BIT_U32(30));
             g2s_warn_once = true;
@@ -495,9 +495,8 @@ static int WARN_UNUSED Grow(StreamingBuffer *sb)
     uint32_t grow = sb->buf_size * 2;
     if (grow > BIT_U32(30)) { // 1GiB
         if (!grow_warn_once) {
-            SCLogWarning(SC_ENOMEM,
-                    "StreamingBuffer::Grow() tried to alloc %u bytes, exceeds limit of %lu", grow,
-                    BIT_U32(30));
+            SCLogWarning("StreamingBuffer::Grow() tried to alloc %u bytes, exceeds limit of %lu",
+                    grow, BIT_U32(30));
             grow_warn_once = true;
         }
         return -1;
index 5191a0497e92e7472fcc2433b054e531b9e56ac5..8fd791a460c6cc835ad4c16197b4b7f5183d98ef 100644 (file)
@@ -34,8 +34,7 @@ TmEcode SysFsWriteValue(const char *path, int64_t value)
     char sentence[64];
 
     if (!path || strlen(path) > SYSFS_MAX_FILENAME_SIZE) {
-        SCLogWarning(SC_ERR_ARG_LEN_LONG, "File path too long, max allowed: %d",
-                SYSFS_MAX_FILENAME_SIZE);
+        SCLogWarning("File path too long, max allowed: %d", SYSFS_MAX_FILENAME_SIZE);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -44,7 +43,7 @@ TmEcode SysFsWriteValue(const char *path, int64_t value)
     /* File must be present and process have correct capabilities to open */
     int fd = open(fname, O_WRONLY);
     if (fd < 0) {
-        SCLogError(SC_ERR_FOPEN, "Could not open file: %s", fname);
+        SCLogError("Could not open file: %s", fname);
         SCReturnInt(TM_ECODE_FAILED);
     }
 
@@ -52,7 +51,7 @@ TmEcode SysFsWriteValue(const char *path, int64_t value)
     ssize_t len = strlen(sentence);
 
     if (write(fd, sentence, len) != len) {
-        SCLogError(SC_ERR_FWRITE, "Could not write to file: %s", fname);
+        SCLogError("Could not write to file: %s", fname);
         close(fd);
         SCReturnInt(TM_ECODE_FAILED);
     }
index 4c20713199986de7f809e0bd36d7075d374cab67..86cb990c6669024b404f2f76af0f7d1ebb31ebb0 100644 (file)
@@ -57,7 +57,7 @@ THashDataQueue *THashDataQueueNew(void)
 {
     THashDataQueue *q = (THashDataQueue *)SCMalloc(sizeof(THashDataQueue));
     if (q == NULL) {
-        SCLogError(SC_ERR_FATAL, "Fatal error encountered in THashDataQueueNew. Exiting...");
+        SCLogError("Fatal error encountered in THashDataQueueNew. Exiting...");
         exit(EXIT_SUCCESS);
     }
     q = THashDataQueueInit(q);
@@ -222,9 +222,9 @@ static int THashInitConfig(THashTableContext *ctx, const char *cnf_prefix)
     if ((ConfGet(varname, &conf_val)) == 1)
     {
         if (ParseSizeStringU64(conf_val, &ctx->config.memcap) < 0) {
-            SCLogError(SC_ERR_SIZE_PARSE, "Error parsing %s "
+            SCLogError("Error parsing %s "
                        "from conf file - %s.  Killing engine",
-                       varname, conf_val);
+                    varname, conf_val);
             return -1;
         }
     }
@@ -249,17 +249,17 @@ static int THashInitConfig(THashTableContext *ctx, const char *cnf_prefix)
     /* alloc hash memory */
     uint64_t hash_size = ctx->config.hash_size * sizeof(THashHashRow);
     if (!(THASH_CHECK_MEMCAP(ctx, hash_size))) {
-        SCLogError(SC_ERR_THASH_INIT, "allocating hash failed: "
-                "max hash memcap is smaller than projected hash size. "
-                "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate "
-                "total hash size by multiplying \"hash-size\" with %"PRIuMAX", "
-                "which is the hash bucket size.", ctx->config.memcap, hash_size,
-                (uintmax_t)sizeof(THashHashRow));
+        SCLogError("allocating hash failed: "
+                   "max hash memcap is smaller than projected hash size. "
+                   "Memcap: %" PRIu64 ", Hash table size %" PRIu64 ". Calculate "
+                   "total hash size by multiplying \"hash-size\" with %" PRIuMAX ", "
+                   "which is the hash bucket size.",
+                ctx->config.memcap, hash_size, (uintmax_t)sizeof(THashHashRow));
         return -1;
     }
     ctx->array = SCMallocAligned(ctx->config.hash_size * sizeof(THashHashRow), CLS);
     if (unlikely(ctx->array == NULL)) {
-        SCLogError(SC_ERR_THASH_INIT, "Fatal error encountered in THashInitConfig. Exiting...");
+        SCLogError("Fatal error encountered in THashInitConfig. Exiting...");
         return -1;
     }
     memset(ctx->array, 0, ctx->config.hash_size * sizeof(THashHashRow));
@@ -273,16 +273,17 @@ static int THashInitConfig(THashTableContext *ctx, const char *cnf_prefix)
     /* pre allocate prealloc */
     for (i = 0; i < ctx->config.prealloc; i++) {
         if (!(THASH_CHECK_MEMCAP(ctx, THASH_DATA_SIZE(ctx)))) {
-            SCLogError(SC_ERR_THASH_INIT, "preallocating data failed: "
-                    "max thash memcap reached. Memcap %"PRIu64", "
-                    "Memuse %"PRIu64".", ctx->config.memcap,
+            SCLogError("preallocating data failed: "
+                       "max thash memcap reached. Memcap %" PRIu64 ", "
+                       "Memuse %" PRIu64 ".",
+                    ctx->config.memcap,
                     ((uint64_t)SC_ATOMIC_GET(ctx->memuse) + THASH_DATA_SIZE(ctx)));
             return -1;
         }
 
         THashData *h = THashDataAlloc(ctx);
         if (h == NULL) {
-            SCLogError(SC_ERR_THASH_INIT, "preallocating data failed: %s", strerror(errno));
+            SCLogError("preallocating data failed: %s", strerror(errno));
             return -1;
         }
         THashDataEnqueue(&ctx->spare_q,h);
index 7a7024143ba2fb7f7f6f4afa17209a8cc07b575b..12c2aaace3ed1be702f2c2ee9b7da6fe3082d1d4 100644 (file)
@@ -115,9 +115,8 @@ void SCThresholdConfGlobalInit(void)
             (PCRE2_SPTR8)DETECT_BASE_REGEX, PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL);
     if (regex_base == NULL) {
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        FatalError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        FatalError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 DETECT_BASE_REGEX, (int)eo, errbuffer);
     }
     regex_base_match = pcre2_match_data_create_from_pattern(regex_base, NULL);
@@ -126,9 +125,8 @@ void SCThresholdConfGlobalInit(void)
             (PCRE2_SPTR8)DETECT_THRESHOLD_REGEX, PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL);
     if (regex_threshold == NULL) {
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        FatalError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        FatalError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 DETECT_THRESHOLD_REGEX, (int)eo, errbuffer);
     }
     regex_threshold_match = pcre2_match_data_create_from_pattern(regex_threshold, NULL);
@@ -137,9 +135,8 @@ void SCThresholdConfGlobalInit(void)
             (PCRE2_SPTR8)DETECT_RATE_REGEX, PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL);
     if (regex_rate == NULL) {
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        FatalError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        FatalError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 DETECT_RATE_REGEX, (int)eo, errbuffer);
     }
     regex_rate_match = pcre2_match_data_create_from_pattern(regex_rate, NULL);
@@ -148,9 +145,8 @@ void SCThresholdConfGlobalInit(void)
             (PCRE2_SPTR8)DETECT_SUPPRESS_REGEX, PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL);
     if (regex_suppress == NULL) {
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        FatalError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        FatalError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 DETECT_SUPPRESS_REGEX, (int)eo, errbuffer);
     }
     regex_suppress_match = pcre2_match_data_create_from_pattern(regex_suppress, NULL);
@@ -254,7 +250,7 @@ int SCThresholdConfInitContext(DetectEngineCtx *de_ctx)
 #endif
         filename = SCThresholdConfGetConfFilename(de_ctx);
         if ( (fd = fopen(filename, "r")) == NULL) {
-            SCLogWarning(SC_ERR_FOPEN, "Error opening file: \"%s\": %s", filename, strerror(errno));
+            SCLogWarning("Error opening file: \"%s\": %s", filename, strerror(errno));
             goto error;
         }
 #ifdef UNITTESTS
@@ -262,8 +258,7 @@ int SCThresholdConfInitContext(DetectEngineCtx *de_ctx)
 #endif
 
     if (SCThresholdConfParseFile(de_ctx, fd) < 0) {
-        SCLogWarning(
-                SC_WARN_THRESH_CONFIG, "Error loading threshold configuration from %s", filename);
+        SCLogWarning("Error loading threshold configuration from %s", filename);
         /* maintain legacy behavior so no errors unless config testing */
         if (RunmodeGetCurrent() == RUNMODE_CONF_TEST) {
             ret = -1;
@@ -327,7 +322,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
         orig_de->timeout = parsed_timeout;
         if (DetectAddressParse((const DetectEngineCtx *)de_ctx, &orig_de->addrs, (char *)th_ip) <
                 0) {
-            SCLogError(SC_ERR_INVALID_IP_NETBLOCK, "failed to parse %s", th_ip);
+            SCLogError("failed to parse %s", th_ip);
             goto error;
         }
     }
@@ -335,7 +330,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
     /* Install it */
     if (id == 0 && gid == 0) {
         if (parsed_track == TRACK_RULE) {
-            SCLogWarning(SC_ERR_EVENT_ENGINE, "suppressing all rules");
+            SCLogWarning("suppressing all rules");
         }
 
         /* update each sig with our suppress info */
@@ -352,7 +347,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
 
             sm = SigMatchAlloc();
             if (sm == NULL) {
-                SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                SCLogError("Error allocating SigMatch");
                 goto error;
             }
 
@@ -362,7 +357,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
         }
     } else if (id == 0 && gid > 0)    {
         if (parsed_track == TRACK_RULE) {
-            SCLogWarning(SC_ERR_EVENT_ENGINE, "suppressing all rules with gid %"PRIu32, gid);
+            SCLogWarning("suppressing all rules with gid %" PRIu32, gid);
         }
         /* set up suppression for each signature with a matching gid */
         for (s = de_ctx->sig_list; s != NULL; s = s->next) {
@@ -381,7 +376,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
 
             sm = SigMatchAlloc();
             if (sm == NULL) {
-                SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                SCLogError("Error allocating SigMatch");
                 goto error;
             }
 
@@ -391,15 +386,16 @@ 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_EINVAL, "Can't use a event config that has "
-                              "sid > 0 and gid == 0. Please fix this "
-                              "in your threshold.config file");
+        SCLogError("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);
         if (s == NULL) {
-            SCLogWarning(SC_ERR_EVENT_ENGINE, "can't suppress sid "
-                    "%"PRIu32", gid %"PRIu32": unknown rule", id, gid);
+            SCLogWarning("can't suppress sid "
+                         "%" PRIu32 ", gid %" PRIu32 ": unknown rule",
+                    id, gid);
         } else {
             if (parsed_track == TRACK_RULE) {
                 s->flags |= SIG_FLAG_NOALERT;
@@ -412,7 +408,7 @@ static int SetupSuppressRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
 
             sm = SigMatchAlloc();
             if (sm == NULL) {
-                SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                SCLogError("Error allocating SigMatch");
                 goto error;
             }
 
@@ -463,20 +459,22 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
             sm = DetectGetLastSMByListId(s,
                     DETECT_SM_LIST_THRESHOLD, DETECT_THRESHOLD, -1);
             if (sm != NULL) {
-                SCLogWarning(SC_ERR_EVENT_ENGINE, "signature sid:%"PRIu32 " has "
-                        "an event var set.  The signature event var is "
-                        "given precedence over the threshold.conf one.  "
-                        "We'll change this in the future though.", s->id);
+                SCLogWarning("signature sid:%" PRIu32 " has "
+                             "an event var set.  The signature event var is "
+                             "given precedence over the threshold.conf one.  "
+                             "We'll change this in the future though.",
+                        s->id);
                 continue;
             }
 
             sm = DetectGetLastSMByListId(s,
                     DETECT_SM_LIST_THRESHOLD, DETECT_DETECTION_FILTER, -1);
             if (sm != NULL) {
-                SCLogWarning(SC_ERR_EVENT_ENGINE, "signature sid:%"PRIu32 " has "
-                        "an event var set.  The signature event var is "
-                        "given precedence over the threshold.conf one.  "
-                        "We'll change this in the future though.", s->id);
+                SCLogWarning("signature sid:%" PRIu32 " has "
+                             "an event var set.  The signature event var is "
+                             "given precedence over the threshold.conf one.  "
+                             "We'll change this in the future though.",
+                        s->id);
                 continue;
             }
 
@@ -494,7 +492,7 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
 
             sm = SigMatchAlloc();
             if (sm == NULL) {
-                SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                SCLogError("Error allocating SigMatch");
                 goto error;
             }
 
@@ -513,10 +511,11 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
                 sm = DetectGetLastSMByListId(s, DETECT_SM_LIST_THRESHOLD,
                         DETECT_THRESHOLD, DETECT_DETECTION_FILTER, -1);
                 if (sm != NULL) {
-                    SCLogWarning(SC_ERR_EVENT_ENGINE, "signature sid:%"PRIu32 " has "
-                            "an event var set.  The signature event var is "
-                            "given precedence over the threshold.conf one.  "
-                            "We'll change this in the future though.", id);
+                    SCLogWarning("signature sid:%" PRIu32 " has "
+                                 "an event var set.  The signature event var is "
+                                 "given precedence over the threshold.conf one.  "
+                                 "We'll change this in the future though.",
+                            id);
                     continue;
                 }
 
@@ -534,7 +533,7 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
 
                 sm = SigMatchAlloc();
                 if (sm == NULL) {
-                    SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                    SCLogError("Error allocating SigMatch");
                     goto error;
                 }
 
@@ -548,14 +547,15 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
             }
         }
     } else if (id > 0 && gid == 0) {
-        SCLogError(SC_EINVAL, "Can't use a event config that has "
-                              "sid > 0 and gid == 0. Please fix this "
-                              "in your threshold.conf file");
+        SCLogError("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) {
-            SCLogWarning(SC_ERR_EVENT_ENGINE, "can't suppress sid "
-                    "%"PRIu32", gid %"PRIu32": unknown rule", id, gid);
+            SCLogWarning("can't suppress sid "
+                         "%" PRIu32 ", gid %" PRIu32 ": unknown rule",
+                    id, gid);
         } else {
             if (parsed_type != TYPE_SUPPRESS && parsed_type != TYPE_THRESHOLD &&
                 parsed_type != TYPE_BOTH && parsed_type != TYPE_LIMIT)
@@ -563,20 +563,22 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
                 sm = DetectGetLastSMByListId(s,
                         DETECT_SM_LIST_THRESHOLD, DETECT_THRESHOLD, -1);
                 if (sm != NULL) {
-                    SCLogWarning(SC_ERR_EVENT_ENGINE, "signature sid:%"PRIu32 " has "
-                            "a threshold set. The signature event var is "
-                            "given precedence over the threshold.conf one. "
-                            "Bug #425.", s->id);
+                    SCLogWarning("signature sid:%" PRIu32 " has "
+                                 "a threshold set. The signature event var is "
+                                 "given precedence over the threshold.conf one. "
+                                 "Bug #425.",
+                            s->id);
                     goto end;
                 }
 
                 sm = DetectGetLastSMByListId(s, DETECT_SM_LIST_THRESHOLD,
                         DETECT_DETECTION_FILTER, -1);
                 if (sm != NULL) {
-                    SCLogWarning(SC_ERR_EVENT_ENGINE, "signature sid:%"PRIu32 " has "
-                            "a detection_filter set. The signature event var is "
-                            "given precedence over the threshold.conf one. "
-                            "Bug #425.", s->id);
+                    SCLogWarning("signature sid:%" PRIu32 " has "
+                                 "a detection_filter set. The signature event var is "
+                                 "given precedence over the threshold.conf one. "
+                                 "Bug #425.",
+                            s->id);
                     goto end;
                 }
 
@@ -605,7 +607,7 @@ static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid
 
             sm = SigMatchAlloc();
             if (sm == NULL) {
-                SCLogError(SC_ENOMEM, "Error allocating SigMatch");
+                SCLogError("Error allocating SigMatch");
                 goto error;
             }
 
@@ -662,8 +664,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
     ret = pcre2_match(
             regex_base, (PCRE2_SPTR8)rawstr, strlen(rawstr), 0, 0, regex_base_match, NULL);
     if (ret < 4) {
-        SCLogError(SC_ERR_PCRE_MATCH, "pcre2_match parse error, ret %" PRId32 ", string %s", ret,
-                rawstr);
+        SCLogError("pcre2_match parse error, ret %" PRId32 ", string %s", ret, rawstr);
         goto error;
     }
 
@@ -672,7 +673,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
     ret = pcre2_substring_copy_bynumber(
             regex_base_match, 1, (PCRE2_UCHAR8 *)th_rule_type, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -680,14 +681,14 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
     copylen = sizeof(th_gid);
     ret = pcre2_substring_copy_bynumber(regex_base_match, 2, (PCRE2_UCHAR8 *)th_gid, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
     copylen = sizeof(th_sid);
     ret = pcre2_substring_copy_bynumber(regex_base_match, 3, (PCRE2_UCHAR8 *)th_sid, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+        SCLogError("pcre2_substring_copy_bynumber failed");
         goto error;
     }
 
@@ -695,7 +696,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
     ret = pcre2_substring_get_bynumber(
             regex_base_match, 4, (PCRE2_UCHAR8 **)&rule_extend, &copylen);
     if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+        SCLogError("pcre2_substring_get_bynumber failed");
         goto error;
     }
 
@@ -709,7 +710,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_EINVAL, "rule type %s is unknown", th_rule_type);
+        SCLogError("rule type %s is unknown", th_rule_type);
         goto error;
     }
 
@@ -721,8 +722,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_match(regex_threshold, (PCRE2_SPTR8)rule_extend, strlen(rule_extend), 0,
                         0, regex_threshold_match, NULL);
                 if (ret < 4) {
-                    SCLogError(SC_ERR_PCRE_MATCH,
-                            "pcre2_match parse error, ret %" PRId32 ", string %s", ret,
+                    SCLogError("pcre2_match parse error, ret %" PRId32 ", string %s", ret,
                             rule_extend);
                     goto error;
                 }
@@ -731,7 +731,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_threshold_match, 1, (PCRE2_UCHAR8 *)th_type, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -739,7 +739,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_threshold_match, 2, (PCRE2_UCHAR8 *)th_track, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -747,7 +747,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_threshold_match, 3, (PCRE2_UCHAR8 *)th_count, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -755,7 +755,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_threshold_match, 4, (PCRE2_UCHAR8 *)th_seconds, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -766,11 +766,11 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 else if (strcasecmp(th_type,"threshold") == 0)
                     parsed_type = TYPE_THRESHOLD;
                 else {
-                    SCLogError(SC_ERR_INVALID_ARGUMENTS, "limit type not supported: %s", th_type);
+                    SCLogError("limit type not supported: %s", th_type);
                     goto error;
                 }
             } else {
-                SCLogError(SC_ERR_INVALID_ARGUMENTS, "rule invalid: %s", rawstr);
+                SCLogError("rule invalid: %s", rawstr);
                 goto error;
             }
             break;
@@ -779,8 +779,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_match(regex_suppress, (PCRE2_SPTR8)rule_extend, strlen(rule_extend), 0,
                         0, regex_suppress_match, NULL);
                 if (ret < 2) {
-                    SCLogError(SC_ERR_PCRE_MATCH,
-                            "pcre2_match parse error, ret %" PRId32 ", string %s", ret,
+                    SCLogError("pcre2_match parse error, ret %" PRId32 ", string %s", ret,
                             rule_extend);
                     goto error;
                 }
@@ -789,14 +788,14 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_suppress_match, 1, (PCRE2_UCHAR8 *)th_track, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
                 /* retrieve the IP; use "get" for heap allocation */
                 ret = pcre2_substring_get_bynumber(
                         regex_suppress_match, 2, (PCRE2_UCHAR8 **)&th_ip, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
+                    SCLogError("pcre2_substring_get_bynumber failed");
                     goto error;
                 }
             } else {
@@ -809,8 +808,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_match(regex_rate, (PCRE2_SPTR8)rule_extend, strlen(rule_extend), 0, 0,
                         regex_rate_match, NULL);
                 if (ret < 5) {
-                    SCLogError(SC_ERR_PCRE_MATCH,
-                            "pcre2_match parse error, ret %" PRId32 ", string %s", ret,
+                    SCLogError("pcre2_match parse error, ret %" PRId32 ", string %s", ret,
                             rule_extend);
                     goto error;
                 }
@@ -819,7 +817,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_rate_match, 1, (PCRE2_UCHAR8 *)th_track, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -827,7 +825,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_rate_match, 2, (PCRE2_UCHAR8 *)th_count, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -835,7 +833,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_rate_match, 3, (PCRE2_UCHAR8 *)th_seconds, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -843,7 +841,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_rate_match, 4, (PCRE2_UCHAR8 *)th_new_action, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -851,7 +849,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 ret = pcre2_substring_copy_bynumber(
                         regex_rate_match, 5, (PCRE2_UCHAR8 *)th_timeout, &copylen);
                 if (ret < 0) {
-                    SCLogError(SC_ERR_PCRE_COPY_SUBSTRING, "pcre2_substring_copy_bynumber failed");
+                    SCLogError("pcre2_substring_copy_bynumber failed");
                     goto error;
                 }
 
@@ -880,7 +878,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 }
                 parsed_type = TYPE_RATE;
             } else {
-                SCLogError(SC_ERR_INVALID_ARGUMENTS, "rule invalid: %s", rawstr);
+                SCLogError("rule invalid: %s", rawstr);
                 goto error;
             }
             break;
@@ -901,7 +899,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_EINVAL, "Invalid track parameter %s in %s", th_track, rawstr);
+                SCLogError("Invalid track parameter %s in %s", th_track, rawstr);
                 goto error;
             }
 
@@ -909,7 +907,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                 goto error;
             }
             if (parsed_count == 0) {
-                SCLogError(SC_EINVAL, "rate filter count should be > 0");
+                SCLogError("rate filter count should be > 0");
                 goto error;
             }
 
@@ -929,8 +927,7 @@ static int ParseThresholdRule(const DetectEngineCtx *de_ctx, char *rawstr, uint3
                     parsed_track = TRACK_EITHER;
                 }
                 else {
-                    SCLogError(
-                            SC_EINVAL, "Invalid track parameter %s in %s", th_track, rule_extend);
+                    SCLogError("Invalid track parameter %s in %s", th_track, rule_extend);
                     goto error;
                 }
             }
index 71e39e7b0ad811c61e99936b0dbc2f0d28fc7ef0..ed80afe21deb7dd03ee456826a3ea6a0db812b8b 100644 (file)
@@ -360,8 +360,8 @@ Packet **UTHBuildPacketArrayFromEth(uint8_t *raw_eth[], int *pktsize, int numpkt
     DecodeThreadVars dtv;
     ThreadVars th_v;
     if (raw_eth == NULL || pktsize == NULL || numpkts <= 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "The arrays cant be null, and the number"
-                                        " of packets should be grater thatn zero");
+        SCLogError("The arrays cant be null, and the number"
+                   " of packets should be grater thatn zero");
         return NULL;
     }
     Packet **p = NULL;
@@ -609,7 +609,8 @@ int UTHGenericTest(Packet **pkt, int numpkts, const char *sigs[], uint32_t sids[
     int result = 0;
     if (pkt == NULL || sigs == NULL || numpkts == 0
         || sids == NULL || results == NULL || numsigs == 0) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Arguments invalid, that the pointer/arrays are not NULL, and the number of signatures and packets is > 0");
+        SCLogError("Arguments invalid, that the pointer/arrays are not NULL, and the number of "
+                   "signatures and packets is > 0");
         goto end;
     }
     DetectEngineCtx *de_ctx = DetectEngineCtxInit();
@@ -646,8 +647,8 @@ int UTHCheckPacketMatchResults(Packet *p, uint32_t sids[],
         uint32_t results[], int numsids)
 {
     if (p == NULL || sids == NULL) {
-        SCLogError(SC_ERR_INVALID_ARGUMENT, "Arguments invalid, check if the "
-                "packet is NULL, and if the array contain sids is set");
+        SCLogError("Arguments invalid, check if the "
+                   "packet is NULL, and if the array contain sids is set");
         return 0;
     }
 
@@ -684,14 +685,16 @@ int UTHAppendSigs(DetectEngineCtx *de_ctx, const char *sigs[], int numsigs)
 
     for (int i = 0; i < numsigs; i++) {
         if (sigs[i] == NULL) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Check the signature"
-                       " at position %d", i);
+            SCLogError("Check the signature"
+                       " at position %d",
+                    i);
             return 0;
         }
         Signature *s = DetectEngineAppendSig(de_ctx, sigs[i]);
         if (s == NULL) {
-            SCLogError(SC_ERR_INVALID_ARGUMENT, "Check the signature at"
-                       " position %d (%s)", i, sigs[i]);
+            SCLogError("Check the signature at"
+                       " position %d (%s)",
+                    i, sigs[i]);
             return 0;
         }
     }
index 202d95bd1951957c960812bf2625a00ab2a75e1c..547988c2e59139807504043b83d5f60fbfa86c6a 100644 (file)
@@ -137,9 +137,8 @@ static int UtRegex (const char *regex_arg)
     {
         PCRE2_UCHAR errbuffer[256];
         pcre2_get_error_message(en, errbuffer, sizeof(errbuffer));
-        SCLogError(SC_ERR_PCRE_COMPILE,
-                "pcre2 compile of \"%s\" failed at "
-                "offset %d: %s",
+        SCLogError("pcre2 compile of \"%s\" failed at "
+                   "offset %d: %s",
                 regex_arg, (int)eo, errbuffer);
         goto error;
     }
index 06191b197334a2112fba4e2cf34522da714319c4..0b7bd24e5fabd64e9bb8eec6e2943610a3f6b76a 100644 (file)
@@ -74,7 +74,7 @@ static void SCAtExitHandler(void)
 
     /* mark service as stopped */
     if (!SetServiceStatus(service_status_handle, &status)) {
-        SCLogWarning(SC_ERR_SVC, "Can't set service status: %d", (int)GetLastError());
+        SCLogWarning("Can't set service status: %d", (int)GetLastError());
     } else {
         SCLogInfo("Service status set to: SERVICE_STOPPED");
     }
@@ -101,7 +101,7 @@ static DWORD WINAPI SCServiceCtrlHandlerEx(DWORD code, DWORD etype, LPVOID edata
 
         /* mark service as stop pending */
         if (!SetServiceStatus(service_status_handle, &status)) {
-            SCLogWarning(SC_ERR_SVC, "Can't set service status: %d", (int)GetLastError());
+            SCLogWarning("Can't set service status: %d", (int)GetLastError());
         } else {
             SCLogInfo("Service status set to: SERVICE_STOP_PENDING");
         }
@@ -131,18 +131,18 @@ static void WINAPI SCServiceMain(uint32_t argc, char** argv)
     };
 
     if ((service_status_handle = RegisterServiceCtrlHandlerEx((char *)PROG_NAME, SCServiceCtrlHandlerEx, NULL)) == (SERVICE_STATUS_HANDLE)0) {
-        SCLogError(SC_ERR_SVC, "Can't register service control handler: %d", (int)GetLastError());
+        SCLogError("Can't register service control handler: %d", (int)GetLastError());
         return;
     }
 
     /* register exit handler */
     if (atexit(SCAtExitHandler)) {
-        SCLogWarning(SC_ERR_SVC, "Can't register exit handler: %d", (int)GetLastError());
+        SCLogWarning("Can't register exit handler: %d", (int)GetLastError());
     }
 
     /* mark service as running immediately */
     if (!SetServiceStatus(service_status_handle, &status)) {
-        SCLogWarning(SC_ERR_SVC, "Can't set service status: %d", (int)GetLastError());
+        SCLogWarning("Can't set service status: %d", (int)GetLastError());
     } else {
         SCLogInfo("Service status set to: SERVICE_RUNNING");
     }
@@ -158,7 +158,7 @@ static void WINAPI SCServiceMain(uint32_t argc, char** argv)
     status.dwCurrentState = SERVICE_STOPPED;
 
     if (!SetServiceStatus(service_status_handle, &status)) {
-        SCLogWarning(SC_ERR_SVC, "Can't set service status: %d", (int)GetLastError());
+        SCLogWarning("Can't set service status: %d", (int)GetLastError());
     } else {
         SCLogInfo("Service status set to: SERVICE_STOPPED");
     }
@@ -179,7 +179,7 @@ int SCServiceInit(int argc, char **argv)
 
     /* continue with suricata initialization */
     if (service_initialized) {
-        SCLogWarning(SC_ERR_SVC, "Service is already initialized.");
+        SCLogWarning("Service is already initialized.");
         return 0;
     }
 
@@ -220,7 +220,7 @@ int SCServiceInstall(int argc, char **argv)
         memset(path, 0, sizeof(path));
 
         if (GetModuleFileName(NULL, path, MAX_PATH) == 0 ){
-            SCLogError(SC_ERR_SVC, "Can't get path to service binary: %d", (int)GetLastError());
+            SCLogError("Can't get path to service binary: %d", (int)GetLastError());
             break;
         }
 
@@ -234,7 +234,7 @@ int SCServiceInstall(int argc, char **argv)
         }
 
         if ((scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't open SCM: %d", (int)GetLastError());
+            SCLogError("Can't open SCM: %d", (int)GetLastError());
             break;
         }
 
@@ -254,7 +254,7 @@ int SCServiceInstall(int argc, char **argv)
                 NULL);
 
         if (service == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't create service: %d", (int)GetLastError());
+            SCLogError("Can't create service: %d", (int)GetLastError());
             break;
         }
 
@@ -288,27 +288,27 @@ int SCServiceRemove(int argc, char **argv)
 
     do {
         if ((scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't open SCM: %d", (int)GetLastError());
+            SCLogError("Can't open SCM: %d", (int)GetLastError());
             break;
         }
 
         if ((service = OpenService(scm, PROG_NAME, SERVICE_ALL_ACCESS)) == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't open service: %d", (int)GetLastError());
+            SCLogError("Can't open service: %d", (int)GetLastError());
             break;
         }
 
         if (!QueryServiceStatus(service, &status)) {
-            SCLogError(SC_ERR_SVC, "Can't query service status: %d", (int)GetLastError());
+            SCLogError("Can't query service status: %d", (int)GetLastError());
             break;
         }
 
         if (status.dwCurrentState != SERVICE_STOPPED) {
-            SCLogError(SC_ERR_SVC, "Service isn't in stopped state: %d", (int)GetLastError());
+            SCLogError("Service isn't in stopped state: %d", (int)GetLastError());
             break;
         }
 
         if (!DeleteService(service)) {
-            SCLogError(SC_ERR_SVC, "Can't delete service: %d", (int)GetLastError());
+            SCLogError("Can't delete service: %d", (int)GetLastError());
             break;
         }
 
@@ -345,7 +345,7 @@ int SCServiceChangeParams(int argc, char **argv)
         memset(path, 0, sizeof(path));
 
         if (GetModuleFileName(NULL, path, MAX_PATH) == 0 ){
-            SCLogError(SC_ERR_SVC, "Can't get path to service binary: %d", (int)GetLastError());
+            SCLogError("Can't get path to service binary: %d", (int)GetLastError());
             break;
         }
 
@@ -359,12 +359,12 @@ int SCServiceChangeParams(int argc, char **argv)
         }
 
         if ((scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't open SCM: %d", (int)GetLastError());
+            SCLogError("Can't open SCM: %d", (int)GetLastError());
             break;
         }
 
         if ((service = OpenService(scm, PROG_NAME, SERVICE_ALL_ACCESS)) == NULL) {
-            SCLogError(SC_ERR_SVC, "Can't open service: %d", (int)GetLastError());
+            SCLogError("Can't open service: %d", (int)GetLastError());
             break;
         }
 
@@ -381,7 +381,7 @@ int SCServiceChangeParams(int argc, char **argv)
                     NULL,
                     PROG_NAME))
         {
-            SCLogError(SC_ERR_SVC, "Can't change service configuration: %d", (int)GetLastError());
+            SCLogError("Can't change service configuration: %d", (int)GetLastError());
             break;
         }
 
index 0c2789264d9708100f3de567aff302e9ae713bcf..37807f92e89e25d2d07e60ef77807f1e4cbea7ea 100644 (file)
@@ -132,23 +132,23 @@ int GetGlobalMTUWin32(void) { return 0; }
 
 int GetIfaceOffloadingWin32(const char *ifname, int csum, int other)
 {
-    SCLogWarning(SC_ERR_SYSCALL, "Suricata not targeted for Windows Vista or "
-                                 "higher. Network offload interrogation not "
-                                 "available.");
+    SCLogWarning("Suricata not targeted for Windows Vista or "
+                 "higher. Network offload interrogation not "
+                 "available.");
     return -1;
 }
 int DisableIfaceOffloadingWin32(LiveDevice *ldev, int csum, int other)
 {
-    SCLogWarning(SC_ERR_SYSCALL, "Suricata not targeted for Windows Vista or "
-                                 "higher. Network offload interrogation not "
-                                 "available.");
+    SCLogWarning("Suricata not targeted for Windows Vista or "
+                 "higher. Network offload interrogation not "
+                 "available.");
     return -1;
 }
 int RestoreIfaceOffloadingWin32(LiveDevice *ldev)
 {
-    SCLogWarning(SC_ERR_SYSCALL, "Suricata not targeted for Windows Vista or "
-                                 "higher. Network offload interrogation not "
-                                 "available.");
+    SCLogWarning("Suricata not targeted for Windows Vista or "
+                 "higher. Network offload interrogation not "
+                 "available.");
     return -1;
 }
 
@@ -300,10 +300,9 @@ release:
 
     if (err != S_OK) {
         const char *errbuf = Win32GetErrorString(err, WmiUtils());
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failure when trying to get MTU via syscall for '%s': %s "
+        SCLogWarning("Failure when trying to get MTU via syscall for '%s': %s "
                      "(0x%08" PRIx32 ")",
-                     pcap_dev, errbuf, (uint32_t)err);
+                pcap_dev, errbuf, (uint32_t)err);
         LocalFree((LPVOID)errbuf);
     } else {
         SCLogInfo("Found an MTU of %d for '%s'", mtu, pcap_dev);
@@ -353,11 +352,8 @@ fail:
                            FORMAT_MESSAGE_IGNORE_INSERTS,
                    NULL, err, 0, (LPTSTR)&errbuf, 0, NULL);
 
-    SCLogWarning(
-            SC_ERR_SYSCALL,
-            "Failure when trying to get global MTU via syscall: %s (%" PRId32
-            ")",
-            errbuf, (uint32_t)err);
+    SCLogWarning("Failure when trying to get global MTU via syscall: %s (%" PRId32 ")", errbuf,
+            (uint32_t)err);
 
     return -1;
 }
@@ -412,7 +408,7 @@ static HRESULT ComInstanceInit(ComInstance *instance, LPCWSTR resource)
     BSTR resource_bstr = SysAllocString(resource);
     if (resource_bstr == NULL) {
         hr = HRESULT_FROM_WIN32(E_OUTOFMEMORY);
-        SCLogWarning(SC_ERR_SYSCALL, "Failed to allocate BSTR");
+        SCLogWarning("Failed to allocate BSTR");
         goto release;
     }
 
@@ -423,17 +419,14 @@ static HRESULT ComInstanceInit(ComInstance *instance, LPCWSTR resource)
         hr = S_OK;
     } else {
         if (hr != S_OK) {
-            SCLogWarning(SC_ERR_SYSCALL,
-                         "COM CoInitializeEx failed: 0x%" PRIx32, (uint32_t)hr);
+            SCLogWarning("COM CoInitializeEx failed: 0x%" PRIx32, (uint32_t)hr);
             goto release;
         }
         hr = CoInitializeSecurity(
                 NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT,
                 RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
         if (hr != S_OK) {
-            SCLogWarning(SC_ERR_SYSCALL,
-                         "COM CoInitializeSecurity failed: 0x%" PRIx32,
-                         (uint32_t)hr);
+            SCLogWarning("COM CoInitializeSecurity failed: 0x%" PRIx32, (uint32_t)hr);
             goto release;
         }
     }
@@ -442,16 +435,14 @@ static HRESULT ComInstanceInit(ComInstance *instance, LPCWSTR resource)
     hr = CoCreateInstance(&CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER,
                           &IID_IWbemLocator, (LPVOID *)&instance->locator);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL, "COM CoCreateInstance failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("COM CoCreateInstance failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
     hr = instance->locator->lpVtbl->ConnectServer(
             instance->locator, resource_bstr, NULL, NULL, NULL, 0, NULL, NULL,
             &instance->services);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL, "COM ConnectServer failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("COM ConnectServer failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -493,7 +484,7 @@ static HRESULT GetWbemClass(ComInstance *instance, LPCWSTR name,
     name_bstr = SysAllocString(name);
     if (name_bstr == NULL) {
         hr = HRESULT_FROM_WIN32(E_OUTOFMEMORY);
-        SCLogWarning(SC_ERR_SYSCALL, "Failed to allocate BSTR");
+        SCLogWarning("Failed to allocate BSTR");
         goto release;
     }
 
@@ -503,8 +494,7 @@ static HRESULT GetWbemClass(ComInstance *instance, LPCWSTR name,
                                                NULL, p_class, NULL);
     if (hr != S_OK) {
         WbemLogDebug(hr);
-        SCLogWarning(SC_ERR_SYSCALL, "WMI GetObject failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI GetObject failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -532,8 +522,7 @@ static HRESULT GetWbemClassInstance(ComInstance *instance, LPCWSTR name,
     hr = class->lpVtbl->SpawnInstance(class, 0, p_instance);
     if (hr != WBEM_S_NO_ERROR) {
         WbemLogDebug(hr);
-        SCLogWarning(SC_ERR_SYSCALL, "WMI SpawnInstance failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI SpawnInstance failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -563,13 +552,13 @@ static HRESULT GetWbemMethod(ComInstance *com_instance, LPCWSTR class_name,
     BSTR class_name_bstr = SysAllocString(class_name);
     if (class_name_bstr == NULL) {
         hr = HRESULT_FROM_WIN32(E_OUTOFMEMORY);
-        SCLogWarning(SC_ERR_SYSCALL, "Failed to allocate BSTR");
+        SCLogWarning("Failed to allocate BSTR");
         goto release;
     }
     method->method_name = SysAllocString(method_name);
     if (method->method_name == NULL) {
         hr = HRESULT_FROM_WIN32(E_OUTOFMEMORY);
-        SCLogWarning(SC_ERR_SYSCALL, "Failed to allocate BSTR");
+        SCLogWarning("Failed to allocate BSTR");
         goto release;
     }
 
@@ -584,8 +573,7 @@ static HRESULT GetWbemMethod(ComInstance *com_instance, LPCWSTR class_name,
                                   &method->out_params);
     if (hr != WBEM_S_NO_ERROR) {
         WbemLogDebug(hr);
-        SCLogWarning(SC_ERR_SYSCALL, "WMI GetMethod failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI GetMethod failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -631,8 +619,7 @@ static HRESULT GetWbemMethodCall(WbemMethod *method, LPCWSTR instance_path,
     call->instance_path = SysAllocString(instance_path);
     if (call->instance_path == NULL) {
         hr = HRESULT_FROM_WIN32(E_OUTOFMEMORY);
-        SCLogWarning(SC_ERR_SYSCALL, "Failed to allocate BSTR: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("Failed to allocate BSTR: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -641,9 +628,7 @@ static HRESULT GetWbemMethodCall(WbemMethod *method, LPCWSTR instance_path,
                                                   &call->in_params);
     if (hr != S_OK) {
         WbemLogDebug(hr);
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "WMI SpawnInstance failed on in_params: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI SpawnInstance failed on in_params: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -705,9 +690,7 @@ static HRESULT WbemGetSubObject(IWbemClassObject *object, LPCWSTR property_name,
     hr = unknown->lpVtbl->QueryInterface(unknown, &IID_IWbemClassObject,
                                          (void **)sub_object);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "WMI QueryInterface (IWbemClassObject) failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI QueryInterface (IWbemClassObject) failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -768,9 +751,7 @@ static HRESULT GetIUnknown(IWbemClassObject *object, IUnknown **p_unknown)
     hr = object->lpVtbl->QueryInterface(object, &IID_IUnknown,
                                         (void **)p_unknown);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "WMI QueryInterface (IUnknown) failed: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("WMI QueryInterface (IUnknown) failed: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
 
@@ -964,7 +945,7 @@ static HRESULT GetNdisOffload(LPCWSTR if_description, uint32_t *offload_flags)
     IWbemClassObject *ndis_offload = NULL;
 
     if (if_description == NULL) {
-        SCLogWarning(SC_ERR_SYSCALL, "No description specified for device");
+        SCLogWarning("No description specified for device");
         hr = HRESULT_FROM_WIN32(E_INVALIDARG);
         goto release;
     }
@@ -975,17 +956,14 @@ static HRESULT GetNdisOffload(LPCWSTR if_description, uint32_t *offload_flags)
                      wcslen(instance_name_fmt);
     LPWSTR instance_name = SCMalloc((n_chars + 1) * sizeof(wchar_t));
     if (instance_name == NULL) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failed to allocate buffer for instance path");
+        SCLogWarning("Failed to allocate buffer for instance path");
         goto release;
     }
     instance_name[n_chars] = 0; /* defensively null-terminate */
     hr = StringCchPrintfW(instance_name, n_chars, instance_name_fmt, class_name,
                           if_description);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failed to format WMI class instance name: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("Failed to format WMI class instance name: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }
     /* method name */
@@ -1041,8 +1019,7 @@ static HRESULT GetNdisOffload(LPCWSTR if_description, uint32_t *offload_flags)
         size_t if_description_len = wcslen(if_description);
         char *if_description_ansi = SCMalloc(if_description_len + 1);
         if (if_description_ansi == NULL) {
-            SCLogWarning(SC_ERR_SYSCALL,
-                         "Failed to allocate buffer for interface description");
+            SCLogWarning("Failed to allocate buffer for interface description");
             goto release;
         }
         if_description_ansi[if_description_len] = 0;
@@ -1192,26 +1169,23 @@ int GetIfaceOffloadingWin32(const char *pcap_dev, int csum, int other)
                   (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP4) != 0,
                   (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP6) != 0);
     } else {
-        SCLogWarning(SC_ERR_NIC_OFFLOADING,
-                     "NIC offloading on %s: Checksum IPv4 Rx: %d Tx: %d IPv6 "
+        SCLogWarning("NIC offloading on %s: Checksum IPv4 Rx: %d Tx: %d IPv6 "
                      "Rx: %d Tx: %d LSOv1 IPv4: %d LSOv2 IPv4: %d IPv6: %d",
-                     pcap_dev,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP4RX) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP4TX) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP6RX) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP6TX) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV1_IP4) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP4) != 0,
-                     (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP6) != 0);
+                pcap_dev, (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP4RX) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP4TX) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP6RX) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_CSUM_IP6TX) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV1_IP4) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP4) != 0,
+                (offload_flags & WIN32_TCP_OFFLOAD_FLAG_LSOV2_IP6) != 0);
     }
 
 release:
     if (ret == -1) {
         const char *err_str = Win32GetErrorString(err, WmiUtils());
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failure when trying to get feature via syscall for '%s': "
+        SCLogWarning("Failure when trying to get feature via syscall for '%s': "
                      "%s (0x%08" PRIx32 ")",
-                     pcap_dev, err_str, (uint32_t)err);
+                pcap_dev, err_str, (uint32_t)err);
         LocalFree((LPVOID)err_str);
     }
 
@@ -1462,7 +1436,7 @@ static HRESULT SetNdisOffload(LPCWSTR if_description, uint32_t offload_flags,
     IWbemClassObject *ndis_tcp_offload_parameters = NULL;
 
     if (if_description == NULL) {
-        SCLogWarning(SC_ERR_SYSCALL, "No description specified for device");
+        SCLogWarning("No description specified for device");
         return E_INVALIDARG;
     }
 
@@ -1472,17 +1446,14 @@ static HRESULT SetNdisOffload(LPCWSTR if_description, uint32_t offload_flags,
                      wcslen(instance_name_fmt);
     LPWSTR instance_name = SCMalloc((n_chars + 1) * sizeof(wchar_t));
     if (instance_name == NULL) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failed to allocate buffer for instance path");
+        SCLogWarning("Failed to allocate buffer for instance path");
         goto release;
     }
     instance_name[n_chars] = 0; /* defensively null-terminate */
     hr = StringCchPrintfW(instance_name, n_chars, instance_name_fmt, class_name,
                           if_description);
     if (hr != S_OK) {
-        SCLogWarning(SC_ERR_SYSCALL,
-                     "Failed to format WMI class instance name: 0x%" PRIx32,
-                     (uint32_t)hr);
+        SCLogWarning("Failed to format WMI class instance name: 0x%" PRIx32, (uint32_t)hr);
         goto release;
     }