improve get_redirect_rule_count() for netfilter_nft too
This commit is contained in:
parent
95d611e7a0
commit
9b32a523bf
|
@ -538,6 +538,20 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto,
|
||||||
timestamp, packets, bytes);
|
timestamp, packets, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get_redirect_rule_count()
|
||||||
|
* return value : -1 for error or the number of redirection rules */
|
||||||
|
int
|
||||||
|
get_redirect_rule_count(const char * ifname)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
refresh_nft_cache_redirect();
|
||||||
|
LIST_FOREACH(r, &head_redirect, entry) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_redirect_rule_by_index()
|
* get_redirect_rule_by_index()
|
||||||
* return -1 when the rule was not found
|
* return -1 when the rule was not found
|
||||||
|
|
|
@ -583,7 +583,7 @@ upnp_delete_redirection(unsigned short eport, const char * protocol)
|
||||||
int
|
int
|
||||||
upnp_get_portmapping_number_of_entries()
|
upnp_get_portmapping_number_of_entries()
|
||||||
{
|
{
|
||||||
#if defined(USE_PF)
|
#if defined(USE_PF) || defined(USE_NFTABLES)
|
||||||
return get_redirect_rule_count(ext_if_name);
|
return get_redirect_rule_count(ext_if_name);
|
||||||
#else
|
#else
|
||||||
int n = 0, r = 0;
|
int n = 0, r = 0;
|
||||||
|
|
Loading…
Reference in New Issue