27b8d0ba8c
- set 'CC="$(HOSTCC)"' to avoid cross-compile failure (see [1]): /bin/sh: line 1: .../build/ntpsec-1_2_0/build/host/ntpd/keyword-gen: cannot execute binary file: Exec format error Waf: Leaving directory `.../build/ntpsec-1_2_0/build/host' Build failed -> task in 'ntp_keyword.h' failed with exit status 126 (run with -v to display more information) - set '-std=gnu99"' to avoid compile failure with old compilers - explicitly set PYTHON_CONFIG - add patch 001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch to fix ntptime jfmt5/ofmt5 jfmt6/ofmt6 related compile failure - add patch 0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch to fix host-compile failure in case target libbsd is detected - add SYSV init file (S49ntp) - add example ntpd.conf (with legacy option enabled and provide skeleton for NTS configuration) - add config option for NTS support - add ntp user/group and run ntpd as restricted user - add libcap dependency (compile time optional but needed for droproot support) [1] https://gitlab.com/NTPsec/ntpsec/-/issues/694 Signed-off-by: Peter Seiderer <ps.report@gmx.net> [Thomas: S49ntp -> S49ntpd] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
91 lines
3.4 KiB
Diff
91 lines
3.4 KiB
Diff
From aa9ed14c7f4d0edbda9370760b44be045638f8a0 Mon Sep 17 00:00:00 2001
|
||
From: Peter Seiderer <ps.report@gmx.net>
|
||
Date: Mon, 4 Oct 2021 22:25:58 +0200
|
||
Subject: [PATCH] ntptime: fix jfmt5/ofmt5 jfmt6/ofmt6 related compile failure
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Use same define guard for definiton as for usage ('HAVE_STRUCT_NTPTIMEVAL_TAI'
|
||
instead of 'NTP_API && NTP_API > 3').
|
||
|
||
While at it use HAVE_STRUCT_NTPTIMEVAL_TAI define guard for the two remaining
|
||
places using NTP_API (which is not defined by the uclibc sys/timex.h header).
|
||
|
||
Fixes:
|
||
|
||
../../ntptime/ntptime.c: In function ‘main’:
|
||
../../ntptime/ntptime.c:349:17: error: ‘jfmt5’ undeclared (first use in this function); did you mean ‘jfmt6’?
|
||
349 | printf(json ? jfmt5 : ofmt5, (long)ntv.tai);
|
||
| ^~~~~
|
||
| jfmt6
|
||
../../ntptime/ntptime.c:349:17: note: each undeclared identifier is reported only once for each function it appears in
|
||
../../ntptime/ntptime.c:349:25: error: ‘ofmt5’ undeclared (first use in this function); did you mean ‘ofmt6’?
|
||
349 | printf(json ? jfmt5 : ofmt5, (long)ntv.tai);
|
||
| ^~~~~
|
||
| ofmt6
|
||
../../ntptime/ntptime.c:321:15: warning: unused variable ‘jfmt6’ [-Wunused-variable]
|
||
321 | const char *jfmt6 = "";
|
||
| ^~~~~
|
||
../../ntptime/ntptime.c:311:15: warning: unused variable ‘ofmt6’ [-Wunused-variable]
|
||
311 | const char *ofmt6 = "\n";
|
||
| ^~~~~
|
||
|
||
[Upstream: https://gitlab.com/NTPsec/ntpsec/-/merge_requests/1245]
|
||
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
||
---
|
||
ntptime/ntptime.c | 12 ++++++------
|
||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||
|
||
diff --git a/ntptime/ntptime.c b/ntptime/ntptime.c
|
||
index ff861cb3b..7fbd09977 100644
|
||
--- a/ntptime/ntptime.c
|
||
+++ b/ntptime/ntptime.c
|
||
@@ -138,7 +138,7 @@ main(
|
||
ntx.modes |= MOD_NANO;
|
||
break;
|
||
#endif
|
||
-#if defined NTP_API && NTP_API > 3
|
||
+#if defined(HAVE_STRUCT_NTPTIMEVAL_TAI)
|
||
case 'T':
|
||
ntx.modes = MOD_TAI;
|
||
ntx.constant = atoi(ntp_optarg);
|
||
@@ -222,7 +222,7 @@ main(
|
||
#else
|
||
"",
|
||
#endif
|
||
-#if defined NTP_API && NTP_API > 3
|
||
+#if defined(HAVE_STRUCT_NTPTIMEVAL_TAI)
|
||
"-T tai_offset set TAI offset\n",
|
||
#else
|
||
"",
|
||
@@ -305,21 +305,21 @@ main(
|
||
const char *ofmt2 = " time %s, (.%0*d),\n";
|
||
const char *ofmt3 = " maximum error %lu us, estimated error %lu us";
|
||
const char *ofmt4 = " ntptime=%x.%x unixtime=%x.%0*d %s";
|
||
-#if defined NTP_API && NTP_API > 3
|
||
+#if defined(HAVE_STRUCT_NTPTIMEVAL_TAI)
|
||
const char *ofmt5 = ", TAI offset %ld\n";
|
||
#else
|
||
const char *ofmt6 = "\n";
|
||
-#endif /* NTP_API */
|
||
+#endif /* HAVE_STRUCT_NTPTIMEVAL_TAI */
|
||
/* JSON formats */
|
||
const char *jfmt1 = "{\"gettime-code\":%d,\"gettime-status\":\"%s\",";
|
||
const char *jfmt2 = "\"time\":\"%s\",\"fractional-time\":\".%0*d\",";
|
||
const char *jfmt3 = "\"maximum-error\":%lu,\"estimated-error\":%lu,";
|
||
const char *jfmt4 = "\"raw-ntp-time\":\"%x.%x\",\"raw-unix-time\":\"%x.%0*d %s\",";
|
||
-#if defined NTP_API && NTP_API > 3
|
||
+#if defined(HAVE_STRUCT_NTPTIMEVAL_TAI)
|
||
const char *jfmt5 = "\"TAI-offset\":%d,";
|
||
#else
|
||
const char *jfmt6 = "";
|
||
-#endif /* NTP_API */
|
||
+#endif /* HAVE_STRUCT_NTPTIMEVAL_TAI */
|
||
printf(json ? jfmt1 : ofmt1, status, timex_state(status));
|
||
time_frac = ntv.time.tv_frac_sec;
|
||
#ifdef STA_NANO
|
||
--
|
||
2.34.1
|
||
|