issue with connecting to IPv6 link local address #3713
Closed
Labels
Comments
What if you try: snprintf(url, sizeof(url), "http://[%s%%d]/", ipv6, scope); instead? |
Is #3655 the fix? |
yes, I think #3655 is correct fix. The workaround I use is http://[%s%%25%d]/. |
bagder
added a commit
that referenced
this issue
Apr 13, 2019
Commit 9081014 fixed most of the confusing issues between scope id and scope however 844896d added bad limits checking assuming that the scope is being set and not the scope id. I have fixed the documentation so it all refers to scope ids. In addition Curl_if2ip refered to the scope id as remote_scope_id which is incorrect, so I renamed it to local_scope_id. Adjusted-by: Daniel Stenberg Closes #3655 Closes #3765 Fixes #3713
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I did this
I consider following fragment using libcurl C API:
(this is great simplification to illustrate the issues)
This was working as expected but it fails inside container running Alpine 3.9. (libcurl 7.64.0)
The issue with docker is that it uses high interface index number and than:
https://github.com/curl/curl/blob/master/lib/setopt.c#L2302-L2312
after some digging I found workaround where I can insert scope_id to URL and the code in url.c would take it out and set scope_id to proper value:
https://github.com/curl/curl/blob/master/lib/url.c#L2177
I verified with
strace
that we pass correctsockaddr_in6
to connect() call.It seems like the argument check for CURLOPT_ADDRESS_SCOPE is incorrect and we should let OS decide if it is valid or not.
I verified that if removed, the code works ok. There should be no harm to existing use.
I'd be happy to craft PR.
I expected the following
I expect this to work consistently, docker or not.
curl/libcurl version
bash-4.4$ curl --version
curl 7.64.0 (x86_64-alpine-linux-musl) libcurl/7.64.0 OpenSSL/1.1.1a zlib/1.2.11 libssh2/1.8.2 nghttp2/1.35.1
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy
operating system
Alpine Linux 3.9
The text was updated successfully, but these errors were encountered: