This patch fixes a regression [1] introduced in ntpd 4.2.8p18 [2]. ntpd[200]: Listen normally on 3 lo [::1]:123 ntpd[200]: bind(20) AF_INET6 [fe80::bf3d:254d:dee0:d345%3]:123 flags 0x811 failed: Cannot assign requested address ntpd[200]: unable to create socket on enp0s3 (4) for [fe80::bf3d:254d:dee0:d345%3]:123 ntpd[192]: daemon control: got EOF ntpd[192]: daemon child died with signal 11 systemd[1]: ntpd.service: Control process exited, code=exited, status=70/SOFTWARE systemd[1]: ntpd.service: Failed with result 'exit-code'. systemd[1]: Failed to start Network Time Service. If the IPv6 link-local interface was not ready for binding on the first attempt, ntpd would segfault in update_interfaces(). The segfault would only occur when ntpd was started as part of the boot sequence. Most - but not all - boots were affected. Evidently it could happen that the timing of ntpd's start up was delayed enough that the IPv6 link-local interface was ready for the bind() call when it was first issued by open_socket() via create_interface(). [1]: https://bugs.ntp.org/show_bug.cgi?id=3928 [2]: https://bugs.ntp.org/show_bug.cgi?id=3913 Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> Cc: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit 489e38fd2c16f9de2a187a4774df29f8c929bc30) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
39 lines
1007 B
Diff
39 lines
1007 B
Diff
Fix crash when binding IPv6 address
|
|
|
|
Reference:
|
|
https://bugs.ntp.org/show_bug.cgi?id=3928
|
|
|
|
Upstream: https://people.nwtime.org/hart/ntp-stable-3928-29.tar.gz
|
|
|
|
Ported fix from updated tarball provided by upstream:
|
|
https://bugs.ntp.org/show_bug.cgi?id=3928#c14
|
|
|
|
Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
|
|
---
|
|
ntpd/ntp_io.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
Index: ntp-4.2.8p18/ntpd/ntp_io.c
|
|
===================================================================
|
|
--- ntp-4.2.8p18.orig/ntpd/ntp_io.c
|
|
+++ ntp-4.2.8p18/ntpd/ntp_io.c
|
|
@@ -1917,15 +1917,15 @@ update_interfaces(
|
|
}
|
|
new_interface_found = TRUE;
|
|
DPRINT_INTERFACE(3,
|
|
- (ep, "updating ", " new - created\n"));
|
|
+ (ep2, "updating ", " new - created\n"));
|
|
}
|
|
else {
|
|
DPRINT_INTERFACE(3,
|
|
- (ep, "updating ", " new - FAILED"));
|
|
+ (ep2, "updating ", " new - FAILED"));
|
|
|
|
msyslog(LOG_ERR,
|
|
"cannot bind address %s",
|
|
- stoa(&ep->sin));
|
|
+ stoa(&ep2->sin));
|
|
}
|
|
free(ep2);
|
|
}
|