EXTRA_OBJS = @EXTRA_OBJS@
-OBJS = array.o cmdparse.o conf.o leapdb.o local.o logging.o main.o memory.o quantiles.o \
+OBJS = addrfilt.o array.o clientlog.o cmdparse.o conf.o keys.o leapdb.o \
+ local.o logging.o main.o memory.o nameserv.o nameserv_async.o \
+ ntp_auth.o ntp_core.o ntp_ext.o ntp_io.o ntp_sources.o quantiles.o \
reference.o regress.o rtc.o samplefilt.o sched.o socket.o sources.o sourcestats.o \
stubs.o smooth.o sys.o sys_null.o tempcomp.o util.o $(EXTRA_OBJS)
--without-tomcrypt Don't use libtomcrypt even if it is available
--disable-nts Disable NTS support
--disable-cmdmon Disable command and monitoring support
- --disable-ntp Disable NTP support
--disable-refclock Disable reference clock support
--disable-phc Disable PHC refclock driver
--disable-pps Disable PPS refclock driver
--without-libcap Don't use libcap even if it is available
--enable-scfilter Enable support for system call filtering
--without-seccomp Don't use seccomp even if it is available
- --disable-asyncdns Disable asynchronous name resolving
--disable-forcednsretry Don't retry on permanent DNS error
--without-aes-gcm-siv Don't use AES-GCM-SIV for NTS even if it is available
--without-clock-gettime Don't use clock_gettime() even if it is available
feat_debug=0
feat_cmdmon=1
-feat_ntp=1
feat_refclock=1
feat_readline=1
try_editline=1
feat_pps=1
try_setsched=0
try_lockmem=0
-feat_asyncdns=1
feat_forcednsretry=1
try_aes_gcm_siv=1
try_clock_gettime=1
try_timestamping=0
feat_ntp_signd=0
ntp_era_split=""
-use_pthread=0
default_user="root"
default_hwclockfile=""
default_pidfile="/var/run/chrony/chronyd.pid"
--disable-cmdmon)
feat_cmdmon=0
;;
- --disable-ntp)
- feat_ntp=0
- ;;
--disable-refclock)
feat_refclock=0
;;
--without-seccomp)
try_seccomp=0
;;
- --disable-asyncdns)
- feat_asyncdns=0
- ;;
--disable-forcednsretry)
feat_forcednsretry=0
;;
EXTRA_OBJECTS="$EXTRA_OBJECTS cmdmon.o manual.o pktlength.o"
fi
-if [ $feat_ntp = "1" ]; then
- add_def FEAT_NTP
- EXTRA_OBJECTS="$EXTRA_OBJECTS ntp_auth.o ntp_core.o ntp_ext.o ntp_io.o ntp_sources.o"
- if [ $feat_ntp_signd = "1" ]; then
- add_def FEAT_SIGND
- EXTRA_OBJECTS="$EXTRA_OBJECTS ntp_signd.o"
- fi
-else
- feat_asyncdns=0
- feat_timestamping=0
-fi
-
-if [ "$feat_cmdmon" = "1" ] || [ $feat_ntp = "1" ]; then
- EXTRA_OBJECTS="$EXTRA_OBJECTS addrfilt.o clientlog.o keys.o nameserv.o"
-else
- feat_ipv6=0
+if [ $feat_ntp_signd = "1" ]; then
+ add_def FEAT_SIGND
+ EXTRA_OBJECTS="$EXTRA_OBJECTS ntp_signd.o"
fi
if [ $feat_refclock = "1" ]; then
exit 1
fi
-if [ $feat_asyncdns = "1" ] && \
- test_code 'pthread' 'pthread.h' '-pthread' '' '
- pthread_t thread;
- return (int)pthread_create(&thread, NULL, (void *)1, NULL);'
+if test_code 'pthread' 'pthread.h' '-pthread' '' '
+ pthread_t thread;
+ return (int)pthread_create(&thread, NULL, (void *)1, NULL);'
then
- add_def FEAT_ASYNCDNS
add_def USE_PTHREAD_ASYNCDNS
- EXTRA_OBJECTS="$EXTRA_OBJECTS nameserv_async.o"
- use_pthread=1
+ MYCFLAGS="$MYCFLAGS -pthread"
+else
+ echo "error: pthread_create() not found"
+ exit 1
fi
if [ $try_arc4random = "1" ] && \
'seccomp_init(SCMP_ACT_KILL);'
then
add_def FEAT_SCFILTER
- if [ $feat_ntp = "1" ]; then
- # NAME2IPADDRESS shouldn't be enabled together with a privops operation
- # used by the main thread as the helper process works on one request at
- # a time and the async resolver would block the main thread
- priv_ops="NAME2IPADDRESS RELOADDNS"
- fi
+ # NAME2IPADDRESS shouldn't be enabled together with a privops operation
+ # used by the main thread as the helper process works on one request at
+ # a time and the async resolver would block the main thread
+ priv_ops="NAME2IPADDRESS RELOADDNS"
EXTRA_LIBS="$EXTRA_LIBS -lseccomp"
fi
pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched);'
then
add_def HAVE_PTHREAD_SETSCHEDPARAM
- use_pthread=1
fi
if [ $try_lockmem = "1" ] && \
EXTRA_CLI_OBJECTS="$EXTRA_CLI_OBJECTS $HASH_OBJ"
LIBS="$LIBS $HASH_LINK"
-if [ $feat_ntp = "1" ] && [ $feat_nts = "1" ] && [ $try_gnutls = "1" ]; then
+if [ $feat_nts = "1" ] && [ $try_gnutls = "1" ]; then
if [ "$HASH_OBJ" = "hash_gnutls.o" ]; then
test_cflags=""
test_link=""
fi
fi
-if [ $use_pthread = "1" ]; then
- MYCFLAGS="$MYCFLAGS -pthread"
-fi
-
SYSCONFDIR=/etc
if [ "x$SETSYSCONFDIR" != "x" ]; then
SYSCONFDIR=$SETSYSCONFDIR
common_features="`get_features SECHASH IPV6 DEBUG`"
chronyc_features="`get_features READLINE`"
-chronyd_features="`get_features CMDMON NTP REFCLOCK RTC PRIVDROP SCFILTER SIGND ASYNCDNS NTS`"
+chronyd_features="`get_features CMDMON REFCLOCK RTC PRIVDROP SCFILTER SIGND NTS`"
add_def CHRONYC_FEATURES "\"$chronyc_features $common_features\""
add_def CHRONYD_FEATURES "\"$chronyd_features $common_features\""
echo "Features : $chronyd_features $chronyc_features $common_features"
extra library is needed. The default user which `chronyd` should run as can be
specified with the `--with-user` option of the `configure` script.
-If development files for the POSIX threads library are available, `chronyd`
-will be built with support for asynchronous resolving of hostnames specified in
-the `server`, `peer`, and `pool` directives. This allows `chronyd` operating as
-a server to respond to client requests when resolving a hostname. If you don't
-want to enable the support, specify the `--disable-asyncdns` flag to
-`configure`.
-
If development files for the https://www.lysator.liu.se/~nisse/nettle/[Nettle],
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS[NSS], or
https://www.libtom.net/LibTomCrypt/[libtomcrypt] library are available,
#include "sched.h"
#include "util.h"
-#if defined(FEAT_NTP) && !defined(FEAT_ASYNCDNS)
-
-/* This is a blocking implementation used when asynchronous resolving is not available */
-
-struct DNS_Async_Instance {
- const char *name;
- DNS_NameResolveHandler handler;
- void *arg;
- int pipe[2];
-};
-
-static void
-resolve_name(int fd, int event, void *anything)
-{
- struct DNS_Async_Instance *inst;
- IPAddr addrs[DNS_MAX_ADDRESSES];
- DNS_Status status;
- int i;
-
- inst = (struct DNS_Async_Instance *)anything;
-
- SCH_RemoveFileHandler(inst->pipe[0]);
- close(inst->pipe[0]);
- close(inst->pipe[1]);
-
- status = PRV_Name2IPAddress(inst->name, addrs, DNS_MAX_ADDRESSES);
-
- for (i = 0; status == DNS_Success && i < DNS_MAX_ADDRESSES &&
- addrs[i].family != IPADDR_UNSPEC; i++)
- ;
-
- (inst->handler)(status, i, addrs, inst->arg);
-
- Free(inst);
-}
-
-void
-DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *anything)
-{
- struct DNS_Async_Instance *inst;
-
- inst = MallocNew(struct DNS_Async_Instance);
- inst->name = name;
- inst->handler = handler;
- inst->arg = anything;
-
- if (pipe(inst->pipe))
- LOG_FATAL("pipe() failed");
-
- UTI_FdSetCloexec(inst->pipe[0]);
- UTI_FdSetCloexec(inst->pipe[1]);
-
- SCH_AddFileHandler(inst->pipe[0], SCH_FILE_INPUT, resolve_name, inst);
-
- if (write(inst->pipe[1], "", 1) < 0)
- ;
-}
-
-#endif /* !FEAT_ASYNCDNS */
-
#ifndef FEAT_CMDMON
void
#endif /* !FEAT_CMDMON */
-#ifndef FEAT_NTP
-
-void
-NCR_AddBroadcastDestination(NTP_Remote_Address *addr, int interval)
-{
-}
-
-void
-NCR_Initialise(void)
-{
-}
-
-void
-NCR_Finalise(void)
-{
-}
-
-int
-NCR_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
-{
- return 1;
-}
-
-int
-NCR_CheckAccessRestriction(IPAddr *ip_addr)
-{
- return 0;
-}
-
-void
-NIO_Initialise(void)
-{
-}
-
-void
-NIO_Finalise(void)
-{
-}
-
-void
-NSR_Initialise(void)
-{
-}
-
-void
-NSR_Finalise(void)
-{
-}
-
-NSR_Status
-NSR_AddSource(NTP_Remote_Address *remote_addr, NTP_Source_Type type,
- SourceParameters *params, uint32_t *conf_id)
-{
- return NSR_TooManySources;
-}
-
-NSR_Status
-NSR_AddSourceByName(char *name, int family, int port, int pool, NTP_Source_Type type,
- SourceParameters *params, uint32_t *conf_id)
-{
- return NSR_TooManySources;
-}
-
-const char *
-NSR_StatusToString(NSR_Status status)
-{
- return "NTP not supported";
-}
-
-NSR_Status
-NSR_RemoveSource(IPAddr *address)
-{
- return NSR_NoSuchSource;
-}
-
-void
-NSR_RemoveSourcesById(uint32_t conf_id)
-{
-}
-
-void
-NSR_RemoveAllSources(void)
-{
-}
-
-void
-NSR_HandleBadSource(IPAddr *address)
-{
-}
-
-void
-NSR_RefreshAddresses(void)
-{
-}
-
-char *
-NSR_GetName(IPAddr *address)
-{
- return NULL;
-}
-
-void
-NSR_SetSourceResolvingEndHandler(NSR_SourceResolvingEndHandler handler)
-{
- if (handler)
- (handler)();
-}
-
-void
-NSR_ResolveSources(void)
-{
-}
-
-void NSR_StartSources(void)
-{
-}
-
-void NSR_AutoStartSources(void)
-{
-}
-
-int
-NSR_InitiateSampleBurst(int n_good_samples, int n_total_samples,
- IPAddr *mask, IPAddr *address)
-{
- return 0;
-}
-
-uint32_t
-NSR_GetLocalRefid(IPAddr *address)
-{
- return 0;
-}
-
-int
-NSR_SetConnectivity(IPAddr *mask, IPAddr *address, SRC_Connectivity connectivity)
-{
- return 0;
-}
-
-int
-NSR_ModifyMinpoll(IPAddr *address, int new_minpoll)
-{
- return 0;
-}
-
-int
-NSR_ModifyMaxpoll(IPAddr *address, int new_maxpoll)
-{
- return 0;
-}
-
-int
-NSR_ModifyMaxdelay(IPAddr *address, double new_max_delay)
-{
- return 0;
-}
-
-int
-NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio)
-{
- return 0;
-}
-
-int
-NSR_ModifyMaxdelaydevratio(IPAddr *address, double new_max_delay_dev_ratio)
-{
- return 0;
-}
-
-int
-NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum)
-{
- return 0;
-}
-
-int
-NSR_ModifyOffset(IPAddr *address, double new_offset)
-{
- return 0;
-}
-
-int
-NSR_ModifyPolltarget(IPAddr *address, int new_poll_target)
-{
- return 0;
-}
-
-void
-NSR_ReportSource(RPT_SourceReport *report, struct timespec *now)
-{
- memset(report, 0, sizeof (*report));
-}
-
-int
-NSR_GetAuthReport(IPAddr *address, RPT_AuthReport *report)
-{
- return 0;
-}
-
-int
-NSR_GetNTPReport(RPT_NTPReport *report)
-{
- return 0;
-}
-
-void
-NSR_GetActivityReport(RPT_ActivityReport *report)
-{
- memset(report, 0, sizeof (*report));
-}
-
-void
-NSR_DumpAuthData(void)
-{
-}
-
-#ifndef FEAT_CMDMON
-
-void
-CLG_Initialise(void)
-{
-}
-
-void
-CLG_Finalise(void)
-{
-}
-
-void
-DNS_SetAddressFamily(int family)
-{
-}
-
-DNS_Status
-DNS_Name2IPAddress(const char *name, IPAddr *ip_addrs, int max_addrs)
-{
- return DNS_Failure;
-}
-
-void
-KEY_Initialise(void)
-{
-}
-
-void
-KEY_Finalise(void)
-{
-}
-
-#endif /* !FEAT_CMDMON */
-#endif /* !FEAT_NTP */
-
#ifndef FEAT_REFCLOCK
void
RCL_Initialise(void)
"--enable-debug" \
"--enable-ntp-signd" \
"--enable-scfilter" \
- "--disable-asyncdns" \
"--disable-ipv6" \
"--disable-privdrop" \
"--disable-readline" \
"--disable-sechash" \
"--disable-cmdmon" \
"--disable-cmdmon --enable-scfilter" \
- "--disable-ntp" \
- "--disable-ntp --enable-scfilter" \
"--disable-nts" \
"--disable-refclock" \
"--disable-timestamping" \
- "--disable-timestamping --disable-ntp" \
- "--disable-cmdmon --disable-ntp" \
- "--disable-cmdmon --disable-ntp --enable-scfilter" \
- "--disable-cmdmon --disable-refclock" \
- "--disable-cmdmon --disable-ntp --disable-refclock"
+ "--disable-cmdmon --disable-refclock"
do
./configure $opts || exit 1
make clean
test_start() {
rm -rf tmp/*
echo "Testing $@:"
-
- check_config_h 'FEAT_NTP 1' || test_skip
}
test_pass() {
test_start() {
local user=$(get_user)
- check_chronyd_features NTP CMDMON || test_skip "NTP/CMDMON support disabled"
+ check_chronyd_features CMDMON || test_skip "CMDMON support disabled"
[ "${#TEST_DIR}" -ge 5 ] || test_skip "invalid TEST_DIR"
#include <config.h>
#include "test.h"
-#if defined(FEAT_NTP) || defined(FEAT_CMDMON)
-
#include <clientlog.c>
static uint64_t
LCL_Finalise();
CNF_Finalise();
}
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif
#include <config.h>
#include "test.h"
-#if defined(FEAT_NTP) || defined(FEAT_CMDMON)
-
#include <keys.c>
#define KEYS 100
CNF_Finalise();
HSH_Finalise();
}
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif
#include <socket.h>
#include "test.h"
-#ifdef FEAT_NTP
-
#include <ntp_auth.c>
static void
CNF_Finalise();
HSH_Finalise();
}
-
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif
#include <local.h>
#include "test.h"
-#ifdef FEAT_NTP
-
static struct timespec current_time;
static NTP_Packet req_buffer, res_buffer;
static int req_length, res_length;
CNF_Finalise();
HSH_Finalise();
}
-
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif
#include <config.h>
#include "test.h"
-#ifdef FEAT_NTP
-
#include <util.h>
#include <logging.h>
}
}
-
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif
#include <config.h>
#include "test.h"
-#ifdef FEAT_NTP
-
#include <conf.h>
#include <cmdparse.h>
#include <nameserv_async.h>
CNF_Finalise();
HSH_Finalise();
}
-
-#else
-void
-test_unit(void)
-{
- TEST_REQUIRE(0);
-}
-#endif