From 489e38fd2c16f9de2a187a4774df29f8c929bc30 Mon Sep 17 00:00:00 2001 From: TIAN Yuanhao Date: Wed, 4 Sep 2024 04:49:03 -0700 Subject: [PATCH] package/ntp: add upstream-provided patch to fix regression 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 Cc: Bernd Kuhls Signed-off-by: Thomas Petazzoni --- ...-Fix-crash-when-binding-IPv6-address.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch diff --git a/package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch b/package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch new file mode 100644 index 0000000000..b4e7378a32 --- /dev/null +++ b/package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch @@ -0,0 +1,38 @@ +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 +--- + 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); + }