|
@@ -550,6 +550,9 @@ static int dns_question ( struct dns_request *dns ) {
|
550
|
550
|
/* Restore name */
|
551
|
551
|
dns->name.offset = offsetof ( typeof ( dns->buf ), name );
|
552
|
552
|
|
|
553
|
+ DBGC2 ( dns, "DNS %p question is %s type %s\n", dns,
|
|
554
|
+ dns_name ( &dns->name ), dns_type ( dns->question->qtype ) );
|
|
555
|
+
|
553
|
556
|
return 0;
|
554
|
557
|
}
|
555
|
558
|
|
|
@@ -614,6 +617,7 @@ static int dns_xfer_deliver ( struct dns_request *dns,
|
614
|
617
|
size_t answer_offset;
|
615
|
618
|
size_t next_offset;
|
616
|
619
|
size_t rdlength;
|
|
620
|
+ size_t name_len;
|
617
|
621
|
int rc;
|
618
|
622
|
|
619
|
623
|
/* Sanity check */
|
|
@@ -691,8 +695,12 @@ static int dns_xfer_deliver ( struct dns_request *dns,
|
691
|
695
|
}
|
692
|
696
|
|
693
|
697
|
/* Skip non-matching names */
|
694
|
|
- if ( dns_compare ( &buf, &dns->name ) != 0 )
|
|
698
|
+ if ( dns_compare ( &buf, &dns->name ) != 0 ) {
|
|
699
|
+ DBGC2 ( dns, "DNS %p ignoring response for %s type "
|
|
700
|
+ "%s\n", dns, dns_name ( &buf ),
|
|
701
|
+ dns_type ( rr->common.type ) );
|
695
|
702
|
continue;
|
|
703
|
+ }
|
696
|
704
|
|
697
|
705
|
/* Handle answer */
|
698
|
706
|
switch ( rr->common.type ) {
|
|
@@ -745,7 +753,9 @@ static int dns_xfer_deliver ( struct dns_request *dns,
|
745
|
753
|
DBGC ( dns, "DNS %p found CNAME %s\n",
|
746
|
754
|
dns, dns_name ( &buf ) );
|
747
|
755
|
dns->search.offset = dns->search.len;
|
748
|
|
- dns_copy ( &buf, &dns->name );
|
|
756
|
+ name_len = dns_copy ( &buf, &dns->name );
|
|
757
|
+ dns->offset = ( offsetof ( typeof ( dns->buf ), name ) +
|
|
758
|
+ name_len - 1 /* Strip root label */ );
|
749
|
759
|
if ( ( rc = dns_question ( dns ) ) != 0 ) {
|
750
|
760
|
dns_done ( dns, rc );
|
751
|
761
|
goto done;
|