fix: Handling ip addresses in format of ::ffff:192.168.0.1#4
Open
John222 wants to merge 3 commits intoO-X-L:latestfrom
Open
fix: Handling ip addresses in format of ::ffff:192.168.0.1#4John222 wants to merge 3 commits intoO-X-L:latestfrom
John222 wants to merge 3 commits intoO-X-L:latestfrom
Conversation
In case the haproxy is running in Ipv4 and IPv6 mode, the haproxy maps Ipv4 addresses in the IPv6 format. This fix converts the IPv4 mapped address in IPv6 format back to a regular IPv4 address like 192.168.0.1
Member
|
@John222 Yeah - makes total sense. local V4_MAPPED_PREFIX = "::ffff:"
local PREFIX_LEN = 7
local function normalize_ip(ip)
if ip:sub(1, PREFIX_LEN) == V4_MAPPED_PREFIX then
return ip:sub(PREFIX_LEN + 1)
end
return ip
endIn my tests it worked |
Author
|
Hi @superstes i tried your suggestion. It worked. |
Fixing the issue that the go backend is returning the string with quotes which breaks in haproxy when comparing the string. As haproxy escapes quotes to '#22' ascii character.
Fixing typo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In case the haproxy is running in Ipv4 and IPv6 mode, the haproxy maps Ipv4 addresses in the IPv6 format. This fix converts the IPv4 mapped address in IPv6 format back to a regular IPv4 address like 192.168.0.1