Cosmetic changes
This commit is contained in:
@@ -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,
|
struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||||
const struct pcap_pkthdr *header,
|
const struct pcap_pkthdr *header,
|
||||||
const u_char *packet,
|
const u_char *packet,
|
||||||
FILE * csv_fp) {
|
FILE * csv_fp) {
|
||||||
/*
|
/*
|
||||||
* Declare pointers to packet headers
|
* 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) {
|
} else if(iph->version == 6) {
|
||||||
if(header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr))
|
if(header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr))
|
||||||
return(nproto); /* Too short for IPv6 header*/
|
return(nproto); /* Too short for IPv6 header*/
|
||||||
|
|
||||||
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
||||||
proto = iph6->ip6_hdr.ip6_un1_nxt;
|
proto = iph6->ip6_hdr.ip6_un1_nxt;
|
||||||
ip_len = ntohs(iph6->ip6_hdr.ip6_un1_plen);
|
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)))
|
if(header->caplen < (ip_offset + sizeof(struct ndpi_ipv6hdr) + ntohs(iph6->ip6_hdr.ip6_un1_plen)))
|
||||||
return(nproto); /* Too short for IPv6 payload*/
|
return(nproto); /* Too short for IPv6 payload*/
|
||||||
|
|
||||||
const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr));
|
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) {
|
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
|
||||||
return(nproto);
|
return(nproto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) {
|
if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) {
|
||||||
if(l4ptr > packet) { /* Better safe than sorry */
|
if(l4ptr > packet) { /* Better safe than sorry */
|
||||||
ip_offset = (l4ptr - packet);
|
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");
|
"\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;
|
ipv4_warning_used = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
workflow->stats.total_discarded_bytes += header->len;
|
workflow->stats.total_discarded_bytes += header->len;
|
||||||
return(nproto);
|
return(nproto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ extern "C" {
|
|||||||
/* The #define below is used for apps that dynamically link with nDPI to make
|
/* The #define below is used for apps that dynamically link with nDPI to make
|
||||||
sure that datastructures and in sync across versions
|
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_ID_STRUCT ( sizeof(struct ndpi_id_struct) )
|
||||||
#define SIZEOF_FLOW_STRUCT ( sizeof(struct ndpi_flow_struct) )
|
#define SIZEOF_FLOW_STRUCT ( sizeof(struct ndpi_flow_struct) )
|
||||||
|
|||||||
Reference in New Issue
Block a user