aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/dns.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2025-02-11 15:48:53 +0100
committerGitHub <noreply@github.com>2025-02-11 15:48:53 +0100
commit1dccaf37b075ebfb726d407b9c4d95fcf2983135 (patch)
tree866227cce31642e6aaa8ac2073f14605dd12cd74 /src/lib/protocols/dns.c
parent73d1856525d99a22328d50dc15a24940a3f86922 (diff)
DNS: fix check for DGA domain (#2716)
If we have a (potential) valid sub-classification, we shoudn't check for DGA, even if the subclassification itself is disabled!
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r--src/lib/protocols/dns.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c
index 19215e79b..b2223f4a9 100644
--- a/src/lib/protocols/dns.c
+++ b/src/lib/protocols/dns.c
@@ -822,6 +822,8 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
ndpi_get_current_time(flow));
}
+ ndpi_check_dga_name(ndpi_struct, flow, flow->host_server_name, 1, 0, ret.proto.app_protocol != NDPI_PROTOCOL_UNKNOWN);
+
if(!ndpi_struct->cfg.dns_subclassification_enabled)
ret.proto.app_protocol = NDPI_PROTOCOL_UNKNOWN;
@@ -830,8 +832,6 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
else
ret.proto.master_protocol = NDPI_PROTOCOL_DNS;
- ndpi_check_dga_name(ndpi_struct, flow, flow->host_server_name, 1, 0);
-
/* Category is always NDPI_PROTOCOL_CATEGORY_NETWORK, regardless of the subprotocol */
flow->category = NDPI_PROTOCOL_CATEGORY_NETWORK;
}
@@ -854,6 +854,8 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
return; /* The response will set the verdict */
}
+ if(strlen(flow->host_server_name) > 0)
+
flow->protos.dns.num_queries = (u_int8_t)dns_header.num_queries,
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);