Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
* [Bug 1483] AI_NUMERICSERV undefined in 4.2.7p20.
* Maintain and use linked list of associations (struct peer) in ntpd,
avoiding walking 128 hash table entries to iterate over peers.
* Remove more workarounds unneeded since we require ISO C90 AKA ANSI C:
- remove fallback implementations for memmove(), memset, strstr().
- do not test for atexit() or memcpy().
* Collapse a bunch of code duplication in ntpd/ntp_restrict.c added with
support for IPv6.
* Correct some corner case failures in automatically enabling the MRU
list if any "restrict ... limited" is in effect, and in disabling MRU
maintenance. (ntp_monitor.c, ntp_restrict.c)
* Reverse the internal sort order of the address restriction lists, but
preserve the same behavior. This allows removal of special-case code
related to the default restrictions and more straightforward lookups
of restrictions for a given address (now, stop on first match).
* Move ntp_restrict.c MRU doubly-linked list maintenance code into
ntp_lists.h macros, allowing more duplicated source excision.
* Correct Windows port's refclock_open() to return 0 on failure not -1.
* Correct CHU, dumbclock, and WWVB drivers to check for 0 returned from
refclock_open() on failure.
* Repair ntpdate.c to handle no longer testing HAVE_TIMER_SETTIME.
* Do not reference peer_node/unpeer_node after freeing when built with
--disable-saveconfig and using DNS.
(4.2.7p20) 2010/02/13 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1483] hostname in ntp.conf "restrict" parameter rejected.
* Use all addresses for each restrict by hostname.
Expand Down
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,6 @@ case "$ac_cv_header_kvm_h" in
AC_CHECK_FUNCS(kvm_open)
;;
esac
AC_CHECK_FUNCS(memcpy memmove memset)
case "$host" in
*-*-sco3.2v5.0.*)
# Just stubs. Idiots.
Expand Down Expand Up @@ -1381,7 +1380,7 @@ case "$host" in
esac])
AC_CHECK_FUNCS(setvbuf sigaction)
AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
AC_CHECK_FUNCS(snprintf strdup strerror strstr)
AC_CHECK_FUNCS(snprintf strdup strerror)
AC_CHECK_FUNCS(timegm)
case "$host" in
*-*-aix[[456]]*)
Expand Down
47 changes: 26 additions & 21 deletions flock-build
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ PARSE="--enable-parse-clocks"
#PARSE=
STD="--enable-simulator"

case "$SIMUL" in
'') PARALLEL_BUILDS=1
;;
*) PARALLEL_BUILDS=$SIMUL
case "$SIMUL::$FB_FIRSTONLY" in
::*)
PARALLEL_BUILDS=1
;;
*::0)
PARALLEL_BUILDS=$SIMUL
;;
*)
PARALLEL_BUILDS=1
esac

case "$PARALLEL_BUILDS" in
Expand Down Expand Up @@ -63,19 +68,19 @@ do
[ -f .buildkey-$i ] && SKIPTHIS=1
case "$SKIPTHIS" in
1)
echo flock-build running on $i? check LIST, skipping
;;
0)
echo $i
echo $SIG > .buildkey-$i
case "1" in
0)
ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
ssh $i "cd $c_d ; ./build $SIG $STD --disable-all-clocks $BUILD_ARGS" &
;;
1)
cat > .flockbuild-$i-$SIG <<-ENDQUOT
echo flock-build running on $i? check LIST, skipping
;;
0)
echo $i
echo $SIG > .buildkey-$i
case "1" in
0)
ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
ssh $i "cd $c_d ; ./build $SIG $STD --disable-all-clocks $BUILD_ARGS" &
;;
1)
cat > .flockbuild-$i-$SIG <<-ENDQUOT
#!/bin/sh

# script uses job control and expects to be invoked
Expand Down Expand Up @@ -114,10 +119,10 @@ do
echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
rm .buildkey-$i
ENDQUOT
chmod +x .flockbuild-$i-$SIG
ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
esac
chmod +x .flockbuild-$i-$SIG
ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
esac
esac
done
echo `date -u '+%H:%M:%S'` flock-build launched
103 changes: 57 additions & 46 deletions include/ntp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
#ifndef NTP_H
#define NTP_H

#include <stddef.h>
#include <math.h>

#include <ntp_fp.h>
#include <ntp_types.h>
#include <ntp_lists.h>
#include <ntp_stdlib.h>
#ifdef OPENSSL
#include <ntp_crypto.h>
Expand Down Expand Up @@ -246,8 +248,9 @@ struct interface {
* spec.
*/
struct peer {
struct peer *next; /* link pointer in peer hash */
struct peer *ass_next; /* link pointer in associd hash */
struct peer *p_link; /* link pointer in free & peer lists */
struct peer *adr_link; /* link pointer in address hash */
struct peer *aid_link; /* link pointer in associd hash */
struct peer *ilink; /* list of peers for interface */
sockaddr_u srcadr; /* address of remote host */
struct interface *dstadr; /* local address (interface) */
Expand Down Expand Up @@ -572,10 +575,11 @@ struct pkt {
#define PKT_LEAP(li_vn_mode) ((u_char)(((li_vn_mode) >> 6) & 0x3))

/*
* Stuff for putting things back into li_vn_mode
* Stuff for putting things back into li_vn_mode in packets and vn_mode
* in ntp_monitor.c's mon_entry.
*/
#define PKT_LI_VN_MODE(li, vn, md) \
((u_char)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))
#define VN_MODE(v, m) ((((v) & 7) << 3) | ((m) & 0x7))
#define PKT_LI_VN_MODE(l, v, m) ((((l) & 3) << 6) | VN_MODE((v), (m)))


/*
Expand Down Expand Up @@ -735,21 +739,20 @@ struct pkt {
/*
* Structure used optionally for monitoring when this is turned on.
*/
typedef struct mon_data mon_entry;
struct mon_data {
struct mon_data *hash_next; /* next structure in hash list */
struct mon_data *mru_next; /* next structure in MRU list */
struct mon_data *mru_prev; /* previous structure in MRU list */
int flags; /* restrict flags */
int leak; /* leaky bucket accumulator */
int count; /* total packet count */
u_long firsttime; /* first time found */
u_long lasttime; /* last time found */
sockaddr_u rmtadr; /* address of remote host */
struct interface *interface; /* interface on which this arrived */
u_short rmtport; /* remote port last came from */
u_char mode; /* packet mode */
u_char version; /* packet version */
u_char cast_flags; /* flags MDF_?CAST */
mon_entry * hash_next; /* next structure in hash list */
DECL_DLIST_LINK(mon_entry, mru);/* MRU list link pointers */
struct interface * lcladr; /* address on which this arrived */
sockaddr_u rmtadr; /* address of remote host */
int flags; /* restrict flags */
int leak; /* leaky bucket accumulator */
int count; /* total packet count */
u_long firsttime; /* first time found */
u_long lasttime; /* last time found */
u_short rmtport; /* remote port last came from */
u_char vn_mode; /* packet mode & version */
u_char cast_flags; /* flags MDF_?CAST */
};

/*
Expand All @@ -758,38 +761,46 @@ struct mon_data {
#define MDF_UCAST 0x01 /* unicast */
#define MDF_MCAST 0x02 /* multicast */
#define MDF_BCAST 0x04 /* broadcast */
#define MDF_LCAST 0x08 /* localcast */
#define MDF_LCAST 0x08 /* localcast (unused) */
#define MDF_ACAST 0x10 /* manycast */
#define MDF_BCLNT 0x20 /* broadcast client */
#define MDF_ACLNT 0x40 /* manycast client */

/* server *cast mode bits */
#define MDF_SRVCASTMASK (MDF_MCAST | MDF_BCAST | MDF_ACAST)
/*
* Values used with mon_enabled to indicate reason for enabling monitoring
*/
#define MON_OFF 0x00 /* no monitoring */
#define MON_ON 0x01 /* monitoring explicitly enabled */
#define MON_RES 0x02 /* implicit monitoring for RES_LIMITED */
#define MON_OFF 0x00 /* no monitoring */
#define MON_ON 0x01 /* monitoring explicitly enabled */
#define MON_RES 0x02 /* implicit monitoring for RES_LIMITED */
/*
* Structure used for restrictlist entries
*/
struct restrictlist {
struct restrictlist *next; /* link to next entry */
u_int32 addr; /* Ipv4 host address (host byte order) */
u_int32 mask; /* Ipv4 mask for address (host byte order) */
u_long count; /* number of packets matched */
u_short flags; /* accesslist flags */
u_short mflags; /* match flags */
};

struct restrictlist6 {
struct restrictlist6 *next; /* link to next entry */
struct in6_addr addr6; /* Ipv6 host address */
struct in6_addr mask6; /* Ipv6 mask address */
u_long count; /* number of packets matched */
u_short flags; /* accesslist flags */
u_short mflags; /* match flags */
typedef struct res_addr4_tag {
u_int32 addr; /* IPv4 addr (host order) */
u_int32 mask; /* IPv4 mask (host order) */
} res_addr4;

typedef struct res_addr6_tag {
struct in6_addr addr; /* IPv6 addr (net order) */
struct in6_addr mask; /* IPv6 mask (net order) */
} res_addr6;

typedef struct restrict_u_tag restrict_u;
struct restrict_u_tag {
restrict_u * link; /* link to next entry */
u_int32 count; /* number of packets matched */
u_short flags; /* accesslist flags */
u_short mflags; /* match flags */
union { /* variant starting here */
res_addr4 v4;
res_addr6 v6;
} u;
};

#define V4_SIZEOF_RESTRICT_U (offsetof(restrict_u, u) \
+ sizeof(res_addr4))
#define V6_SIZEOF_RESTRICT_U (offsetof(restrict_u, u) \
+ sizeof(res_addr6))

/*
* Access flags
Expand All @@ -813,10 +824,10 @@ struct restrictlist6 {
#define RES_MSSNTP 0x0800 /* enable MS-SNTP authentication */
#define RES_TIMEOUT 0x1000 /* timeout this entry */

#define RES_ALLFLAGS (RES_FLAGS | RES_NOQUERY |\
RES_NOMODIFY | RES_NOTRAP |\
RES_LPTRAP | RES_KOD |\
RES_MSSNTP | RES_TIMEOUT)
#define RES_ALLFLAGS (RES_FLAGS | RES_NOQUERY | \
RES_NOMODIFY | RES_NOTRAP | \
RES_LPTRAP | RES_KOD | \
RES_MSSNTP | RES_TIMEOUT)

/*
* Match flags
Expand All @@ -830,7 +841,7 @@ struct restrictlist6 {
#define RESTRICT_FLAGS 1 /* add flags to restrict entry */
#define RESTRICT_UNFLAG 2 /* remove flags from restrict entry */
#define RESTRICT_REMOVE 3 /* remove a restrict entry */
#define RESTRICT_REMOVEIF 4 /* remove an interface restrict entry */
#define RESTRICT_REMOVEIF 4 /* remove an interface restrict entry */

/*
* Endpoint structure for the select algorithm
Expand Down
37 changes: 19 additions & 18 deletions include/ntp_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@

/* Structure for storing an attribute-value pair */
struct attr_val {
int attr;
union val{
double d;
int i;
char *s;
void *p;
} value;
int type;
int attr;
union val{
double d;
int i;
u_int u;
char *s;
void *p;
} value;
int type;
};

/* Structure for nodes on the syntax tree */
Expand All @@ -88,19 +89,19 @@ struct restrict_node {
};

struct peer_node {
int host_mode;
struct address_node *addr;
queue *peerflags;
int minpoll;
int maxpoll;
int ttl;
int peerversion;
int peerkey;
double bias;
int host_mode;
struct address_node *addr;
queue *peerflags;
u_char minpoll;
u_char maxpoll;
u_char ttl;
u_char peerversion;
keyid_t peerkey;
double bias;
};

struct unpeer_node {
u_int assocID;
associd_t assocID;
struct address_node * addr;
};

Expand Down
2 changes: 1 addition & 1 deletion include/ntp_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct value { /* network byte order */
tstamp_t tstamp; /* timestamp */
tstamp_t fstamp; /* filestamp */
u_int32 vallen; /* value length */
u_char *ptr; /* data pointer (various) */
void *ptr; /* data pointer (various) */
u_int32 siglen; /* signature length */
u_char *sig; /* signature */
};
Expand Down
Loading