]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: tools/ip: v4tov6() and v6tov4() rework
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 5 Sep 2023 12:04:51 +0000 (14:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Sep 2023 07:50:55 +0000 (09:50 +0200)
commit72514a44678c88f516827131d249138fb8f01920
treea2c37a7c6ec847eb5b8c037718d5f4cfd4eebe95
parentd3e379b3ce8b0bf6bb167bb1f06268edb5406284
MEDIUM: tools/ip: v4tov6() and v6tov4() rework

v4tov6() and v6tov4() helper function were initially implemented in
4f92d3200 ("[MEDIUM] IPv6 support for stick-tables").

However, since ceb4ac9c3 ("MEDIUM: acl: support IPv6 address matching")
support for legacy ip6 to ip4 conversion formats were added, with the
parsing logic directly performed in acl_match_ip (which later became
pat_match_ip)

The issue is that the original v6tov4() function which is used for sample
expressions handling lacks those additional formats, so we could face
inconsistencies whether we rely on ip4/ip6 conversions from an acl context
or an expression context.

To unify ip4/ip6 automatic mapping behavior, we reworked v4tov6 and v6tov4
functions so that they now behave like in pat_match_ip() function.

Note: '6to4 (RFC3056)' and 'RFC4291 ipv4 compatible address' formats are
still supported for legacy purposes despite being deprecated for a while
now.
src/tools.c