From 2b0a4ffadb1e46aa6a249900ddabd41f963432c1 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Thu, 6 Dec 2018 18:58:54 +0000 Subject: [PATCH] pf: add a comment describing why do we call pf_map_addr again if port selection process fails Obtained from: OpenBSD --- sys/netpfil/pf/pf_lb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 9c04225cc17..030e7ee7684 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -293,6 +293,10 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, switch (r->rpool.opts & PF_POOL_TYPEMASK) { case PF_POOL_RANDOM: case PF_POOL_ROUNDROBIN: + /* + * pick a different source address since we're out + * of free port choices for the current one. + */ if (pf_map_addr(af, r, saddr, naddr, &init_addr, sn)) return (1); break;