]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dns json v2 (C) - log rrtype in response
authorJason Ish <ish@unx.ca>
Fri, 7 Dec 2018 15:26:31 +0000 (09:26 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 10 Dec 2018 13:32:27 +0000 (14:32 +0100)
Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2723

src/output-json-dns.c

index e70a7f263278083514deba2d9d27747971776603..02dc438fb3992c60c0b1b58e2e9c036226513c62 100644 (file)
@@ -861,8 +861,8 @@ static json_t *BuildAnswer(DNSTransaction *tx, uint64_t tx_id, uint64_t flags,
     DNSCreateRcodeString(tx->rcode, rcode, sizeof(rcode));
     json_object_set_new(js, "rcode", json_string(rcode));
 
-    /* Log the query rrname. Mostly useful on error, but still
-     * useful. */
+    /* Log the query rrname and rrtype. Mostly useful on error, but
+     * still useful. */
     DNSQueryEntry *query = TAILQ_FIRST(&tx->query_list);
     if (query != NULL) {
         char *c;
@@ -872,6 +872,9 @@ static json_t *BuildAnswer(DNSTransaction *tx, uint64_t tx_id, uint64_t flags,
             json_object_set_new(js, "rrname", json_string(c));
             SCFree(c);
         }
+        char rrtype[16] = "";
+        DNSCreateTypeString(query->type, rrtype, sizeof(rrtype));
+        json_object_set_new(js, "rrtype", json_string(rrtype));
     }
 
     if (flags & LOG_FORMAT_DETAILED) {