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