summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-01-04 17:40:52 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-01-04 17:40:52 +0000
commit64dbb61a29a5756fc001ac259d55a94c0e13a020 (patch)
treefcf24cd6f682a42af37478357a7f7dce48ae83bd /sbin
parenta7c15f8bfc60b7168a88c35f292b71db66376f26 (diff)
move noroute from flag in pf_rule_addr into type in pf_addr_wrap.
ok henning@, mcbride@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y11
-rw-r--r--sbin/pfctl/pfctl_parser.c11
2 files changed, 8 insertions, 14 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index b1ac854c77c..c3ecf67540d 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.275 2003/01/04 00:01:34 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.276 2003/01/04 17:40:51 dhartmei Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -104,7 +104,6 @@ struct node_host {
struct pf_addr bcast;
sa_family_t af;
u_int8_t not;
- u_int8_t noroute;
u_int32_t ifindex; /* link-local IPv6 addrs */
char *ifname;
u_int ifa_flags;
@@ -1468,7 +1467,7 @@ xhost : '!' host {
$$ = calloc(1, sizeof(struct node_host));
if ($$ == NULL)
err(1, "xhost: calloc");
- $$->noroute = 1;
+ $$->addr.type = PF_ADDR_NOROUTE;
$$->next = NULL;
$$->tail = $$;
}
@@ -3159,13 +3158,11 @@ expand_rule(struct pf_rule *r,
r->ifnot = interface->not;
r->proto = proto->proto;
r->src.addr = src_host->addr;
- r->src.noroute = src_host->noroute;
r->src.not = src_host->not;
r->src.port[0] = src_port->port[0];
r->src.port[1] = src_port->port[1];
r->src.port_op = src_port->op;
r->dst.addr = dst_host->addr;
- r->dst.noroute = dst_host->noroute;
r->dst.not = dst_host->not;
r->dst.port[0] = dst_port->port[0];
r->dst.port[1] = dst_port->port[1];
@@ -3279,13 +3276,11 @@ expand_nat(struct pf_rule *n,
n->ifnot = interface->not;
n->proto = proto->proto;
n->src.addr = src_host->addr;
- n->src.noroute = src_host->noroute;
n->src.not = src_host->not;
n->src.port[0] = src_port->port[0];
n->src.port[1] = src_port->port[1];
n->src.port_op = src_port->op;
n->dst.addr = dst_host->addr;
- n->dst.noroute = dst_host->noroute;
n->dst.not = dst_host->not;
n->dst.port[0] = dst_port->port[0];
n->dst.port[1] = dst_port->port[1];
@@ -3368,10 +3363,8 @@ expand_rdr(struct pf_rule *r, struct node_if *interfaces,
r->ifnot = interface->not;
r->proto = proto->proto;
r->src.addr = src_host->addr;
- r->src.noroute = src_host->noroute;
r->src.not = src_host->not;
r->dst.addr = dst_host->addr;
- r->dst.noroute = dst_host->noroute;
r->dst.not = dst_host->not;
TAILQ_INIT(&r->rpool.list);
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 47de8bc677b..f85c3c06255 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.125 2003/01/04 00:01:34 deraadt Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.126 2003/01/04 17:40:51 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -352,15 +352,16 @@ void
print_fromto(struct pf_rule_addr *src, struct pf_rule_addr *dst,
sa_family_t af, u_int8_t proto)
{
- if (PF_AZERO(&src->addr.addr, AF_INET6) &&
+ if (src->addr.type != PF_ADDR_NOROUTE &&
+ dst->addr.type != PF_ADDR_NOROUTE &&
+ PF_AZERO(&src->addr.addr, AF_INET6) &&
PF_AZERO(&src->addr.mask, AF_INET6) &&
- !src->noroute && !dst->noroute &&
!src->port_op && PF_AZERO(&dst->addr.addr, AF_INET6) &&
PF_AZERO(&dst->addr.mask, AF_INET6) && !dst->port_op)
printf("all ");
else {
printf("from ");
- if (src->noroute)
+ if (src->addr.type == PF_ADDR_NOROUTE)
printf("no-route ");
else if (PF_AZERO(&src->addr.addr, AF_INET6) &&
PF_AZERO(&src->addr.mask, AF_INET6))
@@ -377,7 +378,7 @@ print_fromto(struct pf_rule_addr *src, struct pf_rule_addr *dst,
proto == IPPROTO_TCP ? "tcp" : "udp");
printf("to ");
- if (dst->noroute)
+ if (dst->addr.type == PF_ADDR_NOROUTE)
printf("no-route ");
else if (PF_AZERO(&dst->addr.addr, AF_INET6) &&
PF_AZERO(&dst->addr.mask, AF_INET6))