about summary refs log tree commit diff
path: root/resolv/res_send.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-03-12 11:40:47 +0100
committerFlorian Weimer <fweimer@redhat.com>2019-03-12 11:40:47 +0100
commit08504de71813ddbd447bfbca4a325cbe8ce8bcda (patch)
tree220785321a7949a077d9ea8c381eb810430ccb09 /resolv/res_send.c
parent5fbcd76351eeda3479175e2dce62b342f8964e86 (diff)
downloadglibc-08504de71813ddbd447bfbca4a325cbe8ce8bcda.tar.gz
glibc-08504de71813ddbd447bfbca4a325cbe8ce8bcda.tar.xz
glibc-08504de71813ddbd447bfbca4a325cbe8ce8bcda.zip
resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
The Linux kernel suppresses some ICMP error messages by default for
UDP sockets.  This commit enables full ICMP error reporting,
hopefully resulting in faster failover to working name servers.
Diffstat (limited to 'resolv/res_send.c')
-rw-r--r--resolv/res_send.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index fa040c1198..0f6ec83a7b 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -943,6 +943,18 @@ reopen (res_state statp, int *terrno, int ns)
 			return (-1);
 		}
 
+		/* Enable full ICMP error reporting for this
+		   socket.  */
+		if (__res_enable_icmp (nsap->sa_family,
+				       EXT (statp).nssocks[ns]) < 0)
+		  {
+		    int saved_errno = errno;
+		    __res_iclose (statp, false);
+		    __set_errno (saved_errno);
+		    *terrno = saved_errno;
+		    return -1;
+		  }
+
 		/*
 		 * On a 4.3BSD+ machine (client and server,
 		 * actually), sending to a nameserver datagram