aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-03-09 22:48:07 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-03-09 22:48:07 +0000
commit1e55ed5c7d04c47fc931719fea05314f126aa974 (patch)
tree4e7c9f1ab950cba142f72b53d6a0c8aec9faf979 /lib
parent6dd4fe0740b86087d9bb1957f191da1fb6e6b7e6 (diff)
- Robert Iakobashvili fixed CURLOPT_INTERFACE for IPv6.
Diffstat (limited to 'lib')
-rw-r--r--lib/connect.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c
index a18a335af..d98569fce 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -233,7 +233,9 @@ static CURLcode bindlocal(struct connectdata *conn,
char myhost[256] = "";
in_addr_t in;
int rc;
+ char ipv6_addr[16];
bool was_iface = FALSE;
+ int in6 = -1;
/* First check if the given name is an IP address */
in=inet_addr(data->set.device);
@@ -314,7 +316,11 @@ static CURLcode bindlocal(struct connectdata *conn,
#endif
in=inet_addr(myhost);
- if (CURL_INADDR_NONE == in) {
+
+#ifdef ENABLE_IPV6
+ in6 = inet_pton (AF_INET6, myhost, (void *)&ipv6_addr);
+#endif
+ if (CURL_INADDR_NONE == in && -1 == in6) {
failf(data,"couldn't find my own IP address (%s)", myhost);
return CURLE_HTTP_PORT_FAILED;
} /* end of inet_addr */