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