about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-03-17 06:57:38 -0700
committerUlrich Drepper <drepper@redhat.com>2010-03-17 06:57:38 -0700
commit94308fd0e071018cd823b654276acc103c8b509c (patch)
tree2fa90a3dd299e0934930a712fac793a6164103cb
parent12e6ee86c4f2b17a0f702a46b782447389d4bd82 (diff)
downloadglibc-94308fd0e071018cd823b654276acc103c8b509c.tar.gz
glibc-94308fd0e071018cd823b654276acc103c8b509c.tar.xz
glibc-94308fd0e071018cd823b654276acc103c8b509c.zip
Fix debug statements in resolver
-rw-r--r--ChangeLog6
-rw-r--r--resolv/res_send.c17
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 4272925552..462cd397fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-16  Andreas Schwab  <schwab@redhat.com>
+
+	* resolv/res_send.c (__libc_res_nsend): Fix printing of server
+	address in debug statement.
+	(send_dg): Pass correct buffer pointer to DprintQ.
+
 2010-03-17  Ulrich Drepper  <drepper@redhat.com>
 
 	* libc-abis: Add a few more entries.
diff --git a/resolv/res_send.c b/resolv/res_send.c
index b0966ae036..845b658e36 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -535,7 +535,10 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 
 		Dprint(statp->options & RES_DEBUG,
 		       (stdout, ";; Querying server (# %d) address = %s\n",
-			ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
+			ns + 1, inet_ntop(nsap->sin6_family,
+					  (nsap->sin6_family == AF_INET6
+					   ? &nsap->sin6_addr
+					   : &((struct sockaddr_in *) nsap)->sin_addr),
 					  tmpbuf, sizeof (tmpbuf))));
 
 		if (__builtin_expect (v_circuit, 0)) {
@@ -1201,7 +1204,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; old answer:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1216,7 +1219,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; not our server:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1233,7 +1236,7 @@ send_dg(res_state statp,
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout,
 				 "server rejected query with EDNS0:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			/* record the error */
@@ -1258,7 +1261,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; wrong query name:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1268,7 +1271,7 @@ send_dg(res_state statp,
 		    anhp->rcode == REFUSED) {
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout, "server rejected query:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 
@@ -1295,7 +1298,7 @@ send_dg(res_state statp,
 		    && anhp->aa == 0 && anhp->ra == 0 && anhp->arcount == 0) {
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout, "referred query:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto next_ns;