ARES_SET_LOCAL_DEV(3)
β¨ ARES_SET_LOCAL_DEV β¨
okay bestie, welcome to page 3 of the Library Functions Manual β yes this is ARES_SET_LOCAL_DEV, and yes it's about to be your new fave π
π NAME π
ares_set_local_dev β bind to a specific network device when creating sockets π«Ά
πΈ SYNOPSIS πΈ
#include <ares.h>
void ares_set_local_dev(ares_channel_t *channel, const char* local_dev_name)
π¦ DESCRIPTION π¦
so like, the way that ares_set_local_dev works is: it makes all future sockets get bound to this device with SO_BINDTODEVICE. literally every socket from here on out, no cap π
which means it forces your communications to go over a certain interface β and that's highkey useful on multi-homed machines where you've got options and you need to pick one π§
β οΈ okay but listen β this option is only supported on Linux, and there are two lil conditions: the interface must not already be bound to the socket, or the current effective user must have CAP_NET_RAW capability in the current network namespace for the option to work. both of those, real talk. π
and if SO_BINDTODEVICE isn't supported at all, or the setsockopt call just... fails (probably because of permissions π), then the error is silently ignored. like, no screaming, no warning, nothing. it's giving "we don't talk about it." π
π₯ SEE ALSO π₯
π NOTES π
this function was added in c-ares 1.7.4 β so she's been iconic for a minute β
and that's the whole page, bestie! this one's from the Library Functions Manual, dated 23 September 2024, and it's serving ARES_SET_LOCAL_DEV(3) realness. slay, go bind some sockets responsibly πβ¨π
π¦ where this page comes from
- alpine 3.22: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.23: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.24: c-ares-doc 1.34.9-r0 Β· MIT
- arch rolling: c-ares 1.34.9-1 Β· MIT
- centos-stream 10: c-ares-devel 1.34.9-1.el10 Β· MIT
- debian trixie: libc-ares-dev 1.34.5-1+deb13u1 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- nixos 26.05: c-ares 1.34.9
- nixpkgs unstable: c-ares 1.34.8
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- ubuntu questing: libc-ares-dev 1.34.5-1
- ubuntu questing: libc-ares-dev 1.34.5-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1 Β· MIT
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.2 Β· MIT
- ubuntu stonking: libc-ares-dev 1.34.8-1 Β· MIT
- π the page's license: MIT
- Copyright 2010 by Ben Greear <greearb@candelatech.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms