diff --git a/src/output-lua.c b/src/output-lua.c index 6c937c1e28..1785dc7336 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -89,6 +89,10 @@ static int LuaTxLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow SCMutexLock(&td->lua_ctx->m); + /* we need the p in our callbacks */ + lua_pushlightuserdata(td->lua_ctx->luastate, (void *)&lualog_ext_key_p); + lua_pushlightuserdata(td->lua_ctx->luastate, (void *)p); + lua_settable(td->lua_ctx->luastate, LUA_REGISTRYINDEX); /* we need the tx in our callbacks */ lua_pushlightuserdata(td->lua_ctx->luastate, (void *)&lualog_ext_key_tx); lua_pushlightuserdata(td->lua_ctx->luastate, (void *)txptr); @@ -156,6 +160,11 @@ static int LuaPacketLoggerAlerts(ThreadVars *tv, void *thread_data, const Packet lua_getglobal(td->lua_ctx->luastate, "log"); + /* we need the p in our callbacks */ + lua_pushlightuserdata(td->lua_ctx->luastate, (void *)&lualog_ext_key_p); + lua_pushlightuserdata(td->lua_ctx->luastate, (void *)p); + lua_settable(td->lua_ctx->luastate, LUA_REGISTRYINDEX); + /* prepare data to pass to script */ lua_newtable(td->lua_ctx->luastate);