summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-12-05 14:10:46 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-12-05 14:10:46 +0000
commite76af9eac7256245d4c68901020b3f3aaf8edf17 (patch)
tree87d059e00d49b9ab649c7d277400d7e2b63e7ded
parentc068975ce58223759df9e1a77b5a8509c665c18c (diff)
one step further to "program output is valid program input" and the related
extra regress testing opportunities (an excellent idea by markus@). only print rule numbers in case of pfctl -v -v; but not with pfctl -v. ok markus@ frantzen@ mcbride@
-rw-r--r--sbin/pfctl/pfctl.c9
-rw-r--r--sbin/pfctl/pfctl_parser.c7
-rw-r--r--sbin/pfctl/pfctl_parser.h4
3 files changed, 11 insertions, 9 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index e192733baac..d4f9848a58f 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.97 2002/12/05 12:26:55 mcbride Exp $ */
+/* $OpenBSD: pfctl.c,v 1.98 2002/12/05 14:10:45 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -463,7 +463,8 @@ pfctl_show_rules(int dev, int opts, int format)
case 1:
if (pr.rule.label[0]) {
if (opts & PF_OPT_VERBOSE)
- print_rule(&pr.rule);
+ print_rule(&pr.rule,
+ opts & PF_OPT_VERBOSE2);
else
printf("%s ", pr.rule.label);
printf("%llu %llu %llu\n",
@@ -472,7 +473,7 @@ pfctl_show_rules(int dev, int opts, int format)
}
break;
default:
- print_rule(&pr.rule);
+ print_rule(&pr.rule, opts & PF_OPT_VERBOSE2);
if (opts & PF_OPT_VERBOSE)
printf("[ Evaluations: %-8llu Packets: %-8llu "
"Bytes: %-10llu States: %-6u]\n\n",
@@ -694,7 +695,7 @@ pfctl_add_rule(struct pfctl *pf, struct pf_rule *r)
err(1, "DIOCADDRULE");
}
if (pf->opts & PF_OPT_VERBOSE)
- print_rule(r);
+ print_rule(r, pf->opts & PF_OPT_VERBOSE2);
pfctl_clear_pool(&r->rt_pool);
}
return (0);
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 80261b69c0d..d97fa66256f 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.115 2002/11/30 10:07:51 mickey Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.116 2002/12/05 14:10:45 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -687,11 +687,12 @@ print_status(struct pf_status *s)
}
void
-print_rule(struct pf_rule *r)
+print_rule(struct pf_rule *r, int verbose)
{
int i, opts;
- printf("@%d ", r->nr);
+ if (verbose)
+ printf("@%d ", r->nr);
if (r->action == PF_PASS)
printf("pass ");
else if (r->action == PF_DROP) {
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index b985600b027..ae92996b9b7 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.h,v 1.32 2002/12/04 08:07:28 deraadt Exp $ */
+/* $OpenBSD: pfctl_parser.h,v 1.33 2002/12/05 14:10:45 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -81,7 +81,7 @@ int pfctl_set_logif(struct pfctl *, char *);
int parse_rules(FILE *, struct pfctl *, int);
int parse_flags(char *);
-void print_rule(struct pf_rule *);
+void print_rule(struct pf_rule *, int);
void print_pool(struct pf_pool *, u_int16_t, u_int16_t, sa_family_t, int);
void print_nat(struct pf_nat *);
void print_binat(struct pf_binat *);