From: Jo Johnson Date: Fri, 26 Jan 2024 18:09:00 +0000 (-0800) Subject: lua: remove internal references to luajit X-Git-Tag: suricata-8.0.0-beta1~1266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01c8af766c4a20a1f9fd715d2e365064a315cb54;p=thirdparty%2Fsuricata.git lua: remove internal references to luajit --- diff --git a/src/detect-lua-extensions.c b/src/detect-lua-extensions.c index 9a0850b9e9..da4ec8b583 100644 --- a/src/detect-lua-extensions.c +++ b/src/detect-lua-extensions.c @@ -124,7 +124,7 @@ static int GetFlowVarById(lua_State *luastate, Flow *f, LUA_ERROR("flowvar id not a number"); } int id = lua_tonumber(luastate, 1); - if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) { + if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) { LUA_ERROR("flowvar id out of range"); } uint32_t idx = ld->flowvar[id]; @@ -185,7 +185,7 @@ static int GetFlowIntById(lua_State *luastate, Flow *f, LUA_ERROR("flowvar id not a number"); } int id = lua_tonumber(luastate, 1); - if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) { + if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) { LUA_ERROR("flowvar id out of range"); } uint32_t idx = ld->flowint[id]; @@ -391,7 +391,7 @@ static int LuaSetFlowint(lua_State *luastate) LUA_ERROR("1st arg not a number"); } int id = lua_tonumber(luastate, 1); - if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) { + if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) { LUA_ERROR("flowint id out of range"); } @@ -496,7 +496,7 @@ static int LuaGetByteVar(lua_State *luastate) LUA_ERROR("bytevar id not a number"); } int id = lua_tonumber(luastate, 1); - if (id < 0 || id >= DETECT_LUAJIT_MAX_BYTEVARS) { + if (id < 0 || id >= DETECT_LUA_MAX_BYTEVARS) { LUA_ERROR("bytevar id out of range"); } uint32_t idx = ld->bytevar[id]; diff --git a/src/detect-lua.c b/src/detect-lua.c index a6d334537d..a88f7e79a8 100644 --- a/src/detect-lua.c +++ b/src/detect-lua.c @@ -60,7 +60,7 @@ static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c) { - SCLogError("no Lua support built in, needed for lua/luajit keyword"); + SCLogError("no Lua support built in, needed for lua keyword"); return -1; } @@ -70,7 +70,6 @@ static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char void DetectLuaRegister(void) { sigmatch_table[DETECT_LUA].name = "lua"; - sigmatch_table[DETECT_LUA].alias = "luajit"; sigmatch_table[DETECT_LUA].desc = "support for lua scripting"; sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html"; sigmatch_table[DETECT_LUA].Setup = DetectLuaSetupNoSupport; @@ -104,7 +103,6 @@ static int g_smtp_generic_list_id = 0; void DetectLuaRegister(void) { sigmatch_table[DETECT_LUA].name = "lua"; - sigmatch_table[DETECT_LUA].alias = "luajit"; sigmatch_table[DETECT_LUA].desc = "match via a lua script"; sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html"; sigmatch_table[DETECT_LUA].Match = DetectLuaMatch; @@ -662,7 +660,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const /* removes 'value'; keeps 'key' for next iteration */ lua_pop(luastate, 1); - if (ld->flowvars == DETECT_LUAJIT_MAX_FLOWVARS) { + if (ld->flowvars == DETECT_LUA_MAX_FLOWVARS) { SCLogError("too many flowvars registered"); goto error; } @@ -684,7 +682,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const /* removes 'value'; keeps 'key' for next iteration */ lua_pop(luastate, 1); - if (ld->flowints == DETECT_LUAJIT_MAX_FLOWINTS) { + if (ld->flowints == DETECT_LUA_MAX_FLOWINTS) { SCLogError("too many flowints registered"); goto error; } @@ -706,7 +704,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const /* removes 'value'; keeps 'key' for next iteration */ lua_pop(luastate, 1); - if (ld->bytevars == DETECT_LUAJIT_MAX_BYTEVARS) { + if (ld->bytevars == DETECT_LUA_MAX_BYTEVARS) { SCLogError("too many bytevars registered"); goto error; } diff --git a/src/detect-lua.h b/src/detect-lua.h index ae38b026ca..4f3834087f 100644 --- a/src/detect-lua.h +++ b/src/detect-lua.h @@ -34,9 +34,9 @@ typedef struct DetectLuaThreadData { int alproto; } DetectLuaThreadData; -#define DETECT_LUAJIT_MAX_FLOWVARS 15 -#define DETECT_LUAJIT_MAX_FLOWINTS 15 -#define DETECT_LUAJIT_MAX_BYTEVARS 15 +#define DETECT_LUA_MAX_FLOWVARS 15 +#define DETECT_LUA_MAX_FLOWINTS 15 +#define DETECT_LUA_MAX_BYTEVARS 15 typedef struct DetectLuaData { int thread_ctx_id; @@ -45,12 +45,12 @@ typedef struct DetectLuaData { uint32_t flags; AppProto alproto; char *buffername; /* buffer name in case of a single buffer */ - uint32_t flowint[DETECT_LUAJIT_MAX_FLOWINTS]; + uint32_t flowint[DETECT_LUA_MAX_FLOWINTS]; uint16_t flowints; uint16_t flowvars; - uint32_t flowvar[DETECT_LUAJIT_MAX_FLOWVARS]; + uint32_t flowvar[DETECT_LUA_MAX_FLOWVARS]; uint16_t bytevars; - uint32_t bytevar[DETECT_LUAJIT_MAX_BYTEVARS]; + uint32_t bytevar[DETECT_LUA_MAX_BYTEVARS]; uint32_t sid; uint32_t rev; uint32_t gid;