summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorChris Cappuccio <chris@cvs.openbsd.org>2001-07-06 21:19:57 +0000
committerChris Cappuccio <chris@cvs.openbsd.org>2001-07-06 21:19:57 +0000
commit64c28c3b97aef34653cf92fde589f0f3e8a33197 (patch)
tree693b1394a9b06468a7ac98a3a264e84f4a8064e0 /sbin
parentfb7fb0318c5c819776d4de436a65c53a4d0eae0f (diff)
Allow negative match on interface name for nat and rdr
ok dhartmei@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/pfctl_parser.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index fe01f6f3d34..6a979969a9a 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.27 2001/07/04 23:45:40 deraadt Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.28 2001/07/06 21:19:54 chris Exp $ */
/*
* Copyright (c) 2001, Daniel Hartmeier
@@ -262,7 +262,10 @@ print_flags(u_int8_t f)
void
print_nat(struct pf_nat *n)
{
- printf("nat %s ", n->ifname);
+ printf("nat ");
+ if (n->ifnot)
+ printf("! ");
+ printf("%s ", n->ifname);
if (n->not)
printf("! ");
print_addr(n->saddr);
@@ -289,7 +292,10 @@ print_nat(struct pf_nat *n)
void
print_rdr(struct pf_rdr *r)
{
- printf("rdr %s ", r->ifname);
+ printf("rdr ");
+ if (r->ifnot)
+ printf("! ");
+ printf("%s ", r->ifname);
if (r->not)
printf("! ");
print_addr(r->daddr);
@@ -977,6 +983,10 @@ parse_nat(int n, char *l, struct pf_nat *nat)
w = next_word(&l);
/* if */
+ if (!strcmp(w, "!")) {
+ nat->ifnot = 1;
+ w = next_word(&l);
+ }
strncpy(nat->ifname, w, 16);
w = next_word(&l);
@@ -1048,6 +1058,10 @@ parse_rdr(int n, char *l, struct pf_rdr *rdr)
w = next_word(&l);
/* if */
+ if (!strcmp(w, "!")) {
+ rdr->ifnot = 1;
+ w = next_word(&l);
+ }
strncpy(rdr->ifname, w, 16);
w = next_word(&l);