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 = pbuf[len-4];
ip_from_dns = pbuf[len-3];
ip_from_dns = pbuf[len-2];
ip_from_dns = pbuf[len-1];