suricata
output-json-dns.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Tom DeCanio <td@npulsetech.com>
22  *
23  * Implements JSON DNS logging portion of the engine.
24  */
25 
26 #include "suricata-common.h"
27 #include "conf.h"
28 
29 #include "threadvars.h"
30 
31 #include "util-debug.h"
32 #include "util-mem.h"
33 #include "app-layer-parser.h"
34 #include "output.h"
35 
36 #include "output-json.h"
37 #include "output-json-dns.h"
38 #include "rust.h"
39 
40 /* we can do query logging as well, but it's disabled for now as the
41  * TX id handling doesn't expect it */
42 #define QUERY 0
43 
44 #define LOG_QUERIES BIT_U64(0)
45 #define LOG_ANSWERS BIT_U64(1)
46 
47 #define LOG_A BIT_U64(2)
48 #define LOG_NS BIT_U64(3)
49 #define LOG_MD BIT_U64(4)
50 #define LOG_MF BIT_U64(5)
51 #define LOG_CNAME BIT_U64(6)
52 #define LOG_SOA BIT_U64(7)
53 #define LOG_MB BIT_U64(8)
54 #define LOG_MG BIT_U64(9)
55 #define LOG_MR BIT_U64(10)
56 #define LOG_NULL BIT_U64(11)
57 #define LOG_WKS BIT_U64(12)
58 #define LOG_PTR BIT_U64(13)
59 #define LOG_HINFO BIT_U64(14)
60 #define LOG_MINFO BIT_U64(15)
61 #define LOG_MX BIT_U64(16)
62 #define LOG_TXT BIT_U64(17)
63 #define LOG_RP BIT_U64(18)
64 #define LOG_AFSDB BIT_U64(19)
65 #define LOG_X25 BIT_U64(20)
66 #define LOG_ISDN BIT_U64(21)
67 #define LOG_RT BIT_U64(22)
68 #define LOG_NSAP BIT_U64(23)
69 #define LOG_NSAPPTR BIT_U64(24)
70 #define LOG_SIG BIT_U64(25)
71 #define LOG_KEY BIT_U64(26)
72 #define LOG_PX BIT_U64(27)
73 #define LOG_GPOS BIT_U64(28)
74 #define LOG_AAAA BIT_U64(29)
75 #define LOG_LOC BIT_U64(30)
76 #define LOG_NXT BIT_U64(31)
77 #define LOG_SRV BIT_U64(32)
78 #define LOG_ATMA BIT_U64(33)
79 #define LOG_NAPTR BIT_U64(34)
80 #define LOG_KX BIT_U64(35)
81 #define LOG_CERT BIT_U64(36)
82 #define LOG_A6 BIT_U64(37)
83 #define LOG_DNAME BIT_U64(38)
84 #define LOG_OPT BIT_U64(39)
85 #define LOG_APL BIT_U64(40)
86 #define LOG_DS BIT_U64(41)
87 #define LOG_SSHFP BIT_U64(42)
88 #define LOG_IPSECKEY BIT_U64(43)
89 #define LOG_RRSIG BIT_U64(44)
90 #define LOG_NSEC BIT_U64(45)
91 #define LOG_DNSKEY BIT_U64(46)
92 #define LOG_DHCID BIT_U64(47)
93 #define LOG_NSEC3 BIT_U64(48)
94 #define LOG_NSEC3PARAM BIT_U64(49)
95 #define LOG_TLSA BIT_U64(50)
96 #define LOG_HIP BIT_U64(51)
97 #define LOG_CDS BIT_U64(52)
98 #define LOG_CDNSKEY BIT_U64(53)
99 #define LOG_SPF BIT_U64(54)
100 #define LOG_TKEY BIT_U64(55)
101 #define LOG_TSIG BIT_U64(56)
102 #define LOG_MAILA BIT_U64(57)
103 #define LOG_ANY BIT_U64(58)
104 #define LOG_URI BIT_U64(59)
105 
106 #define LOG_FORMAT_GROUPED BIT_U64(60)
107 #define LOG_FORMAT_DETAILED BIT_U64(61)
108 #define LOG_HTTPS BIT_U64(62)
109 
110 #define LOG_FORMAT_ALL (LOG_FORMAT_GROUPED|LOG_FORMAT_DETAILED)
111 #define LOG_ALL_RRTYPES (~(uint64_t)(LOG_QUERIES|LOG_ANSWERS|LOG_FORMAT_DETAILED|LOG_FORMAT_GROUPED))
112 
113 typedef enum {
174 } DnsRRTypes;
175 
176 static struct {
177  const char *config_rrtype;
178  uint64_t flags;
179 } dns_rrtype_fields[] = {
180  // clang-format off
181  { "a", LOG_A },
182  { "ns", LOG_NS },
183  { "md", LOG_MD },
184  { "mf", LOG_MF },
185  { "cname", LOG_CNAME },
186  { "soa", LOG_SOA },
187  { "mb", LOG_MB },
188  { "mg", LOG_MG },
189  { "mr", LOG_MR },
190  { "null", LOG_NULL },
191  { "wks", LOG_WKS },
192  { "ptr", LOG_PTR },
193  { "hinfo", LOG_HINFO },
194  { "minfo", LOG_MINFO },
195  { "mx", LOG_MX },
196  { "txt", LOG_TXT },
197  { "rp", LOG_RP },
198  { "afsdb", LOG_AFSDB },
199  { "x25", LOG_X25 },
200  { "isdn", LOG_ISDN },
201  { "rt", LOG_RT },
202  { "nsap", LOG_NSAP },
203  { "nsapptr", LOG_NSAPPTR },
204  { "sig", LOG_SIG },
205  { "key", LOG_KEY },
206  { "px", LOG_PX },
207  { "gpos", LOG_GPOS },
208  { "aaaa", LOG_AAAA },
209  { "loc", LOG_LOC },
210  { "nxt", LOG_NXT },
211  { "srv", LOG_SRV },
212  { "atma", LOG_ATMA },
213  { "naptr", LOG_NAPTR },
214  { "kx", LOG_KX },
215  { "cert", LOG_CERT },
216  { "a6", LOG_A6 },
217  { "dname", LOG_DNAME },
218  { "opt", LOG_OPT },
219  { "apl", LOG_APL },
220  { "ds", LOG_DS },
221  { "sshfp", LOG_SSHFP },
222  { "ipseckey", LOG_IPSECKEY },
223  { "rrsig", LOG_RRSIG },
224  { "nsec", LOG_NSEC },
225  { "dnskey", LOG_DNSKEY },
226  { "dhcid", LOG_DHCID },
227  { "nsec3", LOG_NSEC3 },
228  { "nsec3param", LOG_NSEC3PARAM },
229  { "tlsa", LOG_TLSA },
230  { "hip", LOG_HIP },
231  { "cds", LOG_CDS },
232  { "cdnskey", LOG_CDNSKEY },
233  { "https", LOG_HTTPS },
234  { "spf", LOG_SPF },
235  { "tkey", LOG_TKEY },
236  { "tsig", LOG_TSIG },
237  { "maila", LOG_MAILA },
238  { "any", LOG_ANY },
239  { "uri", LOG_URI }
240  // clang-format on
241 };
242 
243 typedef struct LogDnsFileCtx_ {
244  uint64_t flags; /** Store mode */
247 
248 typedef struct LogDnsLogThread_ {
252 
253 static JsonBuilder *JsonDNSLogQuery(void *txptr)
254 {
255  JsonBuilder *queryjb = jb_new_array();
256  if (queryjb == NULL) {
257  return NULL;
258  }
259  bool has_query = false;
260 
261  for (uint16_t i = 0; i < UINT16_MAX; i++) {
262  JsonBuilder *js = jb_new_object();
263  if (!rs_dns_log_json_query((void *)txptr, i, LOG_ALL_RRTYPES, js)) {
264  jb_free(js);
265  break;
266  }
267  jb_close(js);
268  has_query = true;
269  jb_append_object(queryjb, js);
270  jb_free(js);
271  }
272 
273  if (!has_query) {
274  jb_free(queryjb);
275  return NULL;
276  }
277 
278  jb_close(queryjb);
279  return queryjb;
280 }
281 
282 static JsonBuilder *JsonDNSLogAnswer(void *txptr)
283 {
284  if (!rs_dns_do_log_answer(txptr, LOG_ALL_RRTYPES)) {
285  return NULL;
286  } else {
287  JsonBuilder *js = jb_new_object();
288  rs_dns_log_json_answer(txptr, LOG_ALL_RRTYPES, js);
289  jb_close(js);
290  return js;
291  }
292 }
293 
294 bool AlertJsonDns(void *txptr, JsonBuilder *js)
295 {
296  bool r = false;
297  jb_open_object(js, "dns");
298  JsonBuilder *qjs = JsonDNSLogQuery(txptr);
299  if (qjs != NULL) {
300  jb_set_object(js, "query", qjs);
301  jb_free(qjs);
302  r = true;
303  }
304  JsonBuilder *ajs = JsonDNSLogAnswer(txptr);
305  if (ajs != NULL) {
306  jb_set_object(js, "answer", ajs);
307  jb_free(ajs);
308  r = true;
309  }
310  jb_close(js);
311  return r;
312 }
313 
314 static int JsonDnsLoggerToServer(ThreadVars *tv, void *thread_data,
315  const Packet *p, Flow *f, void *alstate, void *txptr, uint64_t tx_id)
316 {
317  SCEnter();
318 
319  LogDnsLogThread *td = (LogDnsLogThread *)thread_data;
320  LogDnsFileCtx *dnslog_ctx = td->dnslog_ctx;
321 
322  if (unlikely(dnslog_ctx->flags & LOG_QUERIES) == 0) {
323  return TM_ECODE_OK;
324  }
325 
326  for (uint16_t i = 0; i < 0xffff; i++) {
327  JsonBuilder *jb = CreateEveHeader(p, LOG_DIR_FLOW, "dns", NULL, dnslog_ctx->eve_ctx);
328  if (unlikely(jb == NULL)) {
329  return TM_ECODE_OK;
330  }
331 
332  jb_open_object(jb, "dns");
333  if (!rs_dns_log_json_query(txptr, i, td->dnslog_ctx->flags, jb)) {
334  jb_free(jb);
335  break;
336  }
337  jb_close(jb);
338 
339  OutputJsonBuilderBuffer(jb, td->ctx);
340  jb_free(jb);
341  }
342 
344 }
345 
346 static int JsonDnsLoggerToClient(ThreadVars *tv, void *thread_data,
347  const Packet *p, Flow *f, void *alstate, void *txptr, uint64_t tx_id)
348 {
349  SCEnter();
350 
351  LogDnsLogThread *td = (LogDnsLogThread *)thread_data;
352  LogDnsFileCtx *dnslog_ctx = td->dnslog_ctx;
353 
354  if (unlikely(dnslog_ctx->flags & LOG_ANSWERS) == 0) {
355  return TM_ECODE_OK;
356  }
357 
358  if (rs_dns_do_log_answer(txptr, td->dnslog_ctx->flags)) {
359  JsonBuilder *jb = CreateEveHeader(p, LOG_DIR_FLOW, "dns", NULL, dnslog_ctx->eve_ctx);
360  if (unlikely(jb == NULL)) {
361  return TM_ECODE_OK;
362  }
363 
364  jb_open_object(jb, "dns");
365  rs_dns_log_json_answer(txptr, td->dnslog_ctx->flags, jb);
366  jb_close(jb);
367  OutputJsonBuilderBuffer(jb, td->ctx);
368  jb_free(jb);
369  }
370 
372 }
373 
374 static int JsonDnsLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *alstate,
375  void *txptr, uint64_t tx_id)
376 {
377  if (rs_dns_tx_is_request(txptr)) {
378  return JsonDnsLoggerToServer(tv, thread_data, p, f, alstate, txptr, tx_id);
379  } else if (rs_dns_tx_is_response(txptr)) {
380  return JsonDnsLoggerToClient(tv, thread_data, p, f, alstate, txptr, tx_id);
381  }
382  return TM_ECODE_OK;
383 }
384 
385 static TmEcode LogDnsLogThreadInit(ThreadVars *t, const void *initdata, void **data)
386 {
387  LogDnsLogThread *aft = SCCalloc(1, sizeof(LogDnsLogThread));
388  if (unlikely(aft == NULL))
389  return TM_ECODE_FAILED;
390 
391  if(initdata == NULL)
392  {
393  SCLogDebug("Error getting context for EveLogDNS. \"initdata\" argument NULL");
394  goto error_exit;
395  }
396 
397  /* Use the Output Context (file pointer and mutex) */
398  aft->dnslog_ctx = ((OutputCtx *)initdata)->data;
399  aft->ctx = CreateEveThreadCtx(t, aft->dnslog_ctx->eve_ctx);
400  if (!aft->ctx) {
401  goto error_exit;
402  }
403 
404  *data = (void *)aft;
405  return TM_ECODE_OK;
406 
407 error_exit:
408  SCFree(aft);
409  return TM_ECODE_FAILED;
410 }
411 
412 static TmEcode LogDnsLogThreadDeinit(ThreadVars *t, void *data)
413 {
414  LogDnsLogThread *aft = (LogDnsLogThread *)data;
415  if (aft == NULL) {
416  return TM_ECODE_OK;
417  }
418  FreeEveThreadCtx(aft->ctx);
419 
420  /* clear memory */
421  memset(aft, 0, sizeof(LogDnsLogThread));
422 
423  SCFree(aft);
424  return TM_ECODE_OK;
425 }
426 
427 static void LogDnsLogDeInitCtxSub(OutputCtx *output_ctx)
428 {
429  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
430  LogDnsFileCtx *dnslog_ctx = (LogDnsFileCtx *)output_ctx->data;
431  SCFree(dnslog_ctx);
432  SCFree(output_ctx);
433 }
434 
435 static void JsonDnsLogParseConfig(LogDnsFileCtx *dnslog_ctx, ConfNode *conf,
436  const char *query_key, const char *answer_key,
437  const char *answer_types_key)
438 {
439  const char *query = ConfNodeLookupChildValue(conf, query_key);
440  if (query != NULL) {
441  if (ConfValIsTrue(query)) {
442  dnslog_ctx->flags |= LOG_QUERIES;
443  } else {
444  dnslog_ctx->flags &= ~LOG_QUERIES;
445  }
446  } else {
447  dnslog_ctx->flags |= LOG_QUERIES;
448  }
449 
450  const char *response = ConfNodeLookupChildValue(conf, answer_key);
451  if (response != NULL) {
452  if (ConfValIsTrue(response)) {
453  dnslog_ctx->flags |= LOG_ANSWERS;
454  } else {
455  dnslog_ctx->flags &= ~LOG_ANSWERS;
456  }
457  } else {
458  dnslog_ctx->flags |= LOG_ANSWERS;
459  }
460 
461  ConfNode *custom;
462  if ((custom = ConfNodeLookupChild(conf, answer_types_key)) != NULL) {
463  dnslog_ctx->flags &= ~LOG_ALL_RRTYPES;
464  ConfNode *field;
465  TAILQ_FOREACH (field, &custom->head, next) {
466  DnsRRTypes f;
467  for (f = DNS_RRTYPE_A; f < DNS_RRTYPE_MAX; f++) {
468  if (strcasecmp(dns_rrtype_fields[f].config_rrtype, field->val) == 0) {
469  dnslog_ctx->flags |= dns_rrtype_fields[f].flags;
470  break;
471  }
472  }
473  }
474  } else {
475  dnslog_ctx->flags |= LOG_ALL_RRTYPES;
476  }
477 }
478 
479 static void JsonDnsCheckVersion(ConfNode *conf)
480 {
481  if (conf == NULL) {
482  return;
483  }
484 
485  static bool v1_deprecation_warned = false;
486  const ConfNode *has_version = ConfNodeLookupChild(conf, "version");
487  if (has_version != NULL) {
488  bool invalid = false;
489  intmax_t config_version;
490  if (ConfGetChildValueInt(conf, "version", &config_version)) {
491  switch(config_version) {
492  case 2:
493  break;
494  case 1:
495  if (!v1_deprecation_warned) {
496  SCLogWarning("DNS EVE v1 logging has been removed, will use v2");
497  v1_deprecation_warned = true;
498  }
499  break;
500  default:
501  invalid = true;
502  break;
503  }
504  } else {
505  invalid = true;
506  }
507  if (invalid) {
508  SCLogWarning("Invalid EVE DNS version \"%s\", will use v2", has_version->val);
509  }
510  }
511 }
512 
513 static void JsonDnsLogInitFilters(LogDnsFileCtx *dnslog_ctx, ConfNode *conf)
514 {
515  dnslog_ctx->flags = ~0ULL;
516 
517  if (conf) {
518  JsonDnsLogParseConfig(dnslog_ctx, conf, "requests", "responses", "types");
519  if (dnslog_ctx->flags & LOG_ANSWERS) {
520  ConfNode *format;
521  if ((format = ConfNodeLookupChild(conf, "formats")) != NULL) {
522  uint64_t flags = 0;
523  ConfNode *field;
524  TAILQ_FOREACH (field, &format->head, next) {
525  if (strcasecmp(field->val, "detailed") == 0) {
527  } else if (strcasecmp(field->val, "grouped") == 0) {
529  } else {
530  SCLogWarning("Invalid JSON DNS log format: %s", field->val);
531  }
532  }
533  if (flags) {
534  dnslog_ctx->flags &= ~LOG_FORMAT_ALL;
535  dnslog_ctx->flags |= flags;
536  } else {
537  SCLogWarning("Empty EVE DNS format array, using defaults");
538  }
539  } else {
540  dnslog_ctx->flags |= LOG_FORMAT_ALL;
541  }
542  }
543  }
544 }
545 
546 static OutputInitResult JsonDnsLogInitCtxSub(ConfNode *conf, OutputCtx *parent_ctx)
547 {
548  OutputInitResult result = { NULL, false };
549  const char *enabled = ConfNodeLookupChildValue(conf, "enabled");
550  if (enabled != NULL && !ConfValIsTrue(enabled)) {
551  result.ok = true;
552  return result;
553  }
554 
555  /* As only a single version of logging is supported, this exists to warn about
556  * unsupported versions. */
557  JsonDnsCheckVersion(conf);
558 
559  OutputJsonCtx *ojc = parent_ctx->data;
560 
561  LogDnsFileCtx *dnslog_ctx = SCCalloc(1, sizeof(LogDnsFileCtx));
562  if (unlikely(dnslog_ctx == NULL)) {
563  return result;
564  }
565 
566  dnslog_ctx->eve_ctx = ojc;
567 
568  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
569  if (unlikely(output_ctx == NULL)) {
570  SCFree(dnslog_ctx);
571  return result;
572  }
573 
574  output_ctx->data = dnslog_ctx;
575  output_ctx->DeInit = LogDnsLogDeInitCtxSub;
576 
577  JsonDnsLogInitFilters(dnslog_ctx, conf);
578 
579  SCLogDebug("DNS log sub-module initialized");
580 
583 
584  result.ctx = output_ctx;
585  result.ok = true;
586  return result;
587 }
588 
589 
590 #define MODULE_NAME "JsonDnsLog"
592 {
593  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", MODULE_NAME, "eve-log.dns",
594  JsonDnsLogInitCtxSub, ALPROTO_DNS, JsonDnsLogger, LogDnsLogThreadInit,
595  LogDnsLogThreadDeinit, NULL);
596 }
DNS_RRTYPE_PX
@ DNS_RRTYPE_PX
Definition: output-json-dns.c:139
ConfGetChildValueInt
int ConfGetChildValueInt(const ConfNode *base, const char *name, intmax_t *val)
Definition: conf.c:434
DNS_RRTYPE_AAAA
@ DNS_RRTYPE_AAAA
Definition: output-json-dns.c:141
DNS_RRTYPE_GPOS
@ DNS_RRTYPE_GPOS
Definition: output-json-dns.c:140
LOG_MR
#define LOG_MR
Definition: output-json-dns.c:55
DNS_RRTYPE_TKEY
@ DNS_RRTYPE_TKEY
Definition: output-json-dns.c:168
DNS_RRTYPE_ANY
@ DNS_RRTYPE_ANY
Definition: output-json-dns.c:171
LOG_NULL
#define LOG_NULL
Definition: output-json-dns.c:56
LOG_NSEC3PARAM
#define LOG_NSEC3PARAM
Definition: output-json-dns.c:94
DNS_RRTYPE_OPT
@ DNS_RRTYPE_OPT
Definition: output-json-dns.c:151
LOG_NSEC
#define LOG_NSEC
Definition: output-json-dns.c:90
LOG_RP
#define LOG_RP
Definition: output-json-dns.c:63
LOG_GPOS
#define LOG_GPOS
Definition: output-json-dns.c:73
DNS_RRTYPE_NULL
@ DNS_RRTYPE_NULL
Definition: output-json-dns.c:123
ALPROTO_DNS
@ ALPROTO_DNS
Definition: app-layer-protos.h:41
MODULE_NAME
#define MODULE_NAME
Definition: output-json-dns.c:590
DNS_RRTYPE_MX
@ DNS_RRTYPE_MX
Definition: output-json-dns.c:128
ConfNode_::val
char * val
Definition: conf.h:34
DNS_RRTYPE_HIP
@ DNS_RRTYPE_HIP
Definition: output-json-dns.c:163
LOG_NXT
#define LOG_NXT
Definition: output-json-dns.c:76
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
DNS_RRTYPE_LOC
@ DNS_RRTYPE_LOC
Definition: output-json-dns.c:142
LOG_TLSA
#define LOG_TLSA
Definition: output-json-dns.c:95
DNS_RRTYPE_NS
@ DNS_RRTYPE_NS
Definition: output-json-dns.c:115
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DNS_RRTYPE_MAX
@ DNS_RRTYPE_MAX
Definition: output-json-dns.c:173
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:58
DNS_RRTYPE_X25
@ DNS_RRTYPE_X25
Definition: output-json-dns.c:132
DnsRRTypes
DnsRRTypes
Definition: output-json-dns.c:113
LOG_TKEY
#define LOG_TKEY
Definition: output-json-dns.c:100
OutputJsonCtx_
Definition: output-json.h:79
Flow_
Flow data structure.
Definition: flow.h:351
DNS_RRTYPE_TSIG
@ DNS_RRTYPE_TSIG
Definition: output-json-dns.c:169
DNS_RRTYPE_HTTPS
@ DNS_RRTYPE_HTTPS
Definition: output-json-dns.c:166
LOG_LOC
#define LOG_LOC
Definition: output-json-dns.c:75
OutputJsonBuilderBuffer
int OutputJsonBuilderBuffer(JsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:928
LOG_TSIG
#define LOG_TSIG
Definition: output-json-dns.c:101
LOG_APL
#define LOG_APL
Definition: output-json-dns.c:85
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:252
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:29
LOG_DNSKEY
#define LOG_DNSKEY
Definition: output-json-dns.c:91
rust.h
DNS_RRTYPE_DHCID
@ DNS_RRTYPE_DHCID
Definition: output-json-dns.c:159
LOG_DNAME
#define LOG_DNAME
Definition: output-json-dns.c:83
LOG_ANSWERS
#define LOG_ANSWERS
Definition: output-json-dns.c:45
LOG_NSEC3
#define LOG_NSEC3
Definition: output-json-dns.c:93
LOG_DS
#define LOG_DS
Definition: output-json-dns.c:86
LOG_MAILA
#define LOG_MAILA
Definition: output-json-dns.c:102
LOG_NS
#define LOG_NS
Definition: output-json-dns.c:48
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:85
LOG_CERT
#define LOG_CERT
Definition: output-json-dns.c:81
DNS_RRTYPE_SPF
@ DNS_RRTYPE_SPF
Definition: output-json-dns.c:167
DNS_RRTYPE_WKS
@ DNS_RRTYPE_WKS
Definition: output-json-dns.c:124
LogDnsFileCtx_::flags
uint64_t flags
Definition: output-json-dns.c:244
LOG_MD
#define LOG_MD
Definition: output-json-dns.c:49
LOG_SOA
#define LOG_SOA
Definition: output-json-dns.c:52
LOG_NAPTR
#define LOG_NAPTR
Definition: output-json-dns.c:79
LOG_WKS
#define LOG_WKS
Definition: output-json-dns.c:57
LOG_CDS
#define LOG_CDS
Definition: output-json-dns.c:97
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:537
OutputCtx_::data
void * data
Definition: tm-modules.h:88
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:84
OutputCtx_
Definition: tm-modules.h:85
LOG_URI
#define LOG_URI
Definition: output-json-dns.c:104
LOG_SRV
#define LOG_SRV
Definition: output-json-dns.c:77
OutputJsonThreadCtx_
Definition: output-json.h:87
LOG_HINFO
#define LOG_HINFO
Definition: output-json-dns.c:59
DNS_RRTYPE_URI
@ DNS_RRTYPE_URI
Definition: output-json-dns.c:172
LogDnsFileCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-json-dns.c:245
DNS_RRTYPE_HINFO
@ DNS_RRTYPE_HINFO
Definition: output-json-dns.c:126
DNS_RRTYPE_NSEC
@ DNS_RRTYPE_NSEC
Definition: output-json-dns.c:157
LOG_ATMA
#define LOG_ATMA
Definition: output-json-dns.c:78
LOG_KEY
#define LOG_KEY
Definition: output-json-dns.c:71
LOG_ALL_RRTYPES
#define LOG_ALL_RRTYPES
Definition: output-json-dns.c:111
util-debug.h
DNS_RRTYPE_MF
@ DNS_RRTYPE_MF
Definition: output-json-dns.c:117
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
LOG_MINFO
#define LOG_MINFO
Definition: output-json-dns.c:60
LOG_SIG
#define LOG_SIG
Definition: output-json-dns.c:70
DNS_RRTYPE_RP
@ DNS_RRTYPE_RP
Definition: output-json-dns.c:130
output-json.h
LOG_KX
#define LOG_KX
Definition: output-json-dns.c:80
LOG_A
#define LOG_A
Definition: output-json-dns.c:47
LOG_MF
#define LOG_MF
Definition: output-json-dns.c:50
DNS_RRTYPE_CDNSKEY
@ DNS_RRTYPE_CDNSKEY
Definition: output-json-dns.c:165
LogDnsLogThread_
Definition: output-json-dns.c:248
AppLayerParserRegisterLogger
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:469
DNS_RRTYPE_IPSECKEY
@ DNS_RRTYPE_IPSECKEY
Definition: output-json-dns.c:155
CreateEveHeader
JsonBuilder * CreateEveHeader(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:787
DNS_RRTYPE_KEY
@ DNS_RRTYPE_KEY
Definition: output-json-dns.c:138
SCEnter
#define SCEnter(...)
Definition: util-debug.h:271
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
DNS_RRTYPE_NSEC3PARAM
@ DNS_RRTYPE_NSEC3PARAM
Definition: output-json-dns.c:161
LOG_RT
#define LOG_RT
Definition: output-json-dns.c:67
LogDnsLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-json-dns.c:250
LOG_SSHFP
#define LOG_SSHFP
Definition: output-json-dns.c:87
OutputInitResult_::ok
bool ok
Definition: output.h:48
DNS_RRTYPE_A
@ DNS_RRTYPE_A
Definition: output-json-dns.c:114
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:249
DNS_RRTYPE_DNAME
@ DNS_RRTYPE_DNAME
Definition: output-json-dns.c:150
app-layer-parser.h
DNS_RRTYPE_RRSIG
@ DNS_RRTYPE_RRSIG
Definition: output-json-dns.c:156
DNS_RRTYPE_DS
@ DNS_RRTYPE_DS
Definition: output-json-dns.c:153
LOG_RRSIG
#define LOG_RRSIG
Definition: output-json-dns.c:89
LOG_MG
#define LOG_MG
Definition: output-json-dns.c:54
DNS_RRTYPE_MAILA
@ DNS_RRTYPE_MAILA
Definition: output-json-dns.c:170
DNS_RRTYPE_TXT
@ DNS_RRTYPE_TXT
Definition: output-json-dns.c:129
Packet_
Definition: decode.h:437
DNS_RRTYPE_AFSDB
@ DNS_RRTYPE_AFSDB
Definition: output-json-dns.c:131
DNS_RRTYPE_ATMA
@ DNS_RRTYPE_ATMA
Definition: output-json-dns.c:145
DNS_RRTYPE_KX
@ DNS_RRTYPE_KX
Definition: output-json-dns.c:147
DNS_RRTYPE_PTR
@ DNS_RRTYPE_PTR
Definition: output-json-dns.c:125
conf.h
DNS_RRTYPE_NSAP
@ DNS_RRTYPE_NSAP
Definition: output-json-dns.c:135
LOG_ANY
#define LOG_ANY
Definition: output-json-dns.c:103
TmEcode
TmEcode
Definition: tm-threads-common.h:83
LOG_MB
#define LOG_MB
Definition: output-json-dns.c:53
LogDnsFileCtx_
Definition: output-json-dns.c:243
LOG_PTR
#define LOG_PTR
Definition: output-json-dns.c:58
DNS_RRTYPE_ISDN
@ DNS_RRTYPE_ISDN
Definition: output-json-dns.c:133
DNS_RRTYPE_TLSA
@ DNS_RRTYPE_TLSA
Definition: output-json-dns.c:162
DNS_RRTYPE_NSEC3
@ DNS_RRTYPE_NSEC3
Definition: output-json-dns.c:160
LOG_HTTPS
#define LOG_HTTPS
Definition: output-json-dns.c:108
DNS_RRTYPE_A6
@ DNS_RRTYPE_A6
Definition: output-json-dns.c:149
DNS_RRTYPE_CERT
@ DNS_RRTYPE_CERT
Definition: output-json-dns.c:148
ConfNodeLookupChild
ConfNode * ConfNodeLookupChild(const ConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:786
LOG_HIP
#define LOG_HIP
Definition: output-json-dns.c:96
util-mem.h
LOG_NSAP
#define LOG_NSAP
Definition: output-json-dns.c:68
LOG_AAAA
#define LOG_AAAA
Definition: output-json-dns.c:74
LOG_DHCID
#define LOG_DHCID
Definition: output-json-dns.c:92
OutputInitResult_
Definition: output.h:46
DNS_RRTYPE_SIG
@ DNS_RRTYPE_SIG
Definition: output-json-dns.c:137
AlertJsonDns
bool AlertJsonDns(void *txptr, JsonBuilder *js)
Definition: output-json-dns.c:294
DNS_RRTYPE_NXT
@ DNS_RRTYPE_NXT
Definition: output-json-dns.c:143
LOG_CNAME
#define LOG_CNAME
Definition: output-json-dns.c:51
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:91
LogDnsFileCtx
struct LogDnsFileCtx_ LogDnsFileCtx
LOG_QUERIES
#define LOG_QUERIES
Definition: output-json-dns.c:44
OutputRegisterTxSubModule
void OutputRegisterTxSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output.c:404
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
LOG_FORMAT_GROUPED
#define LOG_FORMAT_GROUPED
Definition: output-json-dns.c:106
LogDnsLogThread
struct LogDnsLogThread_ LogDnsLogThread
threadvars.h
LOG_DIR_FLOW
@ LOG_DIR_FLOW
Definition: output-json.h:38
output-json-dns.h
LOG_NSAPPTR
#define LOG_NSAPPTR
Definition: output-json-dns.c:69
LOGGER_JSON_TX
@ LOGGER_JSON_TX
Definition: suricata-common.h:467
DNS_RRTYPE_DNSKEY
@ DNS_RRTYPE_DNSKEY
Definition: output-json-dns.c:158
JsonDnsLogRegister
void JsonDnsLogRegister(void)
Definition: output-json-dns.c:591
DNS_RRTYPE_MG
@ DNS_RRTYPE_MG
Definition: output-json-dns.c:121
LOG_CDNSKEY
#define LOG_CDNSKEY
Definition: output-json-dns.c:98
SCFree
#define SCFree(p)
Definition: util-mem.h:61
DNS_RRTYPE_MR
@ DNS_RRTYPE_MR
Definition: output-json-dns.c:122
ConfNode_
Definition: conf.h:32
LOG_ISDN
#define LOG_ISDN
Definition: output-json-dns.c:66
LOG_OPT
#define LOG_OPT
Definition: output-json-dns.c:84
DNS_RRTYPE_SOA
@ DNS_RRTYPE_SOA
Definition: output-json-dns.c:119
DNS_RRTYPE_RT
@ DNS_RRTYPE_RT
Definition: output-json-dns.c:134
LOG_X25
#define LOG_X25
Definition: output-json-dns.c:65
LOG_MX
#define LOG_MX
Definition: output-json-dns.c:61
DNS_RRTYPE_APL
@ DNS_RRTYPE_APL
Definition: output-json-dns.c:152
DNS_RRTYPE_SSHFP
@ DNS_RRTYPE_SSHFP
Definition: output-json-dns.c:154
LOG_FORMAT_DETAILED
#define LOG_FORMAT_DETAILED
Definition: output-json-dns.c:107
DNS_RRTYPE_NSAPPTR
@ DNS_RRTYPE_NSAPPTR
Definition: output-json-dns.c:136
DNS_RRTYPE_MB
@ DNS_RRTYPE_MB
Definition: output-json-dns.c:120
DNS_RRTYPE_CDS
@ DNS_RRTYPE_CDS
Definition: output-json-dns.c:164
LOG_FORMAT_ALL
#define LOG_FORMAT_ALL
Definition: output-json-dns.c:110
LOG_TXT
#define LOG_TXT
Definition: output-json-dns.c:62
flags
uint64_t flags
Definition: output-json-dns.c:178
LOG_IPSECKEY
#define LOG_IPSECKEY
Definition: output-json-dns.c:88
DNS_RRTYPE_MD
@ DNS_RRTYPE_MD
Definition: output-json-dns.c:116
DNS_RRTYPE_NAPTR
@ DNS_RRTYPE_NAPTR
Definition: output-json-dns.c:146
DNS_RRTYPE_SRV
@ DNS_RRTYPE_SRV
Definition: output-json-dns.c:144
DNS_RRTYPE_MINFO
@ DNS_RRTYPE_MINFO
Definition: output-json-dns.c:127
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
LogDnsLogThread_::dnslog_ctx
LogDnsFileCtx * dnslog_ctx
Definition: output-json-dns.c:249
LOG_A6
#define LOG_A6
Definition: output-json-dns.c:82
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:275
output.h
DNS_RRTYPE_CNAME
@ DNS_RRTYPE_CNAME
Definition: output-json-dns.c:118
LOG_PX
#define LOG_PX
Definition: output-json-dns.c:72
LOG_SPF
#define LOG_SPF
Definition: output-json-dns.c:99
config_rrtype
const char * config_rrtype
Definition: output-json-dns.c:177
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:814
LOG_AFSDB
#define LOG_AFSDB
Definition: output-json-dns.c:64