From c3adb3f045f9e2f78f90c11a75ccd98e6e767101 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 15 Jan 2026 11:46:36 +0300 Subject: [PATCH] nfqws2: simplify complex unwinds in lua code --- nfq2/lua.c | 6 +++--- nfq2/lua.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nfq2/lua.c b/nfq2/lua.c index db4f8a9..1fe6803 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -1664,7 +1664,7 @@ static bool lua_reconstruct_ip6exthdr(lua_State *L, int idx, struct ip6_hdr *ip6 LUA_STACK_GUARD_LEAVE(L, 0) return true; err: - LUA_STACK_GUARD_UNWIND_RETURN(L, 0) + LUA_STACK_GUARD_UNWIND(L) return false; } bool lua_reconstruct_ip6hdr(lua_State *L, int idx, struct ip6_hdr *ip6, size_t *len, uint8_t last_proto, bool preserve_next) @@ -1910,7 +1910,7 @@ end: LUA_STACK_GUARD_LEAVE(L, 0) return true; err: - LUA_STACK_GUARD_UNWIND_RETURN(L, 0) + LUA_STACK_GUARD_UNWIND(L) return false; } bool lua_reconstruct_tcphdr(lua_State *L, int idx, struct tcphdr *tcp, size_t *len) @@ -2199,7 +2199,7 @@ bool lua_reconstruct_dissect(lua_State *L, int idx, uint8_t *buf, size_t *len, b LUA_STACK_GUARD_LEAVE(L, 0) return true; err: - LUA_STACK_GUARD_UNWIND_RETURN(L, 0) + LUA_STACK_GUARD_UNWIND(L) return false; } static int luacall_reconstruct_dissect(lua_State *L) diff --git a/nfq2/lua.h b/nfq2/lua.h index 84042c8..2f44e1a 100644 --- a/nfq2/lua.h +++ b/nfq2/lua.h @@ -39,8 +39,6 @@ #define LUA_STACK_GUARD_LEAVE(L,N) if ((_lsg+N)!=lua_gettop(L)) luaL_error(L,"stack guard failure"); #define LUA_STACK_GUARD_RETURN(L,N) LUA_STACK_GUARD_LEAVE(L,N); return N; #define LUA_STACK_GUARD_UNWIND(L) lua_settop(L,_lsg); -#define LUA_STACK_GUARD_UNWIND_RETURN(L,N) LUA_STACK_GUARD_UNWIND(L); return N; - void desync_instance(const char *func, unsigned int dp_n, unsigned int func_n, char *instance, size_t inst_size);