bug: --interface does not consume argument #2104
Comments
It does consume the argument:
Error code 45 is CURLE_INTERFACE_FAILED so that is the correct error code. The message Lines 335 to 343 in c514af5 If you turn on verbose you should see edit: we could make that bind error message what is shown by overwriting the generic resolve error that takes precedence diff --git a/lib/connect.c b/lib/connect.c
index 16104bc..45e18bc 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -412,6 +412,10 @@ static CURLcode bindlocal(struct connectdata *conn,
}
if(done < 1) {
+ /* errorbuf is set false so failf will overwrite any message already in
+ the error buffer, so the user receives this error message instead of a
+ generic resolve error. */
+ data->state.errorbuf = FALSE;
failf(data, "Couldn't bind to '%s'", dev);
return CURLE_INTERFACE_FAILED;
} |
You get a better error message if you add the prefix "if!" to the interface name. This tells curl that it's really an interface. For more information, please see CURLOPT_INTERFACE. Example:
|
@jay: sounds like a neat improvement I see no bug or actual issue here. I'm closing... |
eg consider a non-existent interface eth8, curl --interface eth8 Before: curl: (45) Could not resolve host: eth8 After: curl: (45) Couldn't bind to 'eth8' Bug: #2104 Reported-by: Alfonso Martone
If the argument of --interface is not a valid interface, it should abort with an error.
I did this (on a system without any eth8 network interface):
I expected the following:
"Error: eth8 does not exist"
I instead got this:
"curl: (45) Could not resolve host: eth8"
curl/libcurl version
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0 (+libidn2/2.0.2) librtmp/2.3
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL
operating system
Ubuntu 17.04
The text was updated successfully, but these errors were encountered: