mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
ndpi-netfilter: remove outdated package
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
dab9830702
commit
a92e3e7f23
@ -1,66 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ndpi-netfilter
|
||||
PKG_VERSION:=3.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/betolj/ndpi-netfilter
|
||||
PKG_MIRROR_HASH:=1a26ea73375a99831be6949faa9bc768e9f4f9e3594286729ec9e61dd6402b07
|
||||
PKG_SOURCE_VERSION:=4875069df027199698ba0b7c53541ae2a4e3ba00
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
define Package/iptables-mod-ndpi
|
||||
SUBMENU:=Firewall
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=nDPI successor of OpenDPI
|
||||
URL:=https://github.com/ntop/nDPI
|
||||
DEPENDS:=+iptables +iptables-mod-conntrack-extra +kmod-ipt-ndpi
|
||||
MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ndpi/description
|
||||
nDPI is a ntop-maintained superset of the popular OpenDPI library
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(TAR) -zxf $(PKG_BUILD_DIR)/nDPI.tar.gz -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
MAKE_FLAGS +=\
|
||||
KERNEL_DIR="$(LINUX_DIR)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
NDPI_PATH=$(PKG_BUILD_DIR)/nDPI \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
all
|
||||
|
||||
define Package/iptables-mod-ndpi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ipt/libxt_ndpi.so $(1)/usr/lib/iptables
|
||||
endef
|
||||
|
||||
define KernelPackage/ipt-ndpi
|
||||
SUBMENU:=Netfilter Extensions
|
||||
TITLE:=nDPI netfilter module
|
||||
DEPENDS:=+kmod-nf-conntrack +kmod-nf-conntrack-netlink +kmod-ipt-compat-xtables
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/src/xt_ndpi.ko
|
||||
AUTOLOAD:=$(call AutoProbe,xt_ndpi)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iptables-mod-ndpi))
|
||||
$(eval $(call KernelPackage,ipt-ndpi))
|
@ -1,126 +0,0 @@
|
||||
--- a/nDPI-patch/src/lib/protocols/netflow.c
|
||||
+++ b/nDPI-patch/src/lib/protocols/netflow.c
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
|
||||
+#include <linux/version.h>
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_NETFLOW
|
||||
@@ -29,7 +30,11 @@
|
||||
#ifdef WIN32
|
||||
extern int gettimeofday(struct timeval * tp, struct timezone * tzp);
|
||||
#endif
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
#define do_gettimeofday(a) gettimeofday(a, NULL)
|
||||
+#else
|
||||
+#define ktime_get_real_ts64(a) gettimeofday(a, NULL)
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
struct flow_ver1_rec {
|
||||
@@ -105,7 +110,11 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
// const u_int8_t *packet_payload = packet->payload;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
time_t now;
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
struct timeval now_tv;
|
||||
+#else
|
||||
+ struct timespec64 now_tv;
|
||||
+#endif
|
||||
|
||||
if((packet->udp != NULL) && (payload_len >= 24)) {
|
||||
u_int16_t version = (packet->payload[0] << 8) + packet->payload[1], uptime_offset;
|
||||
@@ -158,7 +167,11 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
_when = (u_int32_t*)&packet->payload[uptime_offset]; /* Sysuptime */
|
||||
when = ntohl(*_when);
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
do_gettimeofday(&now_tv);
|
||||
+#else
|
||||
+ ktime_get_real_ts64(&now_tv);
|
||||
+#endif
|
||||
now = now_tv.tv_sec;
|
||||
|
||||
if(((version == 1) && (when == 0))
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -383,9 +383,16 @@ static void ndpi_gc_flow(void)
|
||||
union nf_inet_addr *ipdst;
|
||||
|
||||
u64 t1;
|
||||
+
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
struct timeval tv;
|
||||
|
||||
do_gettimeofday(&tv);
|
||||
+#else
|
||||
+ struct timespec64 tv;
|
||||
+
|
||||
+ ktime_get_real_ts64(&tv);
|
||||
+#endif
|
||||
t1 = (uint64_t) tv.tv_sec;
|
||||
|
||||
if (debug_dpi) pr_info ("xt_ndpi: call garbage collector.\n");
|
||||
@@ -418,7 +425,11 @@ ndpi_process_packet(struct nf_conn * ct, const uint64_t time,
|
||||
|
||||
u8 exist_flow=0;
|
||||
u64 t1;
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
struct timeval tv;
|
||||
+#else
|
||||
+ struct timespec64 tv;
|
||||
+#endif
|
||||
|
||||
spin_lock_bh (&flow_lock);
|
||||
ipsrc = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3;
|
||||
@@ -449,7 +460,11 @@ ndpi_process_packet(struct nf_conn * ct, const uint64_t time,
|
||||
}
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
do_gettimeofday(&tv);
|
||||
+#else
|
||||
+ ktime_get_real_ts64(&tv);
|
||||
+#endif
|
||||
t1 = (uint64_t) tv.tv_sec;
|
||||
|
||||
if (flow == NULL) {
|
||||
@@ -602,7 +617,11 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
|
||||
enum ip_conntrack_info ctinfo;
|
||||
struct nf_conn * ct;
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
struct timeval tv;
|
||||
+#else
|
||||
+ struct timespec64 tv;
|
||||
+#endif
|
||||
struct sk_buff *linearized_skb = NULL;
|
||||
const struct sk_buff *skb_use = NULL;
|
||||
|
||||
@@ -630,7 +649,7 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
|
||||
} else if (nf_ct_is_untracked(skb)){
|
||||
#else
|
||||
- } else if (nf_ct_is_untracked(ct)){
|
||||
+ } else if (nf_ct_is_expired(ct)){
|
||||
#endif
|
||||
pr_info ("xt_ndpi: ignoring untracked sk_buff.\n");
|
||||
return false;
|
||||
@@ -641,9 +660,15 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
ip = ip_hdr(skb_use);
|
||||
tcph = (const void *)ip + ip_hdrlen(skb_use);
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
do_gettimeofday(&tv);
|
||||
time = ((uint64_t) tv.tv_sec) * detection_tick_resolution +
|
||||
tv.tv_usec / (1000000 / detection_tick_resolution);
|
||||
+#else
|
||||
+ ktime_get_real_ts64(&tv);
|
||||
+ time = ((uint64_t) tv.tv_sec) * detection_tick_resolution +
|
||||
+ (tv.tv_nsec / 1000 )/ (1000000 / detection_tick_resolution);
|
||||
+#endif
|
||||
|
||||
/* reset for new packets and solve ct collisions */
|
||||
if (ctinfo == IP_CT_NEW) {
|
Loading…
x
Reference in New Issue
Block a user