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

Runtime DNS server addition implement #10602

Merged
merged 1 commit into from May 22, 2019

Conversation

@tymoteuszblochmobica
Copy link
Contributor

commented May 16, 2019

Description

Implemented missing runtime DNS server addition in LWIPStack class.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@SeppoTakalo
@mikaleppanen
@kivaisan

Release Notes

@ciarmcom ciarmcom requested review from kivaisan, mikaleppanen, SeppoTakalo and ARMmbed/mbed-os-maintainers May 16, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented May 16, 2019

@andrewc-arm

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

Hi, @tymoteuszblochmobica

Thanks for making this progress!

I see that the implementation add_dns_server() will push the new DNS server to the index 0.
So, does this mean that user application can get_dns_server() and add_dns_server() to reorder the priority?
If so, can we expect the same behavior on generic NetworkInterface::add_dns_server() ?
If so, can we mention such behavior in Doxygen comment?

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?

(CC: @taeily , @joslee02 , @ohadhawk )

@tymoteuszblochmobica tymoteuszblochmobica force-pushed the tymoteuszblochmobica:dns branch from 04879fd to fa4cfcf May 17, 2019

@@ -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

This comment has been minimized.

Copy link
@JanneKiiskila

JanneKiiskila May 20, 2019

Contributor

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?

This comment has been minimized.

Copy link
@tymoteuszblochmobica

tymoteuszblochmobica May 20, 2019

Author Contributor

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);

This comment has been minimized.

Copy link
@SeppoTakalo

SeppoTakalo May 20, 2019

Contributor

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?

This comment has been minimized.

Copy link
@andrewc-arm

andrewc-arm May 20, 2019

Contributor

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.

This comment has been minimized.

Copy link
@tymoteuszblochmobica

tymoteuszblochmobica May 20, 2019

Author Contributor

As member get_dns_server breaks API and is not urgenly needed as add_dns_server is removed.

@kivaisan

This comment has been minimized.

Copy link
Contributor

commented May 20, 2019

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.

    tr_info("add_dns_server: address = %s", address.get_ip_address());
    tr_info("convert = %d", convert_mbed_addr_to_lwip(ip_addr, &addr));
    tr_info("add_dns_server: ip_addr = %s", ipaddr_ntoa(ip_addr));

->

[00025618ms][INFO][LWIP]: add_dns_server: address = 1.1.1.1
[00025621ms][INFO][LWIP]: convert = 1
[00025622ms][INFO][LWIP]: add_dns_server: ip_addr = (null)

Any idea? I'll also do some more debugging.

@tymoteuszblochmobica tymoteuszblochmobica force-pushed the tymoteuszblochmobica:dns branch from fa4cfcf to 63537d0 May 20, 2019

int index;
nsapi_addr_t addr = address.get_addr();
const ip_addr_t *ip_addr_move;
ip_addr_t *ip_addr;

This comment has been minimized.

Copy link
@kivaisan

kivaisan May 20, 2019

Contributor

This should be ip_addr_t ip_addr;

This comment has been minimized.

Copy link
@tymoteuszblochmobica

tymoteuszblochmobica May 20, 2019

Author Contributor

fixed

const ip_addr_t *ip_addr_move;
ip_addr_t *ip_addr;

convert_mbed_addr_to_lwip(ip_addr, &addr);

This comment has been minimized.

Copy link
@kivaisan

kivaisan May 20, 2019

Contributor

and this (and later in function) should then use &ip_addr.

This comment has been minimized.

Copy link
@tymoteuszblochmobica

tymoteuszblochmobica May 20, 2019

Author Contributor

fixed

@tymoteuszblochmobica tymoteuszblochmobica force-pushed the tymoteuszblochmobica:dns branch from 63537d0 to d232e79 May 20, 2019

@kivaisan

This comment has been minimized.

Copy link
Contributor

commented May 20, 2019

One more bug which prevents DNS usage when interface name has been given to gethostbyname method:
https://github.com/ARMmbed/mbed-os/blob/master/features/lwipstack/lwip/src/core/lwip_dns.c#L490
This comparision should be

  if (numdns >= DNS_MAX_SERVERS) {
    return IP_ADDR_ANY;
  }

@tymoteuszblochmobica tymoteuszblochmobica force-pushed the tymoteuszblochmobica:dns branch from d232e79 to cdd31a5 May 20, 2019

@tymoteuszblochmobica

This comment has been minimized.

Copy link
Contributor Author

commented May 20, 2019

if (numdns >= DNS_MAX_SERVERS) {
return IP_ADDR_ANY;
}
Fix was already done but probably lost during rebase.
Applied again.

@0xc0170

This comment has been minimized.

Copy link
Member

commented May 21, 2019

CI started

@0xc0170 0xc0170 added needs: CI and removed needs: review labels May 21, 2019

@mbed-ci

This comment has been minimized.

Copy link

commented May 21, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels May 22, 2019

@0xc0170 0xc0170 merged commit 06cf787 into ARMmbed:master May 22, 2019

26 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage Success
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Success!
Details
travis-ci/docs Success!
Details
travis-ci/doxy-spellcheck Success!
Details
travis-ci/events Success! Runtime is 8642 cycles.
Details
travis-ci/gitattributestest Success!
Details
travis-ci/include_check Success!
Details
travis-ci/licence_check Success!
Details
travis-ci/littlefs Success! Code size is 8448B.
Details
travis-ci/psa-autogen Success!
Details
travis-ci/tools-py2.7 Success!
Details
travis-ci/tools-py3.5 Success!
Details
travis-ci/tools-py3.6 Success!
Details
travis-ci/tools-py3.7 Success!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.