aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-11-03 16:46:30 +0100
committerLuca Deri <deri@ntop.org>2020-11-03 16:46:30 +0100
commit017e395ed179e88ae921b99c88dcfcfe878f7cc3 (patch)
treed336687a0e11f1e05551189244c64bca8928562e
parent0576dc2a49a86b4cc20d4106be5fcf1fd8c539ed (diff)
Cosmetic changes
-rw-r--r--example/reader_util.c7
-rw-r--r--src/include/ndpi_api.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 8c42afe85..78959db71 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1540,7 +1540,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
const struct pcap_pkthdr *header,
const u_char *packet,
- FILE * csv_fp) {
+ FILE * csv_fp) {
/*
* Declare pointers to packet headers
*/
@@ -1825,16 +1825,20 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
} else if(iph->version == 6) {
if(header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr))
return(nproto); /* Too short for IPv6 header*/
+
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
proto = iph6->ip6_hdr.ip6_un1_nxt;
ip_len = ntohs(iph6->ip6_hdr.ip6_un1_plen);
+
if(header->caplen < (ip_offset + sizeof(struct ndpi_ipv6hdr) + ntohs(iph6->ip6_hdr.ip6_un1_plen)))
return(nproto); /* Too short for IPv6 payload*/
const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr));
+
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
return(nproto);
}
+
if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) {
if(l4ptr > packet) { /* Better safe than sorry */
ip_offset = (l4ptr - packet);
@@ -1853,6 +1857,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
"\n\nWARNING: only IPv4/IPv6 packets are supported in this demo (nDPI supports both IPv4 and IPv6), all other packets will be discarded\n\n");
ipv4_warning_used = 1;
}
+
workflow->stats.total_discarded_bytes += header->len;
return(nproto);
}
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 6eccc7306..fefd87e05 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -34,7 +34,7 @@ extern "C" {
/* The #define below is used for apps that dynamically link with nDPI to make
sure that datastructures and in sync across versions
*/
-#define NDPI_API_VERSION 3554
+#define NDPI_API_VERSION 3560
#define SIZEOF_ID_STRUCT ( sizeof(struct ndpi_id_struct) )
#define SIZEOF_FLOW_STRUCT ( sizeof(struct ndpi_flow_struct) )