Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

nfqws2: process --filter-l3 as a list in templates

This commit is contained in:
bol-van
2026-02-02 13:57:40 +03:00
parent 5c97563698
commit 739c24cdf3
4 changed files with 20 additions and 9 deletions

View File

@@ -1222,7 +1222,8 @@ static bool wf_make_l3(char *opt, bool *ipv4, bool *ipv6)
{
char *e, *p, c;
for (p = opt, *ipv4 = *ipv6 = false; p; )
// do not overwrite ipv4 and ipv6 old values. OR instead - simulate adding to the list
for (p = opt; p; )
{
if ((e = strchr(p, ',')))
{
@@ -1343,8 +1344,11 @@ static void LuaDesyncDebug(struct desync_profile *dp, const char *entity)
}
}
static bool deny_proto_filters(struct desync_profile *dp)
static bool filter_defaults(struct desync_profile *dp)
{
// enable both ipv4 and ipv6 if not specified
if (!dp->b_filter_l3) dp->filter_ipv4 = dp->filter_ipv6 = true;
// if any filter is set - deny all unset
if (!LIST_EMPTY(&dp->pf_tcp) || !LIST_EMPTY(&dp->pf_udp) || !LIST_EMPTY(&dp->icf) || !LIST_EMPTY(&dp->ipf))
{
@@ -2931,7 +2935,7 @@ int main(int argc, char **argv)
DLOG_ERR("could not make '%s' accessible. auto hostlist file may not be writable after privilege drop\n", dp->hostlist_auto->filename);
}
if (!deny_proto_filters(dp)) exit_clean(1);
if (!filter_defaults(dp)) exit_clean(1);
LuaDesyncDebug(dp,"profile");
}
LIST_FOREACH(dpl, &params.desync_templates, next)