Adam Tkac 61b073
--- dighost.c.orig	2011-03-11 07:46:58.000000000 +0100
Adam Tkac 61b073
+++ dighost.c	2011-10-28 14:31:29.806591603 +0200
Adam Tkac 61b073
@@ -2619,8 +2619,13 @@ connect_timeout(isc_task_t *task, isc_ev
Adam Tkac 61b073
 		}
Adam Tkac 61b073
 	} else {
Adam Tkac 61b073
 		fputs(l->cmdline, stdout);
Adam Tkac 61b073
-		printf(";; connection timed out; no servers could be "
Adam Tkac 61b073
-		       "reached\n");
Adam Tkac 61b073
+		if (!next_origin(NULL, query)) {
Adam Tkac 61b073
+			printf(";; connection timed out; no servers could be "
Adam Tkac 61b073
+			       "reached\n");
Adam Tkac 61b073
+		} else {
Adam Tkac 61b073
+			printf(";; connection timed out; trying next "
Adam Tkac 61b073
+			       "origin\n");
Adam Tkac 61b073
+		}
Adam Tkac 61b073
 		cancel_lookup(l);
Adam Tkac 61b073
 		check_next_lookup(l);
Adam Tkac 61b073
 		if (exitcode < 9)
Adam Tkac 61b073
@@ -3270,7 +3275,8 @@ recv_done(isc_task_t *task, isc_event_t 
Adam Tkac 61b073
 		return;
Adam Tkac 61b073
 	}
Adam Tkac 61b073
 	if ((msg->rcode == dns_rcode_servfail && !l->servfail_stops) ||
Adam Tkac 61b073
-	    (check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 && l->recurse))
Adam Tkac 61b073
+	    (check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 &&
Adam Tkac 61b073
+	     msg->rcode != dns_rcode_noerror && l->recurse))
Adam Tkac 61b073
 	{
Adam Tkac 61b073
 		dig_query_t *next = ISC_LIST_NEXT(query, link);
Adam Tkac 61b073
 		if (l->current_query == query)