Преглед изворни кода

Straightforward A record resolution now known working.

tags/v0.9.3
Michael Brown пре 20 година
родитељ
комит
138c987738
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4
    4
      src/proto/dns.c

+ 4
- 4
src/proto/dns.c Прегледај датотеку

@@ -147,7 +147,7 @@ static inline const char * dns_skip_name ( const char *name ) {
147 147
  */
148 148
 static struct dns_rr_info * dns_find_rr ( struct dns_query *query,
149 149
 					  struct dns_header *reply ) {
150
-	int i;
150
+	int i, cmp;
151 151
 	const char *p = ( ( char * ) reply ) + sizeof ( struct dns_header );
152 152
 
153 153
 	/* Skip over the questions section */
@@ -157,10 +157,10 @@ static struct dns_rr_info * dns_find_rr ( struct dns_query *query,
157 157
 
158 158
 	/* Process the answers section */
159 159
 	for ( i = ntohs ( reply->ancount ) ; i > 0 ; i-- ) {
160
-		if ( dns_name_cmp ( query->payload, p, reply ) == 0 ) {
161
-			return ( ( struct dns_rr_info * ) p );
162
-		}
160
+		cmp = dns_name_cmp ( query->payload, p, reply );
163 161
 		p = dns_skip_name ( p );
162
+		if ( cmp == 0 )
163
+			return ( ( struct dns_rr_info * ) p );
164 164
 		p += ( sizeof ( struct dns_rr_info ) +
165 165
 		       ntohs ( ( ( struct dns_rr_info * ) p )->rdlength ) );
166 166
 	}

Loading…
Откажи
Сачувај