diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2022-03-17 17:31:37 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2022-03-17 21:37:06 +0000 |
| commit | a632d9e3601272c0157dce6633fc9a23ad6ae45b (patch) | |
| tree | dda7278ee55ab80d9776a9c72f2b4e40a1e5b202 /sbin/pfctl | |
| parent | d58d2e403db48acac7c8459652e9cb19546ab15b (diff) | |
Diffstat (limited to 'sbin/pfctl')
| -rw-r--r-- | sbin/pfctl/pfctl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 4632d2dc3946..88a96bd303a0 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1291,10 +1291,16 @@ pfctl_show_nat(int dev, char *path, int opts, char *anchorname, int depth) static int nattype[3] = { PF_NAT, PF_RDR, PF_BINAT }; int i, dotitle = opts & PF_OPT_SHOWALL; int brace, ret; + int len = strlen(path); char *p; + if (path[0]) + snprintf(&path[len], MAXPATHLEN - len, "/%s", anchorname); + else + snprintf(&path[len], MAXPATHLEN - len, "%s", anchorname); + for (i = 0; i < 3; i++) { - ret = pfctl_get_rules_info(dev, &ri, nattype[i], anchorname); + ret = pfctl_get_rules_info(dev, &ri, nattype[i], path); if (ret != 0) { warn("DIOCGETRULES"); return (-1); @@ -1303,13 +1309,13 @@ pfctl_show_nat(int dev, char *path, int opts, char *anchorname, int depth) brace = 0; INDENT(depth, !(opts & PF_OPT_VERBOSE)); - if (pfctl_get_rule(dev, nr, ri.ticket, anchorname, + if (pfctl_get_rule(dev, nr, ri.ticket, path, nattype[i], &rule, anchor_call)) { warn("DIOCGETRULE"); return (-1); } if (pfctl_get_pool(dev, &rule.rpool, nr, - ri.ticket, nattype[i], anchorname) != 0) + ri.ticket, nattype[i], path) != 0) return (-1); if (anchor_call[0] && |
