-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Runtime DNS server addition implement #10602
Conversation
@tymoteuszblochmobica, thank you for your changes. |
Thanks for making this progress! I see that the implementation add_dns_server() will push the new DNS server to the index 0. I am asking you this because DNS priority concept is also required. My customer's customer has a local DNS server of lower network latency and private domain name list. Or do you think this should be dealt as a separate request? |
@@ -253,6 +253,18 @@ class NetworkInterface: public DNS { | |||
*/ | |||
virtual nsapi_error_t gethostbyname_async_cancel(int id); | |||
|
|||
/** Get a domain name server from a list of servers to query | |||
* | |||
* Returns a DNS server address for a index. If returns error no more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-picking, but the English here could do a bit of fine-tuning. I assume we store the server address to the @param address and also it's name to @param interface_name AND NS_API_ERROR_OK, if a DNS server is availble in the index queried location? If no DNS server in index queries location, we return some negative error code, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Member get_dns_server is removed.
* @param interface_name Network interface name | ||
* @return NSAPI_ERROR_OK on success, negative error code on failure | ||
*/ | ||
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually API break, as the size of the virtual table changes, and therefore forces us to rebuild all binary WiFi drivers that inherit NetworkInterface.
Is this new API really required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @tymoteuszblochmobica
As @SeppoTakalo shared his concern on adding the new API call, can we divide this PR to add_dns_server() implementation and get_dns_server() connection separately? What customer really need urgently is add_dns_server() call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As member get_dns_server breaks API and is not urgenly needed as add_dns_server is removed.
I'm testing this but I always get NSAPI_ERROR_NO_ADDRESS error. I already added some traces and it looks like convert_mbed_addr_to_lwip returns null.
->
Any idea? I'll also do some more debugging. |
features/lwipstack/LWIPStack.cpp
Outdated
int index; | ||
nsapi_addr_t addr = address.get_addr(); | ||
const ip_addr_t *ip_addr_move; | ||
ip_addr_t *ip_addr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ip_addr_t ip_addr;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
features/lwipstack/LWIPStack.cpp
Outdated
const ip_addr_t *ip_addr_move; | ||
ip_addr_t *ip_addr; | ||
|
||
convert_mbed_addr_to_lwip(ip_addr, &addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this (and later in function) should then use &ip_addr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
One more bug which prevents DNS usage when interface name has been given to
|
if (numdns >= DNS_MAX_SERVERS) { |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Implemented missing runtime DNS server addition in LWIPStack class.
Pull request type
Reviewers
@SeppoTakalo
@mikaleppanen
@kivaisan
Release Notes