From 2bbb7d5b3c517956e95e5827037a76cbc39a20c8 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 9 Feb 2007 23:46:29 +0000 Subject: * 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. --- resolv/res_send.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'resolv/res_send.c') 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)) { -- cgit 1.4.1