aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/dns.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2024-08-24 16:30:58 +0200
committerLuca Deri <deri@ntop.org>2024-08-24 16:30:58 +0200
commit53a6bae365618f9b301cf51e5f3f9d5450b0e280 (patch)
tree922e0791f71403d03d90fa2958e102fa2a727bfd /src/lib/protocols/dns.c
parent8894ebc76f4e3d928dd3c2e32a0470149ce90550 (diff)
Introduced ndpi_master_app_protocol typedef
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r--src/lib/protocols/dns.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c
index 7fc2e2085..94367d318 100644
--- a/src/lib/protocols/dns.c
+++ b/src/lib/protocols/dns.c
@@ -699,8 +699,8 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
u_int num_queries, idx;
char _hostname[256];
- ret.master_protocol = NDPI_PROTOCOL_UNKNOWN;
- ret.app_protocol = (d_port == LLMNR_PORT) ? NDPI_PROTOCOL_LLMNR : (((d_port == MDNS_PORT) && isLLMNRMulticastAddress(packet) ) ? NDPI_PROTOCOL_MDNS : NDPI_PROTOCOL_DNS);
+ ret.proto.master_protocol = NDPI_PROTOCOL_UNKNOWN;
+ ret.proto.app_protocol = (d_port == LLMNR_PORT) ? NDPI_PROTOCOL_LLMNR : (((d_port == MDNS_PORT) && isLLMNRMulticastAddress(packet) ) ? NDPI_PROTOCOL_MDNS : NDPI_PROTOCOL_DNS);
if(invalid) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
@@ -800,29 +800,29 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
if(ndpi_struct->cfg.dns_subclassification_enabled) {
ndpi_protocol_match_result ret_match;
- ret.app_protocol = ndpi_match_host_subprotocol(ndpi_struct, flow,
+ ret.proto.app_protocol = ndpi_match_host_subprotocol(ndpi_struct, flow,
flow->host_server_name,
strlen(flow->host_server_name),
&ret_match,
NDPI_PROTOCOL_DNS);
/* Add to FPC DNS cache */
- if(ret.app_protocol != NDPI_PROTOCOL_UNKNOWN &&
+ if(ret.proto.app_protocol != NDPI_PROTOCOL_UNKNOWN &&
(flow->protos.dns.rsp_type == 0x1 || flow->protos.dns.rsp_type == 0x1c) && /* A, AAAA */
ndpi_struct->fpc_dns_cache) {
ndpi_lru_add_to_cache(ndpi_struct->fpc_dns_cache,
- fpc_dns_cache_key_from_dns_info(flow), ret.app_protocol,
+ fpc_dns_cache_key_from_dns_info(flow), ret.proto.app_protocol,
ndpi_get_current_time(flow));
}
- if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN)
- ret.master_protocol = checkDNSSubprotocol(s_port, d_port);
+ if(ret.proto.app_protocol == NDPI_PROTOCOL_UNKNOWN)
+ ret.proto.master_protocol = checkDNSSubprotocol(s_port, d_port);
else
- ret.master_protocol = NDPI_PROTOCOL_DNS;
+ ret.proto.master_protocol = NDPI_PROTOCOL_DNS;
ndpi_check_dga_name(ndpi_struct, flow, flow->host_server_name, 1, 0);
} else {
- ret.master_protocol = checkDNSSubprotocol(s_port, d_port);
- ret.app_protocol = NDPI_PROTOCOL_UNKNOWN;
+ ret.proto.master_protocol = checkDNSSubprotocol(s_port, d_port);
+ ret.proto.app_protocol = NDPI_PROTOCOL_UNKNOWN;
}
/* Category is always NDPI_PROTOCOL_CATEGORY_NETWORK, regardless of the subprotocol */
@@ -835,11 +835,11 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
if(is_query) {
/* In this case we say that the protocol has been detected just to let apps carry on with their activities */
- ndpi_set_detected_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol, NDPI_CONFIDENCE_DPI);
+ ndpi_set_detected_protocol(ndpi_struct, flow, ret.proto.app_protocol, ret.proto.master_protocol, NDPI_CONFIDENCE_DPI);
if(ndpi_struct->cfg.dns_parse_response_enabled) {
/* We have never triggered extra-dissection for LLMNR. Keep the old behaviour */
- if(ret.master_protocol != NDPI_PROTOCOL_LLMNR) {
+ if(ret.proto.master_protocol != NDPI_PROTOCOL_LLMNR) {
/* Don't use just 1 as in TCP DNS more packets could be returned (e.g. ACK). */
flow->max_extra_packets_to_check = 5;
flow->extra_packets_func = search_dns_again;
@@ -864,7 +864,7 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
matched a subprotocol
**/
NDPI_LOG_INFO(ndpi_struct, "found DNS\n");
- ndpi_set_detected_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol, NDPI_CONFIDENCE_DPI);
+ ndpi_set_detected_protocol(ndpi_struct, flow, ret.proto.app_protocol, ret.proto.master_protocol, NDPI_CONFIDENCE_DPI);
} else {
if((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_DNS)
|| (flow->detected_protocol_stack[1] == NDPI_PROTOCOL_DNS))