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