|
@@ -145,8 +145,8 @@ static inline const char * dns_skip_name ( const char *name ) {
|
145
|
145
|
* query. Returns a pointer to the RR, or NULL if no answer found.
|
146
|
146
|
*
|
147
|
147
|
*/
|
148
|
|
-static struct dns_rr_info * dns_find_rr ( struct dns_query *query,
|
149
|
|
- struct dns_header *reply ) {
|
|
148
|
+struct dns_rr_info * dns_find_rr ( struct dns_query *query,
|
|
149
|
+ struct dns_header *reply ) {
|
150
|
150
|
int i, cmp;
|
151
|
151
|
const char *p = ( ( char * ) reply ) + sizeof ( struct dns_header );
|
152
|
152
|
|
|
@@ -192,6 +192,23 @@ static inline char * dns_make_name ( char *dest, const char *name ) {
|
192
|
192
|
return dest;
|
193
|
193
|
}
|
194
|
194
|
|
|
195
|
+/*
|
|
196
|
+ * Produce a printable version of a DNS name. Used only for debugging.
|
|
197
|
+ *
|
|
198
|
+ */
|
|
199
|
+static inline char * dns_unmake_name ( char *name ) {
|
|
200
|
+ char *p;
|
|
201
|
+ unsigned int len;
|
|
202
|
+
|
|
203
|
+ p = name;
|
|
204
|
+ while ( ( len = *p ) ) {
|
|
205
|
+ *(p++) = '.';
|
|
206
|
+ p += len;
|
|
207
|
+ }
|
|
208
|
+
|
|
209
|
+ return name + 1;
|
|
210
|
+}
|
|
211
|
+
|
195
|
212
|
/*
|
196
|
213
|
* Decompress a DNS name.
|
197
|
214
|
*
|
|
@@ -281,10 +298,15 @@ static int dns_resolv ( struct in_addr *addr, const char *name ) {
|
281
|
298
|
( struct dns_rr_info_cname * ) rr_info;
|
282
|
299
|
char *cname = rr_info_cname->cname;
|
283
|
300
|
|
284
|
|
- DBG ( "DNS found CNAME\n" );
|
285
|
301
|
query_info = ( void * )
|
286
|
302
|
dns_decompress_name ( query.payload,
|
287
|
303
|
cname, reply );
|
|
304
|
+ DBG ( "DNS found CNAME %s\n",
|
|
305
|
+ dns_unmake_name ( query.payload ) );
|
|
306
|
+ DBG ( "", /* Reconstruct name */
|
|
307
|
+ dns_make_name ( query.payload,
|
|
308
|
+ query.payload + 1 ) );
|
|
309
|
+
|
288
|
310
|
query_info->qtype = htons ( DNS_TYPE_A );
|
289
|
311
|
query_info->qclass = htons ( DNS_CLASS_IN );
|
290
|
312
|
|