resolve ntp 4.2.4p5 import

This commit is contained in:
kardel 2008-08-23 09:10:31 +00:00
parent 835928de57
commit 1f18cb938c
32 changed files with 512 additions and 457 deletions

82
dist/ntp/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for ntp 4.2.4p2.
# Generated by GNU Autoconf 2.59 for ntp 4.2.4p5.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@ -421,8 +421,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='ntp'
PACKAGE_TARNAME='ntp'
PACKAGE_VERSION='4.2.4p2'
PACKAGE_STRING='ntp 4.2.4p2'
PACKAGE_VERSION='4.2.4p5'
PACKAGE_STRING='ntp 4.2.4p5'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
@ -952,7 +952,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures ntp 4.2.4p2 to adapt to many kinds of systems.
\`configure' configures ntp 4.2.4p5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1018,7 +1018,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ntp 4.2.4p2:";;
short | recursive ) echo "Configuration of ntp 4.2.4p5:";;
esac
cat <<\_ACEOF
@ -1248,7 +1248,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
ntp configure 4.2.4p2
ntp configure 4.2.4p5
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@ -1262,7 +1262,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ntp $as_me 4.2.4p2, which was
It was created by ntp $as_me 4.2.4p5, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@ -1905,7 +1905,7 @@ fi
# Define the identity of the package.
PACKAGE='ntp'
VERSION='4.2.4p2'
VERSION='4.2.4p5'
cat >>confdefs.h <<_ACEOF
@ -5085,7 +5085,11 @@ case "$host" in
LIBS="$LIBS -lcurses"
;;
*-*-solaris*)
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
# see "man standards".
# -D_XOPEN_SOURCE=500 is probably OK for c89 and before
# -D_XOPEN_SOURCE=600 seems OK for c99
#CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
libxnet=-lxnet
;;
esac
@ -15238,7 +15242,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 15241 "configure"' > conftest.$ac_ext
echo '#line 15245 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -16344,7 +16348,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:16347:" \
echo "$as_me:16351:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -17442,11 +17446,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17445: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17449: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:17449: \$? = $ac_status" >&5
echo "$as_me:17453: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -17704,11 +17708,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17707: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17711: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:17711: \$? = $ac_status" >&5
echo "$as_me:17715: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -17766,11 +17770,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17769: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17773: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:17773: \$? = $ac_status" >&5
echo "$as_me:17777: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -20014,7 +20018,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 20017 "configure"
#line 20021 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -20112,7 +20116,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 20115 "configure"
#line 20119 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -22367,11 +22371,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:22370: $lt_compile\"" >&5)
(eval echo "\"\$as_me:22374: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:22374: \$? = $ac_status" >&5
echo "$as_me:22378: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -22429,11 +22433,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:22432: $lt_compile\"" >&5)
(eval echo "\"\$as_me:22436: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:22436: \$? = $ac_status" >&5
echo "$as_me:22440: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -23806,7 +23810,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 23809 "configure"
#line 23813 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -23904,7 +23908,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 23907 "configure"
#line 23911 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -24789,11 +24793,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:24792: $lt_compile\"" >&5)
(eval echo "\"\$as_me:24796: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:24796: \$? = $ac_status" >&5
echo "$as_me:24800: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -24851,11 +24855,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:24854: $lt_compile\"" >&5)
(eval echo "\"\$as_me:24858: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:24858: \$? = $ac_status" >&5
echo "$as_me:24862: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -26981,11 +26985,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:26984: $lt_compile\"" >&5)
(eval echo "\"\$as_me:26988: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:26988: \$? = $ac_status" >&5
echo "$as_me:26992: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -27243,11 +27247,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:27246: $lt_compile\"" >&5)
(eval echo "\"\$as_me:27250: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:27250: \$? = $ac_status" >&5
echo "$as_me:27254: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -27305,11 +27309,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:27308: $lt_compile\"" >&5)
(eval echo "\"\$as_me:27312: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:27312: \$? = $ac_status" >&5
echo "$as_me:27316: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -29553,7 +29557,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 29556 "configure"
#line 29560 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -29651,7 +29655,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 29654 "configure"
#line 29658 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -53482,7 +53486,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by ntp $as_me 4.2.4p2, which was
This file was extended by ntp $as_me 4.2.4p5, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -53545,7 +53549,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
ntp config.status 4.2.4p2
ntp config.status 4.2.4p5
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -63,8 +63,6 @@
<dd>This option is used only with broadcast server and manycast client modes. It specifies the time-to-live <i><tt>ttl</tt></i> to use on broadcast server and multicast server and the maximum <i><tt>ttl</tt></i> for the expanding ring search with manycast client packets. Selection of the proper value, which defaults to 127, is something of a black art and should be coordinated with the network administrator.
<dt><tt>version <i>version</i></tt>
<dd>Specifies the version number to be used for outgoing NTP packets. Versions 1-4 are the choices, with version 4 the default. This option is valid only with the <tt>server,</tt> <tt>peer</tt> and <tt>broadcast</tt> commands.
<dt><tt>dynamic</tt>
<dd>Allows a server/peer to be configured even if it is not reachable at configuration time. It is assumed that at some point in the future the network environment changes so that this server/peer can be reached. This option is useful to configure servers/peers on mobile systems with intermittent network access (e.g. wlan clients).
</dl>
<h4 id="aux">Auxilliary Commands</h4>
<dl>

View File

@ -18,7 +18,7 @@
<pre>
***********************************************************************
* *
* Copyright (c) David L. Mills 1992-2007 *
* Copyright (c) David L. Mills 1992-2008 *
* *
* Permission to use, copy, modify, and distribute this software and *
* its documentation for any purpose with or without fee is hereby *

View File

@ -133,7 +133,7 @@
<dt><tt>addpeer <i>peer_address</i> [
<i>keyid</i> ] [ <i>version</i> ] [
<tt>minpoll# | prefer | iburst | burst | minpoll
<i>N</i> | <tt>maxpoll</tt> <i>N</i> [ <i>dynamic</i> ] [...] ]</tt>
<i>N</i> | <tt>maxpoll</tt> <i>N</i> [...] ]</tt>
<dt><tt>addpeer <i>peer_address</i> [
<tt>prefer | iburst | burst | minpoll
<i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
@ -162,7 +162,6 @@
ntpd. See the <a href="confopt.html">Server Options</a> page for further information.
Each flag (or its absence) replaces the
previous setting. The <tt>prefer</tt> keyword indicates a preferred peer (and thus will be used primarily for clock synchronisation if possible). The preferred peer also determines the validity of the PPS signal - if the preferred peer is suitable for synchronisation so is the PPS signal.
The <tt>dynamic</tt> keyword allows association configuration even when no suitable network interface is found at configuration time. The dynamic interface update mechanism may complete the configuration when new interfaces appear (e.g. WLAN/PPP interfaces) at a later time and thus render the association operable.
<dt><tt>addserver <i>peer_address</i> [
<i>keyid</i> ] [ <i>version</i> ] [
<tt>minpoll# | prefer | iburst | burst | minpoll
@ -170,7 +169,7 @@
<dt><tt>addserver <i>peer_address</i> [
<tt>prefer | iburst | burst | minpoll
<i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
<i>N</i> | <tt>version</tt> <i>N</i> [...] [ <i>dynamic</i> ] ]</tt>
<i>N</i> | <tt>version</tt> <i>N</i> [...] ]</tt>
<dd>Identical to the addpeer command, except that the operating mode is client.
<dt><tt>broadcast <i>peer_address</i> [
<i>keyid</i> ] [ <i>version</i> ] [ <i>prefer</i> ]</tt>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp.h,v 1.5 2007/01/06 19:45:21 kardel Exp $ */
/* $NetBSD: ntp.h,v 1.6 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp.h - NTP definitions for the masses
@ -435,7 +435,6 @@ struct peer {
#define FLAG_FIXPOLL 0x1000 /* stick at minpoll */
#define FLAG_TRUE 0x2000 /* select truechimer */
#define FLAG_PREEMPT 0x4000 /* preemptable association */
#define FLAG_DYNAMIC 0x8000 /* dynamic addresses - allow configuration even if no interface is found */
/*
* Definitions for the clear() routine. We use memset() to clear

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_request.h,v 1.4 2007/01/06 19:45:22 kardel Exp $ */
/* $NetBSD: ntp_request.h,v 1.5 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_request.h - definitions for the ntpd remote query facility
@ -602,7 +602,6 @@ struct conf_peer {
#define CONF_FLAG_IBURST 0x08
#define CONF_FLAG_NOSELECT 0x10
#define CONF_FLAG_SKEY 0x20
#define CONF_FLAG_DYNAMIC 0x40
/*
* Structure for passing peer deletion information. Currently

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntpd.h,v 1.6 2007/01/06 19:45:22 kardel Exp $ */
/* $NetBSD: ntpd.h,v 1.7 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntpd.h - Prototypes for ntpd.
@ -285,6 +285,11 @@ extern u_long numasyncmsgs; /* number of async messages we've sent */
/* ntp_intres.c */
extern keyid_t req_keyid; /* request keyid */
extern char * req_file; /* name of the file with configuration info */
#ifdef SYS_WINNT
extern HANDLE ResolverEventHandle;
#else
extern int resolver_pipe_fd[2]; /* used to let the resolver process alert the parent process */
#endif /* SYS_WINNT */
/*
* Other statistics of possible interest

View File

@ -1,4 +1,4 @@
/* $NetBSD: recvbuff.h,v 1.4 2007/06/24 16:55:12 kardel Exp $ */
/* $NetBSD: recvbuff.h,v 1.5 2008/08/23 09:10:31 kardel Exp $ */
#if !defined __recvbuff_h
#define __recvbuff_h
@ -96,7 +96,8 @@ extern void freerecvbuf P((struct recvbuf *));
* The buffer is removed from the free list. Make sure
* you put it back with freerecvbuf() or
*/
extern struct recvbuf *get_free_recv_buffer P((void));
extern struct recvbuf *get_free_recv_buffer P((void)); /* signal safe - no malloc */
extern struct recvbuf *get_free_recv_buffer_alloc P((void)); /* signal unsafe - may malloc */
/* Add a buffer to the full list
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machines.c,v 1.3 2006/06/11 19:34:10 kardel Exp $ */
/* $NetBSD: machines.c,v 1.4 2008/08/23 09:10:31 kardel Exp $ */
/* machines.c - provide special support for peculiar architectures
*
@ -502,10 +502,10 @@ getpass(const char * prompt)
{
int c, i;
static char password[32];
#ifdef DEBUG
fprintf(stderr, "%s", prompt);
fflush(stderr);
#endif
for (i=0; i<sizeof(password)-1 && ((c=_getch())!='\n' && c!='\r'); i++) {
password[i] = (char) c;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: recvbuff.c,v 1.6 2007/08/18 13:18:23 kardel Exp $ */
/* $NetBSD: recvbuff.c,v 1.7 2008/08/23 09:10:31 kardel Exp $ */
#ifdef HAVE_CONFIG_H
# include <config.h>
@ -21,7 +21,8 @@ static u_long volatile full_recvbufs; /* number of recvbufs on fulllist */
static u_long volatile free_recvbufs; /* number of recvbufs on freelist */
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 ISC_LIST(recvbuf_t) full_recv_list; /* Currently used recv buffers */
static ISC_LIST(recvbuf_t) free_recv_list; /* Currently unused buffers */
@ -76,19 +77,18 @@ initialise_buffer(recvbuf_t *buff)
#endif
}
static int
static void
create_buffers(int nbufs)
{
register recvbuf_t *bufp;
int i;
int i, abuf;
bufp = (recvbuf_t *) emalloc(nbufs*sizeof(recvbuf_t));
/*
* If no memory available, Bail
*/
if (bufp == NULL)
return (0);
for (i = 0; i < nbufs; i++)
abuf = nbufs + buffer_shortfall;
buffer_shortfall = 0;
bufp = (recvbuf_t *) emalloc(abuf*sizeof(recvbuf_t));
for (i = 0; i < abuf; i++)
{
memset((char *) bufp, 0, sizeof(recvbuf_t));
ISC_LIST_APPEND(free_recv_list, bufp, link);
@ -97,7 +97,6 @@ create_buffers(int nbufs)
total_recvbufs++;
}
lowater_adds++;
return (nbufs);
}
void
@ -171,16 +170,35 @@ get_free_recv_buffer(void)
initialise_buffer(buffer);
(buffer->used)++;
}
else
{
buffer_shortfall++;
}
UNLOCK();
return (buffer);
}
#ifdef HAVE_IO_COMPLETION_PORT
recvbuf_t *
get_free_recv_buffer_alloc(void)
{
recvbuf_t * buffer = get_free_recv_buffer();
if (buffer == NULL)
{
create_buffers(RECV_INC);
buffer = get_free_recv_buffer();
}
return (buffer);
}
#endif
recvbuf_t *
get_full_recv_buffer(void)
{
recvbuf_t *rbuf;
LOCK();
#ifdef HAVE_SIGNALED_IO
/*
* make sure there are free buffers when we
* wander off to do lengthy paket processing with
@ -190,15 +208,13 @@ get_full_recv_buffer(void)
* (Bug 889)
*/
rbuf = ISC_LIST_HEAD(free_recv_list);
if (rbuf == NULL) {
if (rbuf == NULL || buffer_shortfall > 0) {
/*
* try to get us some more buffers
*/
if (create_buffers(RECV_INC) <= 0)
{
msyslog(LOG_ERR, "No more memory for recvufs");
}
create_buffers(RECV_INC);
}
#endif
/*
* try to grab a full buffer

View File

@ -1,4 +1,4 @@
/* $NetBSD: save.c,v 1.4 2007/06/24 19:39:06 kardel Exp $ */
/* $NetBSD: save.c,v 1.5 2008/08/23 09:10:31 kardel Exp $ */
/*
@ -439,8 +439,17 @@ optionSaveFile( tOptions* pOpts )
* THEN just print the name and continue
*/
if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NONE) {
fprintf( fp, "%s\n",
(DISABLED_OPT( p )) ? p->pz_DisableName : p->pz_Name );
char const * pznm =
(DISABLED_OPT( p )) ? p->pz_DisableName : p->pz_Name;
/*
* If the option was disabled and the disablement name is NULL,
* then the disablement was caused by aliasing.
* Use the name as the string to emit.
*/
if (pznm == NULL)
pznm = p->pz_Name;
fprintf(fp, "%s\n", pznm);
continue;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd_args.c,v 1.5 2007/08/18 09:56:14 kardel Exp $ */
/* $NetBSD: cmd_args.c,v 1.6 2008/08/23 09:10:31 kardel Exp $ */
/*
* cmd_args.c = command-line argument processing
@ -187,11 +187,11 @@ getCmdOpts(
if (HAVE_OPT( UPDATEINTERVAL )) {
long val = OPT_VALUE_UPDATEINTERVAL;
if ((val >= 60) || (val == 0))
if (val >= 0)
interface_interval = val;
else {
msyslog(LOG_ERR,
"command line interface update interval %ld must be 0 or longer than 60 seconds",
"command line interface update interval %ld must be greater or equal to 0",
val);
errflg++;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_config.c,v 1.9 2007/01/06 19:45:22 kardel Exp $ */
/* $NetBSD: ntp_config.c,v 1.10 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_config.c - read and apply configuration information
@ -38,7 +38,10 @@
#ifdef SYS_WINNT
# include <io.h>
HANDLE ResolverThreadHandle = NULL;
static HANDLE ResolverThreadHandle = NULL;
HANDLE ResolverEventHandle;
#else
int resolver_pipe_fd[2]; /* used to let the resolver process alert the parent process */
#endif /* SYS_WINNT */
/*
@ -408,7 +411,7 @@ static int matchkey P((char *, struct keyword *, int));
enum gnn_type {
t_UNK, /* Unknown */
t_REF, /* Refclock */
t_MSK, /* Network Mask */
t_MSK /* Network Mask */
};
static int getnetnum P((const char *, struct sockaddr_storage *, int,
enum gnn_type));
@ -812,8 +815,10 @@ getconfig(
peerflags |= FLAG_IBURST;
break;
case CONF_MOD_DYNAMIC:
peerflags |= FLAG_DYNAMIC;
case CONF_MOD_DYNAMIC:
msyslog(LOG_WARNING,
"Warning: the \"dynamic\" keyword has been obsoleted"
" and will be removed in the next release\n");
break;
#ifdef OPENSSL
@ -2434,7 +2439,22 @@ do_resolve_internal(void)
(void) signal_no_reset(SIGCHLD, catchchild);
#ifndef SYS_VXWORKS
/* the parent process will write to the pipe
* in order to wake up to child process
* which may be waiting in a select() call
* on the read fd */
if (pipe(resolver_pipe_fd) < 0) {
msyslog(LOG_ERR,
"unable to open resolver pipe");
exit(1);
}
i = fork();
/* Shouldn't the code below be re-ordered?
* I.e. first check if the fork() returned an error, then
* check whether we're parent or child.
* Martin Burnicki
*/
if (i == 0) {
/*
* this used to close everything
@ -2469,6 +2489,9 @@ do_resolve_internal(void)
* THUS:
*/
/* This is the child process who will read the pipe,
* so we close the write fd */
close(resolver_pipe_fd[1]);
closelog();
kill_asyncio(0);
@ -2517,6 +2540,11 @@ do_resolve_internal(void)
(void) signal_no_reset(SIGCHLD, SIG_DFL);
abort_resolve();
}
else {
/* This is the parent process who will write to the pipe,
* so we close the read fd */
close(resolver_pipe_fd[0]);
}
#else /* SYS_WINNT */
{
/* NT's equivalent of fork() is _spawn(), but the start point
@ -2525,6 +2553,11 @@ do_resolve_internal(void)
*/
DWORD dwThreadId;
fflush(stdout);
ResolverEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
if (ResolverEventHandle == NULL) {
msyslog(LOG_ERR, "Unable to create resolver event object, can't start ntp_intres");
abort_resolve();
}
ResolverThreadHandle = CreateThread(
NULL, /* no security attributes */
0, /* use default stack size */
@ -2534,6 +2567,8 @@ do_resolve_internal(void)
&dwThreadId); /* returns the thread identifier */
if (ResolverThreadHandle == NULL) {
msyslog(LOG_ERR, "CreateThread() failed, can't start ntp_intres");
CloseHandle(ResolverEventHandle);
ResolverEventHandle = NULL;
abort_resolve();
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_intres.c,v 1.8 2007/01/13 11:41:05 kardel Exp $ */
/* $NetBSD: ntp_intres.c,v 1.9 2008/08/23 09:10:31 kardel Exp $ */
/*
* ripped off from ../ntpres/ntpres.c by Greg Troxel 4/2/92
@ -148,7 +148,6 @@ char *req_file; /* name of the file with configuration info */
/* end stuff to be filled in */
static RETSIGTYPE bong P((int));
static void checkparent P((void));
static void removeentry P((struct conf_entry *));
static void addentry P((char *, int, int, int, int, u_int,
@ -189,9 +188,11 @@ static void resolver_exit P((int));
static void resolver_exit (int code)
{
#ifdef SYS_WINNT
ExitThread (code); /* Just to kill the thread not the process */
CloseHandle(ResolverEventHandle);
ResolverEventHandle = NULL;
ExitThread(code); /* Just to kill the thread not the process */
#else
exit (code); /* fill the forked process */
exit(code); /* kill the forked process */
#endif
}
@ -221,11 +222,13 @@ void
ntp_intres(void)
{
FILE *in;
#ifdef HAVE_SIGSUSPEND
sigset_t set;
sigemptyset(&set);
#endif /* HAVE_SIGSUSPEND */
struct timeval tv;
fd_set fdset;
#ifdef SYS_WINNT
DWORD rc;
#else
int rc;
#endif
#ifdef DEBUG
if (debug > 1) {
@ -261,93 +264,82 @@ ntp_intres(void)
(void) unlink(req_file);
/*
* Sleep a little to make sure the server is completely up
* Set up the timers to do first shot immediately.
*/
sleep(SLEEPTIME);
/*
* Make a first cut at resolving the bunch
*/
doconfigure(1);
if (confentries == NULL) {
resolver_exit(0);
}
/*
* Here we've got some problem children. Set up the timer
* and wait for it.
*/
resolve_value = resolve_timer = MINRESOLVE;
resolve_timer = 0;
resolve_value = MINRESOLVE;
config_timer = CONFIG_TIME;
#ifndef SYS_WINNT
(void) signal_no_reset(SIGALRM, bong);
alarm(ALARM_TIME);
#endif /* SYS_WINNT */
for (;;) {
if (confentries == NULL)
resolver_exit(0);
checkparent();
if (resolve_timer == 0) {
if (resolve_value < MAXRESOLVE)
resolve_value <<= 1;
/*
* Sleep a little to make sure the network is completely up
*/
sleep(SLEEPTIME);
doconfigure(1);
/* prepare retry, in case there's more work to do */
resolve_timer = resolve_value;
#ifdef DEBUG
if (debug > 2)
msyslog(LOG_INFO, "resolve_timer: 0->%d", resolve_timer);
#endif
if (resolve_value < MAXRESOLVE)
resolve_value <<= 1;
config_timer = CONFIG_TIME;
doconfigure(1);
continue;
} else if (config_timer == 0) {
} else if (config_timer == 0) { /* MB: in which case would this be required ? */
doconfigure(0);
/* MB: should we check now if we could exit, similar to the code above? */
config_timer = CONFIG_TIME;
#ifdef DEBUG
if (debug > 2)
msyslog(LOG_INFO, "config_timer: 0->%d", config_timer);
#endif
doconfigure(0);
continue;
}
#ifndef SYS_WINNT
/*
* There is a race in here. Is okay, though, since
* all it does is delay things by 30 seconds.
*/
# ifdef HAVE_SIGSUSPEND
sigsuspend(&set);
# else
sigpause(0);
# endif /* HAVE_SIGSUSPEND */
#else
if (confentries == NULL)
resolver_exit(0); /* done */
#ifdef SYS_WINNT
rc = WaitForSingleObject(ResolverEventHandle, 1000 * ALARM_TIME); /* in milliseconds */
if ( rc == WAIT_OBJECT_0 ) { /* signaled by the main thread */
resolve_timer = 0; /* retry resolving immediately */
continue;
}
if ( rc != WAIT_TIMEOUT ) /* not timeout: error */
resolver_exit(1);
#else /* not SYS_WINNT */
tv.tv_sec = ALARM_TIME;
tv.tv_usec = 0;
FD_ZERO(&fdset);
FD_SET(resolver_pipe_fd[0], &fdset);
rc = select(resolver_pipe_fd[0] + 1, &fdset, (fd_set *)0, (fd_set *)0, &tv);
if (rc > 0) { /* parent process has written to the pipe */
read(resolver_pipe_fd[0], (char *)&rc, sizeof(rc)); /* make pipe empty */
resolve_timer = 0; /* retry resolving immediately */
continue;
}
if ( rc < 0 ) /* select() returned error */
resolver_exit(1);
#endif
/* normal timeout, keep on waiting */
if (config_timer > 0)
config_timer--;
config_timer--;
if (resolve_timer > 0)
resolve_timer--;
sleep(ALARM_TIME);
#endif /* SYS_WINNT */
resolve_timer--;
}
}
#ifndef SYS_WINNT
/*
* bong - service and reschedule an alarm() interrupt
*/
static RETSIGTYPE
bong(
int sig
)
{
if (config_timer > 0)
config_timer--;
if (resolve_timer > 0)
resolve_timer--;
alarm(ALARM_TIME);
}
#endif /* SYS_WINNT */
/*
* checkparent - see if our parent process is still running
@ -1065,7 +1057,7 @@ readconf(
}
if ((intval[TOK_FLAGS] & ~(FLAG_AUTHENABLE | FLAG_PREFER |
FLAG_NOSELECT | FLAG_BURST | FLAG_IBURST | FLAG_SKEY | FLAG_DYNAMIC))
FLAG_NOSELECT | FLAG_BURST | FLAG_IBURST | FLAG_SKEY))
!= 0) {
msyslog(LOG_ERR, "invalid flags (%ld) in file %s",
intval[TOK_FLAGS], name);
@ -1085,8 +1077,6 @@ readconf(
flags |= CONF_FLAG_IBURST;
if (intval[TOK_FLAGS] & FLAG_SKEY)
flags |= CONF_FLAG_SKEY;
if (intval[TOK_FLAGS] & FLAG_DYNAMIC)
flags |= CONF_FLAG_DYNAMIC;
/*
* This is as good as we can check it. Add it in.
@ -1110,6 +1100,12 @@ doconfigure(
register struct conf_entry *ce;
register struct conf_entry *ceremove;
#ifdef DEBUG
if (debug > 1)
msyslog(LOG_INFO, "Running doconfigure %s DNS",
dores ? "with" : "without" );
#endif
ce = confentries;
while (ce != NULL) {
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_io.c,v 1.25 2007/08/18 09:56:14 kardel Exp $ */
/* $NetBSD: ntp_io.c,v 1.26 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_io.c - input/output routines for ntpd. The socket-opening code
@ -174,7 +174,7 @@ static u_char sys_interphase = 0;
static struct interface *new_interface P((struct interface *));
static void add_interface P((struct interface *));
static void update_interfaces P((u_short, interface_receiver_t, void *));
static int update_interfaces P((u_short, interface_receiver_t, void *));
static void remove_interface P((struct interface *));
static struct interface *create_interface P((u_short, struct interface *));
@ -1053,9 +1053,25 @@ void
interface_update(interface_receiver_t receiver, void *data)
{
if (!disable_dynamic_updates) {
int new_interface_found;
BLOCKIO();
update_interfaces(htons(NTP_PORT), receiver, data);
new_interface_found = update_interfaces(htons(NTP_PORT), receiver, data);
UNBLOCKIO();
if (new_interface_found) {
#ifdef DEBUG
msyslog(LOG_DEBUG, "new interface(s) found: waking up resolver");
#endif
#ifdef SYS_WINNT
/* wake up the resolver thread */
if (ResolverEventHandle != NULL)
SetEvent(ResolverEventHandle);
#else
/* write any single byte to the pipe to wake up the resolver process */
write( resolver_pipe_fd[1], &new_interface_found, 1 );
#endif
}
}
}
@ -1148,7 +1164,7 @@ set_wildcard_reuse(int family, int on)
*
*/
static void
static int
update_interfaces(
u_short port,
interface_receiver_t receiver,
@ -1161,6 +1177,7 @@ update_interfaces(
isc_boolean_t scan_ipv4 = ISC_FALSE;
isc_boolean_t scan_ipv6 = ISC_FALSE;
isc_result_t result;
int new_interface_found = 0;
DPRINTF(3, ("update_interfaces(%d)\n", ntohs( (u_short) port)));
@ -1197,7 +1214,7 @@ update_interfaces(
result = isc_interfaceiter_create(mctx, &iter);
if (result != ISC_R_SUCCESS)
return;
return 0;
sys_interphase ^= 0x1; /* toggle system phase for finding untouched (to be deleted) interfaces */
@ -1300,6 +1317,8 @@ update_interfaces(
if (receiver)
receiver(data, &ifi);
new_interface_found = 1;
DPRINT_INTERFACE(3, (iface, "updating ", " new - created\n"));
}
else
@ -1373,8 +1392,9 @@ update_interfaces(
* phase 3 - re-configure as the world has changed if necessary
*/
refresh_all_peerinterfaces();
return new_interface_found;
}
/*
* create_sockets - create a socket for each interface plus a default
@ -2453,7 +2473,11 @@ open_socket(
/*
* Add the socket to the completion port
*/
io_completion_port_add_socket(fd, interf);
if (io_completion_port_add_socket(fd, interf))
{
msyslog(LOG_ERR, "unable to set up io completion port - EXITING");
exit(1);
}
#endif
return fd;
}
@ -2898,35 +2922,37 @@ read_network_packet(SOCKET fd, struct interface *itf, l_fp ts)
rb->recv_length = recvmsg(fd, &msghdr, 0);
#endif
if (rb->recv_length == 0|| (rb->recv_length == -1 &&
buflen = rb->recv_length;
if (buflen == 0 || (buflen == -1 &&
(errno==EWOULDBLOCK
#ifdef EAGAIN
|| errno==EAGAIN
#endif
))) {
freerecvbuf(rb);
return (rb->recv_length);
return (buflen);
}
else if (rb->recv_length < 0)
else if (buflen < 0)
{
netsyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m",
stoa(&rb->recv_srcadr), fd);
DPRINTF(5, ("read_network_packet: fd=%d dropped (bad recvfrom)\n", fd));
freerecvbuf(rb);
return (rb->recv_length);
return (buflen);
}
#ifdef DEBUG
if (debug > 2) {
if(rb->recv_srcadr.ss_family == AF_INET)
printf("read_network_packet: fd=%d length %d from %08lx %s\n",
fd, rb->recv_length,
fd, buflen,
(u_long)ntohl(((struct sockaddr_in*)&rb->recv_srcadr)->sin_addr.s_addr) &
0x00000000ffffffff,
stoa(&rb->recv_srcadr));
else
printf("read_network_packet: fd=%d length %d from %s\n",
fd, rb->recv_length,
fd, buflen,
stoa(&rb->recv_srcadr));
}
#endif
@ -2947,7 +2973,7 @@ read_network_packet(SOCKET fd, struct interface *itf, l_fp ts)
itf->received++;
packets_received++;
return (rb->recv_length);
return (buflen);
}
/*
@ -3139,7 +3165,7 @@ findinterface(
{
struct interface *interface;
interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD);
interface = findlocalinterface(addr, INT_WILDCARD);
if (interface == NULL)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_peer.c,v 1.5 2007/06/24 16:55:14 kardel Exp $ */
/* $NetBSD: ntp_peer.c,v 1.6 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_peer.c - management of data maintained for peer associations
@ -17,6 +17,10 @@
#include "openssl/rand.h"
#endif /* OPENSSL */
#ifdef SYS_WINNT
extern int accept_wildcard_if_for_winnt;
#endif
/*
* Table of valid association combinations
* ---------------------------------------
@ -29,7 +33,7 @@
* PASSIVE | e 1 e 0 0 0
* CLIENT | e 0 0 0 1 1
* SERVER | e 0 0 0 0 0
* BCAST | e 0 0 0 0 0
* BCAST | e 0 0 0 0 0
* BCLIENT | e 0 0 0 e 1
*
* One point to note here: a packet in BCAST mode can potentially match
@ -708,7 +712,11 @@ select_peerinterface(struct peer *peer, struct sockaddr_storage *srcadr, struct
* crypto will not work without knowing the own transmit address
*/
if (interface != NULL && interface->flags & INT_WILDCARD)
interface = NULL;
#ifdef SYS_WINNT
if ( !accept_wildcard_if_for_winnt )
#endif
interface = NULL;
return interface;
}
@ -761,45 +769,25 @@ newpeer(
cast_flags, stoa(srcadr)));
ISC_LINK_INIT(peer, ilink); /* set up interface link chain */
dstadr = select_peerinterface(peer, srcadr, dstadr, cast_flags);
/*
* If we can't find an interface to use we return a NULL
* unless the DYNAMIC flag is set - then we expect the dynamic
* interface detection code to bind us some day to an interface
*/
if (dstadr == NULL && !(flags & FLAG_DYNAMIC))
{
msyslog(LOG_ERR, "Cannot find existing interface for address %s", stoa(srcadr));
peer->next = peer_free;
peer_free = peer;
peer_associations--;
peer_free_count++;
return (NULL);
}
peer->srcadr = *srcadr;
set_peerdstadr(peer, select_peerinterface(peer, srcadr, dstadr,
cast_flags));
peer->hmode = (u_char)hmode;
peer->version = (u_char)version;
peer->minpoll = (u_char)max(NTP_MINPOLL, minpoll);
peer->maxpoll = (u_char)min(NTP_MAXPOLL, maxpoll);
peer->flags = flags;
set_peerdstadr(peer, dstadr);
#ifdef DEBUG
if (debug > 2) {
if (peer->dstadr)
printf("newpeer: using fd %d and our addr %s\n",
peer->dstadr->fd, stoa(&peer->dstadr->sin));
peer->dstadr->fd,
stoa(&peer->dstadr->sin));
else
printf("newpeer: local interface currently not bound\n");
}
#endif
/*
* Broadcast needs the socket enabled for broadcast
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_request.c,v 1.7 2008/02/20 18:16:09 matt Exp $ */
/* $NetBSD: ntp_request.c,v 1.8 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_request.c - respond to information requests
@ -1347,7 +1347,7 @@ do_conf(
&& temp_cp.hmode != MODE_BROADCAST)
fl = 1;
if (temp_cp.flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER
| CONF_FLAG_BURST | CONF_FLAG_IBURST | CONF_FLAG_SKEY | CONF_FLAG_DYNAMIC))
| CONF_FLAG_BURST | CONF_FLAG_IBURST | CONF_FLAG_SKEY))
fl = 1;
cp = (struct conf_peer *)
((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize));
@ -1380,8 +1380,6 @@ do_conf(
fl |= FLAG_IBURST;
if (temp_cp.flags & CONF_FLAG_SKEY)
fl |= FLAG_SKEY;
if (temp_cp.flags & CONF_FLAG_DYNAMIC)
fl |= FLAG_DYNAMIC;
if (client_v6_capable && temp_cp.v6_flag != 0) {
peeraddr.ss_family = AF_INET6;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_restrict.c,v 1.6 2007/01/06 19:45:23 kardel Exp $ */
/* $NetBSD: ntp_restrict.c,v 1.7 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntp_restrict.c - determine host restrictions
@ -114,9 +114,9 @@ init_restrict(void)
/*
* Zero the list and put all but one on the free list
*/
resfree = 0;
resfree = NULL;
memset((char *)resinit, 0, sizeof resinit);
resfree6 = 0;
resfree6 = NULL;
memset((char *)resinit6, 0, sizeof resinit6);
for (i = 1; i < INITRESLIST; i++) {
resinit[i].next = resfree;
@ -196,7 +196,7 @@ restrictions(
* Work our way down from there.
*/
match = restrictlist;
for (rl = match->next; rl != 0 && rl->addr <= hostaddr;
for (rl = match->next; rl != NULL && rl->addr <= hostaddr;
rl = rl->next)
if ((hostaddr & rl->mask) == rl->addr) {
if ((rl->mflags & RESM_NTPONLY) &&
@ -236,7 +236,7 @@ restrictions(
* Work our way down from there.
*/
match6 = restrictlist6;
for (rl6 = match6->next; rl6 != 0 &&
for (rl6 = match6->next; rl6 != NULL &&
(memcmp(&(rl6->addr6), &hostaddr6,
sizeof(hostaddr6)) <= 0); rl6 = rl6->next) {
SET_IPV6_ADDR_MASK(&hostservaddr6, &hostaddr6,
@ -326,14 +326,14 @@ hack_restrict(
* list. Else go searching for it.
*/
if (addr == 0) {
rlprev = 0;
rlprev = NULL;
rl = restrictlist;
} else {
rlprev = restrictlist;
rl = rlprev->next;
while (rl != 0) {
while (rl != NULL) {
if (rl->addr > addr) {
rl = 0;
rl = NULL;
break;
} else if (rl->addr == addr) {
if (rl->mask == mask) {
@ -345,11 +345,11 @@ hack_restrict(
if (!(mflags &
RESM_NTPONLY)) {
rl = 0;
rl = NULL;
break;
}
} else if (rl->mask > mask) {
rl = 0;
rl = NULL;
break;
}
}
@ -369,11 +369,11 @@ hack_restrict(
} else {
rlprev6 = restrictlist6;
rl6 = rlprev6->next;
while (rl6 != 0) {
while (rl6 != NULL) {
addr_cmp = memcmp(&rl6->addr6, &addr6,
sizeof(addr6));
if (addr_cmp > 0) {
rl6 = 0;
rl6 = NULL;
break;
} else if (addr_cmp == 0) {
mask_cmp = memcmp(&rl6->mask6,
@ -387,11 +387,11 @@ hack_restrict(
if (!(mflags &
RESM_NTPONLY)) {
rl6 = 0;
rl6 = NULL;
break;
}
} else if (mask_cmp > 0) {
rl6 = 0;
rl6 = NULL;
break;
}
}
@ -418,8 +418,8 @@ hack_restrict(
* Here we add bits to the flags. If this is a
* new restriction add it.
*/
if (rl == 0) {
if (numresfree == 0) {
if (rl == NULL) {
if (resfree == NULL) {
rl = (struct restrictlist *)
emalloc(INCRESLIST *
sizeof(struct
@ -465,7 +465,7 @@ hack_restrict(
* Remove some bits from the flags. If we didn't
* find this one, just return.
*/
if (rl != 0) {
if (rl != NULL) {
if ((rl->flags ^ (u_short)flags) &
RES_LIMITED) {
res_limited_refcnt--;
@ -483,7 +483,7 @@ hack_restrict(
* found one. Don't remove the default entry and
* don't remove an interface entry.
*/
if (rl != 0
if (rl != NULL
&& rl->addr != htonl(INADDR_ANY)
&& !(rl->mflags & RESM_INTERFACE && op != RESTRICT_REMOVEIF)) {
if (rlprev != NULL) {
@ -516,8 +516,8 @@ hack_restrict(
* Here we add bits to the flags. If this is a
* new restriction add it.
*/
if (rl6 == 0) {
if (numresfree6 == 0) {
if (rl6 == NULL) {
if (resfree6 == NULL) {
rl6 = (struct
restrictlist6 *)emalloc(
INCRESLIST * sizeof(struct
@ -562,7 +562,7 @@ hack_restrict(
* Remove some bits from the flags. If we didn't
* find this one, just return.
*/
if (rl6 != 0) {
if (rl6 != NULL) {
if ((rl6->flags ^ (u_short)flags) &
RES_LIMITED) {
res_limited_refcnt6--;
@ -580,7 +580,7 @@ hack_restrict(
* found one. Don't remove the default entry and
* don't remove an interface entry.
*/
if (rl6 != 0 &&
if (rl6 != NULL &&
!IN6_IS_ADDR_UNSPECIFIED(&rl6->addr6)
&& !(rl6->mflags & RESM_INTERFACE && op != RESTRICT_REMOVEIF)) {
if (rlprev6 != NULL) {

13
dist/ntp/ntpd/ntpd.c vendored
View File

@ -1,4 +1,4 @@
/* $NetBSD: ntpd.c,v 1.12 2007/06/24 16:55:14 kardel Exp $ */
/* $NetBSD: ntpd.c,v 1.13 2008/08/23 09:10:31 kardel Exp $ */
/*
* ntpd.c - main program for the fixed point NTP daemon
@ -1087,8 +1087,19 @@ getgroup:
rbuf = get_full_recv_buffer();
while (rbuf != NULL)
{
if (alarm_flag)
{
was_alarmed = 1;
alarm_flag = 0;
}
UNBLOCK_IO_AND_ALARM();
if (was_alarmed)
{ /* avoid timer starvation during lengthy I/O handling */
timer();
was_alarmed = 0;
}
/*
* Call the data procedure to handle each received
* packet.

View File

@ -1,4 +1,4 @@
/* $NetBSD: refclock_oncore.c,v 1.10 2007/01/06 19:45:23 kardel Exp $ */
/* $NetBSD: refclock_oncore.c,v 1.11 2008/08/23 09:10:31 kardel Exp $ */
/*
* ----------------------------------------------------------------------------
@ -537,10 +537,6 @@ oncore_start(
char device1[STRING_LEN], device2[STRING_LEN], Msg[160];
const char *cp;
struct stat stat1, stat2;
#ifdef PPS_HAVE_FINDSOURCE
int ret;
char id[STRING_LEN];
#endif
/* create instance structure for this unit */
@ -591,57 +587,6 @@ oncore_start(
(void)sprintf(device1, DEVICE1, unit);
(void)sprintf(device2, DEVICE2, unit);
#ifdef PPS_HAVE_FINDSOURCE
/* Try to find the PPS source (by using "index = -1"
* we ask just for a generic source)
*/
num = fd2 = -1;
if ((num=time_pps_findsource(num, device2, STRING_LEN, id, STRING_LEN)) < 0) {
sprintf(Msg, "No available PPS source in the system");
record_clock_stats(&(instance->peer->srcadr), Msg);
exit(1);
}
sprintf(Msg, "Found PPS source #%d \"%s\" on \"%s\"", num, id, device2);
record_clock_stats(&(instance->peer->srcadr), Msg);
/* there are two cases here:
* either there is a device name in device2 and we must open it,
* or there is not, and and it is not a device, and there is nothing
* to open.
* in either case we must use refclock_open to get fd1 opened raw.
*/
if (strlen(device2)) {
if (stat(device1, &stat1)) {
sprintf(Msg, "Can't stat fd1 (%s)\n", device1);
record_clock_stats(&(instance->peer->srcadr), Msg);
exit(1);
}
if (stat(device2, &stat2)) {
sprintf(Msg, "Can't stat fd2 (%s)\n", device2);
record_clock_stats(&(instance->peer->srcadr), Msg);
exit(1);
}
if ((stat1.st_dev != stat2.st_dev) || (stat1.st_ino != stat2.st_ino)) {
if ((ret=open(device2, O_RDWR)) < 0) { /* different devices here */
sprintf(Msg, "Can't open fd2 (%s)\n", device2);
record_clock_stats(&(instance->peer->srcadr), Msg);
exit(1);
}
}
}
if ((fd1=refclock_open(device1, SPEED, LDISC_RAW)) < 0) {
sprintf(Msg, "Can't open fd1 (%s)\n", device1);
record_clock_stats(&(instance->peer->srcadr), Msg);
exit(1);
}
#else
/* OPEN DEVICES */
/* opening different devices for fd1 and fd2 presents no problems */
/* opening the SAME device twice, seems to be OS dependent.
@ -681,7 +626,7 @@ oncore_start(
}
}
num = fd2;
#endif
/* open ppsapi soure */
if (time_pps_create(num, &instance->pps_h) < 0) {
@ -2424,14 +2369,14 @@ oncore_msg_BnEnHn(
return;
dt1 = instance->saw_tooth + instance->offset; /* dt this time step */
instance->saw_tooth = (s_char) instance->BEHn[10]; /* update for next time Hn[10] */
instance->saw_tooth = (s_char) instance->BEHn[14]; /* update for next time Hn[14] */
dt2 = instance->saw_tooth + instance->offset; /* dt next time step */
} else {
if (instance->BEHn[21]) /* bad TRAIM */
return;
dt1 = instance->saw_tooth + instance->offset; /* dt this time step */
instance->saw_tooth = (s_char) instance->BEHn[25]; /* update for next time */
instance->saw_tooth = (s_char) instance->BEHn[25]; /* update for next time Bn[25], En[25] */
dt2 = instance->saw_tooth + instance->offset; /* dt next time step */
}
@ -2973,7 +2918,7 @@ oncore_msg_Gj(
if (dt) {
sprintf(Msg, "ONCORE[%d]: Leap second (%d) scheduled for %d%s%d at %d:%d:%d",
instance->unit,
dt, buf[9], Month[buf[8]], 256*buf[6]+buf[7],
dt, buf[9], Month[buf[8]-1], 256*buf[6]+buf[7],
buf[15], buf[16], buf[17]);
record_clock_stats(&(instance->peer->srcadr), Msg);
}

View File

@ -1,17 +1,23 @@
/* $NetBSD: refclock_parse.c,v 1.9 2007/08/18 09:56:13 kardel Exp $ */
/* $NetBSD: refclock_parse.c,v 1.10 2008/08/23 09:10:31 kardel Exp $ */
/*
* /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.78 2006/12/22 20:08:27 kardel RELEASE_20061222_A
* /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.80 2007/08/11 12:06:29 kardel Exp
*
* refclock_parse.c,v 4.78 2006/12/22 20:08:27 kardel RELEASE_20061222_A
* refclock_parse.c,v 4.80 2007/08/11 12:06:29 kardel Exp
*
* generic reference clock driver for several DCF/GPS/MSF/... receivers
*
* optionally make use of a STREAMS module for input processing where
* available and configured. Currently the STREAMS module
* is only available for Suns running SunOS 4.x and SunOS5.x
* PPS notes:
* On systems that support PPSAPI (RFC2783) PPSAPI is the
* preferred interface.
*
* Copyright (c) 1995-2006 by Frank Kardel <kardel <AT> ntp.org>
* Optionally make use of a STREAMS module for input processing where
* available and configured. This STREAMS module reduces the time
* stamp latency for serial and PPS events.
* Currently the STREAMS module is only available for Suns running
* SunOS 4.x and SunOS5.x.
*
* Copyright (c) 1995-2007 by Frank Kardel <kardel <AT> ntp.org>
* Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
*
* Redistribution and use in source and binary forms, with or without
@ -184,7 +190,7 @@
#include "ieee754io.h"
#include "recvbuff.h"
static char rcsid[] = "refclock_parse.c,v 4.78 2006/12/22 20:08:27 kardel RELEASE_20061222_A";
static char rcsid[] = "refclock_parse.c,v 4.80 2007/08/11 12:06:29 kardel Exp";
/**===========================================================================
** external interface to ntp mechanism
@ -5740,6 +5746,12 @@ int refclock_parse_bs;
* History:
*
* refclock_parse.c,v
* Revision 4.80 2007/08/11 12:06:29 kardel
* update comments wrt/ to PPS
*
* Revision 4.79 2007/08/11 11:52:23 kardel
* - terminate io bindings before io_closeclock() will close our file descriptor
*
* Revision 4.78 2006/12/22 20:08:27 kardel
* Bug 746 (RFE): add configuration for Expert mouseCLOCK USB v2.0 as mode 19
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntpdate.c,v 1.8 2007/06/24 16:55:14 kardel Exp $ */
/* $NetBSD: ntpdate.c,v 1.9 2008/08/23 09:10:32 kardel Exp $ */
/*
* ntpdate - set the time of day by polling one or more NTP servers
@ -86,6 +86,7 @@ struct timeval timeout = {60,0};
on Windows NT timers. */
#pragma comment(lib, "winmm")
isc_boolean_t ntp_port_inuse(int af, u_short port);
UINT wTimerRes;
#endif /* SYS_WINNT */
/*
@ -106,11 +107,11 @@ static timer_t ntpdate_timerid;
* Compatibility stuff for Version 2
*/
#define NTP_MAXSKW 0x28f /* 0.01 sec in fp format */
#define NTP_MINDIST 0x51f /* 0.02 sec in fp format */
#define NTP_MINDIST 0x51f /* 0.02 sec in fp format */
#define PEER_MAXDISP (64*FP_SECOND) /* maximum dispersion (fp 64) */
#define NTP_INFIN 15 /* max stratum, infinity a la Bellman-Ford */
#define NTP_MAXWGT (8*FP_SECOND) /* maximum select weight 8 seconds */
#define NTP_MAXLIST 5 /* maximum select list size */
#define NTP_MAXLIST 5 /* maximum select list size */
#define PEER_SHIFT 8 /* 8 suitable for crystal time base */
/*
@ -128,8 +129,8 @@ volatile int debug = 0;
*/
int ai_fam_templ;
int nbsock;
SOCKET fd[MAX_AF]; /* support up to 2 sockets */
int nbsock; /* the number of sockets used */
SOCKET fd[MAX_AF];
int fd_family[MAX_AF]; /* to remember the socket family */
#ifdef HAVE_POLL_H
struct pollfd fdmask[MAX_AF];
@ -156,7 +157,7 @@ volatile int alarm_flag = 0;
int simple_query = 0;
/*
* Unpriviledged port flag.
* Unprivileged port flag.
*/
int unpriv_port = 0;
@ -212,7 +213,7 @@ int verbose = 0;
int always_step = 0;
int never_step = 0;
int ntpdatemain P((int, char **));
int ntpdatemain P((int, char **));
static void transmit P((struct server *));
static void receive P((struct recvbuf *));
@ -222,7 +223,7 @@ static struct server *clock_select P((void));
static int clock_adjust P((void));
static void addserver P((char *));
static struct server *findserver P((struct sockaddr_storage *));
void timer P((void));
void timer P((void));
static void init_alarm P((void));
#ifndef SYS_WINNT
static RETSIGTYPE alarming P((int));
@ -239,7 +240,7 @@ static void printserver P((struct server *, FILE *));
#ifdef SYS_WINNT
int on = 1;
WORD wVersionRequested;
WSADATA wsaData;
WSADATA wsaData;
HANDLE TimerThreadHandle = NULL;
#endif /* SYS_WINNT */
@ -271,7 +272,7 @@ void clear_globals()
simple_query = 0;
/*
* Unpriviledged port flag.
* Unprivileged port flag.
*/
unpriv_port = 0;
@ -465,7 +466,7 @@ ntpdatemain (
#ifdef HAVE_SETVBUF
static char buf[BUFSIZ];
#ifdef SYS_WINNT
/* Win32 does not implement line bufferibg */
/* Win32 does not implement line buffering */
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
#else
setvbuf(stdout, buf, _IOLBF, BUFSIZ);
@ -542,10 +543,8 @@ ntpdatemain (
}
authtrust(sys_authkey, 1);
if (!authistrusted(sys_authkey)) {
char buf[10];
(void) sprintf(buf, "%lu", (unsigned long)sys_authkey);
msyslog(LOG_ERR, "authentication key %s unknown", buf);
msyslog(LOG_ERR, "authentication key %lu unknown",
(unsigned long) sys_authkey);
exit(1);
}
}
@ -1286,7 +1285,7 @@ clock_adjust(void)
}
if (dostep) {
if (simple_query || l_step_systime(&server->offset)) {
if (simple_query || debug || l_step_systime(&server->offset)){
msyslog(LOG_NOTICE, "step time server %s offset %s sec",
stoa(&server->srcadr),
lfptoa(&server->offset, 6));
@ -1373,6 +1372,15 @@ addserver(
error = getaddrinfo(serv, service, &hints, &addrResult);
if (error != 0) {
/* Conduct more refined error analysis */
if (error == EAI_FAIL || error == EAI_AGAIN){
/* Name server is unusable. Exit after failing on the
first server, in order to shorten the timeout caused
by waiting for resolution of several servers */
fprintf(stderr, "Name server cannot be used, exiting");
msyslog(LOG_ERR, "name server cannot be used, reason: %s\n", gai_strerror(error));
exit(1);
}
fprintf(stderr, "Error : %s\n", gai_strerror(error));
msyslog(LOG_ERR, "can't find host %s\n", serv);
return;
@ -1529,6 +1537,16 @@ alarming(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
#endif /* SYS_WINNT */
#ifdef SYS_WINNT
static void
callTimeEndPeriod(void)
{
timeEndPeriod( wTimerRes );
wTimerRes = 0;
}
#endif /* SYS_WINNT */
/*
* init_alarm - set up the timer interrupt
*/
@ -1543,7 +1561,7 @@ init_alarm(void)
# endif
#else
TIMECAPS tc;
UINT wTimerRes, wTimerID;
UINT wTimerID;
# endif /* SYS_WINNT */
#if defined SYS_CYGWIN32 || defined SYS_WINNT
HANDLE hToken;
@ -1595,7 +1613,7 @@ init_alarm(void)
# endif
#if defined SYS_CYGWIN32
/*
* Get previleges needed for fiddling with the clock
* Get privileges needed for fiddling with the clock
*/
/* get the current process token handle */
@ -1617,7 +1635,7 @@ init_alarm(void)
_tzset();
/*
* Get previleges needed for fiddling with the clock
* Get privileges needed for fiddling with the clock
*/
/* get the current process token handle */
@ -1650,6 +1668,7 @@ init_alarm(void)
wTimerRes = min(max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
/* establish the minimum timer resolution that we'll use */
timeBeginPeriod(wTimerRes);
atexit(callTimeEndPeriod);
/* start the timer event */
wTimerID = timeSetEvent(
@ -1692,6 +1711,7 @@ init_io(void)
struct addrinfo hints;
char service[5];
int optval = 1;
int check_ntp_port_in_use = !debug && !simple_query && !unpriv_port;
/*
* Init buffer free list and stat counters
@ -1719,7 +1739,7 @@ init_io(void)
}
#ifdef SYS_WINNT
if (ntp_port_inuse(AF_INET, NTP_PORT) ){
if (check_ntp_port_in_use && ntp_port_inuse(AF_INET, NTP_PORT)){
netsyslog(LOG_ERR, "the NTP socket is in use, exiting: %m");
exit(1);
}
@ -1733,8 +1753,8 @@ init_io(void)
*/
for(nbsock = 0; (nbsock < MAX_AF) && res ; res = res->ai_next) {
/* create a datagram (UDP) socket */
fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (fd[nbsock] == SOCKET_ERROR) {
fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (fd[nbsock] == SOCKET_ERROR) {
#ifndef SYS_WINNT
if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT ||
errno == EPFNOSUPPORT)
@ -1747,95 +1767,94 @@ init_io(void)
netsyslog(LOG_ERR, "socket() failed: %m");
exit(1);
/*NOTREACHED*/
}
/* set socket to reuse address */
if (setsockopt(fd[nbsock], SOL_SOCKET, SO_REUSEADDR, (void*) &optval, sizeof(optval)) < 0) {
netsyslog(LOG_ERR, "setsockopt() SO_REUSEADDR failed: %m");
exit(1);
/*NOTREACHED*/
}
}
/* set socket to reuse address */
if (setsockopt(fd[nbsock], SOL_SOCKET, SO_REUSEADDR, (void*) &optval, sizeof(optval)) < 0) {
netsyslog(LOG_ERR, "setsockopt() SO_REUSEADDR failed: %m");
exit(1);
/*NOTREACHED*/
}
#ifdef IPV6_V6ONLY
/* Restricts AF_INET6 socket to IPv6 communications (see RFC 2553bis-03) */
if (res->ai_family == AF_INET6)
if (setsockopt(fd[nbsock], IPPROTO_IPV6, IPV6_V6ONLY, (void*) &optval, sizeof(optval)) < 0) {
netsyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m");
exit(1);
/*NOTREACHED*/
/* Restricts AF_INET6 socket to IPv6 communications (see RFC 2553bis-03) */
if (res->ai_family == AF_INET6)
if (setsockopt(fd[nbsock], IPPROTO_IPV6, IPV6_V6ONLY, (void*) &optval, sizeof(optval)) < 0) {
netsyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m");
exit(1);
/*NOTREACHED*/
}
#endif
/* Remember the socket family in fd_family structure */
fd_family[nbsock] = res->ai_family;
/* Remember the socket family in fd_family structure */
fd_family[nbsock] = res->ai_family;
/*
* bind the socket to the NTP port
*/
if (!debug && !simple_query && !unpriv_port) {
if (bind(fd[nbsock], res->ai_addr, SOCKLEN(res->ai_addr)) < 0) {
/*
* bind the socket to the NTP port
*/
if (check_ntp_port_in_use) {
if (bind(fd[nbsock], res->ai_addr, SOCKLEN(res->ai_addr)) < 0) {
#ifndef SYS_WINNT
if (errno == EADDRINUSE)
if (errno == EADDRINUSE)
#else
if (WSAGetLastError() == WSAEADDRINUSE)
#endif /* SYS_WINNT */
netsyslog(LOG_ERR,
"the NTP socket is in use, exiting");
netsyslog(LOG_ERR, "the NTP socket is in use, exiting");
else
netsyslog(LOG_ERR, "bind() fails: %m");
exit(1);
netsyslog(LOG_ERR, "bind() fails: %m");
exit(1);
}
}
}
#ifdef HAVE_POLL_H
fdmask[nbsock].fd = fd[nbsock];
fdmask[nbsock].events = POLLIN;
fdmask[nbsock].fd = fd[nbsock];
fdmask[nbsock].events = POLLIN;
#else
FD_SET(fd[nbsock], &fdmask);
if (maxfd < fd[nbsock]+1) {
maxfd = fd[nbsock]+1;
}
FD_SET(fd[nbsock], &fdmask);
if (maxfd < fd[nbsock]+1) {
maxfd = fd[nbsock]+1;
}
#endif
/*
* set non-blocking,
*/
/*
* set non-blocking,
*/
#ifndef SYS_WINNT
# ifdef SYS_VXWORKS
{
int on = TRUE;
{
int on = TRUE;
if (ioctl(fd[nbsock],FIONBIO, &on) == ERROR) {
netsyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m");
exit(1);
}
}
if (ioctl(fd[nbsock],FIONBIO, &on) == ERROR) {
netsyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m");
exit(1);
}
}
# else /* not SYS_VXWORKS */
# if defined(O_NONBLOCK)
if (fcntl(fd[nbsock], F_SETFL, O_NONBLOCK) < 0) {
netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
exit(1);
/*NOTREACHED*/
}
if (fcntl(fd[nbsock], F_SETFL, O_NONBLOCK) < 0) {
netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
exit(1);
/*NOTREACHED*/
}
# else /* not O_NONBLOCK */
# if defined(FNDELAY)
if (fcntl(fd[nbsock], F_SETFL, FNDELAY) < 0) {
netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
exit(1);
/*NOTREACHED*/
}
if (fcntl(fd[nbsock], F_SETFL, FNDELAY) < 0) {
netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
exit(1);
/*NOTREACHED*/
}
# else /* FNDELAY */
# include "Bletch: Need non blocking I/O"
# endif /* FNDELAY */
# endif /* not O_NONBLOCK */
# endif /* SYS_VXWORKS */
#else /* SYS_WINNT */
if (ioctlsocket(fd[nbsock], FIONBIO, (u_long *) &on) == SOCKET_ERROR) {
netsyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m");
exit(1);
}
if (ioctlsocket(fd[nbsock], FIONBIO, (u_long *) &on) == SOCKET_ERROR) {
netsyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m");
exit(1);
}
#endif /* SYS_WINNT */
nbsock++;
}
freeaddrinfo(ressave);
nbsock++;
}
freeaddrinfo(ressave);
}
/*
@ -1896,7 +1915,7 @@ input_handler(void)
struct timeval tvzero;
socklen_t fromlen;
l_fp ts;
SOCKET i;
int i;
#ifdef HAVE_POLL_H
struct pollfd fds[MAX_AF];
#else
@ -1932,7 +1951,7 @@ input_handler(void)
* Determine which socket received data
*/
for(i=0; i < maxfd; i++) {
for(i=0; i < nbsock; i++) {
if(FD_ISSET(fd[i], &fds)) {
fdc = fd[i];
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntpdc_ops.c,v 1.7 2007/01/06 19:45:23 kardel Exp $ */
/* $NetBSD: ntpdc_ops.c,v 1.8 2008/08/23 09:10:32 kardel Exp $ */
/*
* ntpdc_ops.c - subroutines which are called to perform operations by xntpdc
@ -121,10 +121,10 @@ struct xcmd opcmds[] = {
{ "", "", "", "" },
"display event timer subsystem statistics" },
{ "addpeer", addpeer, { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
{ "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|dynamic|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
{ "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
"configure a new peer association" },
{ "addserver", addserver, { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
{ "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|dynamic|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
{ "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
"configure a new server" },
{ "addrefclock",addrefclock, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_STR, OPT|NTP_STR },
{ "addr", "mode", "minpoll|prefer", "minpoll|prefer" },
@ -888,8 +888,8 @@ again:
"offset %s, frequency %s, time_const %ld, watchdog %ld\n",
lfptoa(&tempts, 6),
lfptoa(&temp2ts, 3),
(long)ntohl((u_long)il->compliance),
(long)ntohl((u_long)il->watchdog_timer));
(long)(int32_t)ntohl((u_long)il->compliance),
(u_long)ntohl((u_long)il->watchdog_timer));
} else {
NTOHL_FP(&il->last_offset, &tempts);
(void) fprintf(fp, "offset: %s s\n",
@ -897,8 +897,8 @@ again:
NTOHL_FP(&il->drift_comp, &tempts);
(void) fprintf(fp, "frequency: %s ppm\n",
lfptoa(&tempts, 3));
(void) fprintf(fp, "poll adjust: %d\n",
(int)ntohl(il->compliance));
(void) fprintf(fp, "poll adjust: %ld\n",
(long)(int32_t)ntohl(il->compliance));
(void) fprintf(fp, "watchdog timer: %ld s\n",
(u_long)ntohl(il->watchdog_timer));
}
@ -1335,7 +1335,7 @@ again:
else if (STREQ(pcmd->argval[items].string, "burst"))
flags |= CONF_FLAG_BURST;
else if (STREQ(pcmd->argval[items].string, "dynamic"))
flags |= CONF_FLAG_DYNAMIC;
(void) fprintf(fp, "Warning: the \"dynamic\" keyword has been obsoleted and will be removed in the next release\n");
else if (STREQ(pcmd->argval[items].string, "iburst"))
flags |= CONF_FLAG_IBURST;
else if (!refc && STREQ(pcmd->argval[items].string, "keyid"))
@ -2702,7 +2702,6 @@ clockstat(
int res;
l_fp ts;
struct clktype *clk;
u_long ltemp;
for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++)
clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum);
@ -2760,9 +2759,8 @@ again:
lfptoa(&ts, 6));
(void) fprintf(fp, "stratum: %ld\n",
(u_long)ntohl(cl->fudgeval1));
ltemp = ntohl(cl->fudgeval2);
(void) fprintf(fp, "reference ID: %s\n",
(char *)&ltemp);
refid_string(ntohl(cl->fudgeval2), 0));
(void) fprintf(fp, "fudge flags: 0x%x\n",
cl->flags);
@ -2994,7 +2992,7 @@ again:
tscale = 1e-9;
#endif
(void)fprintf(fp, "pll offset: %g s\n",
(int)ntohl(ik->offset) * tscale);
(int32_t)ntohl(ik->offset) * tscale);
(void)fprintf(fp, "pll frequency: %s ppm\n",
fptoa((s_fp)ntohl(ik->freq), 3));
(void)fprintf(fp, "maximum error: %g s\n",

View File

@ -1,4 +1,4 @@
# $NetBSD: 3RDPARTY,v 1.628 2008/08/21 07:57:32 jnemeth Exp $
# $NetBSD: 3RDPARTY,v 1.629 2008/08/23 09:10:31 kardel Exp $
#
# This file contains a list of the software that has been integrated into
# NetBSD where we are not the primary maintainer.
@ -583,7 +583,7 @@ and ndbootd-raw.c. Restore saved config.h, and force it to define
HAVE_STRICT_ALIGNMENT. Fix RCS IDs, import.
Package: ntp
Version: 4.2.4p2
Version: 4.2.4p5
Current Vers: 4.2.4p5
Maintainer: David L. Mills <mills@udel.edu>
Archive Site: ftp://ftp.udel.edu/pub/ntp/ntp4/

View File

@ -1,4 +1,4 @@
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1091 $>
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1092 $>
[Note: This file does not mention every change made to the NetBSD source tree.
@ -582,3 +582,4 @@ Changes from NetBSD 4.0 to NetBSD 5.0:
btpand(8): a Bluetooth Personal Area Networking profile
daemon [plunky 20080817]
ataraid(4): Add support for nVidia MediaShield from FreeBSD. [tacha 20080820]
ntp: Import 4.2.4p5. [kardel 20080823]

View File

@ -1 +1 @@
Sun Jun 24 16:55:11 GMT 2007 (import)
Sat Aug 23 08:32:54 UTC 2008 (import)

View File

@ -443,7 +443,7 @@
/* #undef HAVE_LIBREADLINE */
/* Define to 1 if you have the `rt' library (-lrt). */
/* #undef HAVE_LIBRT */
#define HAVE_LIBRT 1
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
@ -530,7 +530,7 @@
/* #undef HAVE_NET_IF6_H */
/* Define to 1 if you have the <net/if.h> header file. */
/* #undef HAVE_NET_IF_H */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the <net/route.h> header file. */
#define HAVE_NET_ROUTE_H 1
@ -599,7 +599,7 @@
#define HAVE_SCHED_H 1
/* Define to 1 if you have the `sched_setscheduler' function. */
/* #undef HAVE_SCHED_SETSCHEDULER */
#define HAVE_SCHED_SETSCHEDULER 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
@ -1127,13 +1127,13 @@
#define PACKAGE_NAME "ntp"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ntp 4.2.4p2"
#define PACKAGE_STRING "ntp 4.2.4p5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntp"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.2.4p2"
#define PACKAGE_VERSION "4.2.4p5"
/* Do we have the ppsclock streams module? */
/* #undef PPS */
@ -1259,7 +1259,7 @@ typedef unsigned int uintptr_t;
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
#define VERSION "4.2.4p2"
#define VERSION "4.2.4p5"
/* ISC: Want IPv6? */
/* #define WANT_IPV6 */

View File

@ -1,8 +1,7 @@
.\" $NetBSD: ntp-keygen.8,v 1.3 2007/06/24 16:56:48 kardel Exp $
.TH NTP-KEYGEN 8 2007-01-06 "" "Programmer's Manual"
.\" DO NOT EDIT THIS FILE (ntp-keygen-opts.1)
.TH NTP-KEYGEN 8 2008-08-17 "(ntp 4.2.4p5)" "Programmer's Manual"
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen.1)
.\"
.\" It has been AutoGen-ed Saturday January 6, 2007 at 08:16:34 PM MET
.\" It has been AutoGen-ed Sunday August 17, 2008 at 05:27:34 AM EDT
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman1.tpl
.\"
@ -11,7 +10,7 @@ ntp-keygen \- Create a NTP host key
.SH SYNOPSIS
.B ntp-keygen
.\" Mixture of short (flag) options and long options
.RB [ -\fIflag\fP " [\fIvalue\fP]]... [" --\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
.PP
All arguments must be options.
.SH "DESCRIPTION"
@ -20,60 +19,60 @@ If there is no new host key, look for an existing one.
If one is not found, create it.
.SH OPTIONS
.TP
.BR -c " \fIscheme\fP, " --certificate "=" \fIscheme\fP
.BR \-c " \fIscheme\fP, " \--certificate "=" \fIscheme\fP
certificate scheme.
.sp
Just some descriptive text.
.TP
.BR -d ", " --debug-level
.BR \-d ", " \--debug-level
Increase output debug message level.
This option may appear an unlimited number of times.
.sp
Increase the debugging message output level.
.TP
.BR -D " \fIstring\fP, " --set-debug-level "=" \fIstring\fP
.BR \-D " \fIstring\fP, " \--set-debug-level "=" \fIstring\fP
Set the output debug message level.
This option may appear an unlimited number of times.
.sp
Set the output debugging level. Can be supplied multiple times,
but each overrides the previous value(s).
.TP
.BR -e ", " --id-key
.BR \-e ", " \--id-key
Write identity keys.
.sp
Just some descriptive text.
.TP
.BR -G ", " --gq-params
.BR \-G ", " \--gq-params
Generate GQ parameters and keys.
.sp
Just some descriptive text.
.TP
.BR -g ", " --gq-keys
.BR \-g ", " \--gq-keys
update GQ keys.
.sp
Just some descriptive text.
.TP
.BR -H ", " --host-key
.BR \-H ", " \--host-key
generate RSA host key.
.sp
Just some descriptive text.
.TP
.BR -I ", " --iffkey
.BR \-I ", " \--iffkey
generate IFF parameters.
.sp
Just some descriptive text.
.TP
.BR -i ", " --issuer-name
.BR \-i ", " \--issuer-name
set issuer name.
.sp
Just some descriptive text.
.TP
.BR -M ", " --md5key
.BR \-M ", " \--md5key
generate MD5 keys.
.sp
Just some descriptive text.
.TP
.BR -m " \fImodulus\fP, " --modulus "=" \fImodulus\fP
.BR \-m " \fImodulus\fP, " \--modulus "=" \fImodulus\fP
modulus.
This option takes an integer number as its argument.
The value of \fImodulus\fP is constrained to being:
@ -86,43 +85,43 @@ in the range 256 through 2048
.sp
Just some descriptive text.
.TP
.BR -P ", " --pvt-cert
.BR \-P ", " \--pvt-cert
generate PC private certificate.
.sp
Just some descriptive text.
.TP
.BR -p " \fIpasswd\fP, " --pvt-passwd "=" \fIpasswd\fP
.BR \-p " \fIpasswd\fP, " \--pvt-passwd "=" \fIpasswd\fP
output private password.
.sp
Just some descriptive text.
.TP
.BR -q " \fIpasswd\fP, " --get-pvt-passwd "=" \fIpasswd\fP
.BR \-q " \fIpasswd\fP, " \--get-pvt-passwd "=" \fIpasswd\fP
input private password.
.sp
Just some descriptive text.
.TP
.BR -S " \fIsign\fP, " --sign-key "=" \fIsign\fP
.BR \-S " \fIsign\fP, " \--sign-key "=" \fIsign\fP
generate sign key (RSA or DSA).
.sp
Just some descriptive text.
.TP
.BR -s " \fIhost\fP, " --subject-name "=" \fIhost\fP
.BR \-s " \fIhost\fP, " \--subject-name "=" \fIhost\fP
set subject name.
.sp
Just some descriptive text.
.TP
.BR -T ", " --trusted-cert
.BR \-T ", " \--trusted-cert
trusted certificate (TC scheme).
.sp
Just some descriptive text.
.TP
.BR -V " \fInum\fP, " --mv-params "=" \fInum\fP
.BR \-V " \fInum\fP, " \--mv-params "=" \fInum\fP
generate <num> MV parameters.
This option takes an integer number as its argument.
.sp
Just some descriptive text.
.TP
.BR -v " \fInum\fP, " --mv-keys "=" \fInum\fP
.BR \-v " \fInum\fP, " \--mv-keys "=" \fInum\fP
update <num> MV keys.
This option takes an integer number as its argument.
.sp
@ -138,7 +137,7 @@ Extended usage information passed thru pager.
Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
configuration file listed in the \fBOPTION PRESETS\fP section, below.
.TP
.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " --no-load-opts"
.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
Load options from \fIrcfile\fP.
The \fIno-load-opts\fP form will disable the loading
of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
@ -162,7 +161,7 @@ The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
If any of these are directories, then the file \fI.ntprc\fP
is searched for within those directories.
.SH AUTHOR
ntp.org
David L. Mills and/or others
.br
Please send bug reports to: http://bugs.ntp.isc.org, bugs@ntp.org

View File

@ -1,8 +1,7 @@
.\" $NetBSD: ntpd.8,v 1.17 2007/06/24 16:56:48 kardel Exp $
.TH NTPD 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
.\" DO NOT EDIT THIS FILE (ntpd.1)
.TH NTPD 8 2008-08-17 "( 4.2.4p5)" "Programmer's Manual"
.\" EDIT THIS FILE WITH CAUTION (ntpd.1)
.\"
.\" It has been AutoGen-ed Wednesday June 20, 2007 at 07:37:24 AM EDT
.\" It has been AutoGen-ed Sunday August 17, 2008 at 05:20:11 AM EDT
.\" From the definitions ntpd-opts.def
.\" and the template file agman1.tpl
.\"
@ -208,7 +207,7 @@ This option takes an integer number as its argument.
Give the time in seconds between two scans for new or dropped interfaces.
For systems with routing socket support the scans will be performed shortly after the interface change
has been detected by the system.
Use 0 to disable scanning. 60 seconds is the minimum time between scans.
Use 0 to disable scanning.
.TP
.BR \-s " \fIstring\fP, " \--statsdir "=" \fIstring\fP
Statistics file location.
@ -282,14 +281,14 @@ by loading values from environment variables named:
.fi
.aj
.SH AUTHOR
ntp.org
David L. Mills and/or others
.br
Please send bug reports to: http://bugs.ntp.isc.org, bugs@ntp.org
.PP
.nf
.na
see html/copyright.html
see /usr/share/doc/html/ntp/copyright.html
.fi
.ad
.PP

View File

@ -1,8 +1,7 @@
.\" $NetBSD: ntpdc.8,v 1.15 2007/06/24 16:56:48 kardel Exp $
.TH NTPDC 8 2007-01-06 "" "Programmer's Manual"
.\" DO NOT EDIT THIS FILE (ntpdc-opts.1)
.TH NTPDC 8 2008-08-17 "( 4.2.4p5)" "Programmer's Manual"
.\" EDIT THIS FILE WITH CAUTION (ntpdc.1)
.\"
.\" It has been AutoGen-ed Saturday January 6, 2007 at 08:13:26 PM MET
.\" It has been AutoGen-ed Sunday August 17, 2008 at 05:26:27 AM EDT
.\" From the definitions ntpdc-opts.def
.\" and the template file agman1.tpl
.\"
@ -11,7 +10,7 @@ ntpdc \- vendor-specific NTP query program
.SH SYNOPSIS
.B ntpdc
.\" Mixture of short (flag) options and long options
.RB [ -\fIflag\fP " [\fIvalue\fP]]... [" --\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
.br
.in +8
[ host ...]
@ -37,21 +36,21 @@ ntpd's configuration file may also be specified at run time using
.SH OPTIONS
.TP
.BR -4 ", " --ipv4
.BR \-4 ", " \--ipv4
Force IPv4 DNS name resolution.
This option is a member of the ipv4 class of options.
.sp
Force DNS resolution of following host names on the command line
to the IPv4 namespace.
.TP
.BR -6 ", " --ipv6
.BR \-6 ", " \--ipv6
Force IPv6 DNS name resolution.
This option is a member of the ipv4 class of options.
.sp
Force DNS resolution of following host names on the command line
to the IPv6 namespace.
.TP
.BR -c " \fIcmd\fP, " --command "=" \fIcmd\fP
.BR \-c " \fIcmd\fP, " \--command "=" \fIcmd\fP
run a command and exit.
This option may appear an unlimited number of times.
.sp
@ -59,7 +58,7 @@ The following argument is interpreted as an interactive format command
and is added to the list of commands to be executed on the specified
host(s).
.TP
.BR -l ", " --listpeers
.BR \-l ", " \--listpeers
Print a list of the peers.
This option must not appear in combination with any of the following options:
command.
@ -67,7 +66,7 @@ command.
Print a list of the peers known to the server as well as a summary of
their state. This is equivalent to the 'listpeers' interactive command.
.TP
.BR -p ", " --peers
.BR \-p ", " \--peers
Print a list of the peers.
This option must not appear in combination with any of the following options:
command.
@ -75,7 +74,7 @@ command.
Print a list of the peers known to the server as well as a summary
of their state. This is equivalent to the 'peers' interactive command.
.TP
.BR -s ", " --showpeers
.BR \-s ", " \--showpeers
Show a list of the peers.
This option must not appear in combination with any of the following options:
command.
@ -83,7 +82,7 @@ command.
Print a list of the peers known to the server as well as a summary
of their state. This is equivalent to the 'dmpeers' interactive command.
.TP
.BR -i ", " --interactive
.BR \-i ", " \--interactive
Force ntpq to operate in interactive mode.
This option must not appear in combination with any of the following options:
command, listpeers, peers, showpeers.
@ -91,20 +90,20 @@ command, listpeers, peers, showpeers.
Force ntpq to operate in interactive mode. Prompts will be written
to the standard output and commands read from the standard input.
.TP
.BR -d ", " --debug-level
.BR \-d ", " \--debug-level
Increase output debug message level.
This option may appear an unlimited number of times.
.sp
Increase the debugging message output level.
.TP
.BR -D " \fIstring\fP, " --set-debug-level "=" \fIstring\fP
.BR \-D " \fIstring\fP, " \--set-debug-level "=" \fIstring\fP
Set the output debug message level.
This option may appear an unlimited number of times.
.sp
Set the output debugging level. Can be supplied multiple times,
but each overrides the previous value(s).
.TP
.BR -n ", " --numeric
.BR \-n ", " \--numeric
numeric host addresses.
.sp
Output all host addresses in dotted-quad numeric format rather than
@ -120,7 +119,7 @@ Extended usage information passed thru pager.
Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
configuration file listed in the \fBOPTION PRESETS\fP section, below.
.TP
.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " --no-load-opts"
.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
Load options from \fIrcfile\fP.
The \fIno-load-opts\fP form will disable the loading
of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
@ -144,7 +143,7 @@ The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
If any of these are directories, then the file \fI.ntprc\fP
is searched for within those directories.
.SH AUTHOR
ntp.org
David L. Mills and/or others
.br
Please send bug reports to: http://bugs.ntp.isc.org, bugs@ntp.org

View File

@ -1,8 +1,7 @@
.\" $NetBSD: ntpq.8,v 1.18 2007/06/24 16:56:48 kardel Exp $
.TH NTPQ 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
.\" DO NOT EDIT THIS FILE (ntpq.1)
.TH NTPQ 8 2008-08-17 "( 4.2.4p5)" "Programmer's Manual"
.\" EDIT THIS FILE WITH CAUTION (ntpq.1)
.\"
.\" It has been AutoGen-ed Wednesday June 20, 2007 at 07:44:20 AM EDT
.\" It has been AutoGen-ed Sunday August 17, 2008 at 05:26:57 AM EDT
.\" From the definitions ntpq-opts.def
.\" and the template file agman1.tpl
.\"
@ -371,14 +370,14 @@ The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
If any of these are directories, then the file \fI.ntprc\fP
is searched for within those directories.
.SH AUTHOR
ntp.org
David L. Mills and/or others
.br
Please send bug reports to: http://bugs.ntp.isc.org, bugs@ntp.org
.PP
.nf
.na
see html/copyright.html
see /usr/share/doc/html/ntp/copyright.html
.fi
.ad
.PP

View File

@ -3,7 +3,7 @@ PROG=${1-UNKNOWN}
ConfStr="$PROG"
ConfStr="$ConfStr 4.2.4p2"
ConfStr="$ConfStr 4.2.4p5"
case "$CSET" in
'') ;;