From: Andreas Schwab <schwab@redhat.com>
To: libc-hacker@sourceware.org
Subject: [PATCH] Fix debug statements in resolver
Date: Tue, 16 Mar 2010 15:26:00 -0000 [thread overview]
Message-ID: <m31vfk1e5j.fsf@hase.home> (raw)
* resolv/res_send.c (__libc_res_nsend): Fix printing of server
address in debug statement.
(send_dg): Pass correct buffer pointer to DprintQ.
---
resolv/res_send.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index b0966ae..845b658 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;
--
1.7.0.1
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
reply other threads:[~2010-03-16 15:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m31vfk1e5j.fsf@hase.home \
--to=schwab@redhat.com \
--cc=libc-hacker@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).