Skip to content

Commit

Permalink
Removed unnecessary includes (ntop#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi authored Aug 21, 2024
1 parent 5610145 commit d6bde4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/include/ndpi_includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef __APPLE__
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#endif

#if !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __OpenBSD__
#include <endian.h>
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6521,8 +6521,8 @@ static u_int8_t ndpi_detection_get_l4_internal(struct ndpi_detection_module_stru

iph = (const struct ndpi_iphdr *) l3;

if(iph->version == IPVERSION && iph->ihl >= 5) {
NDPI_LOG_DBG2(ndpi_str, "ipv4 header\n");
if((iph->version == 4 /* IPVERSION */) && (iph->ihl >= 5)) {
NDPI_LOG_DBG2(ndpi_str, "IPv4 header\n");
}
else if(iph->version == 6 && l3_len >= sizeof(struct ndpi_ipv6hdr)) {
NDPI_LOG_DBG2(ndpi_str, "ipv6 header\n");
Expand Down Expand Up @@ -6731,7 +6731,7 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str,
if(packet->iph != NULL)
decaps_iph = packet->iph;

if(decaps_iph && decaps_iph->version == IPVERSION && decaps_iph->ihl >= 5) {
if(decaps_iph && (decaps_iph->version == 4 /* IPVERSION */) && (decaps_iph->ihl >= 5)) {
NDPI_LOG_DBG2(ndpi_str, "ipv4 header\n");
} else if(decaps_iph && decaps_iph->version == 6 && l3len >= sizeof(struct ndpi_ipv6hdr) &&
(ndpi_str->ip_version_limit & NDPI_DETECTION_ONLY_IPV4) == 0) {
Expand Down

0 comments on commit d6bde4b

Please sign in to comment.