You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
caseCURLOPT_ADDRESS_SCOPE:
/* * We always get longs when passed plain numericals, but for this value we * know that an unsigned int will always hold the value so we blindly * typecast to this type */arg=va_arg(param, long);
if((arg<0) || (arg>0xf))
returnCURLE_BAD_FUNCTION_ARGUMENT;
data->set.scope_id=curlx_sltoui(arg);
break;
conn->scope_id= (unsigned int)scope;
...
if(data->set.scope_id)
/* Override any scope that was set above. */conn->scope_id=data->set.scope_id;
I verified with strace that we pass correct sockaddr_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.
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#3655Closes#3765Fixes#3713
lockbot
locked as resolved and limited conversation to collaborators
Jun 27, 2019
Sign up for freeto 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: