summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAlexandr Nedvedicky <sashan@cvs.openbsd.org>2022-02-16 08:46:12 +0000
committerAlexandr Nedvedicky <sashan@cvs.openbsd.org>2022-02-16 08:46:12 +0000
commitc39f2d49559e8e91a802b38d7d1812c36c2fb742 (patch)
treef28627862e189e2c930d42ce9abbdaaf01b33124 /sys/net
parent0a84d74cd6ed0bc38c1432eaabb537ae5577ff6e (diff)
nat-to round-robin without a pool should fallback to POOL_NONE
bug reported by giovanni@ OK giovanni@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf_lb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/net/pf_lb.c b/sys/net/pf_lb.c
index 65f70ef9102..d106073d372 100644
--- a/sys/net/pf_lb.c
+++ b/sys/net/pf_lb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_lb.c,v 1.69 2021/12/16 02:01:59 sashan Exp $ */
+/* $OpenBSD: pf_lb.c,v 1.70 2022/02/16 08:46:11 sashan Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -498,6 +498,13 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr,
if (pfr_pool_get(rpool, &raddr, &rmask, af))
return (1);
}
+ } else if (PF_AZERO(&rpool->counter, af)) {
+ /*
+ * fall back to POOL_NONE if there are no addresses in
+ * pool
+ */
+ pf_addrcpy(naddr, raddr, af);
+ break;
} else if (pf_match_addr(0, raddr, rmask, &rpool->counter, af))
return (1);