summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2005-04-30 21:38:51 +0200
committerMichael Brown2005-04-30 21:38:51 +0200
commit138c987738ef362b752769b7aff3bcbc62c737c0 (patch)
tree6fe4b6b20aca31f49067c32a2537072aab12819f /src
parentttl is a uint32_t (diff)
downloadipxe-138c987738ef362b752769b7aff3bcbc62c737c0.tar.gz
ipxe-138c987738ef362b752769b7aff3bcbc62c737c0.tar.xz
ipxe-138c987738ef362b752769b7aff3bcbc62c737c0.zip
Straightforward A record resolution now known working.
Diffstat (limited to 'src')
-rw-r--r--src/proto/dns.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/proto/dns.c b/src/proto/dns.c
index 86151732c..347df9cc8 100644
--- a/src/proto/dns.c
+++ b/src/proto/dns.c
@@ -147,7 +147,7 @@ static inline const char * dns_skip_name ( const char *name ) {
*/
static struct dns_rr_info * dns_find_rr ( struct dns_query *query,
struct dns_header *reply ) {
- int i;
+ int i, cmp;
const char *p = ( ( char * ) reply ) + sizeof ( struct dns_header );
/* Skip over the questions section */
@@ -157,10 +157,10 @@ static struct dns_rr_info * dns_find_rr ( struct dns_query *query,
/* Process the answers section */
for ( i = ntohs ( reply->ancount ) ; i > 0 ; i-- ) {
- if ( dns_name_cmp ( query->payload, p, reply ) == 0 ) {
- return ( ( struct dns_rr_info * ) p );
- }
+ cmp = dns_name_cmp ( query->payload, p, reply );
p = dns_skip_name ( p );
+ if ( cmp == 0 )
+ return ( ( struct dns_rr_info * ) p );
p += ( sizeof ( struct dns_rr_info ) +
ntohs ( ( ( struct dns_rr_info * ) p )->rdlength ) );
}