aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c25
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;