tstellar / rpms / ntp

Forked from rpms/ntp 3 years ago
Clone
3eec3e7
diff -up ntp-4.2.6p5/ntpd/ntp_config.c.linklocal ntp-4.2.6p5/ntpd/ntp_config.c
3eec3e7
--- ntp-4.2.6p5/ntpd/ntp_config.c.linklocal	2016-04-06 13:58:34.659828825 +0200
3eec3e7
+++ ntp-4.2.6p5/ntpd/ntp_config.c	2016-04-06 13:58:39.287842559 +0200
3eec3e7
@@ -4378,16 +4378,6 @@ get_multiple_netnums(
3eec3e7
 			if (pch != NULL)
3eec3e7
 				*pch = '\0';
3eec3e7
 		}
3eec3e7
-		pch = strchr(lookup, '%');
3eec3e7
-		if (pch != NULL) {
3eec3e7
-			if (lookup != lookbuf) {
3eec3e7
-				lookup = lookbuf;
3eec3e7
-				strncpy(lookbuf, nameornum,
3eec3e7
-					sizeof(lookbuf));
3eec3e7
-				pch = strchr(lookup, '%');
3eec3e7
-			}
3eec3e7
-			*pch = '\0';
3eec3e7
-		}
3eec3e7
 	}
3eec3e7
 
3eec3e7
 	if (AF_INET6 == hints.ai_family && !ipv6_works)
3eec3e7
3eec3e7
commit 4a385df4917a49efb37d89276b42a3d962f3302a
3eec3e7
Author:  <stenn@psp-fb1.ntp.org>
3eec3e7
Date:   Sun Feb 9 08:09:56 2014 +0000
3eec3e7
3eec3e7
    [Bug 1186] ntpd fails with link local IPv6 addresses
3eec3e7
3eec3e7
diff -up ntp-4.2.6p5/ntpd/ntp_io.c.linklocal ntp-4.2.6p5/ntpd/ntp_io.c
3eec3e7
--- ntp-4.2.6p5/ntpd/ntp_io.c.linklocal	2016-04-06 13:58:27.916808820 +0200
3eec3e7
+++ ntp-4.2.6p5/ntpd/ntp_io.c	2016-04-06 13:58:27.943808900 +0200
3eec3e7
@@ -786,6 +786,9 @@ is_ip_address(
3eec3e7
 {
3eec3e7
 	struct in_addr in4;
3eec3e7
 	struct in6_addr in6;
3eec3e7
+	struct addrinfo hints;
3eec3e7
+	struct addrinfo *result;
3eec3e7
+	struct sockaddr_in6 *resaddr6;
3eec3e7
 	char tmpbuf[128];
3eec3e7
 	char *pch;
3eec3e7
 
3eec3e7
@@ -816,14 +819,16 @@ is_ip_address(
3eec3e7
 				*pch = '\0';
3eec3e7
 		} else
3eec3e7
 			strncpy(tmpbuf, host, sizeof(tmpbuf));
3eec3e7
-		pch = strchr(tmpbuf, '%');
3eec3e7
-		if (pch != NULL)
3eec3e7
-			*pch = '\0';
3eec3e7
-
3eec3e7
-		if (inet_pton(AF_INET6, tmpbuf, &in6) == 1) {
3eec3e7
+		ZERO(hints);
3eec3e7
+		hints.ai_family = AF_INET6;
3eec3e7
+		hints.ai_flags |= AI_NUMERICHOST;
3eec3e7
+		if (getaddrinfo(tmpbuf, NULL, &hints, &result) == 0) {
3eec3e7
 			AF(addr) = AF_INET6;
3eec3e7
-			SET_ADDR6N(addr, in6);
3eec3e7
+			resaddr6 = (struct sockaddr_in6 *)result->ai_addr;
3eec3e7
+			SET_ADDR6N(addr, resaddr6->sin6_addr);
3eec3e7
+			SET_SCOPE(addr, resaddr6->sin6_scope_id);
3eec3e7
 
3eec3e7
+			freeaddrinfo(result);
3eec3e7
 			return TRUE;
3eec3e7
 		}
3eec3e7
 	}