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

Enable support of scope ID for IPv6 link local addresses #569

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

M-Tarasov
Copy link
Contributor

Try to resolve issue #568

@alexcrichton
Copy link
Owner

Thanks! Is it possible to add a test for this?

@M-Tarasov
Copy link
Contributor Author

Thanks! Is it possible to add a test for this?

Unfortunately, I have no idea how it could be tested with unit tests: from rust point of view, it just on more define in build script for a C library, from the other side, the effect of this define could be observed deep in the libcurl library itself. It is possible, to test it in an integration test within specific environment, but it would require much effort to set up. I could just say, that this change is working for my project.

@alexcrichton
Copy link
Owner

Does connecting with ipv6 not work at all without this? Or could a dummy server be set up with a different link-local ID and then curl tries to connect to it and it would fail if this isn't supported?

@M-Tarasov
Copy link
Contributor Author

Does connecting with ipv6 not work at all without this? Or could a dummy server be set up with a different link-local ID and then curl tries to connect to it and it would fail if this isn't supported?

The issue is related to the IPv6 link-local addresses (all addresses within fe80::/10 range) only.

Just one example: let suppose you have a local web server running with python3 -m http.server -b "::" 8123. Your eth0 interface has a link local IPv6 address fe80::c4:d164:150d:282c. Then you make standard curl calls like this:

curl http://[fe80::c4:d164:150d:282c%eth0]:8123  # works fine, with scope id eth0
curl http://[fe80::c4:d164:150d:282c]:8123       # will not work without scope id

Without the flag (HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) enabled, both variants would fail.

In the libcurl itself, the HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID flag is defined whenever the system's struct sockaddr_in6 has the field sin6_scope_id (no idea, where it could be missing, maybe some very old systems). See curl's original CMakeLists.txt: https://github.com/curl/curl/blob/curl-8_9_0/CMakeLists.txt#L291

@alexcrichton alexcrichton merged commit 0622181 into alexcrichton:main Aug 16, 2024
13 checks passed
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