[En-Nut-Discussion]Bug already resolved in... resolv.c

Zodianet zodianet at wanadoo.fr
Tue Mar 16 07:00:09 CET 2004


 
Current resolv.c of the 3.4.2 release (DNS resolution)has serious problems
to retrieve IP addr of some labels (upon the DNS answers, try for exemple
pop.mail.yahoo.fr) 

The solution given by Mikael Ejberg Pedersen in 2002 well works here since 2
months (no bad effects or DNS name resolution misses observed). 
I recommend it ;-) 
Jean Pierre

See:  
\en-nut-discussion\www.egnite.de\pipermail\en-nut-discussion\2002-November\0
00289.html :

On Sun, 24 Nov 2002 22:37:45 +0100, you wrote:

Well, I tried debugging a bit further, and found the problem myself.
The DNS returns more than one answer, so with a small extension of the
NutDnsGetHostByName function to allow it to decode multiple answers,
it now works :-)

I haven't checked if this has been corrected in the newer releases (I
use Ethernut version 2.5.2), but anyway, here is what I did...


I took this part of NutDnsGetHostByName:

            if(doh->doh_answers >= 1) {
                dor = CreateDnsResource(dor);
                len += DecodeDnsResource(dor, pkt + len);
#ifdef NUTDEBUG
                DumpDnsResource(dor);
#endif
                if(dor->dor_len == 4) {


And extended it into this:

            if(doh->doh_answers >= 1) {
                for(n = 1; n <= doh->doh_answers; n++) {
                    dor = CreateDnsResource(dor);
                    len += DecodeDnsResource(dor, pkt + len);
#ifdef NUTDEBUG
                    DumpDnsResource(dor);
#endif
                    if(dor->dor_type == 1)
                        break;
                }
                if(dor->dor_len == 4) {


Best regards,
Mikael

-- 
Mikael Ejberg Pedersen
http://www.ejberg.dk (Elektroniske dimser til modelflyvning)




More information about the En-Nut-Discussion mailing list