summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-02-05 13:07:21 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-02-05 13:07:21 +0000
commitc1d6b4b65226dd0d71b6c9c40340898718edc342 (patch)
treef2a3106838c84fcdc9d4536842bcd4ebe7821bc7 /sys/net/pf.c
parentdb55ed8a910c9a8c938198c5a90fb094d34abf83 (diff)
Remove the confusing and more-or-less unnecessary temporary
struct pf_pooladdr *cur. It was being used incorrectly in the round-robin case, which meant that the previous address was being selected, rather than the reall current one. ok dhartmei@
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 073503393da..5bf7fbc55a3 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.315 2003/02/01 15:20:16 dhartmei Exp $ */
+/* $OpenBSD: pf.c,v 1.316 2003/02/05 13:07:20 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1456,15 +1456,14 @@ pf_map_addr(u_int8_t af, struct pf_pool *rpool, struct pf_addr *saddr,
struct pf_addr *naddr, struct pf_addr *init_addr)
{
unsigned char hash[16];
- struct pf_pooladdr *cur = rpool->cur;
struct pf_addr *raddr = &rpool->cur->addr.addr.v.a.addr;
struct pf_addr *rmask = &rpool->cur->addr.addr.v.a.mask;
- if (cur->addr.addr.type == PF_ADDR_NOROUTE ||
- cur->addr.addr.type == PF_ADDR_TABLE)
+ if (rpool->cur->addr.addr.type == PF_ADDR_NOROUTE ||
+ rpool->cur->addr.addr.type == PF_ADDR_TABLE)
return (1);
- if (cur->addr.addr.type == PF_ADDR_DYNIFTL &&
- cur->addr.addr.p.dyn->undefined)
+ if (rpool->cur->addr.addr.type == PF_ADDR_DYNIFTL &&
+ rpool->cur->addr.addr.p.dyn->undefined)
return (1);
switch (rpool->opts & PF_POOL_TYPEMASK) {
@@ -1514,16 +1513,17 @@ pf_map_addr(u_int8_t af, struct pf_pool *rpool, struct pf_addr *saddr,
PF_POOLMASK(naddr, raddr, rmask, (struct pf_addr *)&hash, af);
break;
case PF_POOL_ROUNDROBIN:
- if (pf_match_addr(0, &cur->addr.addr.v.a.addr,
- &cur->addr.addr.v.a.mask, &rpool->counter, af)) {
+ if (pf_match_addr(0, &rpool->cur->addr.addr.v.a.addr,
+ &rpool->cur->addr.addr.v.a.mask, &rpool->counter, af)) {
PF_ACPY(naddr, &rpool->counter, af);
PF_AINC(&rpool->counter, af);
} else {
if ((rpool->cur =
TAILQ_NEXT(rpool->cur, entries)) == NULL)
rpool->cur = TAILQ_FIRST(&rpool->list);
- PF_ACPY(naddr, &cur->addr.addr.v.a.addr, af);
- PF_ACPY(&rpool->counter, &cur->addr.addr.v.a.addr, af);
+ PF_ACPY(naddr, &rpool->cur->addr.addr.v.a.addr, af);
+ PF_ACPY(&rpool->counter,
+ &rpool->cur->addr.addr.v.a.addr, af);
PF_AINC(&rpool->counter, af);
}
break;