fixed dns check host name server
This commit is contained in:
@@ -3083,6 +3083,7 @@ void check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
detection_bitmask) != 0) {
|
detection_bitmask) != 0) {
|
||||||
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
||||||
|
|
||||||
|
|
||||||
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
||||||
break; /* Stop after detecting the first protocol */
|
break; /* Stop after detecting the first protocol */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,13 +113,19 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
int off = sizeof(struct ndpi_dns_packet_header) + 1;
|
int off = sizeof(struct ndpi_dns_packet_header) + 1;
|
||||||
while((flow->packet.payload[off] != '\0'))
|
while((flow->packet.payload[off] != '\0'))
|
||||||
|
{
|
||||||
|
if(off < flow->packet.payload_packet_len)
|
||||||
{
|
{
|
||||||
flow->host_server_name[j] = flow->packet.payload[off];
|
flow->host_server_name[j] = flow->packet.payload[off];
|
||||||
|
if(j < strlen(flow->host_server_name))
|
||||||
|
{
|
||||||
if(flow->host_server_name[j] < ' ')
|
if(flow->host_server_name[j] < ' ')
|
||||||
flow->host_server_name[j] = '.';
|
flow->host_server_name[j] = '.';
|
||||||
off++;
|
off++;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
flow->host_server_name[j] = '\0';
|
flow->host_server_name[j] = '\0';
|
||||||
|
|
||||||
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);
|
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);
|
||||||
|
|||||||
Reference in New Issue
Block a user