From 21bbf836051feae4e50d71c926c6f9f239230393 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Thu, 10 Apr 2025 12:44:15 +0200 Subject: FPC: save all addresses from DNS to `fpc_dns` cache (#2792) --- src/lib/protocols/dns.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lib/protocols/dns.c') diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index 9acc49216..c55e1e614 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -444,9 +444,8 @@ static int process_answers(struct ndpi_detection_module_struct *ndpi_struct, found = 1; } - /* Add to FPC DNS cache */ - if(flow->protos.dns.num_rsp_addr == 1 && /* Only the first one */ - ndpi_struct->cfg.fpc_enabled && + /* Add (all addresses) to FPC DNS cache */ + if(ndpi_struct->cfg.fpc_enabled && proto->app_protocol != NDPI_PROTOCOL_UNKNOWN && proto->app_protocol != proto->master_protocol && ndpi_struct->fpc_dns_cache) { @@ -454,6 +453,9 @@ static int process_answers(struct ndpi_detection_module_struct *ndpi_struct, fpc_dns_cache_key_from_packet(packet->payload + x, data_len), proto->app_protocol, ndpi_get_current_time(flow)); + + NDPI_LOG_DBG(ndpi_struct, "Adding entry to fpc_dns: %s proto %d\n", + data_len == 4 ? "ipv4" : "ipv6", proto->app_protocol); } } -- cgit v1.2.3