summaryrefslogtreecommitdiff
path: root/net/xtables-addons/patches/201-fix-lua-packetscript.patch
diff options
context:
space:
mode:
authorPhilip Prindeville <philipp@redfish-solutions.com>2018-01-08 08:18:19 -0700
committerJo-Philipp Wich <jo@mein.io>2018-01-16 19:24:39 +0100
commit3ba01ac1da67eed08bc8300261b915883f35a2e0 (patch)
tree592ada3c337a39a8d6401efde3d27132d0a21581 /net/xtables-addons/patches/201-fix-lua-packetscript.patch
parent72a4ac1585da26134cfcd6656569acf77295b402 (diff)
xtables-addons: import from OpenWrt base
This commit moves xtables-addons from https://github.com/openwrt/openwrt/tree/master/package/network/utils/xtables-addons into the package feed repository to allow for dependencies on other feed packages, such as Perl. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> [fix commit message] Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'net/xtables-addons/patches/201-fix-lua-packetscript.patch')
-rw-r--r--net/xtables-addons/patches/201-fix-lua-packetscript.patch127
1 files changed, 127 insertions, 0 deletions
diff --git a/net/xtables-addons/patches/201-fix-lua-packetscript.patch b/net/xtables-addons/patches/201-fix-lua-packetscript.patch
new file mode 100644
index 000000000..a9fb796d0
--- /dev/null
+++ b/net/xtables-addons/patches/201-fix-lua-packetscript.patch
@@ -0,0 +1,127 @@
+--- 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;
+@@ -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
+