head 1.1; branch 1.1.1; access; symbols netbsd-11-0-RC6:1.1.1.1 netbsd-11-0-RC5:1.1.1.1 netbsd-11-0-RC4:1.1.1.1 netbsd-11-0-RC3:1.1.1.1 netbsd-11-0-RC2:1.1.1.1 netbsd-11-0-RC1:1.1.1.1 perseant-exfatfs-base-20250801:1.1.1.1 netbsd-11:1.1.1.1.0.2 netbsd-11-base:1.1.1.1 ntp-4-2-8p18:1.1.1.1 UDEL:1.1.1; locks; strict; comment @# @; 1.1 date 2024.08.18.20.37.42; author christos; state Exp; branches 1.1.1.1; next ; commitid RohTFOFoVLJItlmF; 1.1.1.1 date 2024.08.18.20.37.42; author christos; state Exp; branches; next ; commitid RohTFOFoVLJItlmF; desc @@ 1.1 log @Initial revision @ text @# # Boost Software License - Version 1.0 - August 17th, 2003 # # Permission is hereby granted, free of charge, to any person or organization # obtaining a copy of the software and accompanying documentation covered by # this license (the "Software") to use, reproduce, display, distribute, # execute, and transmit the Software, and to prepare derivative works of the # Software, and to permit third-parties to whom the Software is furnished to # do so, all subject to the following: # # The copyright notices in the Software and this entire statement, including # the above license grant, this restriction and the following disclaimer, # must be included in all copies of the Software, in whole or in part, and # all derivative works of the Software, unless such copies or derivative # works are solely in the form of machine-executable object code generated by # a source language processor. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT # SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE # FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # # 2012-01-31, Lars Bilke # - Enable Code Coverage # # 2013-09-17, Joakim Söderberg # - Added support for Clang. # - Some additional usage instructions. # # 2016-11-02, Azat Khuzhin # - Adopt for C compiler only (libevent) # # USAGE: # 1. Copy this file into your cmake modules path. # # 2. Add the following line to your CMakeLists.txt: # INCLUDE(CodeCoverage) # # 3. Set compiler flags to turn off optimization and enable coverage: # SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") # SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") # # 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target # which runs your test executable and produces a lcov code coverage report: # Example: # SETUP_TARGET_FOR_COVERAGE( # my_coverage_target # Name for custom target. # test_driver # Name of the test driver executable that runs the tests. # # NOTE! This should always have a ZERO as exit code # # otherwise the coverage generation will not complete. # coverage # Name of output directory. # ) # # 4. Build a Debug build: # cmake -DCMAKE_BUILD_TYPE=Debug .. # make # make my_coverage_target # # # Check prereqs FIND_PROGRAM( GCOV_PATH gcov ) FIND_PROGRAM( LCOV_PATH lcov ) FIND_PROGRAM( GENHTML_PATH genhtml ) FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) IF(NOT GCOV_PATH) MESSAGE(FATAL_ERROR "gcov not found! Aborting...") ENDIF() # NOT GCOV_PATH IF(NOT CMAKE_COMPILER_IS_GNUCC) # Clang version 3.0.0 and greater now supports gcov as well. MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") IF(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") ENDIF() ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests. # MUST return ZERO always, even on errors. # If not, no coverage report will be created! # Param _outputname lcov output is generated as _outputname.info # HTML report is generated in _outputname/index.html # Optional fourth parameter is passed as arguments to _testrunner # Pass them in list form, e.g.: "-j;2" for -j 2 FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) IF(NOT LCOV_PATH) MESSAGE(FATAL_ERROR "lcov not found! Aborting...") ENDIF() # NOT LCOV_PATH IF(NOT GENHTML_PATH) MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") ENDIF() # NOT GENHTML_PATH # Setup target ADD_CUSTOM_TARGET(${_targetname} # Cleanup lcov ${LCOV_PATH} --directory . --zerocounters # Run tests COMMAND ${_testrunner} ${ARGV3} # Capturing lcov counters and generating report COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." ) # Show info where to find the report ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD COMMAND ; COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." ) ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests # Param _outputname cobertura output is generated as _outputname.xml # Optional fourth parameter is passed as arguments to _testrunner # Pass them in list form, e.g.: "-j;2" for -j 2 FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) IF(NOT PYTHON_EXECUTABLE) MESSAGE(FATAL_ERROR "Python not found! Aborting...") ENDIF() # NOT PYTHON_EXECUTABLE IF(NOT GCOVR_PATH) MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") ENDIF() # NOT GCOVR_PATH ADD_CUSTOM_TARGET(${_targetname} # Run tests ${_testrunner} ${ARGV3} # Running gcovr COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Running gcovr to produce Cobertura code coverage report." ) # Show info where to find the report ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD COMMAND ; COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." ) ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA @ 1.1.1.1 log @Import ntp-4.2.8p18 (previous was ntp-4.2.8p15 --- (4.2.8p18) 2024/05/25 Released by Harlan Stenn * [Bug 3918] Tweak openssl header/library handling. * [Bug 3914] Spurious "Unexpected origin timestamp" logged after time stepped. * [Bug 3913] Avoid duplicate IPv6 link-local manycast associations. * [Bug 3912] Avoid rare math errors in ntptrace. * [Bug 3910] Memory leak using openssl-3 * [Bug 3909] Do not select multicast local address for unicast peer. * [Bug 3903] lib/isc/win32/strerror.c NTstrerror() is not thread-safe. * [Bug 3901] LIB_GETBUF isn't thread-safe. * [Bug 3900] fast_xmit() selects wrong local addr responding to mcast on Windows. * [Bug 3888] ntpd with multiple same-subnet IPs using manycastclient creates duplicate associations. * [Bug 3872] Ignore restrict mask for hostname. * [Bug 3871] 4.2.8p17 build without hopf6021 refclock enabled fails. Reported by Hans Mayer. Moved NONEMPTY_TRANSLATION_UNIT declaration from ntp_types.h to config.h. * [Bug 3870] Server drops client packets with ppoll < 4. * [Bug 3869] Remove long-gone "calldelay" & "crypto sign" from docs. Reported by PoolMUC@@web.de. * [Bug 3868] Cannot restrict a pool peer. Thanks to Edward McGuire for tracking down the deficiency. * [Bug 3864] ntpd IPv6 refid different for big-endian and little-endian. * [Bug 3859] Use NotifyIpInterfaceChange on Windows ntpd. * [Bug 3856] Enable Edit & Continue debugging with Visual Studio. * [Bug 3855] ntpq lacks an equivalent to ntpdc's delrestrict. * [Bug 3854] ntpd 4.2.8p17 corrupts rawstats file with space in refid. * [Bug 3853] Clean up warnings with modern compilers. * [Bug 3852] check-libntp.mf and friends are not triggering rebuilds as intended. * [Bug 3851] Drop pool server when no local address can reach it. * [Bug 3850] ntpq -c apeers breaks column formatting s2 w/refclock refid. * [Bug 3849] ntpd --wait-sync times out. * [Bug 3847] SSL detection in configure should run-test if runpath is needed. * [Bug 3846] Use -Wno-format-truncation by default. * [Bug 3845] accelerate pool clock_sync when IPv6 has only link-local access. * [Bug 3842] Windows ntpd PPSAPI DLL load failure crashes. * [Bug 3841] 4.2.8p17 build break w/ gcc 12 -Wformat-security without -Wformat Need to remove --Wformat-security when removing -Wformat to silence numerous libopts warnings. * [Bug 3837] NULL pointer deref crash when ntpd deletes last interface. Reported by renmingshuai. Correct UNLINK_EXPR_SLIST() when the list is empty. * [Bug 3835] NTP_HARD_*FLAGS not used by libevent tearoff. * [Bug 3831] pollskewlist zeroed on runtime configuration. * [Bug 3830] configure libevent check intersperses output with answer. * [Bug 3828] BK should ignore a git repo in the same directory. * [Bug 3827] Fix build in case CLOCK_HOPF6021 or CLOCK_WHARTON_400A is disabled. * [Bug 3825] Don't touch HTML files unless building inside a BK repo. Fix the script checkHtmlFileDates. * [Bug 3756] Improve OpenSSL library/header detection. * [Bug 3753] ntpd fails to start with FIPS-enabled OpenSSL 3. * [Bug 2734] TEST3 prevents initial interleave sync. Fix from * Log failures to allocate receive buffers. * Remove extraneous */ from libparse/ieee754io.c * Fix .datecheck target line in Makefile.am. * Update the copyright year. * Update ntp.conf documentation to add "delrestrict" and correct information about KoD rate limiting. * html/clockopt.html cleanup. * util/lsf-times - added. * Add DSA, DSA-SHA, and SHA to tests/libntp/digests.c. * Provide ntpd thread names to debugger on Windows. * Remove dead code libntp/numtohost.c and its unit tests. * Remove class A, B, C IPv4 distinctions in netof(). * Use @@configure_input@@ in various *.in files to include a comment that the file is generated from another pointing to the *.in. * Correct underquoting, indents in ntp_facilitynames.m4. * Clean up a few warnings seen building with older gcc. * Fix build on older FreeBSD lacking sys/procctl.h. * Disable [Bug 3627] workaround on newer FreeBSD which has the kernel fix that makes it unnecessary, re-enabling ASLR stack gap. * Use NONEMPTY_COMPILATION_UNIT in more conditionally-compiled files. * Remove useless pointer to Windows Help from system error messages. * Avoid newlines within Windows error messages. * Ensure unique association IDs if wrapped. * Simplify calc_addr_distance(). * Clamp min/maxpoll in edge cases in newpeer(). * Quiet local addr change logging when unpeering. * Correct missing arg for %s printf specifier in send_blocking_resp_internal(). * Suppress OpenSSL 3 deprecation warning clutter. * Correct OpenSSL usage in Autokey code to avoid warnings about discarding const qualifiers with OpenSSL 3. * Display KoD refid as text in recently added message. * Avoid running checkHtmlFileDates script repeatedly when no html/*.html files have changed. * Abort configure if --enable-crypto-rand given & unavailable. * Add configure --enable-verbose-ssl to trace SSL detection. * Add build test coverage for --disable-saveconfig to flock-build script. * Remove deprecated configure --with-arlib option. * Remove configure support for ISC UNIX ca. 1998. * Move NTP_OPENSSL and NTP_CRYPTO_RAND invocations from configure.ac files to NTP_LIBNTP. * Remove dead code: HAVE_U_INT32_ONLY_WITH_DNS. * Eliminate [v]snprintf redefinition warnings on macOS. * Fix clang 14 cast increases alignment warning on Linux. * Move ENABLE_CMAC to ntp_openssl.m4, reviving sntp/tests CMAC unit tests. * Use NTP_HARD_CPPFLAGS in libopts tearoff. * wire in --enable-build-framework-help --- (4.2.8p17) 2023/06/06 Released by Harlan Stenn * [Bug 3824] Spurious "ntpd: daemon failed to notify parent!" logged at event_sync. Reported by Edward McGuire. * [Bug 3822] ntpd significantly delays first poll of servers specified by name. Miroslav Lichvar identified regression in 4.2.8p16. * [Bug 3821] 4.2.8p16 misreads hex authentication keys, won't interop with 4.2.8p15 or earlier. Reported by Matt Nordhoff, thanks to Miroslav Lichvar and Matt for rapid testing and identifying the problem. * Add tests/libntp/digests.c to catch regressions reading keys file or with symmetric authentication digest output. --- (4.2.8p16) 2023/05/31 Released by Harlan Stenn * [Sec 3808] Assertion failure in ntpq on malformed RT-11 date * [Sec 3807] praecis_parse() in the Palisade refclock driver has a hypothetical input buffer overflow. Reported by ... stenn@@ * [Sec 3806] libntp/mstolfp.c needs bounds checking - solved numerically instead of using string manipulation * [Sec 3767] An OOB KoD RATE value triggers an assertion when debug is enabled. * [Bug 3819] Updated libopts/Makefile.am was missing NTP_HARD_* values. * [Bug 3817] Bounds-check "tos floor" configuration. * [Bug 3814] First poll delay of new or cleared associations miscalculated. * [Bug 3802] ntp-keygen -I default identity modulus bits too small for OpenSSL 3. Reported by rmsh1216@@163.com * [Bug 3801] gpsdjson refclock gps_open() device name mishandled. * [Bug 3800] libopts-42.1.17 does not compile with Microsoft C. * [Bug 3799] Enable libopts noreturn compiler advice for MSC. * [Bug 3797] Windows getaddrinfo w/AI_ADDRCONFIG fails for localhost when disconnected, breaking ntpq and ntpdc. * [Bug 3795] pollskewlist documentation uses | when it shouldn't. - ntp.conf manual page and miscopt.html corrections. * [Bug 3793] Wrong variable type passed to record_raw_stats(). - Report and patch by Yuezhen LUAN . * [Bug 3786] Timer starvation on high-load Windows ntpd. * [Bug 3784] high-load ntpd on Windows deaf after enough ICMP TTL exceeded. * [Bug 3781] log "Unable to listen for broadcasts" for IPv4 * [Bug 3774] mode 6 packets corrupted in rawstats file - Reported by Edward McGuire, fix identified by . * [Bug 3758] Provide a 'device' config statement for refclocks * [Bug 3757] Improve handling of Linux-PPS in NTPD * [Bug 3741] 4.2.8p15 can't build with glibc 2.34 * [Bug 3725] Make copyright of clk_wharton.c compatible with Debian. Philippe De Muyter * [Bug 3724] ntp-keygen with openSSL 1.1.1 fails on Windows - openssl applink needed again for openSSL-1.1.1 * [Bug 3719] configure.ac checks for closefrom() and getdtablesize() missing. Reported by Brian Utterback, broken in 2010 by * [Bug 3699] Problems handling drift file and restoring previous drifts - command line options override config statements where applicable - make initial frequency settings idempotent and reversible - make sure kernel PLL gets a recovered drift componsation * [Bug 3695] Fix memory leak with ntpq on Windows Server 2019 * [Bug 3694] NMEA refclock seems to unnecessarily require location in messages - misleading title; essentially a request to ignore the receiver status. Added a mode bit for this. * [Bug 3693] Improvement of error handling key lengths - original patch by Richard Schmidt, with mods & unit test fixes * [Bug 3692] /dev/gpsN requirement prevents KPPS - implement/wrap 'realpath()' to resolve symlinks in device names * [Bug 3691] Buffer Overflow reading GPSD output - original patch by matt - increased max PDU size to 4k to avoid truncation * [Bug 3690] newline in ntp clock variable (parse) - patch by Frank Kardel * [Bug 3689] Extension for MD5, SHA-1 and other keys - ntp{q,dc} now use the same password processing as ntpd does in the key file, so having a binary secret >= 11 bytes is possible for all keys. (This is a different approach to the problem than suggested) * [Bug 3688] GCC 10 build errors in testsuite * [Bug 3687] ntp_crypto_rand RNG status not known - patch by Gerry Garvey * [Bug 3682] Fixes for warnings when compiled without OpenSSL - original patch by Gerry Garvey * [Bug 3677] additional peer events not decoded in associations listing - original patch by Gerry Garvey * [Bug 3676] compiler warnings (CMAC, interrupt_buf, typo, fallthrough) - applied patches by Gerry Garvey * [Bug 3675] ntpq ccmds[] stores pointer to non-persistent storage * [Bug 3674] ntpq command 'execute only' using '~' prefix - idea+patch by Gerry Garvey * [Bug 3672] fix biased selection in median cut * [Bug 3666] avoid unlimited receive buffer allocation - follow-up: fix inverted sense in check, reset shortfall counter * [Bug 3660] Revert 4.2.8p15 change to manycast. * [Bug 3640] document "discard monitor" and fix the code. - fixed bug identified by Edward McGuire * [Bug 3626] (SNTP) UTC offset calculation needs dst flag - applied patch by Gerry Garvey * [Bug 3428] ntpd spinning consuming CPU on Linux router with full table. Reported by Israel G. Lugo. * [Bug 3103] libopts zsave_warn format string too few arguments * [Bug 2990] multicastclient incorrectly causes bind to broadcast address. Integrated patch from Brian Utterback. * [Bug 2525] Turn on automake subdir-objects across the project. * [Bug 2410] syslog an error message on panic exceeded. * Use correct rounding in mstolfp(). perlinger/hart * M_ADDF should use u_int32. * Only define tv_fmt_libbuf() if we will use it. * Use recv_buffer instead of the longer recv_space.X_recv_buffer. hart/stenn * Make sure the value returned by refid_str() prints cleanly. * If DEBUG is enabled, the startup banner now says that debug assertions are in force and that ntpd will abort if any are violated. * syslog valid incoming KoDs. * Rename a poorly-named variable. * Disable "embedded NUL in string" messages in libopts, when we can. * Use https in the AC_INIT URLs in configure.ac. * Implement NTP_FUNC_REALPATH. * Lose a gmake construct in ntpd/Makefile.am. * upgrade to: autogen-5.18.16 * upgrade to: libopts-42.1.17 * upgrade to: autoconf-2.71 * upgrade to: automake-1.16.15 * Upgrade to libevent-2.1.12-stable * Support OpenSSL-3.0 @ text @@