summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhartmei <dhartmei@openbsd.org>2001-07-18 22:24:07 +0000
committerdhartmei <dhartmei@openbsd.org>2001-07-18 22:24:07 +0000
commit48db9ab4d5a28d51a719dff4fe2c5264f8984ce4 (patch)
treec506839b04229125a7514aaf605bdd00018892dd
parentchdir("/") from bbraun@synack.net; ok markus@ (diff)
downloadwireguard-openbsd-48db9ab4d5a28d51a719dff4fe2c5264f8984ce4.tar.xz
wireguard-openbsd-48db9ab4d5a28d51a719dff4fe2c5264f8984ce4.zip
fix pf_get_rdr() for single port (dport2 == 0) rules. found by lebel@.
-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);