summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2004-02-12 02:05:33 +0000
committerBob Beck <beck@cvs.openbsd.org>2004-02-12 02:05:33 +0000
commit52683e90132c931fc43071e7db1af3386a51ea79 (patch)
tree94a16c3b7936c3fa58b51fcb3a52753d3bb42d68 /sbin/pfctl
parent7602d7d103c9134a034d5238e295c4aae66e150c (diff)
add -p flag to specify the device - ok mcbride@, henning@ with no objections
from deraadt@
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl.87
-rw-r--r--sbin/pfctl/pfctl.c20
2 files changed, 19 insertions, 8 deletions
diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8
index e2e16554af6..fa5840dde40 100644
--- a/sbin/pfctl/pfctl.8
+++ b/sbin/pfctl/pfctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pfctl.8,v 1.105 2003/12/31 11:18:24 cedric Exp $
+.\" $OpenBSD: pfctl.8,v 1.106 2004/02/12 02:05:32 beck Exp $
.\"
.\" Copyright (c) 2001 Kjell Wooding. All rights reserved.
.\"
@@ -226,6 +226,11 @@ Other rules and options are ignored.
.It Fl O
Load only the options present in the rule file.
Other rules and options are ignored.
+.It Fl p Ar device
+use the device file
+.Ar device
+instead of the default
+.Pa /dev/pf .
.It Fl s Ar modifier
Show the filter parameters specified by
.Ar modifier
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index e0f88697f83..ea70b13ce31 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.202 2004/02/10 22:26:55 dhartmei Exp $ */
+/* $OpenBSD: pfctl.c,v 1.203 2004/02/12 02:05:32 beck Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -85,6 +85,7 @@ char *rulesopt;
const char *showopt;
const char *debugopt;
char *anchoropt;
+char *pf_device = "/dev/pf";
char *tableopt;
const char *tblcmdopt;
int state_killers;
@@ -190,9 +191,11 @@ usage(void)
fprintf(stderr, "usage: %s [-AdeghnNqrROvz] ", __progname);
fprintf(stderr, "[-a anchor[:ruleset]] [-D macro=value]\n");
fprintf(stderr, " ");
- fprintf(stderr, "[-f file] [-F modifier] [-k host] [-s modifier]\n");
+ fprintf(stderr, "[-f file] [-F modifier] [-k host] [-p device] \n");
fprintf(stderr, " ");
- fprintf(stderr, "[-t table] [-T command [address ...]] [-x level]\n");
+ fprintf(stderr, "[-s modifier] [-t table]\n");
+ fprintf(stderr, " ");
+ fprintf(stderr, "[-T command [address ...]] [-x level]\n");
exit(1);
}
@@ -1447,7 +1450,7 @@ main(int argc, char *argv[])
if (argc < 2)
usage();
- while ((ch = getopt(argc, argv, "a:AdD:eqf:F:ghk:nNOrRs:t:T:vx:z")) !=
+ while ((ch = getopt(argc, argv, "a:AdD:eqf:F:ghk:nNOp:rRs:t:T:vx:z")) !=
-1) {
switch (ch) {
case 'a':
@@ -1511,6 +1514,9 @@ main(int argc, char *argv[])
case 'O':
loadopt |= PFCTL_FLAG_OPTION;
break;
+ case 'p':
+ pf_device = optarg;
+ break;
case 's':
showopt = pfctl_lookup_option(optarg, showopt_list);
if (showopt == NULL) {
@@ -1600,12 +1606,12 @@ main(int argc, char *argv[])
}
if ((opts & PF_OPT_NOACTION) == 0) {
- dev = open("/dev/pf", mode);
+ dev = open(pf_device, mode);
if (dev == -1)
- err(1, "/dev/pf");
+ err(1, "%s", pf_device);
altqsupport = pfctl_test_altqsupport(dev, opts);
} else {
- dev = open("/dev/pf", O_RDONLY);
+ dev = open(pf_device, O_RDONLY);
if (dev >= 0)
opts |= PF_OPT_DUMMYACTION;
/* turn off options */