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 failure when trying to get ip of local host #2369

Closed
adamelhakham opened this issue Aug 4, 2016 · 4 comments
Closed

DNS failure when trying to get ip of local host #2369

adamelhakham opened this issue Aug 4, 2016 · 4 comments

Comments

@adamelhakham
Copy link

When running the following code:

EthernetInterface ifaceHandler;
char address[] = "prov-dev.kfn.arm.com";//" this is a local host, running in ARM network with IP 10.45.51.47"
uint16_t port = 5683;
SocketAddress *addr;
const char *ipGet;

ifaceHandler.connect();

addr = new SocketAddress(&ifaceHandler, address, port);

ipGet = addr->get_ip_address();

printf("ip is: %s\n", ipGet);

the message "ip is: 0.0.0.0" is printed instead of "ip is: 10.45.51.47".
I tried digging a bit deeper and found that in the following function (in DnsQuery.cpp):
static int32_t query(UDPSocket *socket, const SocketAddress &addr, const char *hostname, char *ipaddress)

it receives an answer from the DNS but failes to resolve the packet and runs the following code:

if (!resolve(packet, ipaddress)) {
delete packet;
return NSAPI_ERROR_DNS_FAILURE;
}

  • note that on public hosts everything works correctly.

@jenia81

@bridadan
Copy link
Contributor

bridadan commented Aug 4, 2016

cc @sarahmarshy @geky

@geky
Copy link
Contributor

geky commented Aug 4, 2016

Hi @adamelhakham, thanks for reporting this. This would be caused by not using DNS servers supplied by DHCP acknowledgement. This required a bit of tweaking internal to the network-socket API. I should be able to have a fix up soon.

@ciarmcom
Copy link
Member

ARM Internal Ref: IOTMORF-448

@sg-
Copy link
Contributor

sg- commented Aug 26, 2016

Should be fixed with #2497

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

No branches or pull requests

6 participants