summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-07-18 22:24:08 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-07-18 22:24:08 +0000
commitdbf58eafcd9b0edb160c6680606b3907e1b50404 (patch)
treed78eb93cd2070f06b3a6e97e91f556e03a859d39 /sys
parentd830d03d9a08d95c7dd698232a0639ec8746184e (diff)
fix pf_get_rdr() for single port (dport2 == 0) rules. found by lebel@.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 8cb7f7f8836..5673ed3ff1e 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.115 2001/07/17 21:54:25 provos Exp $ */
+/* $OpenBSD: pf.c,v 1.116 2001/07/18 22:24:07 dhartmei Exp $ */
/*
* Copyright (c) 2001, Daniel Hartmeier
@@ -1362,8 +1362,9 @@ pf_get_rdr(struct ifnet *ifp, u_int8_t proto, u_int32_t saddr, u_int32_t daddr,
(!r->proto || r->proto == proto) &&
pf_match_addr(r->snot, r->saddr, r->smask, saddr) &&
pf_match_addr(r->dnot, r->daddr, r->dmask, daddr) &&
- (ntohs(dport) >= ntohs(r->dport)) &&
- (ntohs(dport) <= ntohs(r->dport2)))
+ ((!r->dport2 && dport == r->dport) ||
+ (r->dport2 && (ntohs(dport) >= ntohs(r->dport)) &&
+ ntohs(dport) <= ntohs(r->dport2))))
rm = r;
else
r = TAILQ_NEXT(r, entries);