mirror of
https://github.com/bol-van/zapret.git
synced 2025-08-10 01:02:03 +03:00
tpws,nfqws: return lists reload on HUP
This commit is contained in:
29
nfq/nfqws.c
29
nfq/nfqws.c
@@ -49,14 +49,34 @@
|
||||
#define MAX_CONFIG_FILE_SIZE 16384
|
||||
|
||||
struct params_s params;
|
||||
static bool bReload=false;
|
||||
#ifdef __CYGWIN__
|
||||
bool bQuit=false;
|
||||
#endif
|
||||
|
||||
static void onhup(int sig)
|
||||
{
|
||||
printf("HUP received !\n");
|
||||
// do not do anything. lists auto reload themselves based on file time.
|
||||
printf("HUP received ! Lists will be reloaded.\n");
|
||||
bReload=true;
|
||||
}
|
||||
static void ReloadCheck()
|
||||
{
|
||||
if (bReload)
|
||||
{
|
||||
ResetAllHostlistsModTime();
|
||||
if (!LoadAllHostLists())
|
||||
{
|
||||
DLOG_ERR("hostlists load failed. this is fatal.\n");
|
||||
exit(1);
|
||||
}
|
||||
ResetAllIpsetModTime();
|
||||
if (!LoadAllIpsets())
|
||||
{
|
||||
DLOG_ERR("ipset load failed. this is fatal.\n");
|
||||
exit(1);
|
||||
}
|
||||
bReload=false;
|
||||
}
|
||||
}
|
||||
|
||||
static void onusr1(int sig)
|
||||
@@ -251,6 +271,7 @@ static int nfq_main(void)
|
||||
{
|
||||
while ((rd = recv(fd, buf, sizeof(buf), 0)) >= 0)
|
||||
{
|
||||
ReloadCheck();
|
||||
if (rd)
|
||||
{
|
||||
int r = nfq_handle_packet(h, (char *)buf, (int)rd);
|
||||
@@ -371,6 +392,8 @@ static int dvt_main(void)
|
||||
uint8_t verdict;
|
||||
size_t len = rd;
|
||||
|
||||
ReloadCheck();
|
||||
|
||||
DLOG("packet: id=%u len=%zu\n", id, len);
|
||||
verdict = processPacketData(&mark, NULL, buf, &len);
|
||||
switch (verdict & VERDICT_MASK)
|
||||
@@ -489,6 +512,8 @@ static int win_main(const char *windivert_filter)
|
||||
return w_win32_error;
|
||||
}
|
||||
|
||||
ReloadCheck();
|
||||
|
||||
*ifout=0;
|
||||
if (wa.Outbound) snprintf(ifout,sizeof(ifout),"%u.%u", wa.Network.IfIdx, wa.Network.SubIfIdx);
|
||||
DLOG("packet: id=%u len=%zu %s IPv6=%u IPChecksum=%u TCPChecksum=%u UDPChecksum=%u IfIdx=%u.%u\n", id, len, wa.Outbound ? "outbound" : "inbound", wa.IPv6, wa.IPChecksum, wa.TCPChecksum, wa.UDPChecksum, wa.Network.IfIdx, wa.Network.SubIfIdx);
|
||||
|
Reference in New Issue
Block a user