mirror of
https://github.com/status-im/miniupnp.git
synced 2025-01-27 22:54:54 +00:00
libpfctl: get_redirect_rule_count()
This commit is contained in:
parent
18ac16469c
commit
a3e70b7733
@ -851,13 +851,25 @@ add_filter_rule2(const char * ifname,
|
||||
int
|
||||
get_redirect_rule_count(const char * ifname)
|
||||
{
|
||||
#ifdef USE_LIBPFCTL
|
||||
struct pfctl_rules_info ri;
|
||||
#else
|
||||
struct pfioc_rule pr;
|
||||
#endif
|
||||
UNUSED(ifname);
|
||||
|
||||
if(dev<0) {
|
||||
syslog(LOG_ERR, "pf device is not open");
|
||||
return -1;
|
||||
}
|
||||
#ifdef USE_LIBPFCTL
|
||||
if (pfctl_get_rules_info(dev, &ri, PF_RDR, anchor_name) < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "pfctl_get_rules_info: %m");
|
||||
return -1;
|
||||
}
|
||||
return ri.nr;
|
||||
#else
|
||||
memset(&pr, 0, sizeof(pr));
|
||||
strlcpy(pr.anchor, anchor_name, MAXPATHLEN);
|
||||
#ifndef PF_NEWSTYLE
|
||||
@ -870,6 +882,7 @@ get_redirect_rule_count(const char * ifname)
|
||||
}
|
||||
release_ticket(dev, pr.ticket);
|
||||
return pr.nr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* get_redirect_rule()
|
||||
|
Loading…
x
Reference in New Issue
Block a user