summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2020-07-29 02:32:14 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2020-07-29 02:32:14 +0000
commitfe787aa63f597e9e33158c6fe29d0d6e095f0a6f (patch)
treeccff3c6601dabf0671b6e9f8a5c339d73a25034b /sys/net
parent184e1ceee16b5e28e64a426a120299ef69e1b9b8 (diff)
Fix previous commit which referred wrong address and returned wrong
value. ok sashan
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf_lb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/pf_lb.c b/sys/net/pf_lb.c
index 096f4ea596d..8793de95fea 100644
--- a/sys/net/pf_lb.c
+++ b/sys/net/pf_lb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_lb.c,v 1.66 2020/07/28 16:47:41 yasuoka Exp $ */
+/* $OpenBSD: pf_lb.c,v 1.67 2020/07/29 02:32:13 yasuoka Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -322,13 +322,13 @@ pf_map_addr_sticky(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr,
return (-1);
}
- if ((rpool->opts & PF_POOL_TYPEMASK) == PF_POOL_LEASTSTATES) {
- if (pf_map_addr_states_increase(af, rpool, naddr) == -1)
- return (-1);
- }
- if (!PF_AZERO(cached, af))
+ if (!PF_AZERO(cached, af)) {
pf_addrcpy(naddr, cached, af);
+ if ((rpool->opts & PF_POOL_TYPEMASK) == PF_POOL_LEASTSTATES &&
+ pf_map_addr_states_increase(af, rpool, cached) == -1)
+ return (-1);
+ }
if (pf_status.debug >= LOG_DEBUG) {
log(LOG_DEBUG, "pf: pf_map_addr: "
"src tracking (%u) maps ", type);
@@ -651,7 +651,7 @@ pf_map_addr_states_increase(sa_family_t af, struct pf_pool *rpool,
pf_print_host(naddr, 0, af);
addlog(". Failed to increase count!\n");
}
- return (1);
+ return (-1);
}
} else if (rpool->addr.type == PF_ADDR_DYNIFTL) {
if (pfr_states_increase(rpool->addr.p.dyn->pfid_kt,
@@ -663,7 +663,7 @@ pf_map_addr_states_increase(sa_family_t af, struct pf_pool *rpool,
pf_print_host(naddr, 0, af);
addlog(". Failed to increase count!\n");
}
- return (1);
+ return (-1);
}
}
return (0);