From: Juliana Fajardini Date: Mon, 5 Jul 2021 11:18:41 +0000 (+0100) Subject: lua: use pushinteger for int in flow/packet tuples X-Git-Tag: suricata-5.0.8~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d47ec1634f15ef98e430c36ff4f25900ce27897d;p=thirdparty%2Fsuricata.git lua: use pushinteger for int in flow/packet tuples (cherry picked from commit 7592a9be433b9decba1c40928e6840d0a5071ace) --- diff --git a/src/util-lua-common.c b/src/util-lua-common.c index f987830094..e9675a5a76 100644 --- a/src/util-lua-common.c +++ b/src/util-lua-common.c @@ -334,7 +334,7 @@ static int LuaCallbackTuplePushToStackFromPacket(lua_State *luastate, const Pack } else if (PKT_IS_IPV6(p)) { ipver = 6; } - lua_pushnumber (luastate, ipver); + lua_pushinteger(luastate, ipver); if (ipver == 0) return 1; @@ -351,17 +351,17 @@ static int LuaCallbackTuplePushToStackFromPacket(lua_State *luastate, const Pack lua_pushstring (luastate, dstip); /* proto and ports (or type/code) */ - lua_pushnumber (luastate, p->proto); + lua_pushinteger(luastate, p->proto); if (p->proto == IPPROTO_TCP || p->proto == IPPROTO_UDP) { - lua_pushnumber (luastate, p->sp); - lua_pushnumber (luastate, p->dp); + lua_pushinteger(luastate, p->sp); + lua_pushinteger(luastate, p->dp); } else if (p->proto == IPPROTO_ICMP || p->proto == IPPROTO_ICMPV6) { - lua_pushnumber (luastate, p->icmp_s.type); - lua_pushnumber (luastate, p->icmp_s.code); + lua_pushinteger(luastate, p->icmp_s.type); + lua_pushinteger(luastate, p->icmp_s.code); } else { - lua_pushnumber (luastate, 0); - lua_pushnumber (luastate, 0); + lua_pushinteger(luastate, 0); + lua_pushinteger(luastate, 0); } return 6; @@ -397,7 +397,7 @@ static int LuaCallbackTuplePushToStackFromFlow(lua_State *luastate, const Flow * } else if (FLOW_IS_IPV6(f)) { ipver = 6; } - lua_pushnumber (luastate, ipver); + lua_pushinteger(luastate, ipver); if (ipver == 0) return 1; @@ -414,17 +414,17 @@ static int LuaCallbackTuplePushToStackFromFlow(lua_State *luastate, const Flow * lua_pushstring (luastate, dstip); /* proto and ports (or type/code) */ - lua_pushnumber (luastate, f->proto); + lua_pushinteger(luastate, f->proto); if (f->proto == IPPROTO_TCP || f->proto == IPPROTO_UDP) { - lua_pushnumber (luastate, f->sp); - lua_pushnumber (luastate, f->dp); + lua_pushinteger(luastate, f->sp); + lua_pushinteger(luastate, f->dp); } else if (f->proto == IPPROTO_ICMP || f->proto == IPPROTO_ICMPV6) { - lua_pushnumber (luastate, f->icmp_s.type); - lua_pushnumber (luastate, f->icmp_s.code); + lua_pushinteger(luastate, f->icmp_s.type); + lua_pushinteger(luastate, f->icmp_s.code); } else { - lua_pushnumber (luastate, 0); - lua_pushnumber (luastate, 0); + lua_pushinteger(luastate, 0); + lua_pushinteger(luastate, 0); } return 6;