]> git.kaiwu.me - haproxy.git/commit
OPTIM: pattern: try literal IPv6 parsing before DNS resolution in pat_parse_ip
authorAndre Brait <andrebrait@gmail.com>
Wed, 22 Jul 2026 20:53:17 +0000 (22:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 3 Aug 2026 08:10:31 +0000 (10:10 +0200)
commit35560e3ad3306ac8b83db1062b18a8713b90e99e
tree06ad78d3beb43d0d6e999a584753c4eba2df7f1d
parentbc0b1fd9f61d8696cbdbb06706f56462db894c9e
OPTIM: pattern: try literal IPv6 parsing before DNS resolution in pat_parse_ip

pat_parse_ip() calls str2net() with DNS resolution enabled before trying
str62net(), so every IPv6 entry of a pattern file pays a blocking DNS
resolution attempt (which necessarily fails) before being parsed as an
IPv6 literal. On a configuration loading a 20k-entry IPv6 acl file on a
host with a resolv.conf search domain, this added two DNS round trips
per entry and made "haproxy -c" take 14 seconds instead of about 1.

Try both literal parsers first, then fall back to the resolving call of
str2net(). An IPv6 literal can never be a valid host name (colons are
not permitted in DNS labels) and host names keep resolving exactly as
before, so no working configuration changes behaviour.

Diagnosed on pfSense, where large pfBlockerNG IP block lists are loaded
through "acl ... -f" files:
https://github.com/pfsense/FreeBSD-ports/pull/1450

This patch was authored with Claude Fable 5 and reviewed by GPT-5.6 Sol.
src/pattern.c