Fixed unitialized variable
This commit is contained in:
+15
-15
@@ -35,27 +35,27 @@ static void ndpi_int_dhcp_add_connection(struct ndpi_detection_module_struct *nd
|
|||||||
|
|
||||||
void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
{
|
{
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||||
|
|
||||||
/* this detection also works for asymmetric dhcp traffic */
|
/* this detection also works for asymmetric dhcp traffic */
|
||||||
|
|
||||||
/*check standard DHCP 0.0.0.0:68 -> 255.255.255.255:67 */
|
/*check standard DHCP 0.0.0.0:68 -> 255.255.255.255:67 */
|
||||||
if (packet->payload_packet_len >= 244 && (packet->udp->source == htons(67)
|
if (packet->payload_packet_len >= 244 && (packet->udp->source == htons(67)
|
||||||
|| packet->udp->source == htons(68))
|
|| packet->udp->source == htons(68))
|
||||||
&& (packet->udp->dest == htons(67) || packet->udp->dest == htons(68))
|
&& (packet->udp->dest == htons(67) || packet->udp->dest == htons(68))
|
||||||
&& get_u_int32_t(packet->payload, 236) == htonl(0x63825363)
|
&& get_u_int32_t(packet->payload, 236) == htonl(0x63825363)
|
||||||
&& get_u_int16_t(packet->payload, 240) == htons(0x3501)) {
|
&& get_u_int16_t(packet->payload, 240) == htons(0x3501)) {
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_DHCP, ndpi_struct, NDPI_LOG_DEBUG, "DHCP request\n");
|
NDPI_LOG(NDPI_PROTOCOL_DHCP, ndpi_struct, NDPI_LOG_DEBUG, "DHCP request\n");
|
||||||
|
|
||||||
ndpi_int_dhcp_add_connection(ndpi_struct, flow);
|
ndpi_int_dhcp_add_connection(ndpi_struct, flow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCP);
|
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+20
-18
@@ -80,24 +80,26 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
|||||||
else
|
else
|
||||||
invalid = 1;
|
invalid = 1;
|
||||||
|
|
||||||
if(is_query) {
|
if(!invalid) {
|
||||||
/* DNS Request */
|
if(is_query) {
|
||||||
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS)
|
/* DNS Request */
|
||||||
&& (((dns_header.flags & 0x2800) == 0x2800 /* Dynamic DNS Update */)
|
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS)
|
||||||
|| ((dns_header.num_answers == 0) && (dns_header.authority_rrs == 0)))) {
|
&& (((dns_header.flags & 0x2800) == 0x2800 /* Dynamic DNS Update */)
|
||||||
/* This is a good query */
|
|| ((dns_header.num_answers == 0) && (dns_header.authority_rrs == 0)))) {
|
||||||
} else
|
/* This is a good query */
|
||||||
invalid = 1;
|
} else
|
||||||
} else {
|
invalid = 1;
|
||||||
/* DNS Reply */
|
} else {
|
||||||
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS) /* Don't assume that num_queries must be zero */
|
/* DNS Reply */
|
||||||
&& (((dns_header.num_answers > 0) && (dns_header.num_answers <= NDPI_MAX_DNS_REQUESTS))
|
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS) /* Don't assume that num_queries must be zero */
|
||||||
|| ((dns_header.authority_rrs > 0) && (dns_header.authority_rrs <= NDPI_MAX_DNS_REQUESTS))
|
&& (((dns_header.num_answers > 0) && (dns_header.num_answers <= NDPI_MAX_DNS_REQUESTS))
|
||||||
|| ((dns_header.additional_rrs > 0) && (dns_header.additional_rrs <= NDPI_MAX_DNS_REQUESTS)))
|
|| ((dns_header.authority_rrs > 0) && (dns_header.authority_rrs <= NDPI_MAX_DNS_REQUESTS))
|
||||||
) {
|
|| ((dns_header.additional_rrs > 0) && (dns_header.additional_rrs <= NDPI_MAX_DNS_REQUESTS)))
|
||||||
/* This is a good reply */
|
) {
|
||||||
} else
|
/* This is a good reply */
|
||||||
invalid = 1;
|
} else
|
||||||
|
invalid = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invalid) {
|
if(invalid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user