Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > cd0f440b578c03b7706d19492362a305 > files > 60

ntp-4.2.6p5-24.7.mga5.src.rpm

diff -up ntp-4.2.6p5/ntpd/ntp_config.c.linklocal ntp-4.2.6p5/ntpd/ntp_config.c
--- ntp-4.2.6p5/ntpd/ntp_config.c.linklocal	2016-04-06 13:58:34.659828825 +0200
+++ ntp-4.2.6p5/ntpd/ntp_config.c	2016-04-06 13:58:39.287842559 +0200
@@ -4378,16 +4378,6 @@ get_multiple_netnums(
 			if (pch != NULL)
 				*pch = '\0';
 		}
-		pch = strchr(lookup, '%');
-		if (pch != NULL) {
-			if (lookup != lookbuf) {
-				lookup = lookbuf;
-				strncpy(lookbuf, nameornum,
-					sizeof(lookbuf));
-				pch = strchr(lookup, '%');
-			}
-			*pch = '\0';
-		}
 	}
 
 	if (AF_INET6 == hints.ai_family && !ipv6_works)

commit 4a385df4917a49efb37d89276b42a3d962f3302a
Author:  <stenn@psp-fb1.ntp.org>
Date:   Sun Feb 9 08:09:56 2014 +0000

    [Bug 1186] ntpd fails with link local IPv6 addresses

diff -up ntp-4.2.6p5/ntpd/ntp_io.c.linklocal ntp-4.2.6p5/ntpd/ntp_io.c
--- ntp-4.2.6p5/ntpd/ntp_io.c.linklocal	2016-04-06 13:58:27.916808820 +0200
+++ ntp-4.2.6p5/ntpd/ntp_io.c	2016-04-06 13:58:27.943808900 +0200
@@ -786,6 +786,9 @@ is_ip_address(
 {
 	struct in_addr in4;
 	struct in6_addr in6;
+	struct addrinfo hints;
+	struct addrinfo *result;
+	struct sockaddr_in6 *resaddr6;
 	char tmpbuf[128];
 	char *pch;
 
@@ -816,14 +819,16 @@ is_ip_address(
 				*pch = '\0';
 		} else
 			strncpy(tmpbuf, host, sizeof(tmpbuf));
-		pch = strchr(tmpbuf, '%');
-		if (pch != NULL)
-			*pch = '\0';
-
-		if (inet_pton(AF_INET6, tmpbuf, &in6) == 1) {
+		ZERO(hints);
+		hints.ai_family = AF_INET6;
+		hints.ai_flags |= AI_NUMERICHOST;
+		if (getaddrinfo(tmpbuf, NULL, &hints, &result) == 0) {
 			AF(addr) = AF_INET6;
-			SET_ADDR6N(addr, in6);
+			resaddr6 = (struct sockaddr_in6 *)result->ai_addr;
+			SET_ADDR6N(addr, resaddr6->sin6_addr);
+			SET_SCOPE(addr, resaddr6->sin6_scope_id);
 
+			freeaddrinfo(result);
 			return TRUE;
 		}
 	}