mirror of
https://github.com/bol-van/zapret2.git
synced 2026-10-12 05:07:00 +04:00
nfqws2: do not make autohostlists nonempty if no lists were reloaded
This commit is contained in:
1 parent
c1e8e7c0d9
commit
5fab86344a
2 files changed
+17
-9
No files matched your search
+4
-2
@@ -309,11 +309,13 @@ static struct desync_profile *dp_find(
|
||||
{
|
||||
struct desync_profile_list *dpl;
|
||||
struct dp_match_data match = {
|
||||
.l3proto=l3proto,
|
||||
.ip=ip, .ip6=ip6, .ipr=ipr, .ipr6=ipr6,
|
||||
.port=port, .icmp_type=icmp_type, .icmp_code=icmp_code,
|
||||
.hostname=hostname, .bNoSubdom=bNoSubdom, l7proto=l7proto,
|
||||
.hostname=hostname, .bNoSubdom=bNoSubdom, .l7proto=l7proto,
|
||||
.ssid=ssid, .fwmark=fwmark,
|
||||
.bCheckDone=bCheckDone, .bCheckResult=bCheckResult, .bExcluded=bExcluded};
|
||||
.bCheckDone=bCheckDone, .bCheckResult=bCheckResult, .bExcluded=bExcluded
|
||||
};
|
||||
if (params.debug)
|
||||
{
|
||||
char s[INET6_ADDRSTRLEN];
|
||||
|
||||
+13
-7
@@ -115,7 +115,8 @@ bool AppendHostList(hostlist_pool **hostlist, const char *filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool LoadHostList(struct hostlist_file *hfile)
|
||||
// bLoaded is set to true if the list was loaded and not set otherwise
|
||||
static bool LoadHostList(struct hostlist_file *hfile, bool *bLoaded)
|
||||
{
|
||||
if (hfile->filename)
|
||||
{
|
||||
@@ -143,20 +144,21 @@ static bool LoadHostList(struct hostlist_file *hfile)
|
||||
return false;
|
||||
}
|
||||
hfile->mod_sig=fsig;
|
||||
if (bLoaded) *bLoaded=true;
|
||||
}
|
||||
return true;
|
||||
unchanged:
|
||||
DLOG_ERR("cannot access hostlist file '%s'. in-memory content remains unchanged.\n",hfile->filename);
|
||||
return true;
|
||||
}
|
||||
static bool LoadHostLists(struct hostlist_files_head *list)
|
||||
static bool LoadHostLists(struct hostlist_files_head *list, bool *bLoaded)
|
||||
{
|
||||
bool bres=true;
|
||||
struct hostlist_file *hfile;
|
||||
|
||||
LIST_FOREACH(hfile, list, next)
|
||||
{
|
||||
if (!LoadHostList(hfile))
|
||||
if (!LoadHostList(hfile, bLoaded))
|
||||
// at least one failed
|
||||
bres=false;
|
||||
}
|
||||
@@ -181,9 +183,10 @@ static void MakeAutolistsNonEmpty()
|
||||
|
||||
bool LoadAllHostLists()
|
||||
{
|
||||
if (!LoadHostLists(¶ms.hostlists))
|
||||
bool bLoaded=false;
|
||||
if (!LoadHostLists(¶ms.hostlists, &bLoaded))
|
||||
return false;
|
||||
MakeAutolistsNonEmpty();
|
||||
if (bLoaded) MakeAutolistsNonEmpty();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -227,12 +230,15 @@ static bool SearchHostList(hostlist_pool *hostlist, const char *host, bool no_ma
|
||||
static bool HostlistsReloadCheck(const struct hostlist_collection_head *hostlists)
|
||||
{
|
||||
struct hostlist_item *item;
|
||||
bool bLoaded=false;
|
||||
|
||||
LIST_FOREACH(item, hostlists, next)
|
||||
{
|
||||
if (!LoadHostList(item->hfile))
|
||||
if (!LoadHostList(item->hfile, &bLoaded))
|
||||
return false;
|
||||
}
|
||||
MakeAutolistsNonEmpty();
|
||||
// this is relatively heavy function. walks through all the profiles. do not walk if no hostlists were releaded
|
||||
if (bLoaded) MakeAutolistsNonEmpty();
|
||||
return true;
|
||||
}
|
||||
bool HostlistsReloadCheckForProfile(const struct desync_profile *dp)
|
||||
|
||||
Reference in new issue
Block a user