summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-06-09 20:20:59 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-06-09 20:20:59 +0000
commit0545c7c5e14bdc166962f419da77e65fa8d72b8e (patch)
treec0002c30bb59f41e75d12d0e7483b0773035515c /sbin/pfctl
parent9690aa985d8384814a46db35dc146490235b26b7 (diff)
Make pf_nat.saddr/daddr a pf_rule_addr instead of pf_addr_wrap, so it
includes ports and operator.
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y34
-rw-r--r--sbin/pfctl/pfctl_parser.c16
2 files changed, 26 insertions, 24 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 7a61f18eda7..90412c15a05 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.89 2002/06/09 05:31:25 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.90 2002/06/09 20:20:58 dhartmei Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -1194,11 +1194,11 @@ natrule : no NAT interface af proto FROM ipspec TO ipspec redirection
YYERROR;
}
nat.af = $7->af;
- memcpy(&nat.saddr, &$7->addr,
- sizeof(nat.saddr));
- memcpy(&nat.smask, &$7->mask,
- sizeof(nat.smask));
- nat.snot = $7->not;
+ memcpy(&nat.src.addr, &$7->addr,
+ sizeof(nat.src.addr));
+ memcpy(&nat.src.mask, &$7->mask,
+ sizeof(nat.src.mask));
+ nat.src.not = $7->not;
}
if ($9 != NULL) {
if ($9->addr.addr_dyn != NULL) {
@@ -1214,11 +1214,11 @@ natrule : no NAT interface af proto FROM ipspec TO ipspec redirection
YYERROR;
}
nat.af = $9->af;
- memcpy(&nat.daddr, &$9->addr,
- sizeof(nat.daddr));
- memcpy(&nat.dmask, &$9->mask,
- sizeof(nat.dmask));
- nat.dnot = $9->not;
+ memcpy(&nat.dst.addr, &$9->addr,
+ sizeof(nat.dst.addr));
+ memcpy(&nat.dst.mask, &$9->mask,
+ sizeof(nat.dst.mask));
+ nat.dst.not = $9->not;
}
if (nat.no) {
@@ -1940,8 +1940,8 @@ expand_nat(struct pf_nat *n, struct node_host *src_hosts,
{
int af = n->af, added = 0;
- CHECK_ROOT(struct node_host, src_hosts)
-; CHECK_ROOT(struct node_host, dst_hosts);
+ CHECK_ROOT(struct node_host, src_hosts);
+ CHECK_ROOT(struct node_host, dst_hosts);
LOOP_THROUGH(struct node_host, src_host, src_hosts,
LOOP_THROUGH(struct node_host, dst_host, dst_hosts,
@@ -1957,10 +1957,10 @@ expand_nat(struct pf_nat *n, struct node_host *src_hosts,
else if (!n->af && dst_host->af)
n->af = dst_host->af;
- n->saddr = src_host->addr;
- n->smask = src_host->mask;
- n->daddr = dst_host->addr;
- n->dmask = dst_host->mask;
+ n->src.addr = src_host->addr;
+ n->src.mask = src_host->mask;
+ n->dst.addr = dst_host->addr;
+ n->dst.mask = dst_host->mask;
pfctl_add_nat(pf, n);
added++;
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 41fc0f8a55f..4b07d78d39e 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.83 2002/06/09 05:31:25 deraadt Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.84 2002/06/09 20:20:58 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -373,18 +373,20 @@ print_nat(struct pf_nat *n)
printf("proto %u ", n->proto);
}
printf("from ");
- if (!PF_AZERO(&n->saddr.addr, n->af) || !PF_AZERO(&n->smask, n->af)) {
- if (n->snot)
+ if (!PF_AZERO(&n->src.addr.addr, n->af) ||
+ !PF_AZERO(&n->src.mask, n->af)) {
+ if (n->src.not)
printf("! ");
- print_addr(&n->saddr, &n->smask, n->af);
+ print_addr(&n->src.addr, &n->src.mask, n->af);
printf(" ");
} else
printf("any ");
printf("to ");
- if (!PF_AZERO(&n->daddr.addr, n->af) || !PF_AZERO(&n->dmask, n->af)) {
- if (n->dnot)
+ if (!PF_AZERO(&n->dst.addr.addr, n->af) ||
+ !PF_AZERO(&n->dst.mask, n->af)) {
+ if (n->dst.not)
printf("! ");
- print_addr(&n->daddr, &n->dmask, n->af);
+ print_addr(&n->dst.addr, &n->dst.mask, n->af);
printf(" ");
} else
printf("any ");