Last active
September 9, 2021 08:47
-
-
Save a60814billy/175984c7742534e326ce973d4e7128eb to your computer and use it in GitHub Desktop.
ndpi-netfilter-kernel_5_6_patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget https://gist.githubusercontent.com/a60814billy/175984c7742534e326ce973d4e7128eb/raw/f8bd0b73cc95aec51f6f3213e01d759830e3f555/kernel-module-sign.patch | |
patch -p 1 < kernel-module-sign.patch | |
wget https://gist.githubusercontent.com/a60814billy/175984c7742534e326ce973d4e7128eb/raw/f8bd0b73cc95aec51f6f3213e01d759830e3f555/ndpi-netfilter.patch | |
patch -p 1 < ndpi-netfilter.patch | |
pushd nDPI | |
wget https://gist.githubusercontent.com/a60814billy/175984c7742534e326ce973d4e7128eb/raw/f8bd0b73cc95aec51f6f3213e01d759830e3f555/nDPI-patch.patch | |
patch -p 1 < nDPI-patch.patch | |
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Makefile b/src/Makefile | |
index 7e8a462..746eebc 100644 | |
--- a/src/Makefile | |
+++ b/src/Makefile | |
@@ -2,7 +2,7 @@ NDPI_PATH2 := ${NDPI_PATH}/src | |
NDPI_SRC := ndpi_cpy | |
NDPI_PATCH := ${NDPI_SRC}/../../nDPI-patch/src | |
NDPI_PRO := ${NDPI_SRC}/lib/protocols | |
- | |
+CONFIG_MODULE_SIG := n | |
ccflags-y += -w -I${src}/${NDPI_SRC}/include -I${src}/${NDPI_SRC}/lib -DOPENDPI_NETFILTER_MODULE -DNDPI_IPTABLES_EXT | |
PATCHED_FILES = $(basename $(shell cd ${NDPI_PATCH} ; find -type f -name "*.patch" | cut -c3-)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nDPI b/nDPI | |
--- a/nDPI | |
+++ b/nDPI | |
@@ -1 +1 @@ | |
-Subproject commit 75898a4f9e7034e8af8fe24eb442114f5c7339f6 | |
+Subproject commit 75898a4f9e7034e8af8fe24eb442114f5c7339f6-dirty | |
diff --git a/nDPI-patch/src/lib/protocols/netflow.c.patch b/nDPI-patch/src/lib/protocols/netflow.c.patch | |
index 580bf67..ddbc977 100644 | |
--- a/nDPI-patch/src/lib/protocols/netflow.c.patch | |
+++ b/nDPI-patch/src/lib/protocols/netflow.c.patch | |
@@ -10,7 +10,7 @@ | |
#endif | |
-#define do_gettimeofday(a) gettimeofday(a, NULL) | |
+// See https://community.asterisk.org/t/cant-compile-dahdi-anymore-kernel-5-0-3-200-fc29-x86-64/79140/6 | |
-+static void do_gettimeofday(struct timeval *tv) | |
++static void do_gettimeofday(struct __kernel_old_timeval *tv) | |
+{ | |
+ struct timespec64 ts; | |
+ ktime_get_real_ts64(&ts); | |
diff --git a/nDPI-patch/src/lib/protocols/tls.c.patch b/nDPI-patch/src/lib/protocols/tls.c.patch | |
index 1b888f8..9b49e1a 100644 | |
--- a/nDPI-patch/src/lib/protocols/tls.c.patch | |
+++ b/nDPI-patch/src/lib/protocols/tls.c.patch | |
@@ -20,7 +20,7 @@ | |
+ return era * 146097 + doe - 719468; | |
+} | |
+ | |
-+static time_t timegm(struct tm* t) | |
++static __kernel_old_time_t timegm(struct tm* t) | |
+{ | |
+ int year = t->tm_year + 1900; | |
+ int month = t->tm_mon; // 0-11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/include/ndpi_includes.h b/src/include/ndpi_includes.h | |
index 197f32fc..59188669 100644 | |
--- a/src/include/ndpi_includes.h | |
+++ b/src/include/ndpi_includes.h | |
@@ -70,7 +70,7 @@ | |
#if defined __OpenBSD__ | |
#include "ndpi_includes_OpenBSD.h" | |
#else | |
-typedef struct timeval pkt_timeval; | |
+typedef struct __kernel_old_timeval pkt_timeval; | |
#endif /* __OpenBSD__ */ | |
#endif /* __NDPI_INCLUDES_H__ */ | |
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h | |
index cc8511f0..86fdfb73 100644 | |
--- a/src/include/ndpi_typedefs.h | |
+++ b/src/include/ndpi_typedefs.h | |
@@ -441,7 +441,7 @@ typedef struct atomic { | |
struct hash_ip4p_node { | |
struct hash_ip4p_node *next,*prev; | |
- time_t lchg; | |
+ __kernel_old_time_t lchg; | |
u_int16_t port,count:12,flag:4; | |
u_int32_t ip; | |
// + 12 bytes for ipv6 | |
diff --git a/src/lib/ndpi_classify.c b/src/lib/ndpi_classify.c | |
index a7a02cb4..67e9df54 100644 | |
--- a/src/lib/ndpi_classify.c | |
+++ b/src/lib/ndpi_classify.c | |
@@ -682,7 +682,7 @@ void | |
ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len) | |
{ | |
pkt_timeval tv; | |
- time_t nowtime; | |
+ __kernel_old_time_t nowtime; | |
struct tm nowtm_r; | |
char tmbuf[NDPI_TIMESTAMP_LEN]; | |
diff --git a/src/lib/protocols/netflow.c b/src/lib/protocols/netflow.c | |
index ef9125b6..c027a51b 100644 | |
--- a/src/lib/protocols/netflow.c | |
+++ b/src/lib/protocols/netflow.c | |
@@ -102,8 +102,8 @@ void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struc | |
struct ndpi_packet_struct *packet = &flow->packet; | |
// const u_int8_t *packet_payload = packet->payload; | |
u_int32_t payload_len = packet->payload_packet_len; | |
- time_t now; | |
- struct timeval now_tv; | |
+ __kernel_old_time_t now; | |
+ struct __kernel_old_timeval now_tv; | |
NDPI_LOG_DBG(ndpi_struct, "search netflow\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment