diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2012-05-07 11:55:35 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2012-05-07 11:55:35 +0000 |
commit | d3fbb970c7492e53b0ebd737e2aa366a09cea980 (patch) | |
tree | 9875de589e2f3be2eb4c814e5886051ba732cdf8 /sbin/pfctl | |
parent | 22964f8da629d6f920137721a6f1fe09eaff50c1 (diff) |
fix printing of wildcard anchors, from lteo, ok phessler sthen me
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/pfctl.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index d4f0e19b5d1..02114ae1bf9 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.311 2012/05/02 14:23:49 henning Exp $ */ +/* $OpenBSD: pfctl.c,v 1.312 2012/05/07 11:55:34 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -862,6 +862,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, switch (format) { case PFCTL_SHOW_LABELS: if (pr.rule.label[0]) { + INDENT(depth, !(opts & PF_OPT_VERBOSE)); printf("%s %llu %llu %llu %llu" " %llu %llu %llu %llu\n", pr.rule.label, @@ -1935,6 +1936,7 @@ main(int argc, char *argv[]) int optimize = PF_OPTIMIZE_BASIC; int level; char anchorname[MAXPATHLEN]; + int anchor_wildcard = 0; char *path; char *lfile = NULL, *sfile = NULL; const char *errstr; @@ -2095,9 +2097,10 @@ main(int argc, char *argv[]) int len = strlen(anchoropt); if (anchoropt[len - 1] == '*') { - if (len >= 2 && anchoropt[len - 2] == '/') + if (len >= 2 && anchoropt[len - 2] == '/') { anchoropt[len - 2] = '\0'; - else + anchor_wildcard = 1; + } else anchoropt[len - 1] = '\0'; opts |= PF_OPT_RECURSE; } @@ -2135,11 +2138,19 @@ main(int argc, char *argv[]) pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, 0, 0, shownr); + if (anchor_wildcard) + pfctl_show_rules(dev, path, opts, + PFCTL_SHOW_RULES, anchorname, 0, + anchor_wildcard, shownr); break; case 'l': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, 0, 0, shownr); + if (anchor_wildcard) + pfctl_show_rules(dev, path, opts, + PFCTL_SHOW_LABELS, anchorname, 0, + anchor_wildcard, shownr); break; case 'q': pfctl_show_altq(dev, ifaceopt, opts, |