--- pf/pfpinhole.c.orig 2023-10-30 16:24:29 UTC +++ pf/pfpinhole.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "config.h" #include "pfpinhole.h" @@ -170,6 +171,7 @@ int find_pinhole(const char * ifname, unsigned int ts; int i, n; struct pfioc_rule pr; + struct pfctl_rule rule; struct in6_addr saddr; struct in6_addr daddr; UNUSED(ifname); @@ -196,21 +198,21 @@ int find_pinhole(const char * ifname, n = pr.nr; for(i=0; i= 0; i--) { pr.nr = i; - if(ioctl(dev, DIOCGETRULE, &pr) < 0) { + if (pfctl_get_rule(dev, i, pr.ticket, pr.anchor, pr.action, &rule, pr.anchor_call) < 0) { syslog(LOG_ERR, "ioctl(dev, DIOCGETRULE): %m"); return -1; } - if(sscanf(pr.rule.label, PINEHOLE_LABEL_FORMAT_SKIPDESC, &uid, &ts) != 2) { - syslog(LOG_DEBUG, "rule with label '%s' is not a IGD pinhole", pr.rule.label); + if(sscanf(rule.label[0], PINEHOLE_LABEL_FORMAT_SKIPDESC, &uid, &ts) != 2) { + syslog(LOG_DEBUG, "rule with label '%s' is not a IGD pinhole", rule.label[0]); continue; } if(ts <= (unsigned int)current_time) { - syslog(LOG_INFO, "removing expired pinhole '%s'", pr.rule.label); + syslog(LOG_INFO, "removing expired pinhole '%s'", rule.label[0]); pr.action = PF_CHANGE_GET_TICKET; if(ioctl(dev, DIOCCHANGERULE, &pr) < 0) { syslog(LOG_ERR, "ioctl(dev, DIOCCHANGERULE, ...) PF_CHANGE_GET_TICKET: %m");