Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-13 22:03:09 +00:00
This commit is contained in:
bol-van
2026-02-27 14:34:35 +03:00
parent da6f4c8536
commit e0f67fb203
3 changed files with 16 additions and 12 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -4,6 +4,6 @@
#include <stdbool.h>
bool service_run();
bool service_run(int argc, char *argv[]);
#endif