asyn-thread.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2018, Daniel Stenberg, <[email protected]>, et al.
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at https://curl.haxx.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. ***************************************************************************/
  22. #include "curl_setup.h"
  23. /***********************************************************************
  24. * Only for threaded name resolves builds
  25. **********************************************************************/
  26. #ifdef CURLRES_THREADED
  27. #ifdef HAVE_NETINET_IN_H
  28. #include <netinet/in.h>
  29. #endif
  30. #ifdef HAVE_NETDB_H
  31. #include <netdb.h>
  32. #endif
  33. #ifdef HAVE_ARPA_INET_H
  34. #include <arpa/inet.h>
  35. #endif
  36. #ifdef __VMS
  37. #include <in.h>
  38. #include <inet.h>
  39. #endif
  40. #if defined(USE_THREADS_POSIX)
  41. # ifdef HAVE_PTHREAD_H
  42. # include <pthread.h>
  43. # endif
  44. #elif defined(USE_THREADS_WIN32)
  45. # ifdef HAVE_PROCESS_H
  46. # include <process.h>
  47. # endif
  48. #endif
  49. #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
  50. #undef in_addr_t
  51. #define in_addr_t unsigned long
  52. #endif
  53. #ifdef HAVE_GETADDRINFO
  54. # define RESOLVER_ENOMEM EAI_MEMORY
  55. #else
  56. # define RESOLVER_ENOMEM ENOMEM
  57. #endif
  58. #include "urldata.h"
  59. #include "sendf.h"
  60. #include "hostip.h"
  61. #include "hash.h"
  62. #include "share.h"
  63. #include "strerror.h"
  64. #include "url.h"
  65. #include "multiif.h"
  66. #include "inet_pton.h"
  67. #include "inet_ntop.h"
  68. #include "curl_threads.h"
  69. #include "connect.h"
  70. /* The last 3 #include files should be in this order */
  71. #include "curl_printf.h"
  72. #include "curl_memory.h"
  73. #include "memdebug.h"
  74. struct resdata {
  75. struct curltime start;
  76. };
  77. /*
  78. * Curl_resolver_global_init()
  79. * Called from curl_global_init() to initialize global resolver environment.
  80. * Does nothing here.
  81. */
  82. int Curl_resolver_global_init(void)
  83. {
  84. return CURLE_OK;
  85. }
  86. /*
  87. * Curl_resolver_global_cleanup()
  88. * Called from curl_global_cleanup() to destroy global resolver environment.
  89. * Does nothing here.
  90. */
  91. void Curl_resolver_global_cleanup(void)
  92. {
  93. }
  94. /*
  95. * Curl_resolver_init()
  96. * Called from curl_easy_init() -> Curl_open() to initialize resolver
  97. * URL-state specific environment ('resolver' member of the UrlState
  98. * structure).
  99. */
  100. CURLcode Curl_resolver_init(void **resolver)
  101. {
  102. *resolver = calloc(1, sizeof(struct resdata));
  103. if(!*resolver)
  104. return CURLE_OUT_OF_MEMORY;
  105. return CURLE_OK;
  106. }
  107. /*
  108. * Curl_resolver_cleanup()
  109. * Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
  110. * URL-state specific environment ('resolver' member of the UrlState
  111. * structure).
  112. */
  113. void Curl_resolver_cleanup(void *resolver)
  114. {
  115. free(resolver);
  116. }
  117. /*
  118. * Curl_resolver_duphandle()
  119. * Called from curl_easy_duphandle() to duplicate resolver URL state-specific
  120. * environment ('resolver' member of the UrlState structure).
  121. */
  122. int Curl_resolver_duphandle(void **to, void *from)
  123. {
  124. (void)from;
  125. return Curl_resolver_init(to);
  126. }
  127. static void destroy_async_data(struct Curl_async *);
  128. /*
  129. * Cancel all possibly still on-going resolves for this connection.
  130. */
  131. void Curl_resolver_cancel(struct connectdata *conn)
  132. {
  133. destroy_async_data(&conn->async);
  134. }
  135. /* This function is used to init a threaded resolve */
  136. static bool init_resolve_thread(struct connectdata *conn,
  137. const char *hostname, int port,
  138. const struct addrinfo *hints);
  139. /* Data for synchronization between resolver thread and its parent */
  140. struct thread_sync_data {
  141. curl_mutex_t * mtx;
  142. int done;
  143. char *hostname; /* hostname to resolve, Curl_async.hostname
  144. duplicate */
  145. int port;
  146. int sock_error;
  147. Curl_addrinfo *res;
  148. #ifdef HAVE_GETADDRINFO
  149. struct addrinfo hints;
  150. #endif
  151. struct thread_data *td; /* for thread-self cleanup */
  152. };
  153. struct thread_data {
  154. curl_thread_t thread_hnd;
  155. unsigned int poll_interval;
  156. time_t interval_end;
  157. struct thread_sync_data tsd;
  158. };
  159. static struct thread_sync_data *conn_thread_sync_data(struct connectdata *conn)
  160. {
  161. return &(((struct thread_data *)conn->async.os_specific)->tsd);
  162. }
  163. #define CONN_THREAD_SYNC_DATA(conn) &(((conn)->async.os_specific)->tsd);
  164. /* Destroy resolver thread synchronization data */
  165. static
  166. void destroy_thread_sync_data(struct thread_sync_data * tsd)
  167. {
  168. if(tsd->mtx) {
  169. Curl_mutex_destroy(tsd->mtx);
  170. free(tsd->mtx);
  171. }
  172. free(tsd->hostname);
  173. if(tsd->res)
  174. Curl_freeaddrinfo(tsd->res);
  175. memset(tsd, 0, sizeof(*tsd));
  176. }
  177. /* Initialize resolver thread synchronization data */
  178. static
  179. int init_thread_sync_data(struct thread_data * td,
  180. const char *hostname,
  181. int port,
  182. const struct addrinfo *hints)
  183. {
  184. struct thread_sync_data *tsd = &td->tsd;
  185. memset(tsd, 0, sizeof(*tsd));
  186. tsd->td = td;
  187. tsd->port = port;
  188. /* Treat the request as done until the thread actually starts so any early
  189. * cleanup gets done properly.
  190. */
  191. tsd->done = 1;
  192. #ifdef HAVE_GETADDRINFO
  193. DEBUGASSERT(hints);
  194. tsd->hints = *hints;
  195. #else
  196. (void) hints;
  197. #endif
  198. tsd->mtx = malloc(sizeof(curl_mutex_t));
  199. if(tsd->mtx == NULL)
  200. goto err_exit;
  201. Curl_mutex_init(tsd->mtx);
  202. tsd->sock_error = CURL_ASYNC_SUCCESS;
  203. /* Copying hostname string because original can be destroyed by parent
  204. * thread during gethostbyname execution.
  205. */
  206. tsd->hostname = strdup(hostname);
  207. if(!tsd->hostname)
  208. goto err_exit;
  209. return 1;
  210. err_exit:
  211. /* Memory allocation failed */
  212. destroy_thread_sync_data(tsd);
  213. return 0;
  214. }
  215. static int getaddrinfo_complete(struct connectdata *conn)
  216. {
  217. struct thread_sync_data *tsd = conn_thread_sync_data(conn);
  218. int rc;
  219. rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res);
  220. /* The tsd->res structure has been copied to async.dns and perhaps the DNS
  221. cache. Set our copy to NULL so destroy_thread_sync_data doesn't free it.
  222. */
  223. tsd->res = NULL;
  224. return rc;
  225. }
  226. #ifdef HAVE_GETADDRINFO
  227. /*
  228. * getaddrinfo_thread() resolves a name and then exits.
  229. *
  230. * For builds without ARES, but with ENABLE_IPV6, create a resolver thread
  231. * and wait on it.
  232. */
  233. static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
  234. {
  235. struct thread_sync_data *tsd = (struct thread_sync_data*)arg;
  236. struct thread_data *td = tsd->td;
  237. char service[12];
  238. int rc;
  239. snprintf(service, sizeof(service), "%d", tsd->port);
  240. rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);
  241. if(rc != 0) {
  242. tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
  243. if(tsd->sock_error == 0)
  244. tsd->sock_error = RESOLVER_ENOMEM;
  245. }
  246. else {
  247. Curl_addrinfo_set_port(tsd->res, tsd->port);
  248. }
  249. Curl_mutex_acquire(tsd->mtx);
  250. if(tsd->done) {
  251. /* too late, gotta clean up the mess */
  252. Curl_mutex_release(tsd->mtx);
  253. destroy_thread_sync_data(tsd);
  254. free(td);
  255. }
  256. else {
  257. tsd->done = 1;
  258. Curl_mutex_release(tsd->mtx);
  259. }
  260. return 0;
  261. }
  262. #else /* HAVE_GETADDRINFO */
  263. /*
  264. * gethostbyname_thread() resolves a name and then exits.
  265. */
  266. static unsigned int CURL_STDCALL gethostbyname_thread(void *arg)
  267. {
  268. struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
  269. struct thread_data *td = tsd->td;
  270. tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port);
  271. if(!tsd->res) {
  272. tsd->sock_error = SOCKERRNO;
  273. if(tsd->sock_error == 0)
  274. tsd->sock_error = RESOLVER_ENOMEM;
  275. }
  276. Curl_mutex_acquire(tsd->mtx);
  277. if(tsd->done) {
  278. /* too late, gotta clean up the mess */
  279. Curl_mutex_release(tsd->mtx);
  280. destroy_thread_sync_data(tsd);
  281. free(td);
  282. }
  283. else {
  284. tsd->done = 1;
  285. Curl_mutex_release(tsd->mtx);
  286. }
  287. return 0;
  288. }
  289. #endif /* HAVE_GETADDRINFO */
  290. /*
  291. * destroy_async_data() cleans up async resolver data and thread handle.
  292. */
  293. static void destroy_async_data(struct Curl_async *async)
  294. {
  295. if(async->os_specific) {
  296. struct thread_data *td = (struct thread_data*) async->os_specific;
  297. int done;
  298. /*
  299. * if the thread is still blocking in the resolve syscall, detach it and
  300. * let the thread do the cleanup...
  301. */
  302. Curl_mutex_acquire(td->tsd.mtx);
  303. done = td->tsd.done;
  304. td->tsd.done = 1;
  305. Curl_mutex_release(td->tsd.mtx);
  306. if(!done) {
  307. Curl_thread_destroy(td->thread_hnd);
  308. }
  309. else {
  310. if(td->thread_hnd != curl_thread_t_null)
  311. Curl_thread_join(&td->thread_hnd);
  312. destroy_thread_sync_data(&td->tsd);
  313. free(async->os_specific);
  314. }
  315. }
  316. async->os_specific = NULL;
  317. free(async->hostname);
  318. async->hostname = NULL;
  319. }
  320. /*
  321. * init_resolve_thread() starts a new thread that performs the actual
  322. * resolve. This function returns before the resolve is done.
  323. *
  324. * Returns FALSE in case of failure, otherwise TRUE.
  325. */
  326. static bool init_resolve_thread(struct connectdata *conn,
  327. const char *hostname, int port,
  328. const struct addrinfo *hints)
  329. {
  330. struct thread_data *td = calloc(1, sizeof(struct thread_data));
  331. int err = ENOMEM;
  332. conn->async.os_specific = (void *)td;
  333. if(!td)
  334. goto errno_exit;
  335. conn->async.port = port;
  336. conn->async.done = FALSE;
  337. conn->async.status = 0;
  338. conn->async.dns = NULL;
  339. td->thread_hnd = curl_thread_t_null;
  340. if(!init_thread_sync_data(td, hostname, port, hints)) {
  341. conn->async.os_specific = NULL;
  342. free(td);
  343. goto errno_exit;
  344. }
  345. free(conn->async.hostname);
  346. conn->async.hostname = strdup(hostname);
  347. if(!conn->async.hostname)
  348. goto err_exit;
  349. /* The thread will set this to 1 when complete. */
  350. td->tsd.done = 0;
  351. #ifdef HAVE_GETADDRINFO
  352. td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd);
  353. #else
  354. td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd);
  355. #endif
  356. if(!td->thread_hnd) {
  357. /* The thread never started, so mark it as done here for proper cleanup. */
  358. td->tsd.done = 1;
  359. err = errno;
  360. goto err_exit;
  361. }
  362. return TRUE;
  363. err_exit:
  364. destroy_async_data(&conn->async);
  365. errno_exit:
  366. errno = err;
  367. return FALSE;
  368. }
  369. /*
  370. * resolver_error() calls failf() with the appropriate message after a resolve
  371. * error
  372. */
  373. static CURLcode resolver_error(struct connectdata *conn)
  374. {
  375. const char *host_or_proxy;
  376. CURLcode result;
  377. if(conn->bits.httpproxy) {
  378. host_or_proxy = "proxy";
  379. result = CURLE_COULDNT_RESOLVE_PROXY;
  380. }
  381. else {
  382. host_or_proxy = "host";
  383. result = CURLE_COULDNT_RESOLVE_HOST;
  384. }
  385. failf(conn->data, "Could not resolve %s: %s", host_or_proxy,
  386. conn->async.hostname);
  387. return result;
  388. }
  389. /*
  390. * Curl_resolver_wait_resolv()
  391. *
  392. * waits for a resolve to finish. This function should be avoided since using
  393. * this risk getting the multi interface to "hang".
  394. *
  395. * If 'entry' is non-NULL, make it point to the resolved dns entry
  396. *
  397. * This is the version for resolves-in-a-thread.
  398. */
  399. CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
  400. struct Curl_dns_entry **entry)
  401. {
  402. struct thread_data *td = (struct thread_data*) conn->async.os_specific;
  403. CURLcode result = CURLE_OK;
  404. DEBUGASSERT(conn && td);
  405. /* wait for the thread to resolve the name */
  406. if(Curl_thread_join(&td->thread_hnd))
  407. result = getaddrinfo_complete(conn);
  408. else
  409. DEBUGASSERT(0);
  410. conn->async.done = TRUE;
  411. if(entry)
  412. *entry = conn->async.dns;
  413. if(!conn->async.dns)
  414. /* a name was not resolved, report error */
  415. result = resolver_error(conn);
  416. destroy_async_data(&conn->async);
  417. if(!conn->async.dns)
  418. connclose(conn, "asynch resolve failed");
  419. return result;
  420. }
  421. /*
  422. * Curl_resolver_is_resolved() is called repeatedly to check if a previous
  423. * name resolve request has completed. It should also make sure to time-out if
  424. * the operation seems to take too long.
  425. */
  426. CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
  427. struct Curl_dns_entry **entry)
  428. {
  429. struct Curl_easy *data = conn->data;
  430. struct thread_data *td = (struct thread_data*) conn->async.os_specific;
  431. int done = 0;
  432. *entry = NULL;
  433. if(!td) {
  434. DEBUGASSERT(td);
  435. return CURLE_COULDNT_RESOLVE_HOST;
  436. }
  437. Curl_mutex_acquire(td->tsd.mtx);
  438. done = td->tsd.done;
  439. Curl_mutex_release(td->tsd.mtx);
  440. if(done) {
  441. getaddrinfo_complete(conn);
  442. if(!conn->async.dns) {
  443. CURLcode result = resolver_error(conn);
  444. destroy_async_data(&conn->async);
  445. return result;
  446. }
  447. destroy_async_data(&conn->async);
  448. *entry = conn->async.dns;
  449. }
  450. else {
  451. /* poll for name lookup done with exponential backoff up to 250ms */
  452. timediff_t elapsed = Curl_timediff(Curl_now(),
  453. data->progress.t_startsingle);
  454. if(elapsed < 0)
  455. elapsed = 0;
  456. if(td->poll_interval == 0)
  457. /* Start at 1ms poll interval */
  458. td->poll_interval = 1;
  459. else if(elapsed >= td->interval_end)
  460. /* Back-off exponentially if last interval expired */
  461. td->poll_interval *= 2;
  462. if(td->poll_interval > 250)
  463. td->poll_interval = 250;
  464. td->interval_end = elapsed + td->poll_interval;
  465. Curl_expire(conn->data, td->poll_interval, EXPIRE_ASYNC_NAME);
  466. }
  467. return CURLE_OK;
  468. }
  469. int Curl_resolver_getsock(struct connectdata *conn,
  470. curl_socket_t *socks,
  471. int numsocks)
  472. {
  473. time_t milli;
  474. timediff_t ms;
  475. struct Curl_easy *data = conn->data;
  476. struct resdata *reslv = (struct resdata *)data->state.resolver;
  477. (void)socks;
  478. (void)numsocks;
  479. ms = Curl_timediff(Curl_now(), reslv->start);
  480. if(ms < 10)
  481. milli = ms/3;
  482. else if(ms <= 50)
  483. milli = 10;
  484. else if(ms <= 250)
  485. milli = 50;
  486. else
  487. milli = 200;
  488. Curl_expire(data, milli, EXPIRE_ASYNC_NAME);
  489. return 0;
  490. }
  491. #ifndef HAVE_GETADDRINFO
  492. /*
  493. * Curl_getaddrinfo() - for platforms without getaddrinfo
  494. */
  495. Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
  496. const char *hostname,
  497. int port,
  498. int *waitp)
  499. {
  500. struct in_addr in;
  501. struct Curl_easy *data = conn->data;
  502. struct resdata *reslv = (struct resdata *)data->state.resolver;
  503. *waitp = 0; /* default to synchronous response */
  504. if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
  505. /* This is a dotted IP address 123.123.123.123-style */
  506. return Curl_ip2addr(AF_INET, &in, hostname, port);
  507. reslv->start = Curl_now();
  508. /* fire up a new resolver thread! */
  509. if(init_resolve_thread(conn, hostname, port, NULL)) {
  510. *waitp = 1; /* expect asynchronous response */
  511. return NULL;
  512. }
  513. failf(conn->data, "getaddrinfo() thread failed\n");
  514. return NULL;
  515. }
  516. #else /* !HAVE_GETADDRINFO */
  517. /*
  518. * Curl_resolver_getaddrinfo() - for getaddrinfo
  519. */
  520. Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
  521. const char *hostname,
  522. int port,
  523. int *waitp)
  524. {
  525. struct addrinfo hints;
  526. char sbuf[12];
  527. int pf = PF_INET;
  528. struct Curl_easy *data = conn->data;
  529. struct resdata *reslv = (struct resdata *)data->state.resolver;
  530. *waitp = 0; /* default to synchronous response */
  531. #ifndef USE_RESOLVE_ON_IPS
  532. {
  533. struct in_addr in;
  534. /* First check if this is an IPv4 address string */
  535. if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
  536. /* This is a dotted IP address 123.123.123.123-style */
  537. return Curl_ip2addr(AF_INET, &in, hostname, port);
  538. }
  539. #ifdef CURLRES_IPV6
  540. {
  541. struct in6_addr in6;
  542. /* check if this is an IPv6 address string */
  543. if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
  544. /* This is an IPv6 address literal */
  545. return Curl_ip2addr(AF_INET6, &in6, hostname, port);
  546. }
  547. #endif /* CURLRES_IPV6 */
  548. #endif /* !USE_RESOLVE_ON_IPS */
  549. #ifdef CURLRES_IPV6
  550. /*
  551. * Check if a limited name resolve has been requested.
  552. */
  553. switch(conn->ip_version) {
  554. case CURL_IPRESOLVE_V4:
  555. pf = PF_INET;
  556. break;
  557. case CURL_IPRESOLVE_V6:
  558. pf = PF_INET6;
  559. break;
  560. default:
  561. pf = PF_UNSPEC;
  562. break;
  563. }
  564. if((pf != PF_INET) && !Curl_ipv6works())
  565. /* The stack seems to be a non-IPv6 one */
  566. pf = PF_INET;
  567. #endif /* CURLRES_IPV6 */
  568. memset(&hints, 0, sizeof(hints));
  569. hints.ai_family = pf;
  570. hints.ai_socktype = conn->socktype;
  571. snprintf(sbuf, sizeof(sbuf), "%d", port);
  572. reslv->start = Curl_now();
  573. /* fire up a new resolver thread! */
  574. if(init_resolve_thread(conn, hostname, port, &hints)) {
  575. *waitp = 1; /* expect asynchronous response */
  576. return NULL;
  577. }
  578. failf(data, "getaddrinfo() thread failed to start\n");
  579. return NULL;
  580. }
  581. #endif /* !HAVE_GETADDRINFO */
  582. CURLcode Curl_set_dns_servers(struct Curl_easy *data,
  583. char *servers)
  584. {
  585. (void)data;
  586. (void)servers;
  587. return CURLE_NOT_BUILT_IN;
  588. }
  589. CURLcode Curl_set_dns_interface(struct Curl_easy *data,
  590. const char *interf)
  591. {
  592. (void)data;
  593. (void)interf;
  594. return CURLE_NOT_BUILT_IN;
  595. }
  596. CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data,
  597. const char *local_ip4)
  598. {
  599. (void)data;
  600. (void)local_ip4;
  601. return CURLE_NOT_BUILT_IN;
  602. }
  603. CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
  604. const char *local_ip6)
  605. {
  606. (void)data;
  607. (void)local_ip6;
  608. return CURLE_NOT_BUILT_IN;
  609. }
  610. #endif /* CURLRES_THREADED */