Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package chrony for openSUSE:Factory checked in at 2023-08-17 19:42:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/chrony (Old) and /work/SRC/openSUSE:Factory/.chrony.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "chrony" Thu Aug 17 19:42:53 2023 rev:39 rq:1104233 version:4.4 Changes: -------- --- /work/SRC/openSUSE:Factory/chrony/chrony.changes 2022-11-30 16:07:52.103480803 +0100 +++ /work/SRC/openSUSE:Factory/.chrony.new.1766/chrony.changes 2023-08-17 19:43:03.606734904 +0200 @@ -1,0 +2,31 @@ +Wed Aug 9 17:30:28 UTC 2023 - Reinhard Max <[email protected]> + +- Update to 4.4: + * Add support for AES-GCM-SIV with Nettle >= 3.9 to shorten NTS + cookies to avoid some length-specific blocking of NTP on + Internet. + * Add support for multiple refclocks using extpps option on one + PHC. + * Add maxpoll option to hwtimestamp directive to improve PHC + tracking with low packet rates + * Add hwtstimeout directive to configure timeout for late + timestamps. + * Handle late hardware transmit timestamps of NTP requests on + all sockets. + * Handle mismatched 32/64-bit time_t in SOCK refclock samples + * Improve source replacement + * Log important changes made by command requests (chronyc) + * Refresh address of NTP sources periodically + * Set DSCP for IPv6 packets + * Shorten NTS-KE retry interval when network is down + * Update seccomp filter for musl + * Warn if loading keys from file with unexpected permissions + * Warn if source selection fails or falseticker is detected + * Add selectopts command to modify source-specific selection + options. + * Add timestamp sources to serverstats report and make its fields + 64-bit. + * Add -e option to chronyc to indicate end of response +- Update clknetsim to snapshot ef2a7a9. + +------------------------------------------------------------------- Old: ---- chrony-4.3.tar.gz chrony-4.3.tar.gz.sig clknetsim-f00531b.tar.gz New: ---- chrony-4.4.tar.gz chrony-4.4.tar.gz.sig clknetsim-ef2a7a9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ chrony.spec ++++++ --- /var/tmp/diff_new_pack.KQos9G/_old 2023-08-17 19:43:04.918737358 +0200 +++ /var/tmp/diff_new_pack.KQos9G/_new 2023-08-17 19:43:04.930737381 +0200 @@ -1,7 +1,7 @@ # # spec file for package chrony # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -33,7 +33,7 @@ %bcond_without testsuite %define _systemdutildir %(pkg-config --variable systemdutildir systemd) -%global clknetsim_ver f00531b +%global clknetsim_ver ef2a7a9 #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir %{_localstatedir}/adm/fillup-templates @@ -41,7 +41,7 @@ %define chrony_helper %{_libexecdir}/chrony/helper %define chrony_rundir %{_rundir}/%{name} Name: chrony -Version: 4.3 +Version: 4.4 Release: 0 Summary: System Clock Synchronization Client and Server License: GPL-2.0-only ++++++ chrony-4.3.tar.gz -> chrony-4.4.tar.gz ++++++ ++++ 8824 lines of diff (skipped) ++++++ chrony-htonl.patch ++++++ --- /var/tmp/diff_new_pack.KQos9G/_old 2023-08-17 19:43:05.290738054 +0200 +++ /var/tmp/diff_new_pack.KQos9G/_new 2023-08-17 19:43:05.294738062 +0200 @@ -1,6 +1,6 @@ --- test/unit/util.c.orig +++ test/unit/util.c -@@ -533,7 +533,7 @@ test_unit(void) +@@ -561,7 +561,7 @@ test_unit(void) #else TEST_CHECK(tspec.tv_sec_high == htonl(TV_NOHIGHSEC)); #endif ++++++ clknetsim-f00531b.tar.gz -> clknetsim-ef2a7a9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/client.c new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/client.c --- old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/client.c 2022-05-26 18:30:00.000000000 +0200 +++ new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/client.c 2023-06-12 10:50:01.000000000 +0200 @@ -35,6 +35,7 @@ #include <sys/timerfd.h> #include <sys/ipc.h> #include <sys/shm.h> +#include <sys/sysmacros.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> @@ -57,6 +58,7 @@ #include <linux/ethtool.h> #include <linux/limits.h> #include <linux/pps.h> +#include <linux/rtc.h> #include <linux/sockios.h> #ifdef SO_TIMESTAMPING #include <linux/ptp_clock.h> @@ -87,6 +89,7 @@ #define SYSCLK_CLOCKID ((clockid_t)(((unsigned int)~SYSCLK_FD << 3) | 3)) #define SYSCLK_PHC_INDEX 1 #define PPS_FD 1002 +#define RTC_FD 1003 #define URANDOM_FD 1010 #define MAX_SOCKETS 20 @@ -130,6 +133,7 @@ static void *(*_shmat)(int shmid, const void *shmaddr, int shmflg); static unsigned int node; +static int initializing = 0; static int initialized_symbols = 0; static int initialized = 0; static int clknetsim_fd; @@ -143,6 +147,9 @@ static double phc_jitter_asym = 0.0; static int phc_swap = 0; +static double rtc_offset = 0.0; +static int rtc_timerfd = 0; + enum { IFACE_UNIX, IFACE_LO, @@ -194,6 +201,8 @@ int used; int armed; int type; + int fd_flags; + uint64_t expired; clockid_t clock_id; double timeout; double interval; @@ -228,6 +237,10 @@ static int refclock_offsets_used = 0; static int pps_fds = 0; +static FILE *pcap = NULL; + +static void write_pcap_header(void); + static void make_request(int request_id, const void *request_data, int reqlen, void *reply, int replylen); static void init_symbols(void) { @@ -273,9 +286,11 @@ char command[64]; FILE *f; - if (initialized) + if (initializing || initialized) return; + initializing = 1; + init_symbols(); env = getenv("CLKNETSIM_START_DATE"); @@ -310,6 +325,10 @@ if (env) phc_swap = atoi(env); + env = getenv("CLKNETSIM_RTC_OFFSET"); + if (env) + rtc_offset = atof(env); + f = _fopen("/proc/self/comm", "r"); if (f) { command[0] = '\0'; @@ -325,6 +344,12 @@ } } + env = getenv("CLKNETSIM_PCAP_DUMP"); + if (env) { + pcap = _fopen(env, "w"); + write_pcap_header(); + } + if (fuzz_init()) { node = 0; subnets = 2; @@ -367,6 +392,7 @@ /* this requires the node variable to be already set */ srandom(0); + initializing = 0; initialized = 1; req.node = node; @@ -379,6 +405,9 @@ static void fini(void) { if (initialized) make_request(REQ_DEREGISTER, NULL, 0, NULL, 0); + + if (pcap) + fclose(pcap); } static void make_request(int request_id, const void *request_data, int reqlen, void *reply, int replylen) { @@ -470,6 +499,10 @@ return network_time - get_refclock_offset(); } +static double get_rtc_time(void) { + return get_monotonic_time() + rtc_offset; +} + static void settime(double time) { struct Request_settime req; @@ -707,6 +740,7 @@ timers[timer].timeout += timers[timer].interval; else timers[timer].armed = 0; + timers[timer].expired++; } static void time_to_timeval(double d, struct timeval *tv) { @@ -763,6 +797,87 @@ return (delay + phc_delay / 2.0) * (freq_error + 1.0); } +static int generate_eth_frame(unsigned int type, unsigned int subnet, unsigned int from, + unsigned int to, unsigned int src_port, unsigned int dst_port, + char *data, unsigned int data_len, char *frame, unsigned int buf_len) { + uint16_t port1, port2, ip_len, udp_len; + uint32_t addr1, addr2; + + assert(type == SOCK_DGRAM || type == SOCK_STREAM); + + if ((type == SOCK_DGRAM && data_len + 42 > buf_len) || + (type == SOCK_STREAM && data_len + 54 > buf_len)) + return 0; + + addr1 = htonl(NODE_ADDR(subnet, from)); + addr2 = htonl(NODE_ADDR(subnet, to)); + port1 = htons(src_port); + port2 = htons(dst_port); + + memset(frame, 0, buf_len); + frame[12] = 0x08; + frame[14] = 0x45; + memcpy(frame + 26, &addr1, sizeof (addr1)); + memcpy(frame + 30, &addr2, sizeof (addr2)); + memcpy(frame + 34, &port1, sizeof (port1)); + memcpy(frame + 36, &port2, sizeof (port2)); + + if (type == SOCK_DGRAM) { + ip_len = htons(data_len + 28); + udp_len = htons(data_len + 8); + memcpy(frame + 16, &ip_len, sizeof (ip_len)); + frame[23] = 17; + memcpy(frame + 38, &udp_len, sizeof (udp_len)); + memcpy(frame + 42, data, data_len); + return data_len + 42; + } else { + ip_len = htons(data_len + 40); + memcpy(frame + 16, &ip_len, sizeof (ip_len)); + frame[23] = 6; + frame[46] = 5 << 4; + memcpy(frame + 54, data, data_len); + return data_len + 54; + } +} + +static void write_pcap_header(void) { + /* Big-endian nanosecond pcap with DLT_EN10MB */ + const char header[] = "\xa1\xb2\x3c\x4d\x00\x02\x00\x04\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x01"; + if (!pcap) + return; + if (fwrite(header, sizeof (header) - 1, 1, pcap) != 1) + return; +} + +static void write_pcap_packet(unsigned int type, unsigned int subnet, unsigned int from, unsigned int to, + unsigned int src_port, unsigned int dst_port, char *data, unsigned int len) { + char frame[64 + MAX_PACKET_SIZE]; + unsigned int frame_len; + struct timespec ts; + uint32_t v; + + if (!pcap) + return; + + clock_gettime(CLOCK_REALTIME, &ts); + frame_len = generate_eth_frame(type, subnet, from, to, src_port, dst_port, + data, len, frame, sizeof (frame)); + + v = htonl(ts.tv_sec); + if (fwrite(&v, sizeof (v), 1, pcap) != 1) + return; + v = htonl(ts.tv_nsec); + if (fwrite(&v, sizeof (v), 1, pcap) != 1) + return; + v = htonl(frame_len); + if (fwrite(&v, sizeof (v), 1, pcap) != 1 || fwrite(&v, sizeof (v), 1, pcap) != 1) + return; + if (fwrite(frame, frame_len, 1, pcap) != 1) + return; + +} + int gettimeofday(struct timeval *tv, #if !defined(__GLIBC_PREREQ) || __GLIBC_PREREQ(2, 31) || defined(GETTIMEOFDAY_VOID) void *tz @@ -789,12 +904,10 @@ /* try to allow reading of the clock from other constructors, but prevent a recursive call (e.g. due to a special memory allocator) */ + init(); if (!initialized) { - if (initialized_symbols) { - errno = EINVAL; - return -1; - } - init(); + errno = EINVAL; + return -1; } switch (which_clock) { @@ -1009,6 +1122,13 @@ for (i = 0; i < nfds; i++) { if (!FD_ISSET(i, readfds)) continue; + + if (i == RTC_FD) { + if (rtc_timerfd > 0) + FD_SET(rtc_timerfd, readfds); + continue; + } + s = get_socket_from_fd(i); if ((s < 0 && get_timer_from_fd(i) < 0) || (s >= 0 && sockets[s].buffer.len > 0)) { @@ -1127,8 +1247,11 @@ if (readfds) { FD_ZERO(readfds); - if (recv_fd) + if (recv_fd) { + if (recv_fd == rtc_timerfd) + recv_fd = RTC_FD; FD_SET(recv_fd, readfds); + } } if (timeout) { @@ -1309,6 +1432,10 @@ return _realpath(path, resolved_path); } +char *__realpath_chk(const char *name, char *resolved_path, size_t buflen) { + return realpath(name, resolved_path); +} + int open(const char *pathname, int flags, ...) { int r, mode_arg = 0; mode_t mode = 0; @@ -1329,6 +1456,8 @@ return phc_swap ? REFCLK_FD : SYSCLK_FD; else if (!strcmp(pathname, "/dev/pps0")) return pps_fds++, PPS_FD; + else if (!strcmp(pathname, "/dev/rtc")) + return RTC_FD; else if (!strcmp(pathname, "/dev/urandom")) return URANDOM_FD; @@ -1345,6 +1474,8 @@ } ssize_t read(int fd, void *buf, size_t count) { + int t; + if (fd == URANDOM_FD) { size_t i; long r; @@ -1359,6 +1490,24 @@ } return count; + } else if (fd == RTC_FD) { + unsigned long d = RTC_UF | 1 << 8; + if (count < sizeof (d)) { + errno = EINVAL; + return -1; + } + memcpy(buf, &d, sizeof (d)); + return sizeof (d); + } else if ((t = get_timer_from_fd(fd)) >= 0) { + if (count < sizeof (timers[t].expired)) { + errno = EINVAL; + return -1; + } + + assert(timers[t].expired > 0); + memcpy(buf, &timers[t].expired, sizeof (timers[t].expired)); + timers[t].expired = 0; + return sizeof (timers[t].expired); } return _read(fd, buf, count); @@ -1367,7 +1516,7 @@ int close(int fd) { int t, s; - if (fd == REFCLK_FD || fd == SYSCLK_FD || fd == URANDOM_FD) { + if (fd == REFCLK_FD || fd == SYSCLK_FD || fd == RTC_FD || fd == URANDOM_FD) { return 0; } else if (fd == PPS_FD) { pps_fds--; @@ -1677,6 +1826,9 @@ int i, s = get_socket_from_fd(fd); va_list ap; + if (fd == RTC_FD) + return 0; + if (s < 0) { switch (cmd) { /* including fcntl.h breaks open() declaration */ @@ -1697,6 +1849,13 @@ if (fd == URANDOM_FD) return stat("/dev/urandom", statbuf); + if (fd == REFCLK_FD || fd == SYSCLK_FD) { + memset(statbuf, 0, sizeof (*statbuf)); + statbuf->st_mode = S_IFCHR | 0660; + statbuf->st_rdev = makedev(247, fd == REFCLK_FD ? 0 : 1); + return 0; + } + #ifdef HAVE_STAT assert(_fstat); return _fstat(fd, statbuf); @@ -1951,6 +2110,48 @@ data->info.assert_tu.nsec = (shm_refclock_time - data->info.assert_tu.sec) * 1e9; data->info.assert_tu.sec += system_time_offset; } + } else if (request == RTC_UIE_ON && fd == RTC_FD) { + struct itimerspec it; + + if (rtc_timerfd) + close(rtc_timerfd); + rtc_timerfd = timerfd_create(CLOCK_MONOTONIC, 0); + + it.it_interval.tv_sec = 1; + it.it_interval.tv_nsec = 0; + it.it_value.tv_sec = 0; + it.it_value.tv_nsec = (ceil(get_rtc_time()) - get_rtc_time() + 1e-6) * 1e9; + normalize_timespec(&it.it_value); + timerfd_settime(rtc_timerfd, 0, &it, NULL); + } else if (request == RTC_UIE_OFF && fd == RTC_FD) { + close(rtc_timerfd); + rtc_timerfd = 0; + } else if (request == RTC_RD_TIME && fd == RTC_FD) { + struct rtc_time *rtc = va_arg(ap, struct rtc_time *); + time_t t = (time_t)get_rtc_time() + system_time_offset; + struct tm *tm = gmtime(&t); + + rtc->tm_sec = tm->tm_sec; + rtc->tm_min = tm->tm_min; + rtc->tm_hour = tm->tm_hour; + rtc->tm_mday = tm->tm_mday; + rtc->tm_mon = tm->tm_mon; + rtc->tm_year = tm->tm_year; + rtc->tm_wday = tm->tm_wday; + rtc->tm_yday = tm->tm_yday; + rtc->tm_isdst = tm->tm_isdst; + } else if (request == RTC_SET_TIME && fd == RTC_FD) { + struct rtc_time *rtc = va_arg(ap, struct rtc_time *); + struct tm tm; + + tm.tm_sec = rtc->tm_sec; + tm.tm_min = rtc->tm_min; + tm.tm_hour = rtc->tm_hour; + tm.tm_mday = rtc->tm_mday; + tm.tm_mon = rtc->tm_mon; + tm.tm_year = rtc->tm_year; + tm.tm_isdst = 0; + rtc_offset -= get_rtc_time() + system_time_offset - (timegm(&tm) + 0.5); } else { ret = -1; errno = EINVAL; @@ -2089,6 +2290,9 @@ make_request(REQ_SEND, &req, offsetof(struct Request_send, data) + req.len, NULL, 0); + write_pcap_packet(sockets[s].type, req.subnet, node, req.to, + req.src_port, req.dst_port, req.data, req.len); + timestamping = sockets[s].time_stamping; for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR((struct msghdr *)msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMPING) @@ -2185,9 +2389,6 @@ assert(s >= 0); if (sockets[s].last_ts_msg.len && flags & MSG_ERRQUEUE) { - uint32_t addr; - uint16_t port; - /* last message looped back to the error queue */ last_ts_msg = &sockets[s].last_ts_msg; @@ -2201,20 +2402,12 @@ rep.src_port = last_ts_msg->port; rep.dst_port = sockets[s].port; - addr = htonl(NODE_ADDR(rep.subnet, rep.from)); - port = htons(rep.src_port); - /* put the message in an Ethernet frame */ - memset(rep.data, 0, 42); - rep.data[12] = 0x08; - rep.data[14] = 0x45; - rep.data[23] = 17; - memcpy(rep.data + 30, &addr, sizeof (addr)); - memcpy(rep.data + 36, &port, sizeof (port)); - - assert(last_ts_msg->len + 42 <= sizeof (rep.data)); - memcpy(rep.data + 42, last_ts_msg->data, last_ts_msg->len); - + rep.len = generate_eth_frame(sockets[s].type, last_ts_msg->subnet, + node, last_ts_msg->to, + sockets[s].port, last_ts_msg->port, + last_ts_msg->data, last_ts_msg->len, + rep.data, sizeof (rep.data)); rep.len = 42 + last_ts_msg->len; last_ts_msg->len = 0; @@ -2259,6 +2452,9 @@ default: assert(0); } + + write_pcap_packet(sockets[s].type, rep.subnet, rep.from, node, + rep.src_port, rep.dst_port, rep.data, rep.len); } assert(socket_in_subnet(s, rep.subnet)); @@ -2432,6 +2628,8 @@ timers[t].used = 1; timers[t].armed = 0; timers[t].type = TIMER_TYPE_SIGNAL; + timers[t].fd_flags = 0; + timers[t].expired = 0; timers[t].clock_id = which_clock; *created_timer_id = get_timerid(t); @@ -2464,6 +2662,7 @@ if (value->it_value.tv_sec || value->it_value.tv_nsec) { timers[t].armed = 1; + timers[t].expired = 0; timers[t].timeout = timespec_to_time(&value->it_value, 0); if (!(flags & TIMER_ABSTIME)) timers[t].timeout += get_monotonic_time(); @@ -2533,7 +2732,7 @@ int timerfd_create(int clockid, int flags) { int t; - assert((clockid == CLOCK_REALTIME || clockid == CLOCK_MONOTONIC) && !flags); + assert((clockid == CLOCK_REALTIME || clockid == CLOCK_MONOTONIC) && !(flags & ~TFD_NONBLOCK)); t = get_free_timer(); if (t < 0) { @@ -2545,6 +2744,8 @@ timers[t].used = 1; timers[t].armed = 0; timers[t].type = TIMER_TYPE_FD; + timers[t].fd_flags = flags; + timers[t].expired = 0; timers[t].clock_id = clockid; return get_timerfd(t); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/network.cc new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/network.cc --- old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/network.cc 2022-05-26 18:30:00.000000000 +0200 +++ new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/network.cc 2023-06-12 10:50:01.000000000 +0200 @@ -357,8 +357,15 @@ return; } - assert(packet->to < nodes.size() && packet->from < nodes.size() && - packet->subnet < subnets); + if (packet->to >= nodes.size() || packet->from >= nodes.size() || packet->subnet >= subnets) { +#ifdef DEBUG + printf("dropping packet of type %d from %d to %d:%d:%d at %f\n", + packet->type, packet->from, packet->subnet, packet->to, + packet->dst_port, time); +#endif + delete packet; + return; + } i = packet->from * nodes.size() + packet->to; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/node.cc new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/node.cc --- old/clknetsim-f00531bc9f652a6eb6ecfe0ad73da511c08c9936/node.cc 2022-05-26 18:30:00.000000000 +0200 +++ new/clknetsim-ef2a7a92b05bbefcacaf3ec4e265fd22c098d602/node.cc 2023-06-12 10:50:01.000000000 +0200 @@ -75,7 +75,7 @@ pending_request = request.header.request; #ifdef DEBUG - printf("received request %ld in node %d at %f\n", + printf("received request %d in node %d at %f\n", pending_request, index, clock.get_real_time()); #endif
