From 8d0c7b1faeed1e3df6e6f90658559f373bbf63fb Mon Sep 17 00:00:00 2001 From: Toni Date: Wed, 18 Aug 2021 12:34:16 +0300 Subject: Fixed Mingw64 build, SonerCloud-CI and more. (#1273) * Added ARM build and unit test run for SonarCloud-CI. Signed-off-by: Toni Uhlig * 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 --- example/reader_util.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'example/reader_util.c') 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 +#include +#include #ifdef WIN32 #include /* winsock.h is included automatically */ #include #include +#include #else #include #include -#include -#include #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; -- cgit v1.2.3