summary refs log tree commit diff
path: root/resolv/res_send.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-02-09 23:46:29 +0000
committerUlrich Drepper <drepper@redhat.com>2007-02-09 23:46:29 +0000
commit2bbb7d5b3c517956e95e5827037a76cbc39a20c8 (patch)
treee5d2f14edf74a9e9992ebe907e5feffd9dca7c7e /resolv/res_send.c
parent00458b5bee15b31f90bca83c79f29e168f04ecc8 (diff)
downloadglibc-2bbb7d5b3c517956e95e5827037a76cbc39a20c8.tar.gz
glibc-2bbb7d5b3c517956e95e5827037a76cbc39a20c8.tar.xz
glibc-2bbb7d5b3c517956e95e5827037a76cbc39a20c8.zip
* resolv/res_init.c (res_setoptions): Recognize edns0 option.
	* resolv/res_mkquery.c: Define __res_nopt.
	* resolv/res_query.c (__libc_res_nquery): If RES_USE_EDNS0 is set
	try adding EDNS0 record.
	* resolv/res_send.c (send_dg): If request failed with FORMERR and
	EDNS0 record was send make sure we don't try it again.
	* resolv/resolv.h: Define RES_F_EDNS0ERR and RES_USE_EDNS0.
	* include/resolv.h: Declare __res_nopt.
Diffstat (limited to 'resolv/res_send.c')
-rw-r--r--resolv/res_send.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 887d048e19..f38c399ffd 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -986,6 +986,24 @@ send_dg(res_state statp,
 				ans, (resplen > anssiz) ? anssiz : resplen);
 			goto wait;
 		}
+#ifdef RES_USE_EDNS0
+		if (anhp->rcode == FORMERR
+		    && (statp->options & RES_USE_EDNS0) != 0U) {
+			/*
+			 * Do not retry if the server do not understand
+			 * EDNS0.  The case has to be captured here, as
+			 * FORMERR packet do not carry query section, hence
+			 * res_queriesmatch() returns 0.
+			 */
+			DprintQ(statp->options & RES_DEBUG,
+				(stdout,
+				 "server rejected query with EDNS0:\n"),
+				ans, (resplen > anssiz) ? anssiz : resplen);
+			/* record the error */
+			statp->_flags |= RES_F_EDNS0ERR;
+			goto err_out;
+        }
+#endif
 		if (!(statp->options & RES_INSECURE2) &&
 		    !res_queriesmatch(buf, buf + buflen,
 				      ans, ans + anssiz)) {