Skip to content

-S: if not valid IP addr, treat it as a device name to bind to - #212

Open
Jimmy-Z wants to merge 1 commit into
aarond10:masterfrom
Jimmy-Z:master
Open

-S: if not valid IP addr, treat it as a device name to bind to#212
Jimmy-Z wants to merge 1 commit into
aarond10:masterfrom
Jimmy-Z:master

Conversation

@Jimmy-Z

@Jimmy-Z Jimmy-Z commented Aug 8, 2026

Copy link
Copy Markdown

solves #209

basically adds a single line of code, ares already has the facility to bind device, curl side doesn't need any change since the api takes address or interface name.

Comment thread src/dns_poller.c
} else {
WLOG("Bootstrap source address '%s' is not a valid IP literal", source_addr);
// otherwise treat it as a device/interface name
ares_set_local_dev(channel, source_addr);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? The ares docs say:

If SO_BINDTODEVICE is not supported or the setsocktop call fails (probably because of permissions), the error is silently ignored.

main.c daemon()izes before dns_poller_init which is the caller of this function dropping root will break this and running on a non-linux system will also not work but will no longer show a warning.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it without daemonizing and dropping root, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants