This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
-static short id = 0; +static unsigned short id = 0;
dns_hdr = (struct dns_header *) &msg_buf[0]; + req_id = ((struct dns_header *)msg)->id; do { /* Send a request to each configured DNS server */
if (dns_hdr->id != req_id) { continue; }
Hi,
There is a rollover bug in the current CVS copy of dns.c. Around line 237 there is the following code: /* Reply to an old query. Ignore it */ if (ntohs(dns_hdr->id) != (id-1)) {
If dns_hdr->id == 5 and id == 6, then the 'if' condition is false as expected.
If dns_hdr->id == 0xFFFF and id == 0, then the 'if' condition is incorrectly true.
The simple patch below fixes the issue: --- dns_old.c 2009-10-01 16:01:41.000000000 -0700 +++ dns.c 2009-10-01 16:01:45.000000000 -0700 @@ -234,7 +234,7 @@ }
/* Reply to an old query. Ignore it */ - if (ntohs(dns_hdr->id) != (id-1)) { + if (ntohs(dns_hdr->id) != (cyg_uint16)(id-1)) { continue; } finished = true;
Cheers, Will
-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |