lua: remove lua as a compile time feature

Its always built-in. However, can be disabled at runtime.
pull/11165/head
Jason Ish 2 years ago
parent 1fd2c1a379
commit 2e440169d6

@ -168,7 +168,7 @@ jobs:
git -c advice.detachedHead=false checkout FETCH_HEAD
- run: ./autogen.sh
- run: ./configure --enable-warnings --disable-lua
- run: ./configure --enable-warnings
- run: make -j ${{ env.CPUS }}
- run: python3 ./suricata-verify/run.py -q --debug-failed
- run: make install-full

@ -88,7 +88,7 @@ jobs:
git checkout $rev
echo "Building rev ${rev}" | tee -a build_log.txt
./autogen.sh >> build_log.txt 2>&1
CC="sccache gcc" ./configure --enable-warnings --enable-unittests --disable-lua >> build_log.txt 2>&1
CC="sccache gcc" ./configure --enable-warnings --enable-unittests >> build_log.txt 2>&1
if ! make -j2 >> build_log.txt 2>&1; then
echo "::error ::Failed to build rev ${rev}"
tail -n 50 build_log.txt

@ -130,7 +130,7 @@ jobs:
shell: bash {0}
- run: git clone https://github.com/OISF/libhtp -b 0.5.x
- run: ./autogen.sh
- run: ./configure --enable-warnings --enable-unittests --disable-lua
- run: ./configure --enable-warnings --enable-unittests
- name: Check formatting
run: |
./scripts/clang-format.sh check-branch --diffstat --show-commits >> check_formatting_log.txt 2>&1

@ -1871,11 +1871,6 @@
fi
fi
# Lua support, always enabled
# TODO: Update the code to not require this.
AC_DEFINE([HAVE_LUA], [1], [lua support available])
AM_CONDITIONAL([HAVE_LUA], [true])
# libmaxminddb
AC_ARG_ENABLE(geoip,
AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]),
@ -2502,7 +2497,6 @@ SURICATA_BUILD_CONF="Suricata Configuration:
hiredis support: ${enable_hiredis}
hiredis async with libevent: ${enable_hiredis_async}
PCRE jit: ${pcre2_jit_available}
LUA support: ${enable_lua}
GeoIP2 support: ${enable_geoip}
JA3 support: ${enable_ja3}
JA4 support: ${enable_ja4}

@ -17,7 +17,6 @@ name = "suricata"
debug = true
[features]
lua = []
strict = []
debug = []
debug-validate = []

@ -14,10 +14,6 @@ if RUST_BUILD_STD
NIGHTLY_ARGS = -Z build-std
endif
if HAVE_LUA
RUST_FEATURES += lua $(LUA_INT8)
endif
if HAVE_JA3
RUST_FEATURES += ja3
endif

@ -21,6 +21,4 @@ pub mod detect;
pub mod dns;
pub mod log;
pub mod parser;
#[cfg(feature = "lua")]
pub mod lua;

@ -86,7 +86,6 @@ pub mod detect;
pub mod ja4;
#[cfg(feature = "lua")]
pub mod lua;
pub mod dns;

@ -28,6 +28,3 @@ pub mod nfs2;
pub mod nfs3;
pub mod nfs4;
pub mod log;
//#[cfg(feature = "lua")]
//pub mod lua;

@ -42,6 +42,3 @@ pub mod events;
pub mod auth;
pub mod files;
pub mod funcs;
//#[cfg(feature = "lua")]
//pub mod lua;

@ -59,8 +59,6 @@ util_lua_dnp3_objects_c_template = """/* Copyright (C) 2015 Open Information Sec
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -120,8 +118,6 @@ void DNP3PushPoint(lua_State *luastate, DNP3Object *object,
}
}
#endif /* HAVE_LUA */
"""
output_json_dnp3_objects_template = """/* Copyright (C) 2015 Open Information Security Foundation

@ -116,7 +116,6 @@ void DetectDnsQueryRegister (void)
g_dns_query_buffer_id = DetectBufferTypeGetByName("dns_query");
#ifdef HAVE_LUA
/* register these generic engines from here for now */
DetectAppLayerInspectEngineRegister(
"dns_request", ALPROTO_DNS, SIG_FLAG_TOSERVER, 1, DetectEngineInspectGenericList, NULL);
@ -125,9 +124,7 @@ void DetectDnsQueryRegister (void)
DetectBufferTypeSetDescriptionByName("dns_request",
"dns requests");
DetectBufferTypeSetDescriptionByName("dns_response",
"dns responses");
#endif
DetectBufferTypeSetDescriptionByName("dns_response", "dns responses");
}

@ -62,9 +62,7 @@
#include "util-unittest-helper.h"
#include "util-profiling.h"
#ifdef HAVE_LUA
#include "util-lua.h"
#endif
#ifdef UNITTESTS
thread_local uint32_t ut_inspection_recursion_counter = 0;
@ -650,7 +648,6 @@ static int DetectEngineContentInspectionInternal(DetectEngineThreadCtx *det_ctx,
goto match;
}
goto no_match_discontinue;
#ifdef HAVE_LUA
}
else if (smd->type == DETECT_LUA) {
SCLogDebug("lua starting");
@ -663,7 +660,6 @@ static int DetectEngineContentInspectionInternal(DetectEngineThreadCtx *det_ctx,
}
SCLogDebug("lua match");
goto match;
#endif /* HAVE_LUA */
} else if (smd->type == DETECT_BASE64_DECODE) {
if (DetectBase64DecodeDoMatch(det_ctx, s, smd, buffer, buffer_len)) {
if (s->sm_arrays[DETECT_SM_LIST_BASE64_DATA] != NULL) {

@ -59,8 +59,6 @@
#include "app-layer-parser.h"
#ifdef HAVE_LUA
#include "util-lua.h"
#include "util-lua-common.h"
#include "util-lua-http.h"
@ -591,5 +589,3 @@ int LuaRegisterExtensions(lua_State *lua_state)
LuaRegisterDNP3Functions(lua_state);
return 0;
}
#endif /* HAVE_LUA */

@ -24,11 +24,9 @@
#ifndef SURICATA_DETECT_LUA_EXT_H
#define SURICATA_DETECT_LUA_EXT_H
#ifdef HAVE_LUA
int LuaRegisterExtensions(lua_State *);
void LuaExtensionsMatchSetup(lua_State *lua_state, DetectLuaData *, DetectEngineThreadCtx *det_ctx,
Flow *f, Packet *p, const Signature *s, uint8_t flags);
#endif /* HAVE_LUA */
#endif

@ -56,32 +56,6 @@
#include "util-var-name.h"
#ifndef HAVE_LUA
static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
{
SCLogError("no Lua support built in, needed for lua keyword");
return -1;
}
/**
* \brief Registration function for keyword: lua
*/
void DetectLuaRegister(void)
{
sigmatch_table[DETECT_LUA].name = "lua";
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;
sigmatch_table[DETECT_LUA].Free = NULL;
sigmatch_table[DETECT_LUA].flags = SIGMATCH_NOT_BUILT;
SCLogDebug("registering lua rule option");
return;
}
#else /* HAVE_LUA */
#include "util-lua.h"
#include "util-lua-sandbox.h"
@ -2448,4 +2422,3 @@ void DetectLuaRegisterTests(void)
UtRegisterTest("LuaMatchTest06a", LuaMatchTest06a);
}
#endif
#endif /* HAVE_LUA */

@ -24,8 +24,6 @@
#ifndef SURICATA_DETECT_LUA_H
#define SURICATA_DETECT_LUA_H
#ifdef HAVE_LUA
#include "util-lua.h"
#include "util-lua-sandbox.h"
@ -60,8 +58,6 @@ typedef struct DetectLuaData {
int allow_restricted_functions;
} DetectLuaData;
#endif /* HAVE_LUA */
/* prototypes */
void DetectLuaRegister (void);
int DetectLuaMatchBuffer(DetectEngineThreadCtx *det_ctx,

@ -2076,9 +2076,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
}
}
}
#ifdef HAVE_LUA
DetectLuaPostSetup(s);
#endif
if ((s->init_data->init_flags & SIG_FLAG_INIT_JA) && s->alproto != ALPROTO_UNKNOWN &&
s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {

@ -25,7 +25,6 @@
#include "suricata-common.h"
#include "output-lua.h"
#ifdef HAVE_LUA
#include "util-print.h"
#include "util-unittest.h"
#include "util-debug.h"
@ -888,11 +887,3 @@ void LuaLogRegister(void) {
/* register as separate module */
OutputRegisterModule(MODULE_NAME, "lua", OutputLuaLogInit);
}
#else /* HAVE_LUA */
void LuaLogRegister (void) {
/* no-op */
}
#endif /* HAVE_LUA */

@ -829,13 +829,6 @@ void RunModeInitializeOutputs(void)
} else if (strncmp(output->val, "unified2-", sizeof("unified2-") - 1) == 0) {
SCLogWarning("Unified2 is no longer supported.");
continue;
} else if (strcmp(output->val, "lua") == 0) {
#ifndef HAVE_LUA
SCLogWarning("lua support not compiled in. Reconfigure/"
"recompile with lua(jit) and its development "
"files installed to add lua support.");
continue;
#endif
} else if (strcmp(output->val, "dns-log") == 0) {
SCLogWarning("dns-log is not longer available as of Suricata 5.0");
continue;

@ -740,9 +740,8 @@ static void PrintBuildInfo(void)
strlcat(features, "HAVE_NSS ", sizeof(features));
/* HTTP2_DECOMPRESSION is not an optional feature in this major version */
strlcat(features, "HTTP2_DECOMPRESSION ", sizeof(features));
#ifdef HAVE_LUA
/* Lua is now vendored in and always available. */
strlcat(features, "HAVE_LUA ", sizeof(features));
#endif
#ifdef HAVE_JA3
strlcat(features, "HAVE_JA3 ", sizeof(features));
#endif

@ -48,8 +48,6 @@
#include "util-time.h"
#include "util-conf.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -1004,7 +1002,4 @@ int LuaStateNeedProto(lua_State *luastate, AppProto alproto)
flow_alproto = flow->alproto;
return (alproto == flow_alproto);
}
#endif /* HAVE_LUA */

@ -24,8 +24,6 @@
#ifndef SURICATA_UTIL_LUA_COMMON_H
#define SURICATA_UTIL_LUA_COMMON_H
#ifdef HAVE_LUA
int LuaCallbackError(lua_State *luastate, const char *msg);
const char *LuaGetStringArgument(lua_State *luastate, int argc);
@ -37,6 +35,4 @@ int LuaRegisterFunctions(lua_State *luastate);
int LuaStateNeedProto(lua_State *luastate, AppProto alproto);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_COMMON_H */

@ -27,8 +27,6 @@
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -3539,5 +3537,3 @@ void DNP3PushPoint(lua_State *luastate, DNP3Object *object,
break;
}
}
#endif /* HAVE_LUA */

@ -20,8 +20,6 @@
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -197,5 +195,3 @@ int LuaRegisterDNP3Functions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -18,10 +18,6 @@
#ifndef SURICATA_UTIL_LUA_DNP3_H
#define SURICATA_UTIL_LUA_DNP3_H
#ifdef HAVE_LUA
int LuaRegisterDNP3Functions(lua_State *);
#endif /* HAVE_LUA */
#endif /* !SURICATA_UTIL_LUA_DNP3_H */

@ -47,8 +47,6 @@
#include "util-time.h"
#include "rust.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -158,5 +156,3 @@ int LuaRegisterDnsFunctions(lua_State *luastate)
lua_setglobal(luastate, "DnsGetRecursionDesired");
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_DNS_H
#define SURICATA_UTIL_LUA_DNS_H
#ifdef HAVE_LUA
int LuaRegisterDnsFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* __UTIL_LUA_HTTP_H__ */

@ -47,8 +47,6 @@
#include "util-logopenfile.h"
#include "util-time.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -215,5 +213,3 @@ int LuaRegisterHasshFunctions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_HASSH_H
#define SURICATA_UTIL_LUA_HASSH_H
#ifdef HAVE_LUA
int LuaRegisterHasshFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_HASSH_H */

@ -46,8 +46,6 @@
#include "util-logopenfile.h"
#include "util-time.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -349,5 +347,3 @@ int LuaRegisterHttpFunctions(lua_State *luastate)
lua_setglobal(luastate, "HttpGetResponseBody");
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_HTTP_H
#define SURICATA_UTIL_LUA_HTTP_H
#ifdef HAVE_LUA
int LuaRegisterHttpFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_HTTP_H */

@ -47,8 +47,6 @@
#include "util-logopenfile.h"
#include "util-time.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -168,5 +166,3 @@ int LuaRegisterJa3Functions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_JA3_H
#define SURICATA_UTIL_LUA_JA3_H
#ifdef HAVE_LUA
int LuaRegisterJa3Functions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_JA3_H */

@ -23,22 +23,15 @@
#include "suricata-common.h"
#ifdef HAVE_LUA
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "util-debug.h"
#include "util-validate.h"
#include "util-lua-sandbox.h"
#if !defined(SANDBOX_ALLOC_CTX)
#define SANDBOX_CTX "SANDBOX_CTX"
#endif
typedef struct BlockedFunction {
const char *module;
@ -66,6 +59,7 @@ static void *LuaAlloc(void *ud, void *ptr, size_t osize, size_t nsize)
if (nsize == 0) {
if (ptr != NULL) {
// ASSERT: alloc_bytes > osize
DEBUG_VALIDATE_BUG_ON(ctx->alloc_bytes < osize);
ctx->alloc_bytes -= osize;
}
SCFree(ptr);
@ -334,5 +328,3 @@ static int OpenSandbox(lua_State *L)
luaL_newlib(L, sblib);
return 1;
}
#endif

@ -36,8 +36,6 @@
#include "app-layer-smtp.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
@ -338,5 +336,3 @@ int LuaRegisterSmtpFunctions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -18,10 +18,6 @@
#ifndef SURICATA_UTIL_LUA_SMTP_H
#define SURICATA_UTIL_LUA_SMTP_H
#ifdef HAVE_LUA
int LuaRegisterSmtpFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_SMTP_H */

@ -48,8 +48,6 @@
#include "util-time.h"
#include "rust.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -215,5 +213,3 @@ int LuaRegisterSshFunctions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_SSH_H
#define SURICATA_UTIL_LUA_SSH_H
#ifdef HAVE_LUA
int LuaRegisterSshFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_SSH_H */

@ -47,8 +47,6 @@
#include "util-logopenfile.h"
#include "util-time.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -363,5 +361,3 @@ int LuaRegisterTlsFunctions(lua_State *luastate)
return 0;
}
#endif /* HAVE_LUA */

@ -24,10 +24,6 @@
#ifndef SURICATA_UTIL_LUA_TLS_H
#define SURICATA_UTIL_LUA_TLS_H
#ifdef HAVE_LUA
int LuaRegisterTlsFunctions(lua_State *luastate);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_TLS_H */

@ -47,8 +47,6 @@
#include "util-logopenfile.h"
#include "util-time.h"
#ifdef HAVE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -344,5 +342,3 @@ int LuaPushInteger(lua_State *luastate, lua_Integer n)
lua_pushinteger(luastate, n);
return 1;
}
#endif /* HAVE_LUA */

@ -24,14 +24,6 @@
#ifndef SURICATA_UTIL_LUA_H
#define SURICATA_UTIL_LUA_H
#ifndef HAVE_LUA
/* If we don't have Lua, create a typedef for lua_State so the
* exported Lua functions don't fail the build. */
typedef void lua_State;
#else
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
@ -108,6 +100,4 @@ int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_
int LuaPushInteger(lua_State *luastate, lua_Integer n);
#endif /* HAVE_LUA */
#endif /* SURICATA_UTIL_LUA_H */

Loading…
Cancel
Save