summaryrefslogtreecommitdiff
path: root/usr/src/lib/libresolv2/common/resolv/res_send.c
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2014-06-05 14:30:31 -0400
committerGordon Ross <gwr@nexenta.com>2015-10-26 10:17:47 -0400
commitb3700b074e637f8c6991b70754c88a2cfffb246b (patch)
treec979fb7c426aec884413fae889fab8356ca9ef17 /usr/src/lib/libresolv2/common/resolv/res_send.c
parented81dd52230eff1a7c7625caad21af232c36f6cb (diff)
downloadillumos-gate-b3700b074e637f8c6991b70754c88a2cfffb246b.tar.gz
6352 Updated DC locator for SMB and idmap
Portions contributed by: Matt Barden <Matt.Barden@nexenta.com> Portions contributed by: Kevin Crowe <kevin.crowe@nexenta.com> Portions contributed by: Alek Pinchuk <alek@nexenta.com> Reviewed by: Bayard Bell <bayard.bell@nexenta.com> Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com> Reviewed by: Rick McNeal <rick.mcneal@nexenta.com> Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com> Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libresolv2/common/resolv/res_send.c')
-rw-r--r--usr/src/lib/libresolv2/common/resolv/res_send.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/usr/src/lib/libresolv2/common/resolv/res_send.c b/usr/src/lib/libresolv2/common/resolv/res_send.c
index 8e629a3d96..a043cf2624 100644
--- a/usr/src/lib/libresolv2/common/resolv/res_send.c
+++ b/usr/src/lib/libresolv2/common/resolv/res_send.c
@@ -1,6 +1,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
@@ -94,6 +96,7 @@ static const char rcsid[] = "$Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp
#include <sys/uio.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
@@ -672,6 +675,29 @@ send_vc(res_state statp,
(void)setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,
sizeof(on));
#endif
+#ifdef TCP_CONN_ABORT_THRESHOLD
+ /*
+ * The default connection timeout is over two minutes.
+ * We need something more reasonable here. The default
+ * retrans value is 5 sec., then 10, 20, 40, on retries.
+ * TCP connect does its own retries, so we want just one
+ * reasonable timeout value. Using 2X retrans, which
+ * gives us a 10 sec. connect timeout. If we're waiting
+ * that long to connect, we probably want to give up and
+ * try the next DNS server in our list.
+ *
+ * It might be reasonable to do this for all callers,
+ * but for now do it only when we see MS_INTEROP in the
+ * environment (set in smbd and idmapd)
+ */
+ if (getenv("MS_INTEROP") != NULL) {
+ int conn_tmo;
+ conn_tmo = statp->retrans * 2000; /* mSec */
+ (void)setsockopt(statp->_vcsock, IPPROTO_TCP,
+ TCP_CONN_ABORT_THRESHOLD, &conn_tmo,
+ sizeof(conn_tmo));
+ }
+#endif
errno = 0;
if (connect(statp->_vcsock, nsap, nsaplen) < 0) {
*terrno = errno;