Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dns] allow to specify an interface to use DNS servers that are specific it during lookup #17

Open
wants to merge 1 commit into
base: particle
Choose a base branch
from

Conversation

avtolstoy
Copy link
Member

@avtolstoy avtolstoy force-pushed the feature/iface-specific-dns-lookup branch from 5bf5129 to 2464af8 Compare February 18, 2025 14:07
@@ -1653,14 +1676,20 @@ dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_call
#endif /* LWIP_DNS_SUPPORT_MDNS_QUERIES */
{
/* prevent calling found callback if no server is set, return error instead */
if (next_server_index(0) == DNS_MAX_SERVERS) {
if (next_server_index(0, if_idx) == DNS_MAX_SERVERS) {
Copy link
Member

Choose a reason for hiding this comment

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

I know you didnt change this logic, but is the intent to switch to the next potential DNS server to use to resolve the address if we failed to resolve the address? or is this just a check that we have any usable DNS server?

Copy link
Member Author

Choose a reason for hiding this comment

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

Next server that is associated with this interface. If if_idx == 0, it's any next server in the list. If it's not 0, only subsequent ones that match LWIP_HOOK_DNS_GET_NETIF_FOR_SERVER_INDEX(i)

Copy link
Member

Choose a reason for hiding this comment

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

Ok, if the start_index parameter of next_server_index() is always passed as zero, wont it always use the first one it finds that matches that index? It just walks through the dns_servers[] array starting from zero each time? Im wondering how this worked before.

Copy link
Member

Choose a reason for hiding this comment

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

I guess this is just a check to see if any dns server is available (for our interface specifically). The iterating happens elsewhere in dns_backupserver_available() and dns_check_entry()

@scott-brust
Copy link
Member

Looks good to me

@scott-brust scott-brust self-requested a review February 19, 2025 19:52
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