From 3241732e277b6a79cb005dd1dd05799a489cbe19 Mon Sep 17 00:00:00 2001 From: Tom DeCanio Date: Tue, 12 Nov 2013 17:28:16 -0800 Subject: [PATCH] rename alert-json.[ch] output-json.[ch] --- src/Makefile.am | 2 +- src/output-dnslog.c | 19 ++++++++++++------- src/output-httplog.c | 2 +- src/{alert-json.c => output-json.c} | 6 ++---- src/{alert-json.h => output-json.h} | 1 - src/output-tlslog.c | 2 +- src/suricata.c | 2 +- 7 files changed, 18 insertions(+), 16 deletions(-) rename src/{alert-json.c => output-json.c} (99%) rename src/{alert-json.h => output-json.h} (99%) diff --git a/src/Makefile.am b/src/Makefile.am index 7824318313..18c86d56a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,6 @@ bin_PROGRAMS = suricata suricata_SOURCES = \ alert-debuglog.c alert-debuglog.h \ alert-fastlog.c alert-fastlog.h \ -alert-json.c alert-json.h \ alert-pcapinfo.c alert-pcapinfo.h \ alert-prelude.c alert-prelude.h \ alert-syslog.c alert-syslog.h \ @@ -221,6 +220,7 @@ output-packet.c output-packet.h \ output-tx.c output-tx.h \ output-dnslog.c output-dnslog.h \ output-httplog.c output-httplog.h \ +output-json.c output-json.h \ output-tlslog.c output-tlslog.h \ packet-queue.c packet-queue.h \ pkt-var.c pkt-var.h \ diff --git a/src/output-dnslog.c b/src/output-dnslog.c index 2e4d27e27f..3729b5aee7 100644 --- a/src/output-dnslog.c +++ b/src/output-dnslog.c @@ -48,7 +48,7 @@ #include "util-logopenfile.h" #include "util-time.h" -#include "alert-json.h" +#include "output-json.h" #ifdef HAVE_LIBJANSSON #include @@ -209,12 +209,6 @@ static TmEcode DnsJsonIPWrapper(ThreadVars *tv, Packet *p, void *data, PacketQue AlertJsonThread *aft = (AlertJsonThread *)data; - /* no flow, no htp state */ - if (p->flow == NULL) { - SCLogDebug("no flow"); - SCReturnInt(TM_ECODE_OK); - } - /* check if we have DNS state or not */ FLOWLOCK_WRLOCK(p->flow); /* WRITE lock before we updated flow logged id */ uint16_t proto = AppLayerGetProtoFromPacket(p); @@ -275,6 +269,7 @@ end: SCReturnInt(TM_ECODE_OK); } +#if 0 int OutputDnsNeedsLog(Packet *p) { SCEnter(); @@ -306,11 +301,21 @@ end: SCReturnInt(1); } +#endif TmEcode OutputDnsLog(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueue *postpq) { SCEnter(); + /* no flow, no htp state */ + if (p->flow == NULL) { + SCReturnInt(TM_ECODE_OK); + } + + if (!(PKT_IS_UDP(p)) && !(PKT_IS_TCP(p))) { + SCReturnInt(TM_ECODE_OK); + } + DnsJsonIPWrapper(tv, p, data, pq, postpq, AF_INET); SCReturnInt(TM_ECODE_OK); diff --git a/src/output-httplog.c b/src/output-httplog.c index c80ae3ae8c..53dda2eba3 100644 --- a/src/output-httplog.c +++ b/src/output-httplog.c @@ -47,7 +47,7 @@ #include "util-proto-name.h" #include "util-logopenfile.h" #include "util-time.h" -#include "alert-json.h" +#include "output-json.h" #ifdef HAVE_LIBJANSSON #include diff --git a/src/alert-json.c b/src/output-json.c similarity index 99% rename from src/alert-json.c rename to src/output-json.c index b3f5fc5218..93927e5517 100644 --- a/src/alert-json.c +++ b/src/output-json.c @@ -60,7 +60,7 @@ #include "util-buffer.h" #include "util-logopenfile.h" -#include "alert-json.h" +#include "output-json.h" #ifndef HAVE_LIBJANSSON @@ -524,9 +524,7 @@ TmEcode AlertJson (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe } if (outputFlags & OUTPUT_DNS) { - if (OutputDnsNeedsLog(p)) { - OutputDnsLog(tv, p, data, pq, postpq); - } + OutputDnsLog(tv, p, data, pq, postpq); } if (outputFlags & OUTPUT_HTTP) { diff --git a/src/alert-json.h b/src/output-json.h similarity index 99% rename from src/alert-json.h rename to src/output-json.h index aa8e8fb1fd..fb981807df 100644 --- a/src/alert-json.h +++ b/src/output-json.h @@ -63,4 +63,3 @@ typedef struct AlertJsonThread_ { #endif /* HAVE_LIBJANSSON */ #endif /* __ALERT_JSON_H__ */ - diff --git a/src/output-tlslog.c b/src/output-tlslog.c index b3fd376770..f78b27225b 100644 --- a/src/output-tlslog.c +++ b/src/output-tlslog.c @@ -48,7 +48,7 @@ #include "util-logopenfile.h" #include "util-crypt.h" -#include "alert-json.h" +#include "output-json.h" #ifdef HAVE_LIBJANSSON #include diff --git a/src/suricata.c b/src/suricata.c index 6bd214d267..5161835444 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -78,7 +78,6 @@ #include "alert-prelude.h" #include "alert-syslog.h" #include "alert-pcapinfo.h" -#include "alert-json.h" #include "log-droplog.h" #include "log-httplog.h" @@ -88,6 +87,7 @@ #include "log-file.h" #include "log-filestore.h" +#include "output-json.h" #include "output-dnslog.h" #include "output-httplog.h"