aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-07 01:11:18 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-07 01:11:18 +0100
commite66a09ba9c167b210694cf940648757868a3f994 (patch)
tree64692370ab58d34d61434a48750c80cfd073f438
parentb55d652400ced8184740e15973f9831cd2afc19d (diff)
downloadbusybox-w32-e66a09ba9c167b210694cf940648757868a3f994.tar.gz
busybox-w32-e66a09ba9c167b210694cf940648757868a3f994.tar.bz2
busybox-w32-e66a09ba9c167b210694cf940648757868a3f994.zip
dnsd: add more -v messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/dnsd.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index 91d66edcc..42deb1f35 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -388,24 +388,32 @@ static int process_packet(struct dns_entry *conf_data,
388 388
389 move_from_unaligned16(type, &unaligned_type_class->type); 389 move_from_unaligned16(type, &unaligned_type_class->type);
390 if (type != htons(REQ_A) && type != htons(REQ_PTR)) { 390 if (type != htons(REQ_A) && type != htons(REQ_PTR)) {
391 /* we can't handle the query type */ 391 /* we can't handle this query type */
392//TODO: handle REQ_AAAA (0x1c) requests
393 bb_error_msg("type %u is !REQ_A and !REQ_PTR%s",
394 (int)ntohs(type),
395 ", returning Not Implemented reply");
392 goto empty_packet; 396 goto empty_packet;
393 } 397 }
394 move_from_unaligned16(class, &unaligned_type_class->class); 398 move_from_unaligned16(class, &unaligned_type_class->class);
395 if (class != htons(1)) { /* not class INET? */ 399 if (class != htons(1)) { /* not class INET? */
400 bb_error_msg("class != 1%s",
401 ", returning Not Implemented reply");
396 goto empty_packet; 402 goto empty_packet;
397 } 403 }
398 /* OPCODE != 0 "standard query" ? */ 404 /* OPCODE != 0 "standard query" ? */
399 if ((head->flags & htons(0x7800)) != 0) { 405 if ((head->flags & htons(0x7800)) != 0) {
406 bb_error_msg("opcode != 0%s",
407 ", returning Not Implemented reply");
400 goto empty_packet; 408 goto empty_packet;
401 } 409 }
402 410
403 /* look up the name */ 411 /* look up the name */
412 answstr = table_lookup(conf_data, type, query_string);
404#if DEBUG 413#if DEBUG
405 /* need to convert lengths to dots before we can use it in non-debug */ 414 /* Shows lengths instead of dots, unusable for !DEBUG */
406 bb_info_msg("%s", query_string); 415 bb_error_msg("'%s'->'%s'", query_string, answstr);
407#endif 416#endif
408 answstr = table_lookup(conf_data, type, query_string);
409 outr_rlen = 4; 417 outr_rlen = 4;
410 if (answstr && type == htons(REQ_PTR)) { 418 if (answstr && type == htons(REQ_PTR)) {
411 /* returning a host name */ 419 /* returning a host name */
@@ -417,6 +425,8 @@ static int process_packet(struct dns_entry *conf_data,
417 /* QR = 1 "response" 425 /* QR = 1 "response"
418 * AA = 1 "Authoritative Answer" 426 * AA = 1 "Authoritative Answer"
419 * RCODE = 3 "Name Error" */ 427 * RCODE = 3 "Name Error" */
428 if (OPT_verbose)
429 bb_error_msg("returning Name Error reply");
420 outr_flags = htons(0x8000 | 0x0400 | 3); 430 outr_flags = htons(0x8000 | 0x0400 | 3);
421 goto empty_packet; 431 goto empty_packet;
422 } 432 }
@@ -438,6 +448,8 @@ static int process_packet(struct dns_entry *conf_data,
438 * "** server can't find HOSTNAME" 448 * "** server can't find HOSTNAME"
439 * RCODE = 0 "success" 449 * RCODE = 0 "success"
440 */ 450 */
451 if (OPT_verbose)
452 bb_error_msg("returning positive reply");
441 outr_flags = htons(0x8000 | 0x0400 | 0); 453 outr_flags = htons(0x8000 | 0x0400 | 0);
442 /* we have one answer */ 454 /* we have one answer */
443 head->nansw = htons(1); 455 head->nansw = htons(1);
@@ -492,7 +504,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
492 504
493 { 505 {
494 char *p = xmalloc_sockaddr2dotted(&lsa->u.sa); 506 char *p = xmalloc_sockaddr2dotted(&lsa->u.sa);
495 bb_info_msg("Accepting UDP packets on %s", p); 507 bb_error_msg("accepting UDP packets on %s", p);
496 free(p); 508 free(p);
497 } 509 }
498 510
@@ -510,7 +522,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
510 continue; 522 continue;
511 } 523 }
512 if (OPT_verbose) 524 if (OPT_verbose)
513 bb_info_msg("Got UDP packet"); 525 bb_error_msg("got UDP packet");
514 buf[r] = '\0'; /* paranoia */ 526 buf[r] = '\0'; /* paranoia */
515 r = process_packet(conf_data, conf_ttl, buf); 527 r = process_packet(conf_data, conf_ttl, buf);
516 if (r <= 0) 528 if (r <= 0)