From e0f67fb2030a75586695d66a522f98e26962d6ca Mon Sep 17 00:00:00 2001 From: bol-van Date: Fri, 27 Feb 2026 14:34:35 +0300 Subject: [PATCH] AI fixes --- lua/zapret-lib.lua | 2 +- nfq2/nfqws.c | 24 ++++++++++++++---------- nfq2/win.h | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lua/zapret-lib.lua b/lua/zapret-lib.lua index 3de372e..fa9203a 100644 --- a/lua/zapret-lib.lua +++ b/lua/zapret-lib.lua @@ -153,7 +153,7 @@ function apply_arg_prefix(desync) local c = string.sub(v,1,1) if c=='#' then local blb = blob(desync,string.sub(v,2)) - desync.arg[a] = tostring((type(blb)=='string' or type(blb)=='table') and #blb or 0) + desync.arg[a] = tostring(type(blb)=='string' and #blb or 0) elseif c=='%' then desync.arg[a] = blob(desync,string.sub(v,2)) elseif c=='\\' then diff --git a/nfq2/nfqws.c b/nfq2/nfqws.c index bb89d74..2877951 100644 --- a/nfq2/nfqws.c +++ b/nfq2/nfqws.c @@ -378,7 +378,11 @@ static bool nfq_init(struct nfq_handle **h, struct nfq_q_handle **qh, struct nfq // dot not fail. not supported in old linuxes <3.6 } - nfnl_rcvbufsiz(nfq_nfnlh(*h), Q_RCVBUF); + unsigned int rcvbuf = nfnl_rcvbufsiz(nfq_nfnlh(*h), Q_RCVBUF) / 2; + if (rcvbuf==Q_RCVBUF) + DLOG("set receive buffer size to %u\n", rcvbuf); + else + DLOG_CONDUP("could not set receive buffer size to %u. real size is %u\n", Q_RCVBUF, rcvbuf); int yes = 1, fd = nfq_fd(*h); @@ -412,7 +416,7 @@ static int nfq_main(void) ssize_t rd; FILE *Fpid = NULL; uint8_t *buf=NULL, *mod=NULL; - struct nfq_cb_data cbdata = { .sock = -1 }; + struct nfq_cb_data cbdata = { .sock = -1, .mod = NULL }; if (*params.pidfile && !(Fpid = fopen(params.pidfile, "w"))) { @@ -517,11 +521,18 @@ static int nfq_main(void) // do not fail on ENOBUFS } while (e == ENOBUFS); +err: + res=1; + goto ex; + +quit: + DLOG_CONDUP("quit requested\n"); exok: res=0; ex: - free(cbdata.mod); + if (Fpid) fclose(Fpid); if (cbdata.sock>=0) close(cbdata.sock); + free(cbdata.mod); free(buf); nfq_deinit(&h, &qh); lua_shutdown(); @@ -530,13 +541,6 @@ ex: #endif rawsend_cleanup(); return res; -err: - if (Fpid) fclose(Fpid); - res=1; - goto ex; -quit: - DLOG_CONDUP("quit requested\n"); - goto exok; } #elif defined(BSD) diff --git a/nfq2/win.h b/nfq2/win.h index c319fa1..63fa92a 100644 --- a/nfq2/win.h +++ b/nfq2/win.h @@ -4,6 +4,6 @@ #include -bool service_run(); +bool service_run(int argc, char *argv[]); #endif