mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fix xtables
This commit is contained in:
parent
c9ca844e7f
commit
816f19640e
12 changed files with 48 additions and 311 deletions
56
xtables-addons/patches/200-add-lua-packetscript.patch
Executable file → Normal file
56
xtables-addons/patches/200-add-lua-packetscript.patch
Executable file → Normal 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue