merge conflicts between ntp-4.2.8p1{4,5}

This commit is contained in:
christos 2022-10-09 21:41:03 +00:00
parent b8da6a3f08
commit 50c1bace96
45 changed files with 817 additions and 456 deletions

View File

@ -912,7 +912,7 @@ case "$host" in
;;
esac
AC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
AC_CHECK_FUNCS([strdup strerror setrlimit strchr])
AC_CHECK_FUNCS([strdup strnlen memchr strerror setrlimit strchr])
case "$host" in
*-*-aix[[4-9]]*)
# XXX only verified thru AIX6.

View File

@ -1,4 +1,4 @@
/* $NetBSD: l_stdlib.h,v 1.5 2020/05/25 20:47:19 christos Exp $ */
/* $NetBSD: l_stdlib.h,v 1.6 2022/10/09 21:41:03 christos Exp $ */
/*
* Proto types for machines that are not ANSI and POSIX compliant.
@ -223,4 +223,13 @@ extern int errno;
extern int h_errno;
#endif
#ifndef HAVE_MEMCHR
extern void *memchr(const void *s, int c, size_t n);
#endif
#ifndef HAVE_STRNLEN
extern size_t strnlen(const char *s, size_t n);
#endif
#endif /* L_STDLIB_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp.h,v 1.11 2020/05/25 20:47:19 christos Exp $ */
/* $NetBSD: ntp.h,v 1.12 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp.h - NTP definitions for the masses
@ -130,7 +130,7 @@ typedef char s_char;
#define MAX_TTL 8 /* max ttl mapping vector size */
#define BEACON 7200 /* manycast beacon interval */
#define NTP_MAXEXTEN 2048 /* max extension field size */
#define NTP_ORPHWAIT 300 /* orphan wair (s) */
#define NTP_ORPHWAIT 300 /* orphan wait (s) */
/*
* Miscellaneous stuff

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_config.h,v 1.13 2020/05/30 23:52:09 joerg Exp $ */
/* $NetBSD: ntp_config.h,v 1.14 2022/10/09 21:41:03 christos Exp $ */
#ifndef NTP_CONFIG_H
#define NTP_CONFIG_H
@ -277,6 +277,7 @@ typedef struct settrap_parms_tag {
int ifaddr_nonnull;
} settrap_parms;
/*
** Data Minimization Items
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: recvbuff.h,v 1.7 2020/05/25 20:47:20 christos Exp $ */
/* $NetBSD: recvbuff.h,v 1.8 2022/10/09 21:41:03 christos Exp $ */
#ifndef RECVBUFF_H
#define RECVBUFF_H
@ -12,10 +12,26 @@
/*
* recvbuf memory management
*/
#define RECV_INIT 10 /* 10 buffers initially */
#define RECV_INIT 64 /* 64 buffers initially */
#define RECV_LOWAT 3 /* when we're down to three buffers get more */
#define RECV_INC 5 /* get 5 more at a time */
#define RECV_TOOMANY 40 /* this is way too many buffers */
#define RECV_INC 32 /* [power of 2] get 32 more at a time */
#define RECV_BATCH 128 /* [power of 2] max increment in one sweep */
#define RECV_TOOMANY 4096 /* this should suffice, really. TODO: tos option? */
/* If we have clocks, keep an iron reserve of receive buffers for
* clocks only.
*/
#if defined(REFCLOCK)
# if !defined(RECV_CLOCK) || RECV_CLOCK == 0
# undef RECV_CLOCK
# define RECV_CLOCK 16
# endif
#else
# if defined(RECV_CLOCK)
# undef RECV_CLOCK
# endif
# define RECV_CLOCK 0
#endif
#if defined HAVE_IO_COMPLETION_PORT
# include "ntp_iocompletionport.h"
@ -92,10 +108,10 @@ extern void freerecvbuf(struct recvbuf *);
* you put it back with freerecvbuf() or
*/
/* signal safe - no malloc */
extern struct recvbuf *get_free_recv_buffer(void);
/* signal unsafe - may malloc, never returs NULL */
extern struct recvbuf *get_free_recv_buffer_alloc(void);
/* signal safe - no malloc, returns NULL when no bufs */
extern struct recvbuf *get_free_recv_buffer(int /*BOOL*/ urgent);
/* signal unsafe - may malloc, returns NULL when no bufs */
extern struct recvbuf *get_free_recv_buffer_alloc(int /*BOOL*/ urgent);
/* Add a buffer to the full list
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: int.h,v 1.6 2020/05/25 20:47:23 christos Exp $ */
/* $NetBSD: int.h,v 1.7 2022/10/09 21:41:03 christos Exp $ */
/*
* Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
@ -22,7 +22,9 @@
#ifndef ISC_INT_H
#define ISC_INT_H 1
#define _INTEGRAL_MAX_BITS 64
#ifndef _INTEGRAL_MAX_BITS
# define _INTEGRAL_MAX_BITS 64
#endif
#include <limits.h>
typedef __int8 isc_int8_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: a_md5encrypt.c,v 1.11 2020/05/25 20:47:24 christos Exp $ */
/* $NetBSD: a_md5encrypt.c,v 1.12 2022/10/09 21:41:03 christos Exp $ */
/*
* digest support for NTP, MD5 and with OpenSSL more
@ -95,7 +95,7 @@ make_mac(
}
cmac_fail:
if (ctx)
CMAC_CTX_cleanup(ctx);
CMAC_CTX_free(ctx);
}
else
# endif /*ENABLE_CMAC*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: decodenetnum.c,v 1.6 2020/05/25 20:47:24 christos Exp $ */
/* $NetBSD: decodenetnum.c,v 1.7 2022/10/09 21:41:03 christos Exp $ */
/*
* decodenetnum - return a net number (this is crude, but careful)
@ -15,106 +15,152 @@
#include "ntp.h"
#include "ntp_stdlib.h"
#include "ntp_assert.h"
#define PORTSTR(x) _PORTSTR(x)
#define _PORTSTR(x) #x
static int
isnumstr(
const char *s
/* If the given string position points to a decimal digit, parse the
* number. If this is not possible, or the parsing did not consume the
* whole string, or if the result exceeds the maximum value, return the
* default value.
*/
static unsigned long
_num_or_dflt(
char * sval,
unsigned long maxval,
unsigned long defval
)
{
while (*s >= '0' && *s <= '9')
++s;
return !*s;
char * ep;
unsigned long num;
if (!(sval && isdigit(*(unsigned char*)sval)))
return defval;
num = strtoul(sval, &ep, 10);
if (!*ep && num <= maxval)
return num;
return defval;
}
/* If the given string position is not NULL and does not point to the
* terminator, replace the character with NUL and advance the pointer.
* Return the resulting position.
*/
static inline char*
_chop(
char * sp)
{
if (sp && *sp)
*sp++ = '\0';
return sp;
}
/* If the given string position points to the given char, advance the
* pointer and return the result. Otherwise, return NULL.
*/
static inline char*
_skip(
char * sp,
int ch)
{
if (sp && *(unsigned char*)sp == ch)
return (sp + 1);
return NULL;
}
/*
* decodenetnum convert text IP address and port to sockaddr_u
*
* Returns 0 for failure, 1 for success.
* Returns FALSE (->0) for failure, TRUE (->1) for success.
*/
int
decodenetnum(
const char *num,
sockaddr_u *netnum
sockaddr_u *net
)
{
static const char * const servicename = "ntp";
static const char * const serviceport = PORTSTR(NTP_PORT);
/* Building a parser is more fun in Haskell, but here we go...
*
* This works through 'inet_pton()' taking the brunt of the
* work, after some string manipulations to split off URI
* brackets, ports and scope identifiers. The heuristics are
* simple but must hold for all _VALID_ addresses. inet_pton()
* will croak on bad ones later, but replicating the whole
* parser logic to detect errors is wasteful.
*/
struct addrinfo hints, *ai = NULL;
int err;
const char *host_str;
const char *port_str;
char *pp;
char *np;
char nbuf[80];
REQUIRE(num != NULL);
if (strlen(num) >= sizeof(nbuf)) {
printf("length error\n");
sockaddr_u netnum;
char buf[64]; /* working copy of input */
char *haddr=buf;
unsigned int port=NTP_PORT, scope=0;
unsigned short afam=AF_UNSPEC;
/* copy input to working buffer with length check */
if (strlcpy(buf, num, sizeof(buf)) >= sizeof(buf))
return FALSE;
}
port_str = servicename;
if ('[' != num[0]) {
/*
* to distinguish IPv6 embedded colons from a port
* specification on an IPv4 address, assume all
* legal IPv6 addresses have at least two colons.
*/
pp = strchr(num, ':');
if (NULL == pp)
host_str = num; /* no colons */
else if (NULL != strchr(pp + 1, ':'))
host_str = num; /* two or more colons */
else { /* one colon */
strlcpy(nbuf, num, sizeof(nbuf));
host_str = nbuf;
pp = strchr(nbuf, ':');
*pp = '\0';
port_str = pp + 1;
/* Identify address family and possibly the port, if given. If
* this results in AF_UNSPEC, we will fail in the next step.
*/
if (*haddr == '[') {
char * endp = strchr(++haddr, ']');
if (endp) {
port = _num_or_dflt(_skip(_chop(endp), ':'),
0xFFFFu, port);
afam = strchr(haddr, ':') ? AF_INET6 : AF_INET;
}
} else {
host_str = np = nbuf;
while (*++num && ']' != *num)
*np++ = *num;
*np = 0;
if (']' == num[0] && ':' == num[1] && '\0' != num[2])
port_str = &num[2];
char *col = strchr(haddr, ':');
char *dot = strchr(haddr, '.');
if (col == dot) {
/* no dot, no colon: bad! */
afam = AF_UNSPEC;
} else if (!col) {
/* no colon, only dot: IPv4! */
afam = AF_INET;
} else if (!dot || col < dot) {
/* no dot or 1st colon before 1st dot: IPv6! */
afam = AF_INET6;
} else {
/* 1st dot before 1st colon: must be IPv4 with port */
afam = AF_INET;
port = _num_or_dflt(_chop(col), 0xFFFFu, port);
}
}
if ( ! *host_str)
return FALSE;
if ( ! *port_str)
port_str = servicename;
ZERO(hints);
hints.ai_flags |= Z_AI_NUMERICHOST;
if (isnumstr(port_str))
hints.ai_flags |= Z_AI_NUMERICSERV;
err = getaddrinfo(host_str, port_str, &hints, &ai);
/* retry with default service name if the service lookup failed */
if (err == EAI_SERVICE && strcmp(port_str, servicename)) {
hints.ai_flags &= ~Z_AI_NUMERICSERV;
port_str = servicename;
err = getaddrinfo(host_str, port_str, &hints, &ai);
}
/* retry another time with default service port if the service lookup failed */
if (err == EAI_SERVICE && strcmp(port_str, serviceport)) {
hints.ai_flags |= Z_AI_NUMERICSERV;
port_str = serviceport;
err = getaddrinfo(host_str, port_str, &hints, &ai);
}
if (err != 0)
return FALSE;
INSIST(ai->ai_addrlen <= sizeof(*netnum));
ZERO(*netnum);
memcpy(netnum, ai->ai_addr, ai->ai_addrlen);
freeaddrinfo(ai);
/* Since we don't know about additional members in the address
* structures, we wipe the result buffer thoroughly:
*/
memset(&netnum, 0, sizeof(netnum));
/* For AF_INET6, evaluate and remove any scope suffix. Have
* inet_pton() do the real work for AF_INET and AF_INET6, bail
* out otherwise:
*/
switch (afam) {
case AF_INET:
if (inet_pton(afam, haddr, &netnum.sa4.sin_addr) <= 0)
return FALSE;
netnum.sa4.sin_port = htons((unsigned short)port);
break;
case AF_INET6:
scope = _num_or_dflt(_chop(strchr(haddr, '%')), 0xFFFFFFFFu, scope);
if (inet_pton(afam, haddr, &netnum.sa6.sin6_addr) <= 0)
return FALSE;
netnum.sa6.sin6_port = htons((unsigned short)port);
netnum.sa6.sin6_scope_id = scope;
break;
case AF_UNSPEC:
default:
return FALSE;
}
/* Collect the remaining pieces and feed the output, which was
* not touched so far:
*/
netnum.sa.sa_family = afam;
memcpy(net, &netnum, sizeof(netnum));
return TRUE;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: recvbuff.c,v 1.8 2020/05/25 20:47:24 christos Exp $ */
/* $NetBSD: recvbuff.c,v 1.9 2022/10/09 21:41:03 christos Exp $ */
#ifdef HAVE_CONFIG_H
# include <config.h>
@ -13,6 +13,15 @@
#include "recvbuff.h"
#include "iosignal.h"
#if (RECV_INC & (RECV_INC-1))
# error RECV_INC not a power of 2!
#endif
#if (RECV_BATCH & (RECV_BATCH - 1))
#error RECV_BATCH not a power of 2!
#endif
#if (RECV_BATCH < RECV_INC)
#error RECV_BATCH must be >= RECV_INC!
#endif
/*
* Memory allocation
@ -23,6 +32,8 @@ static u_long volatile total_recvbufs; /* total recvbufs currently in use */
static u_long volatile lowater_adds; /* number of times we have added memory */
static u_long volatile buffer_shortfall;/* number of missed free receive buffers
between replenishments */
static u_long limit_recvbufs; /* maximum total of receive buffers */
static u_long emerg_recvbufs; /* emergency/urgent buffers to keep */
static DECL_FIFO_ANCHOR(recvbuf_t) full_recv_fifo;
static recvbuf_t * free_recv_list;
@ -35,11 +46,16 @@ static recvbuf_t * free_recv_list;
* short a time as possible
*/
static CRITICAL_SECTION RecvLock;
# define LOCK() EnterCriticalSection(&RecvLock)
# define UNLOCK() LeaveCriticalSection(&RecvLock)
static CRITICAL_SECTION FreeLock;
# define LOCK_R() EnterCriticalSection(&RecvLock)
# define UNLOCK_R() LeaveCriticalSection(&RecvLock)
# define LOCK_F() EnterCriticalSection(&FreeLock)
# define UNLOCK_F() LeaveCriticalSection(&FreeLock)
#else
# define LOCK() do {} while (FALSE)
# define UNLOCK() do {} while (FALSE)
# define LOCK_R() do {} while (FALSE)
# define UNLOCK_R() do {} while (FALSE)
# define LOCK_F() do {} while (FALSE)
# define UNLOCK_F() do {} while (FALSE)
#endif
#ifdef DEBUG
@ -78,33 +94,52 @@ initialise_buffer(recvbuf_t *buff)
}
static void
create_buffers(int nbufs)
create_buffers(
size_t nbufs)
{
register recvbuf_t *bufp;
int i, abuf;
# ifndef DEBUG
static const u_int chunk = RECV_INC;
# else
/* Allocate each buffer individually so they can be free()d
* during ntpd shutdown on DEBUG builds to keep them out of heap
* leak reports.
*/
static const u_int chunk = 1;
# endif
register recvbuf_t *bufp;
u_int i;
size_t abuf;
if (limit_recvbufs <= total_recvbufs)
return;
abuf = nbufs + buffer_shortfall;
buffer_shortfall = 0;
#ifndef DEBUG
bufp = eallocarray(abuf, sizeof(*bufp));
#endif
for (i = 0; i < abuf; i++) {
#ifdef DEBUG
/*
* Allocate each buffer individually so they can be
* free()d during ntpd shutdown on DEBUG builds to
* keep them out of heap leak reports.
*/
bufp = emalloc_zero(sizeof(*bufp));
#endif
LINK_SLIST(free_recv_list, bufp, link);
bufp++;
free_recvbufs++;
total_recvbufs++;
if (abuf < nbufs || abuf > RECV_BATCH)
abuf = RECV_BATCH; /* clamp on overflow */
else
abuf += (~abuf + 1) & (RECV_INC - 1); /* round up */
if (abuf > (limit_recvbufs - total_recvbufs))
abuf = limit_recvbufs - total_recvbufs;
abuf += (~abuf + 1) & (chunk - 1); /* round up */
while (abuf) {
bufp = calloc(chunk, sizeof(*bufp));
if (!bufp) {
limit_recvbufs = total_recvbufs;
break;
}
for (i = chunk; i; --i,++bufp) {
LINK_SLIST(free_recv_list, bufp, link);
}
free_recvbufs += chunk;
total_recvbufs += chunk;
abuf -= chunk;
}
lowater_adds++;
++lowater_adds;
}
void
@ -117,15 +152,19 @@ init_recvbuff(int nbufs)
free_recvbufs = total_recvbufs = 0;
full_recvbufs = lowater_adds = 0;
limit_recvbufs = RECV_TOOMANY;
emerg_recvbufs = RECV_CLOCK;
create_buffers(nbufs);
#if defined(SYS_WINNT)
# if defined(SYS_WINNT)
InitializeCriticalSection(&RecvLock);
#endif
InitializeCriticalSection(&FreeLock);
# endif
#ifdef DEBUG
# ifdef DEBUG
atexit(&uninit_recvbuff);
#endif
# endif
}
@ -148,6 +187,10 @@ uninit_recvbuff(void)
break;
free(rbunlinked);
}
# if defined(SYS_WINNT)
DeleteCriticalSection(&FreeLock);
DeleteCriticalSection(&RecvLock);
# endif
}
#endif /* DEBUG */
@ -159,13 +202,14 @@ void
freerecvbuf(recvbuf_t *rb)
{
if (rb) {
LOCK();
rb->used--;
if (rb->used != 0)
if (--rb->used != 0) {
msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used);
rb->used = 0;
}
LOCK_F();
LINK_SLIST(free_recv_list, rb, link);
free_recvbufs++;
UNLOCK();
++free_recvbufs;
UNLOCK_F();
}
}
@ -177,28 +221,34 @@ add_full_recv_buffer(recvbuf_t *rb)
msyslog(LOG_ERR, "add_full_recv_buffer received NULL buffer");
return;
}
LOCK();
LOCK_R();
LINK_FIFO(full_recv_fifo, rb, link);
full_recvbufs++;
UNLOCK();
++full_recvbufs;
UNLOCK_R();
}
recvbuf_t *
get_free_recv_buffer(void)
get_free_recv_buffer(
int /*BOOL*/ urgent
)
{
recvbuf_t *buffer;
recvbuf_t *buffer = NULL;
LOCK();
UNLINK_HEAD_SLIST(buffer, free_recv_list, link);
if (buffer != NULL) {
free_recvbufs--;
initialise_buffer(buffer);
buffer->used++;
} else {
buffer_shortfall++;
LOCK_F();
if (free_recvbufs > (urgent ? emerg_recvbufs : 0)) {
UNLINK_HEAD_SLIST(buffer, free_recv_list, link);
}
UNLOCK();
if (buffer != NULL) {
if (free_recvbufs)
--free_recvbufs;
initialise_buffer(buffer);
++buffer->used;
} else {
++buffer_shortfall;
}
UNLOCK_F();
return buffer;
}
@ -206,17 +256,15 @@ get_free_recv_buffer(void)
#ifdef HAVE_IO_COMPLETION_PORT
recvbuf_t *
get_free_recv_buffer_alloc(void)
get_free_recv_buffer_alloc(
int /*BOOL*/ urgent
)
{
recvbuf_t *buffer;
buffer = get_free_recv_buffer();
if (NULL == buffer) {
LOCK_F();
if (free_recvbufs <= emerg_recvbufs || buffer_shortfall > 0)
create_buffers(RECV_INC);
buffer = get_free_recv_buffer();
}
ENSURE(buffer != NULL);
return (buffer);
UNLOCK_F();
return get_free_recv_buffer(urgent);
}
#endif
@ -226,30 +274,26 @@ get_full_recv_buffer(void)
{
recvbuf_t * rbuf;
LOCK();
/*
* make sure there are free buffers when we
* wander off to do lengthy packet processing with
* any buffer we grab from the full list.
* make sure there are free buffers when we wander off to do
* lengthy packet processing with any buffer we grab from the
* full list.
*
* fixes malloc() interrupted by SIGIO risk
* (Bug 889)
* fixes malloc() interrupted by SIGIO risk (Bug 889)
*/
if (NULL == free_recv_list || buffer_shortfall > 0) {
/*
* try to get us some more buffers
*/
LOCK_F();
if (free_recvbufs <= emerg_recvbufs || buffer_shortfall > 0)
create_buffers(RECV_INC);
}
UNLOCK_F();
/*
* try to grab a full buffer
*/
LOCK_R();
UNLINK_FIFO(rbuf, full_recv_fifo, link);
if (rbuf != NULL)
full_recvbufs--;
UNLOCK();
if (rbuf != NULL && full_recvbufs)
--full_recvbufs;
UNLOCK_R();
return rbuf;
}
@ -267,12 +311,18 @@ purge_recv_buffers_for_fd(
recvbuf_t *rbufp;
recvbuf_t *next;
recvbuf_t *punlinked;
recvbuf_t *freelist = NULL;
LOCK();
/* We want to hold only one lock at a time. So we do a scan on
* the full buffer queue, collecting items as we go, and when
* done we spool the the collected items to 'freerecvbuf()'.
*/
LOCK_R();
for (rbufp = HEAD_FIFO(full_recv_fifo);
rbufp != NULL;
rbufp = next) {
rbufp = next)
{
next = rbufp->link;
# ifdef HAVE_IO_COMPLETION_PORT
if (rbufp->dstadr == NULL && rbufp->fd == fd)
@ -283,12 +333,20 @@ purge_recv_buffers_for_fd(
UNLINK_MID_FIFO(punlinked, full_recv_fifo,
rbufp, link, recvbuf_t);
INSIST(punlinked == rbufp);
full_recvbufs--;
freerecvbuf(rbufp);
if (full_recvbufs)
--full_recvbufs;
rbufp->link = freelist;
freelist = rbufp;
}
}
UNLOCK();
UNLOCK_R();
while (freelist) {
next = freelist->link;
freerecvbuf(freelist);
freelist = next;
}
}

View File

@ -1,15 +1,17 @@
/* $NetBSD: strdup.c,v 1.5 2020/05/25 20:47:24 christos Exp $ */
/* $NetBSD: strdup.c,v 1.6 2022/10/09 21:41:03 christos Exp $ */
#include <config.h>
#include <ntp_assert.h>
#include "ntp_malloc.h"
#include <string.h>
#include "ntp_malloc.h"
#include "l_stdlib.h"
#define STRDUP_EMPTY_UNIT
#ifndef HAVE_STRDUP
# undef STRDUP_EMPTY_UNIT
char *strdup(const char *s);
char *
strdup(
const char *s
@ -26,6 +28,30 @@ strdup(
return cp;
}
#else
#endif
#ifndef HAVE_MEMCHR
# undef STRDUP_EMPTY_UNIT
void *memchr(const void *s, int c, size_t n)
{
const unsigned char *p = s;
while (n && *p != c) {
--n;
++p;
}
return n ? (char*)p : NULL;
}
#endif
#ifndef HAVE_STRNLEN
# undef STRDUP_EMPTY_UNIT
size_t strnlen(const char *s, size_t n)
{
const char *e = memchr(s, 0, n);
return e ? (size_t)(e - s) : n;
}
#endif
#ifdef STRDUP_EMPTY_UNIT
int strdup_c_nonempty_compilation_unit;
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: timexsup.c,v 1.3 2020/05/29 20:15:14 christos Exp $ */
/* $NetBSD: timexsup.c,v 1.4 2022/10/09 21:41:03 christos Exp $ */
/*
* timexsup.c - 'struct timex' support functions
@ -35,8 +35,8 @@ clamp_rounded(
if (dval <= (double)LONG_MIN)
return LONG_MIN;
return (long)dval;
}
double
dbl_from_var_long(
long lval,
@ -83,4 +83,3 @@ usec_long_from_dbl(
{
return clamp_rounded(dval * 1e+6);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_config.c,v 1.24 2020/05/30 23:52:09 joerg Exp $ */
/* $NetBSD: ntp_config.c,v 1.25 2022/10/09 21:41:03 christos Exp $ */
/* ntp_config.c
*
@ -148,6 +148,16 @@ typedef struct peer_resolved_ctx_tag {
#define MAXPHONE 10 /* maximum number of phone strings */
#define MAXPPS 20 /* maximum length of PPS device string */
/*
* Poll Skew List
*/
static psl_item psl[17-3+1]; /* values for polls 3-17 */
/* To simplify the runtime code we */
/* don't want to have to special-case */
/* dealing with a default */
/*
* Miscellaneous macros
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_io.c,v 1.31 2021/01/31 08:27:49 roy Exp $ */
/* $NetBSD: ntp_io.c,v 1.32 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp_io.c - input/output routines for ntpd. The socket-opening code
@ -3300,15 +3300,20 @@ read_refclock_packet(
int consumed;
struct recvbuf * rb;
rb = get_free_recv_buffer();
rb = get_free_recv_buffer(TRUE);
if (NULL == rb) {
/*
* No buffer space available - just drop the packet
* No buffer space available - just drop the 'packet'.
* Since this is a non-blocking character stream we read
* all data that we can.
*
* ...hmmmm... what about "tcflush(fd,TCIFLUSH)" here?!?
*/
char buf[RX_BUFF_SIZE];
buflen = read(fd, buf, sizeof buf);
char buf[128];
do
buflen = read(fd, buf, sizeof(buf));
while (buflen > 0);
packets_dropped++;
return (buflen);
}
@ -3494,15 +3499,18 @@ read_network_packet(
#endif
/*
* Get a buffer and read the frame. If we
* haven't got a buffer, or this is received
* on a disallowed socket, just dump the
* Get a buffer and read the frame. If we haven't got a buffer,
* or this is received on a disallowed socket, just dump the
* packet.
*/
rb = get_free_recv_buffer();
if (NULL == rb || itf->ignore_packets) {
char buf[RX_BUFF_SIZE];
rb = itf->ignore_packets ? NULL : get_free_recv_buffer(FALSE);
if (NULL == rb) {
/* A partial read on a UDP socket truncates the data and
* removes the message from the queue. So there's no
* need to have a full buffer here on the stack.
*/
char buf[16];
sockaddr_u from;
if (rb != NULL)
@ -4756,12 +4764,14 @@ process_routing_msgs(struct asyncio_reader *reader)
#ifdef HAVE_RTNETLINK
for (nh = UA_PTR(struct nlmsghdr, buffer);
NLMSG_OK(nh, cnt);
nh = NLMSG_NEXT(nh, cnt)) {
nh = NLMSG_NEXT(nh, cnt))
{
msg_type = nh->nlmsg_type;
#else
for (p = buffer;
(p + sizeof(struct rt_msghdr)) <= (buffer + cnt);
p += rtm.rtm_msglen) {
p += rtm.rtm_msglen)
{
memcpy(&rtm, p, sizeof(rtm));
if (rtm.rtm_version != RTM_VERSION) {
msyslog(LOG_ERR,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_proto.c,v 1.18 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: ntp_proto.c,v 1.19 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp_proto.c - NTP version 4 protocol machinery
@ -1335,9 +1335,10 @@ receive(
* manycaster has already synchronized to us.
*/
if ( sys_leap == LEAP_NOTINSYNC
|| sys_stratum >= hisstratum
|| sys_stratum > hisstratum + 1
|| (!sys_cohort && sys_stratum == hisstratum + 1)
|| rbufp->dstadr->addr_refid == pkt->refid) {
DPRINTF(2, ("receive: sys leap: %0x, sys_stratum %d > hisstratum+1 %d, !sys_cohort %d && sys_stratum == hisstratum+1, loop refid %#x == pkt refid %#x\n", sys_leap, sys_stratum, hisstratum + 1, !sys_cohort, rbufp->dstadr->addr_refid, pkt->refid));
DPRINTF(2, ("receive: AM_FXMIT drop: LEAP_NOTINSYNC || stratum || loop\n"));
sys_declined++;
return; /* no help */
@ -1683,8 +1684,9 @@ receive(
* MODE_ACTIVE KoDs, which will time out eventually.
*/
if ( hisleap != LEAP_NOTINSYNC
&& (hisstratum < sys_floor || hisstratum >= sys_ceiling)) {
DPRINTF(2, ("receive: AM_NEWPASS drop: Autokey group mismatch\n"));
&& (hisstratum < sys_floor || hisstratum >= sys_ceiling)) {
DPRINTF(2, ("receive: AM_NEWPASS drop: Remote stratum (%d) out of range\n",
hisstratum));
sys_declined++;
return; /* no help */
}
@ -2487,10 +2489,6 @@ process_packet(
double etemp, ftemp, td;
#endif /* ASSYM */
#if 0
sys_processed++;
peer->processed++;
#endif
p_del = FPTOD(NTOHS_FP(pkt->rootdelay));
p_offset = 0;
p_disp = FPTOD(NTOHS_FP(pkt->rootdisp));
@ -2503,10 +2501,6 @@ process_packet(
pversion = PKT_VERSION(pkt->li_vn_mode);
pstratum = PKT_TO_STRATUM(pkt->stratum);
/**/
/**/
/*
* Verify the server is synchronized; that is, the leap bits,
* stratum and root distance are valid.
@ -2526,19 +2520,15 @@ process_packet(
peer->seldisptoolarge++;
DPRINTF(1, ("packet: flash header %04x\n",
peer->flash));
/* ppoll updated? */
/* XXX: Fuzz the poll? */
poll_update(peer, peer->hpoll, (peer->hmode == MODE_CLIENT));
/* [Bug 3592] do *not* update poll on bad packets! */
return;
}
/**/
#if 1
/*
* update stats, now that we really handle this packet:
*/
sys_processed++;
peer->processed++;
#endif
/*
* Capture the header values in the client/peer association..
@ -2573,9 +2563,6 @@ process_packet(
if (peer->burst > 0)
peer->nextdate = current_time;
}
poll_update(peer, peer->hpoll, (peer->hmode == MODE_CLIENT));
/**/
/*
* If the peer was previously unreachable, raise a trap. In any
@ -3457,11 +3444,13 @@ clock_select(void)
double d, e, f, g;
double high, low;
double speermet;
double lastresort_dist = MAXDISPERSE;
double orphmet = 2.0 * U_INT32_MAX; /* 2x is greater than */
struct endpoint endp;
struct peer *osys_peer;
struct peer *sys_prefer = NULL; /* prefer peer */
struct peer *typesystem = NULL;
struct peer *typelastresort = NULL;
struct peer *typeorphan = NULL;
#ifdef REFCLOCK
struct peer *typeacts = NULL;
@ -3525,6 +3514,22 @@ clock_select(void)
continue;
}
/*
* If we have never been synchronised, look for any peer
* which has ever been synchronised and pick the one which
* has the lowest root distance. This can be used as a last
* resort if all else fails. Once we get an initial sync
* with this peer, sys_reftime gets set and so this
* function becomes disabled.
*/
if (L_ISZERO(&sys_reftime)) {
d = root_distance(peer);
if (!L_ISZERO(&peer->reftime) && d < lastresort_dist) {
typelastresort = peer;
lastresort_dist = d;
}
}
/*
* If this peer is an orphan parent, elect the
* one with the lowest metric defined as the
@ -3758,6 +3763,9 @@ clock_select(void)
if (typeorphan != NULL) {
peers[0].peer = typeorphan;
nlist = 1;
} else if (typelastresort != NULL) {
peers[0].peer = typelastresort;
nlist = 1;
}
}
@ -3951,8 +3959,7 @@ clock_select(void)
*/
if (typesystem == NULL) {
if (osys_peer != NULL) {
if (sys_orphwait > 0)
orphwait = current_time + sys_orphwait;
orphwait = current_time + sys_orphwait;
report_event(EVNT_NOPEER, NULL, NULL);
}
sys_peer = NULL;
@ -5346,7 +5353,7 @@ proto_config(
case PROTO_ORPHWAIT: /* orphan wait (orphwait) */
orphwait -= sys_orphwait;
sys_orphwait = (int)dvalue;
sys_orphwait = (dvalue >= 1) ? (int)dvalue : NTP_ORPHWAIT;
orphwait += sys_orphwait;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_refclock.c,v 1.13 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: ntp_refclock.c,v 1.14 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp_refclock - processing support for reference clocks
@ -50,15 +50,15 @@
* structure, which contains for most drivers the decimal equivalants
* of the year, day, month, hour, second and millisecond/microsecond
* decoded from the ASCII timecode. Additional information includes
* the receive timestamp, exception report, statistics tallies, etc.
* the receive timestamp, exception report, statistics tallies, etc.
* In addition, there may be a driver-specific unit structure used for
* local control of the device.
*
* The support routines are passed a pointer to the peer structure,
* which is used for all peer-specific processing and contains a
* pointer to the refclockproc structure, which in turn contains a
* pointer to the unit structure, if used. The peer structure is
* identified by an interface address in the dotted quad form
* pointer to the unit structure, if used. The peer structure is
* identified by an interface address in the dotted quad form
* 127.127.t.u, where t is the clock type and u the unit.
*/
#define FUDGEFAC .1 /* fudge correction factor */
@ -345,7 +345,7 @@ refclock_timer(
if (pp->action != NULL && pp->nextaction <= current_time)
(*pp->action)(p);
}
/*
* refclock_transmit - simulate the transmit procedure
@ -437,17 +437,17 @@ refclock_samples_avail(
)
{
u_int na;
# if MAXSTAGE & (MAXSTAGE - 1)
na = pp->coderecv - pp->codeproc;
if (na > MAXSTAGE)
na += MAXSTAGE;
# else
na = (pp->coderecv - pp->codeproc) & (MAXSTAGE - 1);
# endif
return na;
}
@ -464,26 +464,26 @@ refclock_samples_expire(
)
{
u_int na;
if (nd <= 0)
return 0;
# if MAXSTAGE & (MAXSTAGE - 1)
na = pp->coderecv - pp->codeproc;
if (na > MAXSTAGE)
na += MAXSTAGE;
if ((u_int)nd < na)
nd = na;
nd = na;
pp->codeproc = (pp->codeproc + nd) % MAXSTAGE;
# else
na = (pp->coderecv - pp->codeproc) & (MAXSTAGE - 1);
if ((u_int)nd > na)
nd = (int)na;
pp->codeproc = (pp->codeproc + nd) & (MAXSTAGE - 1);
# endif
return nd;
}
@ -617,14 +617,14 @@ refclock_sample(
/*
* Determine the offset and jitter.
*/
pp->offset = 0;
pp->offset = off[i];
pp->jitter = 0;
for (k = i; k < j; k++) {
for (k = i + 1; k < j; k++) {
pp->offset += off[k];
if (k > i)
pp->jitter += SQUARE(off[k] - off[k - 1]);
pp->jitter += SQUARE(off[k] - off[k - 1]);
}
pp->offset /= m;
m -= (m > 1); /* only (m-1) terms attribute to jitter! */
pp->jitter = max(SQRT(pp->jitter / m), LOGTOD(sys_precision));
/*
@ -738,7 +738,7 @@ refclock_gtlin(
while (sp != spend && dp != dpend) {
char c;
c = *sp++ & 0x7f;
if (c >= 0x20 && c < 0x7f)
*dp++ = c;
@ -1409,7 +1409,7 @@ refclock_params(
ap->pps_params.mode & ~PPS_TSFMT_TSPEC,
PPS_TSFMT_TSPEC) < 0)
{
if (errno != EOPNOTSUPP) {
if (errno != EOPNOTSUPP) {
msyslog(LOG_ERR,
"refclock_params: time_pps_kcbind: %m");
return (0);
@ -1433,7 +1433,7 @@ int
refclock_pps(
struct peer *peer, /* peer structure pointer */
struct refclock_atom *ap, /* atom structure pointer */
int mode /* mode bits */
int mode /* mode bits */
)
{
struct refclockproc *pp;
@ -1445,7 +1445,7 @@ refclock_pps(
* We require the clock to be synchronized before setting the
* parameters. When the parameters have been set, fetch the
* most recent PPS timestamp.
*/
*/
pp = peer->procptr;
if (ap->handle == 0)
return (0);
@ -1521,7 +1521,7 @@ refclock_pps(
pp->lastrec.l_uf = (u_int32)(dtemp * FRAC);
clk_add_sample(pp, dcorr);
refclock_checkburst(peer, pp);
#ifdef DEBUG
if (debug > 1)
printf("refclock_pps: %lu %f %f\n", current_time,
@ -1581,7 +1581,7 @@ refclock_ppsaugment(
)
{
l_fp delta[1];
#ifdef HAVE_PPSAPI
pps_info_t pps_info;
@ -1591,14 +1591,14 @@ refclock_ppsaugment(
static const uint32_t s_plim_hi = UINT32_C(1932735284);
static const uint32_t s_plim_lo = UINT32_C(2362232013);
/* fixup receive time in case we have to bail out early */
DTOLFP(rcvfudge, delta);
L_SUB(rcvtime, delta);
if (NULL == ap)
return FALSE;
ZERO(timeout);
ZERO(pps_info);
@ -1632,7 +1632,7 @@ refclock_ppsaugment(
phase = delta->l_ui;
if (phase >= 2 && phase < (uint32_t)-2)
return FALSE; /* PPS is stale, don't use it */
/* If the phase is too close to 0.5, the decision whether to
* move up or down is becoming noise sensitive. That is, we
* might amplify usec noise between samples into seconds with a
@ -1644,7 +1644,7 @@ refclock_ppsaugment(
phase = delta->l_uf;
if (phase > s_plim_hi && phase < s_plim_lo)
return FALSE; /* we're in the noise lock gap */
/* sign-extend fraction into seconds */
delta->l_ui = UINT32_C(0) - ((phase >> 31) & 1);
/* add it up now */
@ -1652,7 +1652,7 @@ refclock_ppsaugment(
return TRUE;
# else /* have no PPS support at all */
/* just fixup receive time and fail */
UNUSED_ARG(ap);
UNUSED_ARG(ppsfudge);
@ -1660,7 +1660,7 @@ refclock_ppsaugment(
DTOLFP(rcvfudge, delta);
L_SUB(rcvtime, delta);
return FALSE;
# endif
}
@ -1696,7 +1696,7 @@ refclock_checkburst(
* reach mask. With less samples available, we break away.
*/
needs = peer->reach;
needs -= (needs >> 1) & 0x55;
needs -= (needs >> 1) & 0x55;
needs = (needs & 0x33) + ((needs >> 2) & 0x33);
needs = (needs + (needs >> 4)) & 0x0F;
if (needs > 6)
@ -1708,7 +1708,7 @@ refclock_checkburst(
/* Get serious. Reduce the poll to minimum and schedule early.
* (Changing the peer poll is probably in vain, as it will be
* re-adjusted, but maybe some time the hint will work...)
* re-adjusted, but maybe some time the hint will work...)
*/
peer->hpoll = peer->minpoll;
peer->nextdate = limit;
@ -1751,7 +1751,7 @@ refclock_vformat_lcode(
len = 0;
else if ((size_t)len >= sizeof(pp->a_lastcode))
len = sizeof(pp->a_lastcode) - 1;
pp->lencode = (u_short)len;
pp->a_lastcode[len] = '\0';
/* !note! the NUL byte is needed in case vsnprintf() really fails */
@ -1765,10 +1765,10 @@ refclock_format_lcode(
)
{
va_list va;
va_start(va, fmt);
refclock_vformat_lcode(pp, fmt, va);
va_end(va);
va_end(va);
}
#endif /* REFCLOCK */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_request.c,v 1.17 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: ntp_request.c,v 1.18 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp_request.c - respond to information requests
@ -1186,7 +1186,7 @@ mem_stats(
for (i = 0; i < NTP_HASH_SIZE; i++)
ms->hashcount[i] = (u_char)
max((u_int)peer_hash_count[i], UCHAR_MAX);
min((u_int)peer_hash_count[i], UCHAR_MAX);
(void) more_pkt();
flush_pkt();

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_timer.c,v 1.10 2021/02/18 15:13:37 kardel Exp $ */
/* $NetBSD: ntp_timer.c,v 1.11 2022/10/09 21:41:03 christos Exp $ */
/*
* ntp_timer.c - event timer support routines
@ -352,21 +352,38 @@ timer(void)
* than the orphan stratum are available. A server with no other
* synchronization source is an orphan. It shows offset zero and
* reference ID the loopback address.
*
* [bug 3644] If the orphan stratum is >= STRATUM_UNSPEC, we
* have to do it a bit different. 'clock_select()' simply
* tiptoed home, but since we're unsync'd and have no peer, we
* should eventually declare we're out of sync. Otherwise we
* would persistently claim we're good, and we're everything but
* that...
*
* XXX: do we want to log an event about this?
*/
if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL &&
current_time > orphwait) {
if (sys_leap == LEAP_NOTINSYNC) {
set_sys_leap(LEAP_NOWARNING);
if (sys_peer == NULL && current_time > orphwait) {
if (sys_orphan < STRATUM_UNSPEC) {
if (sys_leap == LEAP_NOTINSYNC) {
set_sys_leap(LEAP_NOWARNING);
#ifdef AUTOKEY
if (crypto_flags)
crypto_update();
if (crypto_flags)
crypto_update();
#endif /* AUTOKEY */
}
sys_stratum = (u_char)sys_orphan;
} else {
if (sys_leap != LEAP_NOTINSYNC) {
set_sys_leap(LEAP_NOTINSYNC);
msyslog(LOG_WARNING, "%s",
"no peer for too long, server running free now");
}
sys_stratum = STRATUM_UNSPEC;
}
sys_stratum = (u_char)sys_orphan;
if (sys_stratum > 1)
sys_refid = htonl(LOOPBACKADR);
sys_refid = htonl(LOOPBACKADR);
else
memcpy(&sys_refid, "LOOP", 4);
memcpy(&sys_refid, "LOOP", 4);
sys_offset = 0;
sys_rootdelay = 0;
sys_rootdisp = 0;

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpd-opts.c,v 1.13 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: ntpd-opts.c,v 1.14 2022/10/09 21:41:03 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:40:30 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:04 AM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@ -77,7 +77,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpd options
*/
static char const ntpd_opt_strs[3132] =
/* 0 */ "ntpd 4.2.8p14\n"
/* 0 */ "ntpd 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -207,12 +207,12 @@ static char const ntpd_opt_strs[3132] =
/* 2901 */ "output version information and exit\0"
/* 2937 */ "version\0"
/* 2945 */ "NTPD\0"
/* 2950 */ "ntpd - NTP daemon program - Ver. 4.2.8p14\n"
/* 2950 */ "ntpd - NTP daemon program - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ <server1> ... <serverN> ]\n\0"
/* 3082 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 3116 */ "\n\0"
/* 3118 */ "ntpd 4.2.8p14";
/* 3118 */ "ntpd 4.2.8p15";
/**
* ipv4 option description with
@ -1531,7 +1531,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdOptions.pzCopyright */
puts(_("ntpd 4.2.8p14\n\
puts(_("ntpd 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -1672,7 +1672,7 @@ implied warranty.\n"));
puts(_("output version information and exit"));
/* referenced via ntpdOptions.pzUsageTitle */
puts(_("ntpd - NTP daemon program - Ver. 4.2.8p14\n\
puts(_("ntpd - NTP daemon program - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ <server1> ... <serverN> ]\n"));
@ -1680,7 +1680,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via ntpdOptions.pzFullVersion */
puts(_("ntpd 4.2.8p14"));
puts(_("ntpd 4.2.8p15"));
/* referenced via ntpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpd-opts.h,v 1.16 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: ntpd-opts.h,v 1.17 2022/10/09 21:41:03 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:40:30 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:04 AM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@ -108,9 +108,9 @@ typedef enum {
/** count of all options for ntpd */
#define OPTION_CT 38
/** ntpd version */
#define NTPD_VERSION "4.2.8p14"
#define NTPD_VERSION "4.2.8p15"
/** Full ntpd version text */
#define NTPD_FULL_VERSION "ntpd 4.2.8p14"
#define NTPD_FULL_VERSION "ntpd 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1,4 +1,4 @@
/* $NetBSD: refclock_jjy.c,v 1.15 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: refclock_jjy.c,v 1.16 2022/10/09 21:41:03 christos Exp $ */
/*
* refclock_jjy - clock driver for JJY receivers
@ -6,7 +6,7 @@
/**********************************************************************/
/* */
/* Copyright (C) 2001-2015, Takao Abe. All rights reserved. */
/* Copyright (C) 2001-2020, Takao Abe. All rights reserved. */
/* */
/* Permission to use, copy, modify, and distribute this software */
/* and its documentation for any purpose is hereby granted */
@ -117,6 +117,13 @@
/* tool. ( The code is harmless and has no bug. ) */
/* teljjy_conn_send() */
/* */
/* 2020/01/19 */
/* [Change] Handling TS-JJY01/02 status of the the STUS reply. */
/* Time synchronization can be skipped by the settings of */
/* the flag2 when the status of the reply is UNADJUSTED. */
/* [Change] Quiet compilation for the GCC 9.2.0. */
/* [Fix] Correct typos in comment lines */
/* */
/**********************************************************************/
#ifdef HAVE_CONFIG_H
@ -196,6 +203,10 @@ struct jjyunit {
char sTextBuf [ MAX_RAWBUF ] ;
int iTextBufLen ;
char bSkipCntrlCharOnly ;
/* TS-JJY01, TS-JJY02 */
time_t tLastAdjustedTimestamp ;
char bStusReplyAdjusted ;
char bStusReplyAdjustedAtLeastOnce ;
/* Telephone JJY auto measurement of the loopback delay */
char bLoopbackMode ;
short iLoopbackCount ;
@ -373,7 +384,7 @@ struct refclock refclock_jjy = {
* Local constants definition
*/
#define MAX_LOGTEXT 100
#define MAX_LOGTEXT 200
#ifndef TRUE
#define TRUE (0==0)
@ -412,6 +423,7 @@ struct refclock refclock_jjy = {
#define JJY_CLOCKSTATS_MESSAGE_LOOPBACK_DELAY "* Loopback delay : %d.%03d mSec."
#define JJY_CLOCKSTATS_MESSAGE_DELAY_ADJUST "* Delay adjustment : %d mSec. ( valid=%hd/%d )"
#define JJY_CLOCKSTATS_MESSAGE_DELAY_UNADJUST "* Delay adjustment : None ( valid=%hd/%d )"
#define JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED "* Skip time synchronization : STUS is 'UNADJUSTED' for %.0lf %s"
#define JJY_CLOCKSTATS_MESSAGE_UNEXPECTED_REPLY "# Unexpected reply : [%s]"
#define JJY_CLOCKSTATS_MESSAGE_INVALID_LENGTH "# Invalid length : length=%d"
@ -621,7 +633,7 @@ jjy_receive ( struct recvbuf *rbufp )
/* To avoid its claim, pass the value BMAX-1. */
/*
* Append received charaters to temporary buffer
* Append received characters to temporary buffer
*/
for ( i = 0 ;
i < pp->lencode && up->iRawBufLen < MAX_RAWBUF - 2 ;
@ -705,7 +717,7 @@ jjy_receive ( struct recvbuf *rbufp )
iBreakPosition = up->iRawBufLen - 1 ;
}
/* Copy charaters from temporary buffer to process buffer */
/* Copy characters from temporary buffer to process buffer */
up->iLineBufLen = up->iTextBufLen = 0 ;
for ( i = iReadRawBuf ; i <= iBreakPosition ; i ++ ) {
@ -928,7 +940,7 @@ jjy_poll ( int unit, struct peer *peer )
up->iRawBufLen = 0 ;
switch ( up->unittype ) {
case UNITTYPE_TRISTATE_JJY01 :
jjy_poll_tristate_jjy01 ( unit, peer ) ;
break ;
@ -993,7 +1005,7 @@ jjy_timer ( int unit, struct peer *peer )
}
switch ( up->unittype ) {
case UNITTYPE_TELEPHONE :
jjy_timer_telephone ( unit, peer ) ;
break ;
@ -1022,8 +1034,8 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
pp->second = up->second ;
pp->nsec = up->msecond * 1000000 ;
/*
* JST to UTC
/*
* JST to UTC
*/
pp->hour -= 9 ;
if ( pp->hour < 0 ) {
@ -1072,7 +1084,7 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
case 5 : cStatus = '#' ; pStatus = "Selected" ; break ;
case 6 : cStatus = '*' ; pStatus = "Sys.Peer" ; break ;
case 7 : cStatus = 'o' ; pStatus = "PPS.Peer" ; break ;
default : break ;
default : break ;
}
snprintf ( sLog, sizeof(sLog),
@ -1153,6 +1165,9 @@ jjy_start_tristate_jjy01 ( int unit, struct peer *peer, struct jjyunit *up )
up->linespeed = SPEED232_TRISTATE_JJY01 ;
up->linediscipline = LDISC_CLK ;
time( &(up->tLastAdjustedTimestamp) ) ;
up->bStusReplyAdjustedAtLeastOnce = FALSE ;
return 0 ;
}
@ -1166,10 +1181,12 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
struct refclockproc *pp ;
struct peer *peer;
char * pBuf ;
char sLog [ 192 ] ;
int iLen ;
int rc ;
char * pBuf ;
char sLog [ MAX_LOGTEXT ] ;
int iLen ;
int rc ;
time_t now ;
double fSeconds ;
const char * pCmd ;
int iCmdLen ;
@ -1271,11 +1288,17 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
case TS_JJY01_COMMAND_NUMBER_STUS :
if ( strncmp( pBuf, TS_JJY01_REPLY_STUS_ADJUSTED,
TS_JJY01_REPLY_LENGTH_STUS_ADJUSTED ) == 0
|| strncmp( pBuf, TS_JJY01_REPLY_STUS_UNADJUSTED,
TS_JJY01_REPLY_LENGTH_STUS_UNADJUSTED ) == 0 ) {
/* Good */
TS_JJY01_REPLY_LENGTH_STUS_ADJUSTED ) == 0 ) {
/* STUS reply : adjusted */
up->bStusReplyAdjusted = TRUE ;
up->bStusReplyAdjustedAtLeastOnce = TRUE ;
time( &(up->tLastAdjustedTimestamp) ) ;
} else if ( strncmp( pBuf, TS_JJY01_REPLY_STUS_UNADJUSTED,
TS_JJY01_REPLY_LENGTH_STUS_UNADJUSTED ) == 0 ) {
/* STUS reply : unadjusted */
up->bStusReplyAdjusted = FALSE ;
} else {
/* Bad reply */
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
pBuf ) ;
jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_ERROR, sLog ) ;
@ -1288,11 +1311,12 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
case TS_JJY01_COMMAND_NUMBER_DCST :
if ( strncmp( pBuf, TS_JJY01_REPLY_DCST_VALID,
TS_JJY01_REPLY_LENGTH_DCST_VALID ) == 0
TS_JJY01_REPLY_LENGTH_DCST_VALID ) == 0
|| strncmp( pBuf, TS_JJY01_REPLY_DCST_INVALID,
TS_JJY01_REPLY_LENGTH_DCST_INVALID ) == 0 ) {
/* Good */
TS_JJY01_REPLY_LENGTH_DCST_INVALID ) == 0 ) {
/* Valid reply */
} else {
/* Bad reply */
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
pBuf ) ;
jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_ERROR, sLog ) ;
@ -1302,7 +1326,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
break ;
default : /* Unexpected reply */
default : /* Unexpected reply */
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
pBuf ) ;
@ -1315,9 +1339,27 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
if ( up->iTimestampCount == 2 ) {
/* Process date and time */
if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
&& up->iTimestamp[0] <= up->iTimestamp[1] ) {
/* 3 commands (time,date,stim) was excuted in two seconds */
time( &now ) ;
fSeconds = difftime( now, up->tLastAdjustedTimestamp ) ;
if ( ( pp->sloppyclockflag & CLK_FLAG2 ) != 0
&& ( ! up->bStusReplyAdjusted )
&& ( fSeconds >= ( pp->fudgetime2 * 3600 ) || ( ! up->bStusReplyAdjustedAtLeastOnce ) ) ) {
/* STUS is not ADJUSTED */
if ( fSeconds < 60 ) {
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds, "seconds" ) ;
} else if ( fSeconds < 3600 ) {
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 60, "minutes" ) ;
} else if ( fSeconds < 86400 ) {
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 3600, "hours" ) ;
} else {
snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 86400, "days" ) ;
}
jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_INFORMATION, sLog ) ;
return JJY_RECEIVE_SKIP ;
} else if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
&& up->iTimestamp[0] <= up->iTimestamp[1] ) {
/* 3 commands (time,date,stim) was executed in two seconds */
jjy_synctime( peer, pp, up ) ;
return JJY_RECEIVE_DONE ;
} else if ( up->iTimestamp[0] > up->iTimestamp[1] ) {
@ -1387,6 +1429,8 @@ jjy_poll_tristate_jjy01 ( int unit, struct peer *peer )
up->iLineCount = 2 ;
}
up->bStusReplyAdjusted = FALSE ;
#ifdef DEBUG
if ( debug ) {
printf ( "%s (refclock_jjy.c) : flag1=%X CLK_FLAG1=%X up->iLineCount=%d\n",
@ -1423,7 +1467,7 @@ jjy_poll_tristate_jjy01 ( int unit, struct peer *peer )
/* */
/* Command Response Remarks */
/* -------------------- ---------------------------------------- ---------------------------- */
/* <ENQ>1J<ETX> <STX>JYYMMDD HHMMSSS<ETX> J is a fixed character */
/* <ENQ>1J<ETX> <STX>JYYMMDDWHHMMSSS<ETX> J is a fixed character */
/* */
/*################################################################################################*/
@ -1463,7 +1507,7 @@ jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
struct refclockproc *pp ;
struct peer *peer ;
char *pBuf, sLog [ 192 ] ;
char *pBuf, sLog [ MAX_LOGTEXT ] ;
int iLen ;
int rc ;
@ -1948,8 +1992,8 @@ jjy_poll_citizentic_jjy200 ( int unit, struct peer *peer )
/*################################################################################################*/
/*################################################################################################*/
/* */
/* This clock has NMEA mode and command/respose mode. */
/* When this jjy driver are used, set to command/respose mode of this clock */
/* This clock has NMEA mode and command/response mode. */
/* When this jjy driver are used, set to command/response mode of this clock */
/* by the onboard switch SW4, and make sure the LED-Y is tured on. */
/* Other than this JJY driver, the refclock driver type 20, generic NMEA driver, */
/* works with the NMEA mode of this clock. */
@ -2024,7 +2068,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
struct peer *peer;
char * pBuf ;
char sLog [ 100 ] ;
char sLog [ MAX_LOGTEXT ] ;
int iLen ;
int rc ;
@ -2191,7 +2235,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
&& up->iTimestamp[0] <= up->iTimestamp[1] ) {
/* 3 commands (time,date,stim) was excuted in two seconds */
/* 3 commands (time,date,stim) was executed in two seconds */
jjy_synctime( peer, pp, up ) ;
return JJY_RECEIVE_DONE ;
} else if ( up->iTimestamp[0] > up->iTimestamp[1] ) {
@ -2346,7 +2390,7 @@ jjy_receive_seiko_tsys_tdc_300 ( struct recvbuf *rbufp )
struct refclockproc *pp ;
struct jjyunit *up ;
char *pBuf, sLog [ 192 ] ;
char *pBuf, sLog [ MAX_LOGTEXT ] ;
int iLen, i ;
int rc, iWeekday ;
time_t now ;
@ -3404,7 +3448,7 @@ teljjy_conn_data ( struct peer *peer, struct refclockproc *pp, struct jjyunit *u
char *pBuf ;
int iLen, rc ;
char sLog [ 192 ] ;
char sLog [ MAX_LOGTEXT ] ;
char bAdjustment ;

View File

@ -1,4 +1,4 @@
/* $NetBSD: refclock_nmea.c,v 1.13 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: refclock_nmea.c,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* refclock_nmea.c - clock driver for an NMEA GPS CLOCK
@ -291,7 +291,7 @@ static int nmea_start (int, struct peer *);
static void nmea_shutdown (int, struct peer *);
static void nmea_receive (struct recvbuf *);
static void nmea_poll (int, struct peer *);
static void nmea_procrec (struct peer *, l_fp);
static void nmea_procrec (struct peer * const, l_fp);
#ifdef HAVE_PPSAPI
static double tabsdiffd (l_fp, l_fp);
static void nmea_control (int, const struct refclockstat *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: refclock_palisade.c,v 1.8 2020/05/25 20:47:25 christos Exp $ */
/* $NetBSD: refclock_palisade.c,v 1.9 2022/10/09 21:41:04 christos Exp $ */
/*
* This software was developed by the Software and Component Technologies
@ -306,13 +306,13 @@ palisade_start (
int fd;
char gpsdev[20];
struct termios tio;
u_int speed;
snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit);
/*
* Open serial port.
*/
u_int speed;
speed = (CLK_TYPE(peer) == CLK_COPERNICUS) ? SPEED232COP : SPEED232;
fd = refclock_open(gpsdev, speed, LDISC_RAW);
if (fd <= 0) {
@ -943,30 +943,32 @@ TSIP_decode (
return 0;
}
/* Get date & time from WN & ToW minus offset */
TCivilDate cd;
TGpsDatum wd;
l_fp ugo; /* UTC-GPS offset, negative number */
ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset;
ugo.l_uf = 0;
wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo);
gpscal_to_calendar(&cd, &wd);
pp->year = cd.year;
pp->day = cd.yearday;
pp->hour = cd.hour;
pp->minute = cd.minute;
pp->second = cd.second;
pp->nsec = 0;
pp->leap = LEAP_NOWARNING;
{
TCivilDate cd;
TGpsDatum wd;
l_fp ugo; /* UTC-GPS offset, negative number */
ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset;
ugo.l_uf = 0;
wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo);
gpscal_to_calendar(&cd, &wd);
pp->year = cd.year;
pp->day = cd.yearday;
pp->hour = cd.hour;
pp->minute = cd.minute;
pp->second = cd.second;
pp->nsec = 0;
pp->leap = LEAP_NOWARNING;
#ifdef DEBUG
if (debug > 1) {
printf("GPS TOW: %ld\n", tow);
printf("GPS WN: %d\n", wn);
printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset);
printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ",
up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second,
pp->nsec, cd.month, cd.monthday, pp->year);
}
if (debug > 1) {
printf("GPS TOW: %ld\n", tow);
printf("GPS WN: %d\n", wn);
printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset);
printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ",
up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second,
pp->nsec, cd.month, cd.monthday, pp->year);
}
#endif
}
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: refclock_parse.c,v 1.23 2020/09/03 07:26:41 kardel Exp $ */
/* $NetBSD: refclock_parse.c,v 1.24 2022/10/09 21:41:04 christos Exp $ */
/*
* /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A
@ -2368,7 +2368,7 @@ local_input(
}
if (count)
{ /* simulate receive */
buf = get_free_recv_buffer();
buf = get_free_recv_buffer(TRUE);
if (buf != NULL) {
memmove((caddr_t)buf->recv_buffer,
(caddr_t)&parse->parseio.parse_dtime,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntpdate.c,v 1.14 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpdate.c,v 1.15 2022/10/09 21:41:04 christos Exp $ */
/*
* ntpdate - set the time of day by polling one or more NTP servers
@ -1987,7 +1987,7 @@ input_handler(void)
continue;
}
rb = get_free_recv_buffer();
rb = get_free_recv_buffer(TRUE);
fromlen = sizeof(rb->recv_srcadr);
rb->recv_length = recvfrom(fdc, (char *)&rb->recv_pkt,
@ -2016,7 +2016,7 @@ l_adj_systime(
l_fp *ts
)
{
struct timeval adjtv, oadjtv;
struct timeval adjtv;
int isneg = 0;
l_fp offset;
#ifndef STEP_SLEW
@ -2056,6 +2056,7 @@ l_adj_systime(
/* A time correction needs to be applied. */
#if !defined SYS_WINNT && !defined SYS_CYGWIN32
/* Slew the time on systems that support this. */
struct timeval oadjtv;
if (adjtime(&adjtv, &oadjtv) < 0) {
msyslog(LOG_ERR, "Can't adjust the time of day: %m");
exit(1);

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpdc-opts.c,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpdc-opts.c,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:07 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:41 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@ -71,7 +71,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpdc options
*/
static char const ntpdc_opt_strs[1914] =
/* 0 */ "ntpdc 4.2.8p14\n"
/* 0 */ "ntpdc 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -130,14 +130,14 @@ static char const ntpdc_opt_strs[1914] =
/* 1695 */ "no-load-opts\0"
/* 1708 */ "no\0"
/* 1711 */ "NTPDC\0"
/* 1717 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14\n"
/* 1717 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1848 */ "$HOME\0"
/* 1854 */ ".\0"
/* 1856 */ ".ntprc\0"
/* 1863 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1897 */ "\n\0"
/* 1899 */ "ntpdc 4.2.8p14";
/* 1899 */ "ntpdc 4.2.8p15";
/**
* ipv4 option description with
@ -798,7 +798,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdcOptions.pzCopyright */
puts(_("ntpdc 4.2.8p14\n\
puts(_("ntpdc 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -864,14 +864,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpdcOptions.pzUsageTitle */
puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14\n\
puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpdcOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpdcOptions.pzFullVersion */
puts(_("ntpdc 4.2.8p14"));
puts(_("ntpdc 4.2.8p15"));
/* referenced via ntpdcOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpdc-opts.h,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpdc-opts.h,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:07 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:41 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@ -85,9 +85,9 @@ typedef enum {
/** count of all options for ntpdc */
#define OPTION_CT 15
/** ntpdc version */
#define NTPDC_VERSION "4.2.8p14"
#define NTPDC_VERSION "4.2.8p15"
/** Full ntpdc version text */
#define NTPDC_FULL_VERSION "ntpdc 4.2.8p14"
#define NTPDC_FULL_VERSION "ntpdc 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpq-opts.c,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpq-opts.c,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:14 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:48 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@ -71,7 +71,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpq options
*/
static char const ntpq_opt_strs[1977] =
/* 0 */ "ntpq 4.2.8p14\n"
/* 0 */ "ntpq 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -134,13 +134,13 @@ static char const ntpq_opt_strs[1977] =
/* 1768 */ "no-load-opts\0"
/* 1781 */ "no\0"
/* 1784 */ "NTPQ\0"
/* 1789 */ "ntpq - standard NTP query program - Ver. 4.2.8p14\n"
/* 1789 */ "ntpq - standard NTP query program - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1909 */ "$HOME\0"
/* 1915 */ ".\0"
/* 1917 */ ".ntprc\0"
/* 1924 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1958 */ "ntpq 4.2.8p14\0"
/* 1958 */ "ntpq 4.2.8p15\0"
/* 1972 */ "hash";
/**
@ -843,7 +843,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpqOptions.pzCopyright */
puts(_("ntpq 4.2.8p14\n\
puts(_("ntpq 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -912,11 +912,11 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpqOptions.pzUsageTitle */
puts(_("ntpq - standard NTP query program - Ver. 4.2.8p14\n\
puts(_("ntpq - standard NTP query program - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpqOptions.pzFullVersion */
puts(_("ntpq 4.2.8p14"));
puts(_("ntpq 4.2.8p15"));
/* referenced via ntpqOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpq-opts.h,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpq-opts.h,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:14 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:48 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@ -86,9 +86,9 @@ typedef enum {
/** count of all options for ntpq */
#define OPTION_CT 16
/** ntpq version */
#define NTPQ_VERSION "4.2.8p14"
#define NTPQ_VERSION "4.2.8p15"
/** Full ntpq version text */
#define NTPQ_FULL_VERSION "ntpq 4.2.8p14"
#define NTPQ_FULL_VERSION "ntpq 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpsnmpd-opts.c,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpsnmpd-opts.c,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:23 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:57 AM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@ -63,7 +63,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpsnmpd options
*/
static char const ntpsnmpd_opt_strs[1613] =
/* 0 */ "ntpsnmpd 4.2.8p14\n"
/* 0 */ "ntpsnmpd 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -103,14 +103,14 @@ static char const ntpsnmpd_opt_strs[1613] =
/* 1415 */ "no-load-opts\0"
/* 1428 */ "no\0"
/* 1431 */ "NTPSNMPD\0"
/* 1440 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p14\n"
/* 1440 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 1544 */ "$HOME\0"
/* 1550 */ ".\0"
/* 1552 */ ".ntprc\0"
/* 1559 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1593 */ "\n\0"
/* 1595 */ "ntpsnmpd 4.2.8p14";
/* 1595 */ "ntpsnmpd 4.2.8p15";
/**
* nofork option description:
@ -556,7 +556,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpsnmpdOptions.pzCopyright */
puts(_("ntpsnmpd 4.2.8p14\n\
puts(_("ntpsnmpd 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -601,14 +601,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpsnmpdOptions.pzUsageTitle */
puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p14\n\
puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntpsnmpdOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpsnmpdOptions.pzFullVersion */
puts(_("ntpsnmpd 4.2.8p14"));
puts(_("ntpsnmpd 4.2.8p15"));
/* referenced via ntpsnmpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntpsnmpd-opts.h,v 1.13 2020/05/25 20:47:26 christos Exp $ */
/* $NetBSD: ntpsnmpd-opts.h,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:23 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:20:57 AM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@ -78,9 +78,9 @@ typedef enum {
/** count of all options for ntpsnmpd */
#define OPTION_CT 8
/** ntpsnmpd version */
#define NTPSNMPD_VERSION "4.2.8p14"
#define NTPSNMPD_VERSION "4.2.8p15"
/** Full ntpsnmpd version text */
#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p14"
#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1,4 +1,4 @@
/* $NetBSD: crypto.c,v 1.18 2020/05/25 20:47:32 christos Exp $ */
/* $NetBSD: crypto.c,v 1.19 2022/10/09 21:41:04 christos Exp $ */
/*
* HMS: we need to test:
@ -72,7 +72,8 @@ compute_mac(
}
len = (u_int)slen;
CMAC_CTX_cleanup(ctx);
if (ctx)
CMAC_CTX_free(ctx);
/* Test our AES-128-CMAC implementation */
} else /* MD5 MAC handling */

View File

@ -1,9 +1,9 @@
/* $NetBSD: sntp-opts.c,v 1.14 2020/05/25 20:47:32 christos Exp $ */
/* $NetBSD: sntp-opts.c,v 1.15 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:39:59 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:19:32 AM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@ -72,7 +72,7 @@ extern FILE * option_usage_fp;
* static const strings for sntp options
*/
static char const sntp_opt_strs[2566] =
/* 0 */ "sntp 4.2.8p14\n"
/* 0 */ "sntp 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -158,7 +158,7 @@ static char const sntp_opt_strs[2566] =
/* 2313 */ "LOAD_OPTS\0"
/* 2323 */ "no-load-opts\0"
/* 2336 */ "SNTP\0"
/* 2341 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p14\n"
/* 2341 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ hostname-or-IP ...]\n\0"
/* 2501 */ "$HOME\0"
@ -166,7 +166,7 @@ static char const sntp_opt_strs[2566] =
/* 2509 */ ".ntprc\0"
/* 2516 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2550 */ "\n\0"
/* 2552 */ "sntp 4.2.8p14";
/* 2552 */ "sntp 4.2.8p15";
/**
* ipv4 option description with
@ -1178,7 +1178,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via sntpOptions.pzCopyright */
puts(_("sntp 4.2.8p14\n\
puts(_("sntp 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -1268,7 +1268,7 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via sntpOptions.pzUsageTitle */
puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p14\n\
puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ hostname-or-IP ...]\n"));
@ -1276,7 +1276,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via sntpOptions.pzFullVersion */
puts(_("sntp 4.2.8p14"));
puts(_("sntp 4.2.8p15"));
/* referenced via sntpOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: sntp-opts.h,v 1.13 2020/05/25 20:47:32 christos Exp $ */
/* $NetBSD: sntp-opts.h,v 1.14 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:39:58 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:19:32 AM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@ -93,9 +93,9 @@ typedef enum {
/** count of all options for sntp */
#define OPTION_CT 23
/** sntp version */
#define SNTP_VERSION "4.2.8p14"
#define SNTP_VERSION "4.2.8p15"
/** Full sntp version text */
#define SNTP_FULL_VERSION "sntp 4.2.8p14"
#define SNTP_FULL_VERSION "sntp 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1,7 +1,7 @@
/* $NetBSD: version.c,v 1.4 2020/05/25 20:47:32 christos Exp $ */
/* $NetBSD: version.c,v 1.5 2022/10/09 21:41:04 christos Exp $ */
/*
* version file for sntp
*/
#include <config.h>
const char * Version = "sntp 4.2.8p14@1.3728-o Wed Mar 4 01:42:35 UTC 2020 (8)";
const char * Version = "sntp 4.2.8p15@1.3728-o Tue Jun 23 09:22:10 UTC 2020 (10)";

View File

@ -1,4 +1,4 @@
/* $NetBSD: decodenetnum.c,v 1.2 2020/05/25 20:47:36 christos Exp $ */
/* $NetBSD: decodenetnum.c,v 1.3 2022/10/09 21:41:04 christos Exp $ */
#include "config.h"
#include "ntp_stdlib.h"
@ -11,8 +11,11 @@ extern void test_IPv4AddressOnly(void);
extern void test_IPv4AddressWithPort(void);
extern void test_IPv6AddressOnly(void);
extern void test_IPv6AddressWithPort(void);
extern void test_IPv6AddressWithScope(void);
extern void test_IPv6AddressWithPortAndScope(void);
extern void test_IllegalAddress(void);
extern void test_IllegalCharInPort(void);
extern void test_NameBufOverflow(void);
/*
* NOTE: The IPv6 specific tests are reduced to stubs when IPv6 is
@ -37,6 +40,7 @@ test_IPv4AddressOnly(void)
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa4.sin_family = AF_INET;
expected.sa4.sin_addr.s_addr = inet_addr("192.0.2.1");
SET_PORT(&expected, NTP_PORT);
@ -52,6 +56,7 @@ test_IPv4AddressWithPort(void)
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa4.sin_family = AF_INET;
expected.sa4.sin_addr.s_addr = inet_addr("192.0.2.2");
SET_PORT(&expected, 2000);
@ -73,21 +78,26 @@ test_IPv6AddressOnly(void)
0x03, 0x70, 0x73, 0x34
};
const char *str = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
const char *str1 = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
const char *str2 = "[2001:0db8:85a3:08d3:1319:8a2e:0370:7334]";
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa6.sin6_family = AF_INET6;
expected.sa6.sin6_addr = address;
SET_PORT(&expected, NTP_PORT);
TEST_ASSERT_TRUE(decodenetnum(str, &actual));
TEST_ASSERT_TRUE(decodenetnum(str1, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
TEST_ASSERT_TRUE(decodenetnum(str2, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
#else
TEST_IGNORE_MESSAGE("IPV6 disabled in build");
#endif
}
@ -108,6 +118,7 @@ test_IPv6AddressWithPort(void)
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa6.sin6_family = AF_INET6;
expected.sa6.sin6_addr = address;
SET_PORT(&expected, 3000);
@ -116,12 +127,77 @@ test_IPv6AddressWithPort(void)
TEST_ASSERT_TRUE(IsEqual(expected, actual));
#else
TEST_IGNORE_MESSAGE("IPV6 disabled in build");
#endif
}
void test_IPv6AddressWithScope(void)
{
#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6)
const struct in6_addr address = {
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
0x13, 0x19, 0x8a, 0x2e,
0x03, 0x70, 0x73, 0x34
};
const char *str1 = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334%42";
const char *str2 = "[2001:0db8:85a3:08d3:1319:8a2e:0370:7334%42]";
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa6.sin6_family = AF_INET6;
expected.sa6.sin6_addr = address;
expected.sa6.sin6_scope_id = 42;
SET_PORT(&expected, NTP_PORT);
TEST_ASSERT_TRUE(decodenetnum(str1, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
TEST_ASSERT_TRUE(decodenetnum(str2, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
#else
TEST_IGNORE_MESSAGE("IPV6 disabled in build");
#endif
}
void test_IPv6AddressWithPortAndScope(void)
{
#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6)
const struct in6_addr address = {
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
0x13, 0x19, 0x8a, 0x2e,
0x03, 0x70, 0x73, 0x34
};
const char *str = "[2001:0db8:85a3:08d3:1319:8a2e:0370:7334%42]:3000";
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa6.sin6_family = AF_INET6;
expected.sa6.sin6_addr = address;
expected.sa6.sin6_scope_id = 42;
SET_PORT(&expected, 3000);
TEST_ASSERT_TRUE(decodenetnum(str, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
#else
TEST_IGNORE_MESSAGE("IPV6 disabled in build");
#endif
}
void
test_IllegalAddress(void)
@ -143,6 +219,7 @@ test_IllegalCharInPort(void)
sockaddr_u actual;
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa4.sin_family = AF_INET;
expected.sa4.sin_addr.s_addr = inet_addr("192.0.2.1");
SET_PORT(&expected, NTP_PORT);
@ -150,3 +227,14 @@ test_IllegalCharInPort(void)
TEST_ASSERT_TRUE(decodenetnum(str, &actual));
TEST_ASSERT_TRUE(IsEqual(expected, actual));
}
void
test_NameBufOverflow(void)
{
const char *str =
"loremipsumloremipsumloremipsumloremipsumloremipsum"
"loremipsumloremipsumloremipsumloremipsum";
sockaddr_u actual;
TEST_ASSERT_FALSE(decodenetnum(str, &actual));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netof.c,v 1.2 2020/05/25 20:47:36 christos Exp $ */
/* $NetBSD: netof.c,v 1.3 2022/10/09 21:41:04 christos Exp $ */
#include "config.h"
@ -91,11 +91,13 @@ test_IPv6Address(void)
} } }; // 2001:0db8:85a3:08d3:0000:0000:0000:0000
sockaddr_u input;
memset(&input, 0, sizeof(input));
input.sa6.sin6_family = AF_INET6;
input.sa6.sin6_addr = input_address;
SET_PORT(&input, 3000);
sockaddr_u expected;
memset(&expected, 0, sizeof(expected));
expected.sa6.sin6_family = AF_INET6;
expected.sa6.sin6_addr = expected_address;
SET_PORT(&expected, 3000);

View File

@ -1,4 +1,4 @@
/* $NetBSD: recvbuff.c,v 1.2 2020/05/25 20:47:36 christos Exp $ */
/* $NetBSD: recvbuff.c,v 1.3 2022/10/09 21:41:04 christos Exp $ */
#include "config.h"
@ -31,7 +31,7 @@ test_Initialization(void) {
void
test_GetAndFree(void) {
u_long initial = free_recvbuffs();
recvbuf_t* buf = get_free_recv_buffer();
recvbuf_t* buf = get_free_recv_buffer(TRUE);
TEST_ASSERT_EQUAL_UINT(initial-1, free_recvbuffs());
freerecvbuf(buf);
@ -42,7 +42,7 @@ test_GetAndFree(void) {
void
test_GetAndFill(void) {
// int initial = free_recvbuffs();
recvbuf_t* buf = get_free_recv_buffer();
recvbuf_t* buf = get_free_recv_buffer(TRUE);
add_full_recv_buffer(buf);
TEST_ASSERT_EQUAL_UINT(1, full_recvbuffs());

View File

@ -1,4 +1,4 @@
/* $NetBSD: run-decodenetnum.c,v 1.3 2020/05/25 20:47:36 christos Exp $ */
/* $NetBSD: run-decodenetnum.c,v 1.4 2022/10/09 21:41:04 christos Exp $ */
/* AUTOGENERATED FILE. DO NOT EDIT. */
@ -35,8 +35,11 @@ extern void test_IPv4AddressOnly(void);
extern void test_IPv4AddressWithPort(void);
extern void test_IPv6AddressOnly(void);
extern void test_IPv6AddressWithPort(void);
extern void test_IPv6AddressWithScope(void);
extern void test_IPv6AddressWithPortAndScope(void);
extern void test_IllegalAddress(void);
extern void test_IllegalCharInPort(void);
extern void test_NameBufOverflow(void);
//=======Suite Setup=====
@ -69,8 +72,11 @@ int main(int argc, char *argv[])
RUN_TEST(test_IPv4AddressWithPort, 9);
RUN_TEST(test_IPv6AddressOnly, 10);
RUN_TEST(test_IPv6AddressWithPort, 11);
RUN_TEST(test_IllegalAddress, 12);
RUN_TEST(test_IllegalCharInPort, 13);
RUN_TEST(test_IPv6AddressWithScope, 12);
RUN_TEST(test_IPv6AddressWithPortAndScope, 13);
RUN_TEST(test_IllegalAddress, 14);
RUN_TEST(test_IllegalCharInPort, 15);
RUN_TEST(test_NameBufOverflow, 16);
return (UnityEnd());
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sockaddrtest.c,v 1.2 2020/05/25 20:47:36 christos Exp $ */
/* $NetBSD: sockaddrtest.c,v 1.3 2022/10/09 21:41:04 christos Exp $ */
#include "config.h"
@ -28,9 +28,9 @@ IsEqual(const sockaddr_u expected, const sockaddr_u actual) {
}
if (actual.sa.sa_family == AF_INET) { // IPv4
if (expected.sa4.sin_port == actual.sa4.sin_port &&
memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
sizeof( in )) == 0) {
if ( expected.sa4.sin_port == actual.sa4.sin_port
&& memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
sizeof( in )) == 0) {
return TRUE;
} else {
char buf[4][32];
@ -43,9 +43,10 @@ IsEqual(const sockaddr_u expected, const sockaddr_u actual) {
return FALSE;
}
} else if (actual.sa.sa_family == AF_INET6) { //IPv6
if (expected.sa6.sin6_port == actual.sa6.sin6_port &&
memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
sizeof(in6)) == 0) {
if ( expected.sa6.sin6_port == actual.sa6.sin6_port
&& expected.sa6.sin6_scope_id == actual.sa6.sin6_scope_id
&& memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
sizeof(in6)) == 0) {
return TRUE;
} else {
printf("IPv6 comparision failed");

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntp-keygen-opts.c,v 1.18 2020/05/25 20:47:37 christos Exp $ */
/* $NetBSD: ntp-keygen-opts.c,v 1.19 2022/10/09 21:41:04 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:28 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:21:03 AM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@ -74,7 +74,7 @@ extern FILE * option_usage_fp;
* static const strings for ntp-keygen options
*/
static char const ntp_keygen_opt_strs[2442] =
/* 0 */ "ntp-keygen (ntp) 4.2.8p14\n"
/* 0 */ "ntp-keygen (ntp) 4.2.8p15\n"
"Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@ -167,14 +167,14 @@ static char const ntp_keygen_opt_strs[2442] =
/* 2223 */ "no-load-opts\0"
/* 2236 */ "no\0"
/* 2239 */ "NTP_KEYGEN\0"
/* 2250 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p14\n"
/* 2250 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p15\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 2365 */ "$HOME\0"
/* 2371 */ ".\0"
/* 2373 */ ".ntprc\0"
/* 2380 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2414 */ "\n\0"
/* 2416 */ "ntp-keygen (ntp) 4.2.8p14";
/* 2416 */ "ntp-keygen (ntp) 4.2.8p15";
/**
* imbits option description:
@ -1312,7 +1312,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntp_keygenOptions.pzCopyright */
puts(_("ntp-keygen (ntp) 4.2.8p14\n\
puts(_("ntp-keygen (ntp) 4.2.8p15\n\
Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@ -1411,14 +1411,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntp_keygenOptions.pzUsageTitle */
puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p14\n\
puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p15\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntp_keygenOptions.pzExplain */
puts(_("\n"));
/* referenced via ntp_keygenOptions.pzFullVersion */
puts(_("ntp-keygen (ntp) 4.2.8p14"));
puts(_("ntp-keygen (ntp) 4.2.8p15"));
/* referenced via ntp_keygenOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));

View File

@ -1,9 +1,9 @@
/* $NetBSD: ntp-keygen-opts.h,v 1.13 2020/05/25 20:47:37 christos Exp $ */
/* $NetBSD: ntp-keygen-opts.h,v 1.14 2022/10/09 21:41:05 christos Exp $ */
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
*
* It has been AutoGen-ed March 3, 2020 at 05:41:28 PM by AutoGen 5.18.5
* It has been AutoGen-ed June 23, 2020 at 02:21:03 AM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@ -96,9 +96,9 @@ typedef enum {
/** count of all options for ntp-keygen */
#define OPTION_CT 26
/** ntp-keygen version */
#define NTP_KEYGEN_VERSION "4.2.8p14"
#define NTP_KEYGEN_VERSION "4.2.8p15"
/** Full ntp-keygen version text */
#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p14"
#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p15"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED

View File

@ -1 +1 @@
Mon May 25 15:53:34 EDT 2020 (import)
Sun Oct 9 17:37:20 EDT 2022 (import)

View File

@ -591,6 +591,10 @@
/* Define to 1 if you have the <md5.h> header file. */
#define HAVE_MD5_H 1
/* Define to 1 if you have the `memchr' function. */
#define HAVE_MEMCHR 1
/* Define to 1 if you have the `memlk' function. */
/* Define to 1 if you have the `memlk' function. */
/* #undef HAVE_MEMLK */
@ -906,6 +910,9 @@
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the `strnlen' function. */
#define HAVE_STRNLEN 1
/* Define to 1 if you have the <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
@ -1489,7 +1496,7 @@
#define PACKAGE_NAME "ntp"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ntp 4.2.8p14"
#define PACKAGE_STRING "ntp 4.2.8p15"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntp"
@ -1498,7 +1505,7 @@
#define PACKAGE_URL "http://www.ntp.org./"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.2.8p14"
#define PACKAGE_VERSION "4.2.8p15"
/* data dir */
#define PERLLIBDIR "/usr/local/share/ntp/lib"
@ -1675,7 +1682,7 @@ typedef unsigned int uintptr_t;
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
#define VERSION "4.2.8p14"
#define VERSION "4.2.8p15"
/* vsnprintf expands "%m" to strerror(errno) */
/* #undef VSNPRINTF_PERCENT_M */

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: ntp2netbsd,v 1.7 2020/05/25 20:47:18 christos Exp $
# $NetBSD: ntp2netbsd,v 1.8 2022/10/09 21:41:03 christos Exp $
#
# Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
# All rights reserved.
@ -36,7 +36,7 @@
# $ tar xpfz /new/ntp/release/tar/file
# $ sh /usr/src/external/bsd/ntp/ntp2netbsd ntp-4.x.y `pwd`
# $ cd src/external/bsd/ntp/dist
# $ cvs import -m "Import ntp 4.x.y" src/external/bsd/ntp/dist UDEL ntp-4-x-y
# $ cvs import src/external/bsd/ntp/dist UDEL ntp-4-x-y
# $ cd ../../../../../ntp-4.x.y
# $ run ./configure --enable-all-clocks --enable-parse-clocks
# $ echo cp config.h /usr/src/external/bsd/ntp/include

View File

@ -3,7 +3,7 @@ PROG=${1-UNKNOWN}
ConfStr="$PROG"
ConfStr="$ConfStr 4.2.8p14"
ConfStr="$ConfStr 4.2.8p15"
case "$CSET" in
'') ;;
@ -15,24 +15,32 @@ case "o" in
*) ConfStr="${ConfStr}-o" ;;
esac
ifile="`dirname $0`/../importdate"
if [ -f "$ifile" ]; then
# NetBSD MKREPRO: Don't embed current date/time/run number
ConfStr="$ConfStr "`cat "$ifile"`
else
ConfStr="$ConfStr `LC_TIME=C TZ= date`"
if [ ! -f .version ]; then
echo 0 > .version
fi
RUN="`cat .version`"
RUN="`expr $RUN + 1`"
echo $RUN > .version
ConfStr="$ConfStr (${RUN})"
if [ -n "$MKREPRO_TIMESTAMP" ]; then
SOURCE_DATE_EPOCH=$MKREPRO_TIMESTAMP
fi
if [ -n "$SOURCE_DATE_EPOCH" ]; then
ConfStr="$ConfStr `LC_TIME=C TZ=UTC date -d@$SOURCE_DATE_EPOCH 2>/dev/null`" ||
ConfStr="$ConfStr `LC_TIME=C TZ=UTC date -r $SOURCE_DATE_EPOCH`"
else
ifile="`dirname $0`/../importdate"
if [ -f "$ifile" ]; then
# NetBSD MKREPRO: Don't embed current date/time/run number
ConfStr="$ConfStr "`cat "$ifile"`
else
ConfStr="$ConfStr `LC_TIME=C TZ=UTC date`"
fi
fi
if [ ! -f .version ]; then
echo 0 > .version
fi
RUN="`cat .version`"
RUN="`expr $RUN + 1`"
echo $RUN > .version
ConfStr="$ConfStr (${RUN})"
echo "Version <${ConfStr}>";
rm -f version.c