summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-02-27 18:11:46 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-02-27 18:11:46 +0000
commit0112a0c2d5320ea0e4034b4db6908c62fc3b8dc8 (patch)
treeda89958338b60615d2632f32464cfa3d05f22826
parentd38e7e5fc0033ccf4c07ad762a5f02e37cab1ee1 (diff)
Instead of printing useless @0 rule numbers from pfctl -vR, increase a
counter. Helps debugging rule sets that are not loaded. Suggested by John Kerbawy.
-rw-r--r--sbin/pfctl/parse.y6
-rw-r--r--sbin/pfctl/pfctl.c3
-rw-r--r--sbin/pfctl/pfctl_parser.h3
3 files changed, 8 insertions, 4 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index e46e082fbbf..ad86add008c 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.55 2002/01/11 22:26:41 mickey Exp $ */
+/* $OpenBSD: parse.y,v 1.56 2002/02/27 18:11:45 dhartmei Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -1265,8 +1265,10 @@ void expand_rule_hosts(struct pf_rule *r,
if (rule_consistent(r) < 0 || nomatch)
yyerror("skipping rule "
"due to errors");
- else
+ else {
+ r->nr = pf->rule_nr++;
pfctl_add_rule(pf, r);
+ }
dst_port = dst_port->next;
}
dst_host = dst_host->next;
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index f04c4898bc7..175f0b78244 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.52 2002/02/26 07:25:33 dhartmei Exp $ */
+/* $OpenBSD: pfctl.c,v 1.53 2002/02/27 18:11:45 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -483,6 +483,7 @@ pfctl_rules(int dev, char *filename, int opts)
pf.dev = dev;
pf.opts = opts;
pf.prule = &pr;
+ pf.rule_nr = 0;
if (parse_rules(fin, &pf) < 0)
errx(1, "syntax error in rule file: pf rules not loaded");
if ((opts & PF_OPT_NOACTION) == 0) {
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index a0522f43cf7..5866092d9c8 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.h,v 1.13 2002/01/09 11:30:53 dhartmei Exp $ */
+/* $OpenBSD: pfctl_parser.h,v 1.14 2002/02/27 18:11:45 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -43,6 +43,7 @@
struct pfctl {
int dev;
int opts;
+ u_int16_t rule_nr;
struct pfioc_rule *prule;
struct pfioc_nat *pnat;
struct pfioc_binat *pbinat;