suricata
output-json-dns.c File Reference
#include "suricata-common.h"
#include "debug.h"
#include "detect.h"
#include "pkt-var.h"
#include "conf.h"
#include "threads.h"
#include "threadvars.h"
#include "tm-threads.h"
#include "util-print.h"
#include "util-unittest.h"
#include "util-debug.h"
#include "util-mem.h"
#include "app-layer-parser.h"
#include "output.h"
#include "app-layer-dns-udp.h"
#include "app-layer.h"
#include "util-privs.h"
#include "util-buffer.h"
#include "util-proto-name.h"
#include "util-logopenfile.h"
#include "util-time.h"
#include "output-json.h"
#include "output-json-dns.h"
#include "rust-dns-log-gen.h"
Include dependency graph for output-json-dns.c:

Go to the source code of this file.

Data Structures

struct  LogDnsFileCtx_
 
struct  LogDnsLogThread_
 

Macros

#define QUERY   0
 
#define LOG_QUERIES   BIT_U64(0)
 
#define LOG_ANSWERS   BIT_U64(1)
 
#define LOG_A   BIT_U64(2)
 
#define LOG_NS   BIT_U64(3)
 
#define LOG_MD   BIT_U64(4)
 
#define LOG_MF   BIT_U64(5)
 
#define LOG_CNAME   BIT_U64(6)
 
#define LOG_SOA   BIT_U64(7)
 
#define LOG_MB   BIT_U64(8)
 
#define LOG_MG   BIT_U64(9)
 
#define LOG_MR   BIT_U64(10)
 
#define LOG_NULL   BIT_U64(11)
 
#define LOG_WKS   BIT_U64(12)
 
#define LOG_PTR   BIT_U64(13)
 
#define LOG_HINFO   BIT_U64(14)
 
#define LOG_MINFO   BIT_U64(15)
 
#define LOG_MX   BIT_U64(16)
 
#define LOG_TXT   BIT_U64(17)
 
#define LOG_RP   BIT_U64(18)
 
#define LOG_AFSDB   BIT_U64(19)
 
#define LOG_X25   BIT_U64(20)
 
#define LOG_ISDN   BIT_U64(21)
 
#define LOG_RT   BIT_U64(22)
 
#define LOG_NSAP   BIT_U64(23)
 
#define LOG_NSAPPTR   BIT_U64(24)
 
#define LOG_SIG   BIT_U64(25)
 
#define LOG_KEY   BIT_U64(26)
 
#define LOG_PX   BIT_U64(27)
 
#define LOG_GPOS   BIT_U64(28)
 
#define LOG_AAAA   BIT_U64(29)
 
#define LOG_LOC   BIT_U64(30)
 
#define LOG_NXT   BIT_U64(31)
 
#define LOG_SRV   BIT_U64(32)
 
#define LOG_ATMA   BIT_U64(33)
 
#define LOG_NAPTR   BIT_U64(34)
 
#define LOG_KX   BIT_U64(35)
 
#define LOG_CERT   BIT_U64(36)
 
#define LOG_A6   BIT_U64(37)
 
#define LOG_DNAME   BIT_U64(38)
 
#define LOG_OPT   BIT_U64(39)
 
#define LOG_APL   BIT_U64(40)
 
#define LOG_DS   BIT_U64(41)
 
#define LOG_SSHFP   BIT_U64(42)
 
#define LOG_IPSECKEY   BIT_U64(43)
 
#define LOG_RRSIG   BIT_U64(44)
 
#define LOG_NSEC   BIT_U64(45)
 
#define LOG_DNSKEY   BIT_U64(46)
 
#define LOG_DHCID   BIT_U64(47)
 
#define LOG_NSEC3   BIT_U64(48)
 
#define LOG_NSEC3PARAM   BIT_U64(49)
 
#define LOG_TLSA   BIT_U64(50)
 
#define LOG_HIP   BIT_U64(51)
 
#define LOG_CDS   BIT_U64(52)
 
#define LOG_CDNSKEY   BIT_U64(53)
 
#define LOG_SPF   BIT_U64(54)
 
#define LOG_TKEY   BIT_U64(55)
 
#define LOG_TSIG   BIT_U64(56)
 
#define LOG_MAILA   BIT_U64(57)
 
#define LOG_ANY   BIT_U64(58)
 
#define LOG_URI   BIT_U64(59)
 
#define LOG_FORMAT_GROUPED   BIT_U64(60)
 
#define LOG_FORMAT_DETAILED   BIT_U64(61)
 
#define LOG_FORMAT_ALL   (LOG_FORMAT_GROUPED|LOG_FORMAT_DETAILED)
 
#define LOG_ALL_RRTYPES   (~(uint64_t)(LOG_QUERIES|LOG_ANSWERS|LOG_FORMAT_DETAILED|LOG_FORMAT_GROUPED))
 
#define DNS_VERSION_DEFAULT   DNS_VERSION_2
 
#define DEFAULT_LOG_FILENAME   "dns.json"
 
#define MODULE_NAME   "JsonDnsLog"
 

Typedefs

typedef struct LogDnsFileCtx_ LogDnsFileCtx
 
typedef struct LogDnsLogThread_ LogDnsLogThread
 

Enumerations

enum  DnsRRTypes {
  DNS_RRTYPE_A = 0, DNS_RRTYPE_NS, DNS_RRTYPE_MD, DNS_RRTYPE_MF,
  DNS_RRTYPE_CNAME, DNS_RRTYPE_SOA, DNS_RRTYPE_MB, DNS_RRTYPE_MG,
  DNS_RRTYPE_MR, DNS_RRTYPE_NULL, DNS_RRTYPE_WKS, DNS_RRTYPE_PTR,
  DNS_RRTYPE_HINFO, DNS_RRTYPE_MINFO, DNS_RRTYPE_MX, DNS_RRTYPE_TXT,
  DNS_RRTYPE_RP, DNS_RRTYPE_AFSDB, DNS_RRTYPE_X25, DNS_RRTYPE_ISDN,
  DNS_RRTYPE_RT, DNS_RRTYPE_NSAP, DNS_RRTYPE_NSAPPTR, DNS_RRTYPE_SIG,
  DNS_RRTYPE_KEY, DNS_RRTYPE_PX, DNS_RRTYPE_GPOS, DNS_RRTYPE_AAAA,
  DNS_RRTYPE_LOC, DNS_RRTYPE_NXT, DNS_RRTYPE_SRV, DNS_RRTYPE_ATMA,
  DNS_RRTYPE_NAPTR, DNS_RRTYPE_KX, DNS_RRTYPE_CERT, DNS_RRTYPE_A6,
  DNS_RRTYPE_DNAME, DNS_RRTYPE_OPT, DNS_RRTYPE_APL, DNS_RRTYPE_DS,
  DNS_RRTYPE_SSHFP, DNS_RRTYPE_IPSECKEY, DNS_RRTYPE_RRSIG, DNS_RRTYPE_NSEC,
  DNS_RRTYPE_DNSKEY, DNS_RRTYPE_DHCID, DNS_RRTYPE_NSEC3, DNS_RRTYPE_NSEC3PARAM,
  DNS_RRTYPE_TLSA, DNS_RRTYPE_HIP, DNS_RRTYPE_CDS, DNS_RRTYPE_CDNSKEY,
  DNS_RRTYPE_SPF, DNS_RRTYPE_TKEY, DNS_RRTYPE_TSIG, DNS_RRTYPE_MAILA,
  DNS_RRTYPE_ANY, DNS_RRTYPE_URI, DNS_RRTYPE_MAX
}
 
enum  DnsVersion { DNS_VERSION_1 = 1, DNS_VERSION_2 }
 

Functions

json_t * JsonDNSLogQuery (void *txptr, uint64_t tx_id)
 
json_t * JsonDNSLogAnswer (void *txptr, uint64_t tx_id)
 
void JsonDnsLogRegister (void)
 

Detailed Description

Author
Tom DeCanio td@np.nosp@m.ulse.nosp@m.tech..nosp@m.com

Implements JSON DNS logging portion of the engine.

Definition in file output-json-dns.c.

Macro Definition Documentation

#define DEFAULT_LOG_FILENAME   "dns.json"

Definition at line 612 of file output-json-dns.c.

#define DNS_VERSION_DEFAULT   DNS_VERSION_2

Definition at line 195 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_A   BIT_U64(2)

Definition at line 63 of file output-json-dns.c.

#define LOG_A6   BIT_U64(37)

Definition at line 98 of file output-json-dns.c.

#define LOG_AAAA   BIT_U64(29)

Definition at line 90 of file output-json-dns.c.

#define LOG_AFSDB   BIT_U64(19)

Definition at line 80 of file output-json-dns.c.

#define LOG_ALL_RRTYPES   (~(uint64_t)(LOG_QUERIES|LOG_ANSWERS|LOG_FORMAT_DETAILED|LOG_FORMAT_GROUPED))

Definition at line 126 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer(), and JsonDNSLogQuery().

#define LOG_ANSWERS   BIT_U64(1)

Definition at line 61 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_ANY   BIT_U64(58)

Definition at line 119 of file output-json-dns.c.

#define LOG_APL   BIT_U64(40)

Definition at line 101 of file output-json-dns.c.

#define LOG_ATMA   BIT_U64(33)

Definition at line 94 of file output-json-dns.c.

#define LOG_CDNSKEY   BIT_U64(53)

Definition at line 114 of file output-json-dns.c.

#define LOG_CDS   BIT_U64(52)

Definition at line 113 of file output-json-dns.c.

#define LOG_CERT   BIT_U64(36)

Definition at line 97 of file output-json-dns.c.

#define LOG_CNAME   BIT_U64(6)

Definition at line 67 of file output-json-dns.c.

#define LOG_DHCID   BIT_U64(47)

Definition at line 108 of file output-json-dns.c.

#define LOG_DNAME   BIT_U64(38)

Definition at line 99 of file output-json-dns.c.

#define LOG_DNSKEY   BIT_U64(46)

Definition at line 107 of file output-json-dns.c.

#define LOG_DS   BIT_U64(41)

Definition at line 102 of file output-json-dns.c.

#define LOG_FORMAT_ALL   (LOG_FORMAT_GROUPED|LOG_FORMAT_DETAILED)

Definition at line 125 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_FORMAT_DETAILED   BIT_U64(61)

Definition at line 123 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_FORMAT_GROUPED   BIT_U64(60)

Definition at line 122 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_GPOS   BIT_U64(28)

Definition at line 89 of file output-json-dns.c.

#define LOG_HINFO   BIT_U64(14)

Definition at line 75 of file output-json-dns.c.

#define LOG_HIP   BIT_U64(51)

Definition at line 112 of file output-json-dns.c.

#define LOG_IPSECKEY   BIT_U64(43)

Definition at line 104 of file output-json-dns.c.

#define LOG_ISDN   BIT_U64(21)

Definition at line 82 of file output-json-dns.c.

#define LOG_KEY   BIT_U64(26)

Definition at line 87 of file output-json-dns.c.

#define LOG_KX   BIT_U64(35)

Definition at line 96 of file output-json-dns.c.

#define LOG_LOC   BIT_U64(30)

Definition at line 91 of file output-json-dns.c.

#define LOG_MAILA   BIT_U64(57)

Definition at line 118 of file output-json-dns.c.

#define LOG_MB   BIT_U64(8)

Definition at line 69 of file output-json-dns.c.

#define LOG_MD   BIT_U64(4)

Definition at line 65 of file output-json-dns.c.

#define LOG_MF   BIT_U64(5)

Definition at line 66 of file output-json-dns.c.

#define LOG_MG   BIT_U64(9)

Definition at line 70 of file output-json-dns.c.

#define LOG_MINFO   BIT_U64(15)

Definition at line 76 of file output-json-dns.c.

#define LOG_MR   BIT_U64(10)

Definition at line 71 of file output-json-dns.c.

#define LOG_MX   BIT_U64(16)

Definition at line 77 of file output-json-dns.c.

#define LOG_NAPTR   BIT_U64(34)

Definition at line 95 of file output-json-dns.c.

#define LOG_NS   BIT_U64(3)

Definition at line 64 of file output-json-dns.c.

#define LOG_NSAP   BIT_U64(23)

Definition at line 84 of file output-json-dns.c.

#define LOG_NSAPPTR   BIT_U64(24)

Definition at line 85 of file output-json-dns.c.

#define LOG_NSEC   BIT_U64(45)

Definition at line 106 of file output-json-dns.c.

#define LOG_NSEC3   BIT_U64(48)

Definition at line 109 of file output-json-dns.c.

#define LOG_NSEC3PARAM   BIT_U64(49)

Definition at line 110 of file output-json-dns.c.

#define LOG_NULL   BIT_U64(11)

Definition at line 72 of file output-json-dns.c.

#define LOG_NXT   BIT_U64(31)

Definition at line 92 of file output-json-dns.c.

#define LOG_OPT   BIT_U64(39)

Definition at line 100 of file output-json-dns.c.

#define LOG_PTR   BIT_U64(13)

Definition at line 74 of file output-json-dns.c.

#define LOG_PX   BIT_U64(27)

Definition at line 88 of file output-json-dns.c.

#define LOG_QUERIES   BIT_U64(0)

Definition at line 60 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

#define LOG_RP   BIT_U64(18)

Definition at line 79 of file output-json-dns.c.

#define LOG_RRSIG   BIT_U64(44)

Definition at line 105 of file output-json-dns.c.

#define LOG_RT   BIT_U64(22)

Definition at line 83 of file output-json-dns.c.

#define LOG_SIG   BIT_U64(25)

Definition at line 86 of file output-json-dns.c.

#define LOG_SOA   BIT_U64(7)

Definition at line 68 of file output-json-dns.c.

#define LOG_SPF   BIT_U64(54)

Definition at line 115 of file output-json-dns.c.

#define LOG_SRV   BIT_U64(32)

Definition at line 93 of file output-json-dns.c.

#define LOG_SSHFP   BIT_U64(42)

Definition at line 103 of file output-json-dns.c.

#define LOG_TKEY   BIT_U64(55)

Definition at line 116 of file output-json-dns.c.

#define LOG_TLSA   BIT_U64(50)

Definition at line 111 of file output-json-dns.c.

#define LOG_TSIG   BIT_U64(56)

Definition at line 117 of file output-json-dns.c.

#define LOG_TXT   BIT_U64(17)

Definition at line 78 of file output-json-dns.c.

#define LOG_URI   BIT_U64(59)

Definition at line 120 of file output-json-dns.c.

#define LOG_WKS   BIT_U64(12)

Definition at line 73 of file output-json-dns.c.

#define LOG_X25   BIT_U64(20)

Definition at line 81 of file output-json-dns.c.

#define MODULE_NAME   "JsonDnsLog"

Definition at line 672 of file output-json-dns.c.

Referenced by JsonDnsLogRegister().

#define QUERY   0

Definition at line 58 of file output-json-dns.c.

Typedef Documentation

typedef struct LogDnsFileCtx_ LogDnsFileCtx

Enumeration Type Documentation

enum DnsRRTypes
Enumerator
DNS_RRTYPE_A 
DNS_RRTYPE_NS 
DNS_RRTYPE_MD 
DNS_RRTYPE_MF 
DNS_RRTYPE_CNAME 
DNS_RRTYPE_SOA 
DNS_RRTYPE_MB 
DNS_RRTYPE_MG 
DNS_RRTYPE_MR 
DNS_RRTYPE_NULL 
DNS_RRTYPE_WKS 
DNS_RRTYPE_PTR 
DNS_RRTYPE_HINFO 
DNS_RRTYPE_MINFO 
DNS_RRTYPE_MX 
DNS_RRTYPE_TXT 
DNS_RRTYPE_RP 
DNS_RRTYPE_AFSDB 
DNS_RRTYPE_X25 
DNS_RRTYPE_ISDN 
DNS_RRTYPE_RT 
DNS_RRTYPE_NSAP 
DNS_RRTYPE_NSAPPTR 
DNS_RRTYPE_SIG 
DNS_RRTYPE_KEY 
DNS_RRTYPE_PX 
DNS_RRTYPE_GPOS 
DNS_RRTYPE_AAAA 
DNS_RRTYPE_LOC 
DNS_RRTYPE_NXT 
DNS_RRTYPE_SRV 
DNS_RRTYPE_ATMA 
DNS_RRTYPE_NAPTR 
DNS_RRTYPE_KX 
DNS_RRTYPE_CERT 
DNS_RRTYPE_A6 
DNS_RRTYPE_DNAME 
DNS_RRTYPE_OPT 
DNS_RRTYPE_APL 
DNS_RRTYPE_DS 
DNS_RRTYPE_SSHFP 
DNS_RRTYPE_IPSECKEY 
DNS_RRTYPE_RRSIG 
DNS_RRTYPE_NSEC 
DNS_RRTYPE_DNSKEY 
DNS_RRTYPE_DHCID 
DNS_RRTYPE_NSEC3 
DNS_RRTYPE_NSEC3PARAM 
DNS_RRTYPE_TLSA 
DNS_RRTYPE_HIP 
DNS_RRTYPE_CDS 
DNS_RRTYPE_CDNSKEY 
DNS_RRTYPE_SPF 
DNS_RRTYPE_TKEY 
DNS_RRTYPE_TSIG 
DNS_RRTYPE_MAILA 
DNS_RRTYPE_ANY 
DNS_RRTYPE_URI 
DNS_RRTYPE_MAX 

Definition at line 128 of file output-json-dns.c.

enum DnsVersion
Enumerator
DNS_VERSION_1 
DNS_VERSION_2 

Definition at line 190 of file output-json-dns.c.

Function Documentation

json_t* JsonDNSLogQuery ( void *  txptr,
uint64_t  tx_id 
)

Definition at line 276 of file output-json-dns.c.

References LOG_ALL_RRTYPES, and unlikely.

void JsonDnsLogRegister ( void  )

Definition at line 673 of file output-json-dns.c.

References ALPROTO_DNS, LOGGER_JSON_DNS_TC, LOGGER_JSON_DNS_TS, MODULE_NAME, OutputRegisterTxModuleWithProgress(), and OutputRegisterTxSubModuleWithProgress().

Referenced by OutputRegisterLoggers().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char* config_rrtype

Definition at line 198 of file output-json-dns.c.

Referenced by JsonDNSLogAnswer().

uint64_t flags

Definition at line 199 of file output-json-dns.c.