1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_DNS_INTERFACE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_DNS_LOCAL_IP4 (3) 9 - CURLOPT_DNS_LOCAL_IP6 (3) 10 - CURLOPT_DNS_SERVERS (3) 11 - CURLOPT_INTERFACE (3) 12--- 13 14# NAME 15 16CURLOPT_DNS_INTERFACE - interface to speak DNS over 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname); 24~~~ 25 26# DESCRIPTION 27 28Pass a char pointer as parameter. Set the name of the network interface that 29the DNS resolver should bind to. This must be an interface name (not an 30address). Set this option to NULL to use the default setting (do not bind to a 31specific interface). 32 33The application does not have to keep the string around after setting this 34option. 35 36# DEFAULT 37 38NULL 39 40# PROTOCOLS 41 42All protocols except file:// - protocols that resolve host names. 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode res; 52 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 53 curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0"); 54 res = curl_easy_perform(curl); 55 curl_easy_cleanup(curl); 56 } 57} 58~~~ 59 60# AVAILABILITY 61 62Added in 7.33.0. This option also requires that libcurl was built with a 63resolver backend that supports this operation. The c-ares backend is the only 64such one. 65 66# RETURN VALUE 67 68Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, 69or CURLE_NOT_BUILT_IN if support was disabled at compile-time. 70