Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider ::ffff:127.0.0.1 as a loopback address #2253

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

laduke
Copy link
Contributor

@laduke laduke commented Mar 15, 2024

cpp-httplib sets IPV6_V6ONLY to false on it's sockets. On FreeBSD, this makes all ipv4 addresses get get prefixed with ::ffff:. It makes them into IPv4 mapped IPv6 addresses.

This is a partial fix for #2151. The cli will work again. Something should probably also be adjusted with httplib.

If you want to, for example, use the allowManagementFrom option in local.conf
you will need to prefix it with "::ffff:", "::ffff:1.2.3.4" which is a little surprising and inconsistent between BSD and other OSs.

Thanks @dch for figuring this out. We used your example code but tried to make it match with what already exists.

root@vultr:~/ZeroTierOne # uname -a
FreeBSD vultr.guest 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon Dec 11 04:56:01 UTC 2023     [email protected]:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
root@vultr:~/ZeroTierOne # ./zerotier-cli info
200 info ad521db9aa 1.12.2 ONLINE

cpp-httplib  sets IPV6_V6ONLY to false on it's sockets.
On FreeBSD, this makes all ipv4 addresses get get prefixed with ::ffff:
it makes them IPv6 addresses mapped to v4.

This is a partial fix for #2151. The cli will work again.
Something should probably also be adjusted with the httplib.

If you want to, for example, use the `allowManagementFrom` option in
local.conf
you will need to prefix it with "::ffff:", "::ffff:1.2.3.4"
which is a little surprising and inconsistent between BSD and other OSs.
@laduke laduke requested a review from joseph-henry March 15, 2024 18:08
Copy link
Contributor

@joseph-henry joseph-henry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsing logic seems correct as it mirrors existing patterns in the code and I don't see any bugs, but I haven't personally tested this yet.

@laduke laduke merged commit 9f49982 into dev Mar 19, 2024
5 checks passed
@laduke laduke deleted the freebsd-localhost branch March 19, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants