]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Simple code fixes
authorDuarte Silva <development@serializing.me>
Tue, 12 Aug 2014 17:13:52 +0000 (18:13 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 14 Aug 2014 08:19:47 +0000 (10:19 +0200)
- Removed unnecessary assignment of the data field
- Removed else condition (same function called for IPv4 and IPV6)
- Fixed constants to be a power of two (used in bitwise operations)

src/alert-debuglog.c
src/alert-unified2-alert.c
src/output-json-alert.c
src/reputation.h

index 361b070a3e21540944a7046b54a9afeccf074309..0a7402047256916cbb8fef582f992d18d8547c82 100644 (file)
@@ -500,9 +500,7 @@ static int AlertDebugLogCondition(ThreadVars *tv, const Packet *p)
 
 static int AlertDebugLogLogger(ThreadVars *tv, void *thread_data, const Packet *p)
 {
-    if (PKT_IS_IPV4(p)) {
-        return AlertDebugLogger(tv, p, thread_data);
-    } else if (PKT_IS_IPV6(p)) {
+    if (PKT_IS_IPV4(p) || PKT_IS_IPV6(p)) {
         return AlertDebugLogger(tv, p, thread_data);
     } else if (p->events.cnt > 0) {
         return AlertDebugLogDecoderEvent(tv, p, thread_data);
index bdf7c5e7b82fdb8552a7a3ecc72356f92015d950..9a0a280682c0ab1a93b90e9a5930cdad1a78532b 100644 (file)
@@ -1394,7 +1394,6 @@ OutputCtx *Unified2AlertInitCtx(ConfNode *conf)
     output_ctx = SCCalloc(1, sizeof(OutputCtx));
     if (unlikely(output_ctx == NULL))
         goto error;
-    output_ctx->data = file_ctx;
 
     Unified2AlertFileCtx *unified2alert_ctx = SCMalloc(sizeof(Unified2AlertFileCtx));
     if (unlikely(unified2alert_ctx == NULL)) {
index e20a80cf0876988a96f8865e1520f39311980545..d4d9f72d43d79b14f2b66f9a4573fc0edc48b223 100644 (file)
@@ -67,7 +67,7 @@
 #define LOG_JSON_PAYLOAD 1
 #define LOG_JSON_PACKET 2
 #define LOG_JSON_PAYLOAD_BASE64 4
-#define LOG_JSON_HTTP 5
+#define LOG_JSON_HTTP 8
 
 #define JSON_STREAM_BUFFER_SIZE 4096
 
index 1266bf500a842b335d4d487274fac1b665d0241d..4e35830d82ffb82e75cf4fe0cc0689eaded2ea5d 100644 (file)
@@ -88,7 +88,7 @@ typedef struct Reputation_ {
 /* flags for transactions */
 #define TRANSACTION_FLAG_NEEDSYNC 0x01 /**< We will apply the transaction only if necesary */
 #define TRANSACTION_FLAG_INCS     0x02 /**< We will increment only if necesary */
-#define TRANSACTION_FLAG_DECS     0x03 /**< We will decrement only if necesary */
+#define TRANSACTION_FLAG_DECS     0x04 /**< We will decrement only if necesary */
 
 /* transaction for feedback */
 typedef struct ReputationTransaction_ {