1CURLOPT_DNS_INTERFACE(3) curl_easy_setopt options CURLOPT_DNS_INTERFACE(3)
2
3
4
6 CURLOPT_DNS_INTERFACE - interface to speak DNS over
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname);
12
14 Pass a char * as parameter. Set the name of the network interface that
15 the DNS resolver should bind to. This must be an interface name (not an
16 address). Set this option to NULL to use the default setting (do not
17 bind to a specific interface).
18
19 The application does not have to keep the string around after setting
20 this option.
21
23 NULL
24
27 CURL *curl = curl_easy_init();
28 if(curl) {
29 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
30 curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0");
31 ret = curl_easy_perform(curl);
32 curl_easy_cleanup(curl);
33 }
34
36 Added in 7.33.0. This option also requires that libcurl was built with
37 a resolver backend that supports this operation. The c-ares backend is
38 the only such one.
39
41 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
42 not, or CURLE_NOT_BUILT_IN if support was disabled at compile-time.
43
45 CURLOPT_DNS_SERVERS(3), CURLOPT_DNS_LOCAL_IP4(3),
46
47
48
49libcurl 7.85.0 May 17, 2022 CURLOPT_DNS_INTERFACE(3)