1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2023-07-05 16:07:43 +08:00
parent e3fb82cd63
commit 88590b3b5c
6 changed files with 55 additions and 318 deletions

View file

@ -1,26 +1,26 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=xtables-addons
PKG_VERSION:=3.22
PKG_RELEASE:=$(AUTORELEASE)
PKG_HASH:=faa16a27166275afbfe8df605f55c3a81ac693bf19da674d45ceded4137ae217
PKG_VERSION:=3.24
PKG_RELEASE:=1
PKG_HASH:=3e823f71720519ced31c4c7d2bfaf7120d9c01c59a0843dfcbe93c95c64d81c1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://inai.de/files/xtables-addons/
PKG_BUILD_DEPENDS:=iptables
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_ASLR_PIE:=0
@ -162,7 +162,7 @@ define Package/iptgeoip/install
$(1)/usr/lib/xtables-addons/
$(INSTALL_DIR) $(1)/usr/bin
$(CP) \
$(PKG_INSTALL_DIR)/usr/bin/xt_geoip_fetch \
$(PKG_INSTALL_DIR)/usr/bin/xt_geoip_query \
$(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share/xt_geoip
touch $(1)/usr/share/xt_geoip/.keep

View file

@ -1,8 +1,8 @@
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return
@@ -41,7 +41,7 @@ regular_CFLAGS="-Wall -Waggregate-return
if test -n "$kbuilddir"; then
AS_IF([test -n "$kbuilddir"], [
AC_MSG_CHECKING([kernel version that we will build against])
- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"
+ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"

View file

@ -1725,7 +1725,7 @@
+module_exit(fini);
--- a/extensions/Kbuild
+++ b/extensions/Kbuild
@@ -27,6 +27,7 @@ obj-${build_lscan} += xt_lscan.o
@@ -28,6 +28,7 @@ obj-${build_lscan} += xt_lscan.o
obj-${build_pknock} += pknock/
obj-${build_psd} += xt_psd.o
obj-${build_quota2} += xt_quota2.o
@ -1735,7 +1735,7 @@
-include ${M}/Kbuild.*
--- a/mconfig
+++ b/mconfig
@@ -23,3 +23,4 @@ build_lscan=m
@@ -24,3 +24,4 @@ build_lscan=m
build_pknock=m
build_psd=m
build_quota2=m

View file

@ -1,6 +1,6 @@
--- /dev/null
+++ b/extensions/LUA/byte_array.c
@@ -0,0 +1,145 @@
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
+ * by Andre Graf <andre@dergraf.org>
@ -110,12 +110,26 @@
+static int32_t byte_array_to_string(lua_State *L)
+{
+ lua_packet_segment * array = checkbytearray(L, 1);
+ uint8_t buf[(array->length * 3) + 255];
+ uint8_t hexval[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ char res[255 + (array->length * 3)]; /* make sure the buffer is big enough*/
+ uint8_t * buf;
+ char * res;
+ int32_t i, n;
+ uint8_t *ptr = array->start + array->offset;
+
+ buf = kcalloc((array->length * 3) + 255, sizeof(*buf), GFP_KERNEL);
+
+ if (!buf) {
+ return luaL_error(L, "byte_array_to_string, failed alloc buf buffer");
+ }
+
+ /* make sure the buffer is big enough*/
+ res = kcalloc((array->length * 3) + 255, sizeof(*res), GFP_KERNEL);
+
+ if (!res) {
+ kfree(buf);
+ return luaL_error(L, "byte_array_to_string, failed alloc res buffer");
+ }
+
+ for (i = 0; i < array->length; i++) {
+ buf[i * 3] = hexval[(ptr[i] >> 4) & 0xF];
+ buf[(i * 3) + 1] = hexval[ptr[i] & 0x0F];
@ -126,6 +140,8 @@
+ n = sprintf(res, "byte_array: length: %d value: %s", array->length, buf);
+
+ lua_pushlstring(L, res, n);
+ kfree(res);
+ kfree(buf);
+
+ return 1;
+}
@ -1137,7 +1153,7 @@
+ struct xt_lua_tginfo *info = (void *)target->data;
+
+ info->state_id = 0;
+ strncpy(info->function, "process_packet\0", sizeof("process_packet\0"));
+ strcpy(info->function, "process_packet\0");
+}
+
+static int
@ -2453,15 +2469,13 @@
+#endif
--- /dev/null
+++ b/extensions/LUA/lua/lauxlib.c
@@ -0,0 +1,674 @@
@@ -0,0 +1,672 @@
+/*
+** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+#include <stdarg.h>
+
+#if !defined(__KERNEL__)
+#include <ctype.h>
+#include <errno.h>
@ -4887,7 +4901,7 @@
+#endif
--- /dev/null
+++ b/extensions/LUA/lua/ldebug.c
@@ -0,0 +1,637 @@
@@ -0,0 +1,636 @@
+/*
+** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $
+** Debug Interface
@ -4895,7 +4909,6 @@
+*/
+
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+
@ -5301,7 +5314,7 @@
+ case OP_FORLOOP:
+ case OP_FORPREP:
+ checkreg(pt, a+3);
+ /* go through */
+ fallthrough;
+ case OP_JMP: {
+ int dest = pc+1+b;
+ /* not full check and jump is forward and do not skip `lastpc'? */
@ -6204,7 +6217,7 @@
+
+static void DumpString(const TString* s, DumpState* D)
+{
+ if (s==NULL || getstr(s)==NULL)
+ if (s==NULL)
+ {
+ size_t size=0;
+ DumpVar(size,D);
@ -7716,6 +7729,7 @@
+ }
+ else if (sep == -1) return '[';
+ else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
+ fallthrough;
+ }
+ case '=': {
+ next(ls);
@ -7809,7 +7823,6 @@
+ lua_assert(ls->lookahead.token == TK_EOS);
+ ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
+}
+
--- /dev/null
+++ b/extensions/LUA/lua/llex.h
@@ -0,0 +1,81 @@
@ -8165,15 +8178,13 @@
+
--- /dev/null
+++ b/extensions/LUA/lua/lobject.c
@@ -0,0 +1,215 @@
@@ -0,0 +1,213 @@
+/*
+** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $
+** Some generic functions over Lua objects
+** See Copyright Notice in lua.h
+*/
+
+#include <stdarg.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
@ -12471,7 +12482,7 @@
+ lua_number2int(k, n);
+ if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */
+ return luaH_getnum(t, k); /* use specialized version */
+ /* else go through */
+ fallthrough;
+ }
+ default: {
+ Node *n = mainposition(t, key);
@ -12766,7 +12777,7 @@
+ if (!lua_isstring(L, -1))
+ luaL_error(L, "invalid value (%s) at index %d in table for "
+ LUA_QL("concat"), luaL_typename(L, -1), i);
+ luaL_addvalue(b);
+ luaL_addvalue(b);
+}
+
+
@ -13851,7 +13862,7 @@
+
--- /dev/null
+++ b/extensions/LUA/lua/lua.h
@@ -0,0 +1,387 @@
@@ -0,0 +1,386 @@
+/*
+** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
+** Lua - An Extensible Extension Language
@ -13863,7 +13874,6 @@
+#ifndef lua_h
+#define lua_h
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#include "luaconf.h"
@ -17984,7 +17994,7 @@
+ int32_t ret;
+ struct lua_env * env = kmalloc(sizeof(struct lua_env), GFP_KERNEL);
+
+ if (!script_size > 0) {
+ if (!script_size) {
+ pr_debug("LUA [%d]: script_size %lu < 0\n", state_id, script_size);
+ return false;
+ }
@ -18134,7 +18144,7 @@
+
--- a/extensions/Kbuild
+++ b/extensions/Kbuild
@@ -28,6 +28,7 @@ obj-${build_pknock} += pknock/
@@ -29,6 +29,7 @@ obj-${build_pknock} += pknock/
obj-${build_psd} += xt_psd.o
obj-${build_quota2} += xt_quota2.o
obj-${build_rtsp} += rtsp/
@ -18144,14 +18154,14 @@
-include ${M}/Kbuild.*
--- a/extensions/Mbuild
+++ b/extensions/Mbuild
@@ -23,3 +23,4 @@ obj-${build_pknock} += pknock/
@@ -24,3 +24,4 @@ obj-${build_pknock} += pknock/
obj-${build_psd} += libxt_psd.so
obj-${build_quota2} += libxt_quota2.so
obj-${build_gradm} += libxt_gradm.so
+obj-${build_LUA} += LUA/
--- a/mconfig
+++ b/mconfig
@@ -24,3 +24,4 @@ build_pknock=m
@@ -25,3 +25,4 @@ build_pknock=m
build_psd=m
build_quota2=m
build_rtsp=m

View file

@ -1,3 +1,14 @@
--- a/extensions/LUA/Kbuild
+++ b/extensions/LUA/Kbuild
@@ -22,6 +22,8 @@ xt_LUA-y += nf_lua.o \
prot_buf_dynamic.o \
+# Enable <stddef.h> <stdarg.h>
+EXTRA_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
# Adding Lua Support
EXTRA_CFLAGS += -I$(src)/lua -I$(src)/lua/include
xt_LUA-y += lua/lapi.o \
--- a/extensions/LUA/xt_LUA_target.c
+++ b/extensions/LUA/xt_LUA_target.c
@@ -19,7 +19,7 @@

View file

@ -1,284 +0,0 @@
Linux 5.16 includes 04e85bbf71c9 ("isystem: delete global -isystem compile option")
compile error on >=5.16
xtables-addons-3.21/extensions/LUA/lua/lua.h:12:10: fatal error: stdarg.h: No such file or directory
12 | #include <stdarg.h>
| ^~~~~~~~~~
Generated with coccinelle:
cat <<EOF>cocci-xtables-lua-linux-5.16.spatch
@include_arg@
@@
#include <stdarg.h>
@include_def@
@@
#include <stddef.h>
@include_both depends on include_arg && include_def@
@@
#include <stdarg.h>
@add_include_linux_stdheaders_both depends on include_both@
@@
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
?#include <stdarg.h>
?#include <stddef.h>
+#else
+#include <linux/stdarg.h>
+#include <linux/stddef.h>
+#endif
@add_include_linux_stdheaders depends on !include_both@
@@
(
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
+#else
+#include <linux/stdarg.h>
+#endif
|
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
)
EOF
spatch --in-place --include-headers --no-includes --sp-file cocci-xtables-lua-linux-5.16.spatch --dir extensions/LUA/lua/
---
--- a/extensions/LUA/lua/lauxlib.c
+++ b/extensions/LUA/lua/lauxlib.c
@@ -4,7 +4,12 @@
** See Copyright Notice in lua.h
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
+#else
+#include <linux/stdarg.h>
+#endif
#if !defined(__KERNEL__)
#include <ctype.h>
--- a/extensions/LUA/lua/lauxlib.h
+++ b/extensions/LUA/lua/lauxlib.h
@@ -9,7 +9,12 @@
#define lauxlib_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#include <linux/slab.h> /* for kmalloc and kfree when allocating luaL_Buffer */
#if !defined(__KERNEL__)
--- a/extensions/LUA/lua/ldebug.c
+++ b/extensions/LUA/lua/ldebug.c
@@ -5,8 +5,14 @@
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
#include <stddef.h>
+#else
+#include <linux/stdarg.h>
+#include <linux/stddef.h>
+#endif
#include <string.h>
#define ldebug_c
--- a/extensions/LUA/lua/ldump.c
+++ b/extensions/LUA/lua/ldump.c
@@ -4,7 +4,12 @@
** See Copyright Notice in lua.h
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#define ldump_c
#define LUA_CORE
--- a/extensions/LUA/lua/lfunc.c
+++ b/extensions/LUA/lua/lfunc.c
@@ -5,7 +5,12 @@
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#define lfunc_c
#define LUA_CORE
--- a/extensions/LUA/lua/llimits.h
+++ b/extensions/LUA/lua/llimits.h
@@ -7,7 +7,12 @@
#ifndef llimits_h
#define llimits_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#include "lua.h"
--- a/extensions/LUA/lua/lmem.c
+++ b/extensions/LUA/lua/lmem.c
@@ -5,7 +5,12 @@
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#define lmem_c
#define LUA_CORE
--- a/extensions/LUA/lua/lmem.h
+++ b/extensions/LUA/lua/lmem.h
@@ -8,7 +8,12 @@
#define lmem_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#include "llimits.h"
#include "lua.h"
--- a/extensions/LUA/lua/lobject.c
+++ b/extensions/LUA/lua/lobject.c
@@ -4,7 +4,12 @@
** See Copyright Notice in lua.h
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
+#else
+#include <linux/stdarg.h>
+#endif
#include <ctype.h>
#include <stdio.h>
--- a/extensions/LUA/lua/lobject.h
+++ b/extensions/LUA/lua/lobject.h
@@ -9,7 +9,12 @@
#define lobject_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
+#else
+#include <linux/stdarg.h>
+#endif
#include "llimits.h"
--- a/extensions/LUA/lua/lstate.c
+++ b/extensions/LUA/lua/lstate.c
@@ -5,7 +5,12 @@
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#define lstate_c
#define LUA_CORE
--- a/extensions/LUA/lua/lstrlib.c
+++ b/extensions/LUA/lua/lstrlib.c
@@ -6,7 +6,12 @@
#include <ctype.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- a/extensions/LUA/lua/ltablib.c
+++ b/extensions/LUA/lua/ltablib.c
@@ -5,7 +5,12 @@
*/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#define ltablib_c
#define LUA_LIB
--- a/extensions/LUA/lua/lua.h
+++ b/extensions/LUA/lua/lua.h
@@ -9,8 +9,14 @@
#ifndef lua_h
#define lua_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stdarg.h>
#include <stddef.h>
+#else
+#include <linux/stdarg.h>
+#include <linux/stddef.h>
+#endif
#include "luaconf.h"
--- a/extensions/LUA/lua/luaconf.h
+++ b/extensions/LUA/lua/luaconf.h
@@ -8,7 +8,12 @@
#ifndef lconfig_h
#define lconfig_h
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#include <stddef.h>
+#else
+#include <linux/stddef.h>
+#endif
#if !defined(__KERNEL__)
#include <limits.h>