From daac1d2127b76e2628118b47e1b10d93c91c310c Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 29 Oct 2024 17:36:49 +0300 Subject: [PATCH] tpws: unify pools.c with nfqws --- tpws/pools.c | 6 ++++++ tpws/pools.h | 1 + 2 files changed, 7 insertions(+) diff --git a/tpws/pools.c b/tpws/pools.c index 32aa5ca..81a7b80 100644 --- a/tpws/pools.c +++ b/tpws/pools.c @@ -481,3 +481,9 @@ bool port_filters_in_range(const struct port_filters_head *head, uint16_t port) } return false; } +bool port_filters_deny_if_empty(struct port_filters_head *head) +{ + port_filter pf; + if (LIST_FIRST(head)) return true; + return pf_parse("0",&pf) && port_filter_add(head,&pf); +} diff --git a/tpws/pools.h b/tpws/pools.h index 5f23be4..cd37bdd 100644 --- a/tpws/pools.h +++ b/tpws/pools.h @@ -140,3 +140,4 @@ LIST_HEAD(port_filters_head, port_filter_item); bool port_filter_add(struct port_filters_head *head, const port_filter *pf); void port_filters_destroy(struct port_filters_head *head); bool port_filters_in_range(const struct port_filters_head *head, uint16_t port); +bool port_filters_deny_if_empty(struct port_filters_head *head);