ares_set_local_dev.3 (1087B)
1 .\" 2 .\" Copyright 2010 by Ben Greear <greearb@candelatech.com> 3 .\" SPDX-License-Identifier: MIT 4 .\" 5 .TH ARES_SET_LOCAL_DEV 3 "23 September 2024" 6 .SH NAME 7 ares_set_local_dev \- Bind to a specific network device when creating sockets. 8 .SH SYNOPSIS 9 .nf 10 #include <ares.h> 11 12 void ares_set_local_dev(ares_channel_t *\fIchannel\fP, const char* \fIlocal_dev_name\fP) 13 .fi 14 .SH DESCRIPTION 15 The \fBares_set_local_dev\fP function causes all future sockets 16 to be bound to this device with SO_BINDTODEVICE. This forces communications 17 to go over a certain interface, which can be useful on multi-homed machines. 18 This option is only supported on Linux, the interface must not be already bound to the 19 socket or the current effective user must have CAP_NET_RAW capability in the current 20 network namespace for the option to work. If SO_BINDTODEVICE is not supported or the 21 setsockopt call fails (probably because of permissions), the error is 22 silently ignored. 23 .SH SEE ALSO 24 .BR ares_set_local_ip4 (3) 25 .BR ares_set_local_ip6 (3) 26 .BR network_namespaces (7) 27 .SH NOTES 28 This function was added in c-ares 1.7.4