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