fullconenat: bump to latest HEAD

Fixes: #13771
This commit is contained in:
aiamadeus 2025-10-25 22:28:10 +08:00
parent 7523ae1bf3
commit 89e46be186
4 changed files with 27 additions and 65 deletions

View File

@ -1,34 +1,28 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2018 Chion Tang <tech@chionlab.moe>
# Original xt_FULLCONENAT and related iptables extension author
# Copyright (c) 2019-2022 GitHub/llccd Twitter/@gNodeB
# Added IPv6 support for xt_FULLCONENAT and ip6tables extension
# Ported to recent kernel versions
# Copyright (c) 2022 Syrone Wong <wong.syrone@gmail.com>
# Massively rewrite the whole module, split the original code into library and nftables 'fullcone' expression module
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=fullconenat-nft
PKG_RELEASE:=2
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/fullcone-nat-nftables/nft-fullcone.git
PKG_SOURCE_DATE:=2023-05-17
PKG_SOURCE_URL:=https://github.com/fullcone-nat-nftables/nft-fullcone.git
PKG_SOURCE_VERSION:=07d93b626ce5ea885cd16f9ab07fac3213c355d9
PKG_MIRROR_HASH:=b89c68c68b5912f20cefed703c993498fed612ba4860fa75ef50037cb79a32f5
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Syrone Wong <wong.syrone@gmail.com>
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/nft-fullcone
SUBMENU:=Netfilter Extensions
DEPENDS:=+kmod-nft-nat
TITLE:=nftables fullcone expression support
TITLE:=Netfilter nf_tables fullcone support
FILES:= $(PKG_BUILD_DIR)/src/nft_fullcone.ko
KCONFIG:= \
CONFIG_NF_CONNTRACK_EVENTS=y \
@ -37,10 +31,7 @@ define KernelPackage/nft-fullcone
endef
define KernelPackage/nft-fullcone/Description
Kernel module adds the fullcone expression that you can use
to perform NAT in the RFC3489-compatible full cone SNAT flavour.
Currently only UDP traffic is supported for full-cone NAT.
For other protos FULLCONENAT is equivalent to MASQUERADE.
nftables fullcone expression kernel module
endef
define Build/Compile

View File

@ -1,10 +1,12 @@
--- a/src/nft_ext_fullcone.c
+++ b/src/nft_ext_fullcone.c
@@ -121,7 +121,11 @@ static int exp_event_cb(unsigned int eve
@@ -121,7 +121,13 @@ static int exp_event_cb(unsigned int eve
}
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 113)) && \
+ (LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0))) || \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0))
+static int nft_fullcone_validate(const struct nft_ctx *ctx, const struct nft_expr *expr)
+#else
static int nft_fullcone_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data)

View File

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fullconenat
PKG_RELEASE:=10
PKG_RELEASE:=1
PKG_SOURCE_DATE:=2022-02-13
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/llccd/netfilter-full-cone-nat.git
PKG_SOURCE_VERSION:=108a36cbdca17e68c9e6e7fd5e26156a88f738e8
PKG_MIRROR_HASH:=00d749235271dee194dcd23c22e6e85207ea90192a62a110b2af0b4e4de1971f
PKG_SOURCE_DATE:=2023-01-01
PKG_SOURCE_URL:=https://github.com/llccd/netfilter-full-cone-nat
PKG_SOURCE_VERSION:=74c5e6f3c7faaf33ece451697537c81781781c20
PKG_MIRROR_HASH:=3c254f1edba28eafdccac9cf95eb550fd2b05eeaaec8a02c73e1dcd2f98f9d93
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
@ -23,19 +23,6 @@ PKG_MAINTAINER:=Chion Tang <tech@chionlab.moe>
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define Package/iptables-mod-fullconenat
SUBMENU:=Firewall
SECTION:=net
CATEGORY:=Network
TITLE:=FULLCONENAT iptables extension
DEPENDS:=+libxtables +kmod-ipt-fullconenat
endef
define Package/iptables-mod-fullconenat/install
$(INSTALL_DIR) $(1)/usr/lib/iptables
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FULLCONENAT.so $(1)/usr/lib/iptables
endef
define KernelPackage/ipt-fullconenat
SUBMENU:=Netfilter Extensions
TITLE:=FULLCONENAT netfilter module
@ -47,13 +34,21 @@ define KernelPackage/ipt-fullconenat
AUTOLOAD:=$(call AutoProbe,xt_FULLCONENAT)
endef
include $(INCLUDE_DIR)/kernel-defaults.mk
define Package/iptables-mod-fullconenat
SECTION:=net
CATEGORY:=Network
SUBMENU:=Firewall
TITLE:=FULLCONENAT iptables extension
DEPENDS:=+libxtables +kmod-ipt-fullconenat
endef
define Package/iptables-mod-fullconenat/install
$(INSTALL_DIR) $(1)/usr/lib/iptables
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FULLCONENAT.so $(1)/usr/lib/iptables
endef
define Build/Compile
+$(KERNEL_MAKE) $(PKG_JOBS) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(BUILDFLAGS)" \
modules
+$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
$(call Build/Compile/Default)
endef

View File

@ -1,26 +0,0 @@
--- a/xt_FULLCONENAT.c
+++ b/xt_FULLCONENAT.c
@@ -325,7 +325,11 @@
/* for now we do the same thing for both --random and --random-fully */
/* select a random starting point */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ start = (uint16_t)(get_random_u32() % (u32)range_size);
+#else
start = (uint16_t)(prandom_u32() % (u32)range_size);
+#endif
} else {
if ((original_port >= min && original_port <= min + range_size - 1)
@@ -995,7 +999,11 @@
/* for now we do the same thing for both --random and --random-fully */
/* select a random starting point */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ start = (uint16_t)(get_random_u32() % (u32)range_size);
+#else
start = (uint16_t)(prandom_u32() % (u32)range_size);
+#endif
} else {
if ((original_port >= min && original_port <= min + range_size - 1)