From 0446b1493bfb4e4928a2446feeb6e84492256ed2 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sat, 17 Jan 2026 10:01:26 +0300 Subject: [PATCH] AI inspired fixes --- lua/zapret-auto.lua | 1 + nfq2/lua.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/zapret-auto.lua b/lua/zapret-auto.lua index ce20fc1..3050d1d 100644 --- a/lua/zapret-auto.lua +++ b/lua/zapret-auto.lua @@ -58,6 +58,7 @@ function automate_host_record(desync) end -- per-connection storage function automate_conn_record(desync) + if not desync.track then return nil end if not desync.track.lua_state.automate then desync.track.lua_state.automate = {} end diff --git a/nfq2/lua.c b/nfq2/lua.c index d0679cd..f66ddba 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -1278,11 +1278,11 @@ void lua_pushf_iphdr(lua_State *L, const struct ip *ip, size_t len) lua_pushf_int(L,"ip_off",ntohs(ip->ip_off)); lua_pushf_int(L,"ip_ttl",ip->ip_ttl); lua_pushf_int(L,"ip_p",ip->ip_p); - lua_pushf_int(L,"ip_sum",ip->ip_sum); + lua_pushf_int(L,"ip_sum",ntohs(ip->ip_sum)); lua_pushf_raw(L,"ip_src",&ip->ip_src,sizeof(struct in_addr)); lua_pushf_raw(L,"ip_dst",&ip->ip_dst,sizeof(struct in_addr)); if (b_has_opt) - lua_pushf_raw(L,"options",(uint8_t*)(ip+1),hl-sizeof(struct tcphdr)); + lua_pushf_raw(L,"options",(uint8_t*)(ip+1),hl-sizeof(struct ip)); } else lua_pushnil(L);