Description of Contribution: The DHCP responce may contain the address of the DNS server and the domain. When using DHCP this contribution adds extra code to extract this information from the reply and use it to initialise the DNS resolver. It also contains a few minor bug fixes. Note: It needs more testing. I've tested the basic functionality, but i don't have control over the DHCP server. So i've not tested what happens when the lease expires, or when the server does not give back the information needed. I've also not tested to see if i've broken redboots use of DNS. Also, this fix has the same buffer overrun problem as reported in one of the other bugzilla bugs i've reported today. So, you probably want Hugo and Gary to have a look at it. Version-Release number of selected component (if applicable): 1.5.2-final.
Created attachment 39407 [details] Context diff patch.
Duh! Remove the line index = cyg_thread_new_data_index(); at the end of cyg_dns_res_init() in dns.h!
I'll have a look at this unless Gary/Hugo want to?
I have committed this change to the trunk; a few extra diddles were needed to make it work OK. Though not having a DNS server, I didn't test it *with* server, just going through the new initialization from DHCP. Specifically, I had to release the per-thread-data index when re-starting, and check for many NULL name pointers and return NULL *before* the assertion check for valid pointer, so that the init to NULL works OK.