xtables-addons: merge patches
authorGeorgi Valkov <[email protected]>
Mon, 8 Jul 2024 18:28:02 +0000 (21:28 +0300)
committerRosen Penev <[email protected]>
Tue, 9 Jul 2024 12:08:14 +0000 (05:08 -0700)
Merge the following patches
201-fix-lua-packetscript.patch
210-freebsd-build-fix.patch
since they modify files created by 200-add-lua-packetscript.patch

Signed-off-by: Georgi Valkov <[email protected]>
net/xtables-addons/patches/200-add-lua-packetscript.patch
net/xtables-addons/patches/201-fix-lua-packetscript.patch [deleted file]
net/xtables-addons/patches/210-freebsd-build-fix.patch [deleted file]

index bb3cc50abaddd622acab4461deecd85b5cb62d34..c49014e491813f2b2204f50ba5fbb5ed9e0df552 100644 (file)
 +#endif /* CONTROLLER_H_ */
 --- /dev/null
 +++ b/extensions/LUA/Kbuild
-@@ -0,0 +1,49 @@
+@@ -0,0 +1,51 @@
 +# -*- Makefile -*-
 +
 +# Adding debug options
 +                      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 \
 +#include <linux/string.h>
 --- /dev/null
 +++ b/extensions/LUA/lua/lapi.c
-@@ -0,0 +1,1086 @@
+@@ -0,0 +1,1083 @@
 +/*
 +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $
 +** Lua API
 +** See Copyright Notice in lua.h
 +*/
 +
-+#include <stdarg.h>
-+#include <math.h>
-+#include <assert.h>
 +#include <string.h>
 +
 +#define lapi_c
 +}
 --- /dev/null
 +++ b/extensions/LUA/lua/llex.h
-@@ -0,0 +1,81 @@
+@@ -0,0 +1,83 @@
 +/*
 +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $
 +** Lexical Analyzer
 +#include "lobject.h"
 +#include "lzio.h"
 +
++/* prevent conflict with definition from asm/current.h */
++#undef current
 +
 +#define FIRST_RESERVED        257
 +
 +#endif
 --- /dev/null
 +++ b/extensions/LUA/lua/llimits.h
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,124 @@
 +/*
 +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
 +** Limits, basic types, and some other `installation-dependent' definitions
 +#define llimits_h
 +
 +#include <stddef.h>
-+#include <limits.h>
 +
 +#include "lua.h"
 +
 +}
 --- /dev/null
 +++ b/extensions/LUA/lua/ltable.c
-@@ -0,0 +1,588 @@
+@@ -0,0 +1,587 @@
 +/*
 +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $
 +** Lua tables (hash)
 +** Hence even when the load factor reaches 100%, performance remains good.
 +*/
 +
-+#include <math.h>
 +#include <string.h>
 +
 +#define ltable_c
 +#endif
 --- /dev/null
 +++ b/extensions/LUA/lua/luaconf.h
-@@ -0,0 +1,797 @@
+@@ -0,0 +1,803 @@
 +/*
 +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
 +** Configuration file for Lua
 +#if !defined(__KERNEL__)
 +#include <limits.h>
 +#else
++#include <linux/kernel.h>
++
++#undef UCHAR_MAX
++#undef BUFSIZ
++#undef NO_FPU
 +#define UCHAR_MAX     255
-+#define SHRT_MAX        32767
 +#define BUFSIZ                8192
 +#define NO_FPU
 +#endif
 +*/
 +#if defined(__KERNEL__)
 +#undef LUA_USE_ULONGJMP
++#define setjmp __builtin_setjmp
++#define longjmp __builtin_longjmp
 +#endif
 +
 +#if defined(__cplusplus)
 +RANLIB = ranlib
 +SED = /bin/sed
 +SET_MAKE = 
-+SHELL = /bin/bash
++SHELL = /bin/sh
 +STRIP = strip
 +VERSION = 1.21
 +abs_builddir = /home/andre/Dropbox/xtables-addons/extensions/LUA
 +#include <linux/kernel.h>
 +#include <linux/slab.h>
 +#include <linux/module.h>
-+#include <asm/uaccess.h>
++#include <linux/uaccess.h>
 +#include <net/ip.h>
 +#include <linux/netfilter/x_tables.h>
 +#include "xt_LUA.h"
 + * XT_CONTINUE inside the *register_lua_packet_lib* function.
 + */
 +
-+spinlock_t lock = SPIN_LOCK_UNLOCKED;
++DEFINE_SPINLOCK(lock);
 +
 +static uint32_t 
-+lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
++lua_tg(struct sk_buff *pskb, const struct xt_action_param *par)
 +{
 +      uint32_t  verdict;
 +      lua_packet_segment *p;
 +
 +      L = lua_envs[info->state_id]->L;
 +
-+      if (!skb_make_writable(pskb, pskb->len))
++      if (skb_ensure_writable(pskb, pskb->len))
 +              return NF_DROP;
 +
 +      /* call the function provided by --function parameter or the default 'process_packet' defined in Lua */
 +      /* push the lua_packet_segment as a parameter */
 +      p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
 +      if (pskb->mac_header)
-+              p->start = pskb->mac_header;
++              p->start = skb_mac_header(pskb);
 +      else if (pskb->network_header)
-+              p->start = pskb->network_header;
++              p->start = skb_network_header(pskb);
 +      else if (pskb->transport_header)
-+              p->start = pskb->transport_header;
++              p->start = skb_transport_header(pskb);
 +      p->offset = 0;
 +      p->length = (unsigned long)pskb->tail - (unsigned long)p->start;
 +      p->changes = NULL;
 + * some workqueue initialization. So far this is done each time this function
 + * is called, subject to change.
 + */
-+static bool
++static int
 +lua_tg_checkentry(const struct xt_tgchk_param *par)
 +{
 +      const struct xt_lua_tginfo *info = par->targinfo;
 +
 +      if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
 +              lua_state_refs[info->state_id]++;
-+              return true;
++              return 0;
 +      }
-+      return false;
++      return -EINVAL;
 +}
 +
 +/*::*
diff --git a/net/xtables-addons/patches/201-fix-lua-packetscript.patch b/net/xtables-addons/patches/201-fix-lua-packetscript.patch
deleted file mode 100644 (file)
index 6413012..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
---- 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 @@
- #include <linux/kernel.h>
- #include <linux/slab.h>
- #include <linux/module.h>
--#include <asm/uaccess.h>
-+#include <linux/uaccess.h>
- #include <net/ip.h>
- #include <linux/netfilter/x_tables.h>
- #include "xt_LUA.h"
-@@ -64,10 +64,10 @@ uint32_t  lua_state_refs[LUA_STATE_ARRAY
-  * XT_CONTINUE inside the *register_lua_packet_lib* function.
-  */
--spinlock_t lock = SPIN_LOCK_UNLOCKED;
-+DEFINE_SPINLOCK(lock);
- static uint32_t 
--lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
-+lua_tg(struct sk_buff *pskb, const struct xt_action_param *par)
- {
-       uint32_t  verdict;
-       lua_packet_segment *p;
-@@ -79,7 +79,7 @@ lua_tg(struct sk_buff *pskb, const struc
-       L = lua_envs[info->state_id]->L;
--      if (!skb_make_writable(pskb, pskb->len))
-+      if (skb_ensure_writable(pskb, pskb->len))
-               return NF_DROP;
-       /* call the function provided by --function parameter or the default 'process_packet' defined in Lua */
-@@ -88,11 +88,11 @@ lua_tg(struct sk_buff *pskb, const struc
-       /* push the lua_packet_segment as a parameter */
-       p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
-       if (pskb->mac_header)
--              p->start = pskb->mac_header;
-+              p->start = skb_mac_header(pskb);
-       else if (pskb->network_header)
--              p->start = pskb->network_header;
-+              p->start = skb_network_header(pskb);
-       else if (pskb->transport_header)
--              p->start = pskb->transport_header;
-+              p->start = skb_transport_header(pskb);
-       p->offset = 0;
-       p->length = (unsigned long)pskb->tail - (unsigned long)p->start;
-       p->changes = NULL;
-@@ -208,16 +208,16 @@ static bool load_script_into_state(uint3
-  * some workqueue initialization. So far this is done each time this function
-  * is called, subject to change.
-  */
--static bool
-+static int
- lua_tg_checkentry(const struct xt_tgchk_param *par)
- {
-       const struct xt_lua_tginfo *info = par->targinfo;
-       if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
-               lua_state_refs[info->state_id]++;
--              return true;
-+              return 0;
-       }
--      return false;
-+      return -EINVAL;
- }
- /*::*
---- a/extensions/LUA/lua/llimits.h
-+++ b/extensions/LUA/lua/llimits.h
-@@ -8,7 +8,6 @@
- #define llimits_h
- #include <stddef.h>
--#include <limits.h>
- #include "lua.h"
---- a/extensions/LUA/lua/lapi.c
-+++ b/extensions/LUA/lua/lapi.c
-@@ -4,9 +4,6 @@
- ** See Copyright Notice in lua.h
- */
--#include <stdarg.h>
--#include <math.h>
--#include <assert.h>
- #include <string.h>
- #define lapi_c
---- a/extensions/LUA/lua/ltable.c
-+++ b/extensions/LUA/lua/ltable.c
-@@ -18,7 +18,6 @@
- ** Hence even when the load factor reaches 100%, performance remains good.
- */
--#include <math.h>
- #include <string.h>
- #define ltable_c
---- a/extensions/LUA/lua/luaconf.h
-+++ b/extensions/LUA/lua/luaconf.h
-@@ -13,8 +13,12 @@
- #if !defined(__KERNEL__)
- #include <limits.h>
- #else
-+#include <linux/kernel.h>
-+
-+#undef UCHAR_MAX
-+#undef BUFSIZ
-+#undef NO_FPU
- #define UCHAR_MAX     255
--#define SHRT_MAX        32767
- #define BUFSIZ                8192
- #define NO_FPU
- #endif
-@@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l;
- */
- #if defined(__KERNEL__)
- #undef LUA_USE_ULONGJMP
-+#define setjmp __builtin_setjmp
-+#define longjmp __builtin_longjmp
- #endif
- #if defined(__cplusplus)
---- a/extensions/LUA/lua/llex.h
-+++ b/extensions/LUA/lua/llex.h
-@@ -10,6 +10,8 @@
- #include "lobject.h"
- #include "lzio.h"
-+/* prevent conflict with definition from asm/current.h */
-+#undef current
- #define FIRST_RESERVED        257
diff --git a/net/xtables-addons/patches/210-freebsd-build-fix.patch b/net/xtables-addons/patches/210-freebsd-build-fix.patch
deleted file mode 100644 (file)
index 4f05d60..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/extensions/LUA/Makefile
-+++ b/extensions/LUA/Makefile
-@@ -110,7 +110,7 @@ PKG_CONFIG = /usr/bin/pkg-config
- RANLIB = ranlib
- SED = /bin/sed
- SET_MAKE = 
--SHELL = /bin/bash
-+SHELL = /bin/sh
- STRIP = strip
- VERSION = 1.21
- abs_builddir = /home/andre/Dropbox/xtables-addons/extensions/LUA