diff options
author | Toni <matzeton@googlemail.com> | 2021-08-18 12:34:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 11:34:16 +0200 |
commit | 8d0c7b1faeed1e3df6e6f90658559f373bbf63fb (patch) | |
tree | 8ef500067f538f23652986c7b844f299a0e92ef3 /example/reader_util.c | |
parent | 677b513f70ade895ef28be744245803238100489 (diff) |
Fixed Mingw64 build, SonerCloud-CI and more. (#1273)
* Added ARM build and unit test run for SonarCloud-CI.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Fixed Mingw64 build.
* adapted to SonarCloud-CI workflow
* removed broken and incomplete Windows example (tested on VS2017/VS2019)
* removed unnecessary include (e.g. pthread.h for the library which does not make use of it)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'example/reader_util.c')
-rw-r--r-- | example/reader_util.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index c960005ed..8b1ec8493 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -26,16 +26,17 @@ #endif #include <stdlib.h> +#include <math.h> +#include <float.h> #ifdef WIN32 #include <winsock2.h> /* winsock.h is included automatically */ #include <process.h> #include <io.h> +#include <ip6_misc.h> #else #include <unistd.h> #include <netinet/in.h> -#include <math.h> -#include <float.h> #endif #include "reader_util.h" @@ -1566,8 +1567,12 @@ int ndpi_is_datalink_supported(int datalink_type) { case DLT_PPP_SERIAL: case DLT_C_HDLC: case DLT_PPP: +#ifdef DLT_IPV4 case DLT_IPV4: +#endif +#ifdef DLT_IPV6 case DLT_IPV6: +#endif case DLT_EN10MB: case DLT_LINUX_SLL: case DLT_IEEE802_11_RADIO: @@ -1693,15 +1698,19 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, } break; +#ifdef DLT_IPV4 case DLT_IPV4: type = ETH_P_IP; ip_offset = 0; break; +#endif +#ifdef DLT_IPV6 case DLT_IPV6: type = ETH_P_IPV6; ip_offset = 0; break; +#endif /* IEEE 802.3 Ethernet - 1 */ case DLT_EN10MB: @@ -1863,7 +1872,11 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, ip_len = ((u_int16_t)iph->ihl * 4); iph6 = NULL; - if(iph->protocol == IPPROTO_IPV6 || iph->protocol == IPPROTO_IPIP) { + if(iph->protocol == IPPROTO_IPV6 +#ifdef IPPROTO_IPIP + || iph->protocol == IPPROTO_IPIP +#endif + ) { ip_offset += ip_len; if(ip_len > 0) goto iph_check; @@ -1899,7 +1912,11 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, return(nproto); } - if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) { + if(proto == IPPROTO_IPV6 +#ifdef IPPROTO_IPIP + || proto == IPPROTO_IPIP +#endif + ) { if(l4ptr > packet) { /* Better safe than sorry */ ip_offset = (l4ptr - packet); goto iph_check; |