WIZnet Developer Forum

DNS example?

Hi

I’m just wondering if there was anywhere I could get an example program using the DNS using the W5500? I’m not worries which processor it is for, just something I can use as a reference. I know there is one using the DHCP, but that one doesn’t use the DNS.

Thanks
Wizneter

Hi,
into ioLibrary_BSD library here https://github.com/Wiznet/ioLibrary_Driver
References http://wizwiki.net/wiki/doku.php?id=products:w5500:driver
folder ioLibrary_Driver / Internet / DNS

Hi Coccoliso

Thank you, and thank you again for your help in the last thread. I have now got DNS up and running. I am noticing however that there seems to be some bugs in it. Perhaps I’ve done something wrong. Here are some website’s I’ve tried.

www.google.com” // Works and gets correct values - is default example
"www.xe.com" // Crashes my whole program, cause unknown.
www.news.com.au” // Fails, only get “0,0,0,0” in my IP address
"www.bbc.com" // Works and gets correct value
"www.facebook.com" // Works and gets correct value
"www.facebook.com.au" // Works and gets correct value
"www.di.fm" // Works and gets correct value
"www.honda-engines-eu.com" // Fails, only get “0,0,0,0” in my IP address

All sites work with command prompt. The PC used to with command prompt is on the same network. Results are repeatable. I’m afraid that about half of the sites I need to do a DNS on don’t work.

I have tried increasing “DNS_WAIT_TIME” and “MAX_DNS_RETRY”, but this had no effect.

Thanks again
Wizneter

Hi,
clearly it depends greatly on the geographic area.
Did you try tracert to view jumps that are made in the case of those not working address?
I noticed, for example, www.xe.com loops are fast but like I said it depends on your location.
Would seem that more the node is quick to respond and greater is the probability of not resolve the address.
Some time ago I remember a problem on the DNS in case of multiple addresses endpoint (for example google in my area responds on three possible addresses based on traffic node).
Unfortunately I can not help more because I cannot do test in this regard.

Hi Coccoliso

Thank you again. I did not try that and can do. To be candid I simply tested the code and found it to be buggy, so after repeatedly checking I posted and moved onto another aspect of my project.

Though I did notice the multiple address aspect you mention with google.com. This did not seem to cause an issue and some sites, with a single fixed IP address didn’t work. I did not think of the timing aspect.

Am I correct in understanding that its not possible for you to test? If it is then I’m sure you can find an address that doesn’t work for you but does with command promt. I found about 50% of sites don’t work correctly.

If so, what should be my next step to sort this? I’m already in contact with Wiznet, but for technical matters they suggest I use these forums.

Thanks again
Wizneter

Hi Coccoliso

I’ve done some debugging on the Wiznet Stack and discovered the main issue. The function “dns_answer” in parseDNSMSG is not correctly handing parsing the IP address in all situations. On a separate issue, I think the function “parseDNSMSG” is causing the crashing to to a pointer issue. I believe this may be caused by the fact that the returned web address is longer than the web address requested. It may though be related to the fact that there’s a porting issue between 8 and the 32 bit processor I’m using. I’ve not dug too deep.

I’ve wrote some new functions that appear to fix all the bugs and issues, using Wireshark as my guide. They have only been tested with a “Type A” response, though that is of course the only one I am requesting. All the website I now try work correctly. Can you think of any reason the below function won’t work correctly in all situations? (Please note I’ve added the “len” parameter on “parseDNSMSG”)

ret = parseDNSMSG(&dhp, pDNSMSG, ip_from_dns, len);

int8_t parseDNSMSG(struct dhdr * pdhdr, uint8_t * pbuf, uint8_t * ip_from_dns, uint8_t len)
{

ip_from_dns[0] = pbuf[len-4];
ip_from_dns[1] = pbuf[len-3];
ip_from_dns[2] = pbuf[len-2];
ip_from_dns[3] = pbuf[len-1];

}

Kind regards
Wizneter

Hi

Just bumping this. I might have uncovered some important bugs in the DNS. I hope these can be either confirmed, or not. If they are real issues, I hope they can be fixed for everyone.

Kind regards
Wizneter

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.