18287627 ntpd sometimes logs unexpected getifaddrs errors s11u2-sru
authorBrian Utterback <brian.utterback@oracle.com>
Tue, 15 Jul 2014 07:20:42 -0700
branchs11u2-sru
changeset 3221 e863b2da18cb
parent 3220 6677a3ca6750
child 3222 e94472bb9273
18287627 ntpd sometimes logs unexpected getifaddrs errors
components/ntp/patches/85-getif-eintr.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ntp/patches/85-getif-eintr.patch	Tue Jul 15 07:20:42 2014 -0700
@@ -0,0 +1,47 @@
+If getifaddrs blocks on a lock and a SIGALRM happens to fire while it
+is block, it will return with EINTR. WE need to detect that and just
+try again.
+
+This is NTP bug 2565. Remove this patch when upgrading to a version that
+has bug 2565 fixed in it.
+
+--- lib/isc/unix/ifiter_getifaddrs.c
++++ lib/isc/unix/ifiter_getifaddrs.c
[email protected]@ -55,6 +55,8 @@ isc_interfaceiter_create(isc_mem_t *mctx
+ 	isc_interfaceiter_t *iter;
+ 	isc_result_t result;
+ 	char strbuf[ISC_STRERRORSIZE];
++	int trys;
++	int ret;
+ 
+ 	REQUIRE(mctx != NULL);
+ 	REQUIRE(iterp != NULL);
[email protected]@ -86,15 +88,21 @@ isc_interfaceiter_create(isc_mem_t *mctx
+ 	iter->valid = ISC_R_FAILURE;
+ #endif
+ 
+-	if (getifaddrs(&iter->ifaddrs) < 0) {
++	for (trys = 0; trys < 3; trys++) {
++		if ((ret = getifaddrs(&iter->ifaddrs)) >= 0)
++			break;
++		if (errno != EINTR) 
++			break;
++	}
++	if (ret < 0) {
+ 		isc__strerror(errno, strbuf, sizeof(strbuf));
+ 		UNEXPECTED_ERROR(__FILE__, __LINE__,
+-				 isc_msgcat_get(isc_msgcat,
+-						ISC_MSGSET_IFITERGETIFADDRS,
+-						ISC_MSG_GETIFADDRS,
+-						"getting interface "
+-						"addresses: getifaddrs: %s"),
+-				 strbuf);
++		    isc_msgcat_get(isc_msgcat,
++		    ISC_MSGSET_IFITERGETIFADDRS,
++		    ISC_MSG_GETIFADDRS,
++		    "getting interface "
++		    "addresses: getifaddrs: %s"),
++		    strbuf);
+ 		result = ISC_R_UNEXPECTED;
+ 		goto failure;
+ 	}