Index: contrib/ntp/libntp/work_thread.c
===================================================================
--- contrib/ntp/libntp/work_thread.c	(版本 297264)
+++ contrib/ntp/libntp/work_thread.c	(版本 298770)
@@ -88,8 +88,28 @@
 static	int	queue_req_pointer(blocking_child *, blocking_pipe_header *);
 static	void	cleanup_after_child(blocking_child *);
 
+static sema_type worker_mmutex;
+static sem_ref   worker_memlock;
 
+/* --------------------------------------------------------------------
+ * locking the global worker state table (and other global stuff)
+ */
 void
+worker_global_lock(
+	int inOrOut)
+{
+	if (worker_memlock) {
+		if (inOrOut)
+			wait_for_sem(worker_memlock, NULL);
+		else
+			tickle_sem(worker_memlock);
+	}
+}
+
+/* --------------------------------------------------------------------
+ * implementation isolation wrapper
+ */
+void
 exit_worker(
 	int	exitcode
 	)
@@ -724,6 +744,9 @@
 	blocking_child *c
 	)
 {
+	if (NULL == worker_memlock)
+		worker_memlock = create_sema(&worker_mmutex, 1, 1);
+	
 	c->accesslock           = create_sema(&c->sem_table[0], 1, 1);
 	c->workitems_pending    = create_sema(&c->sem_table[1], 0, 0);
 	c->wake_scheduled_sleep = create_sema(&c->sem_table[2], 0, 1);
Index: contrib/ntp/ntpd/invoke-ntpd.texi
===================================================================
--- contrib/ntp/ntpd/invoke-ntpd.texi	(版本 297264)
+++ contrib/ntp/ntpd/invoke-ntpd.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntpd.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:18:04 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:28:32 PM by AutoGen 5.18.5
 # From the definitions    ntpd-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -142,7 +142,7 @@
 
 @exampleindent 0
 @example
-ntpd - NTP daemon program - Ver. 4.2.8p6
+ntpd - NTP daemon program - Ver. 4.2.8p7
 Usage:  ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
                 [ <server1> ... <serverN> ]
   Flg Arg Option-Name    Description
Index: contrib/ntp/libntp/Makefile.in
===================================================================
--- contrib/ntp/libntp/Makefile.in	(版本 297264)
+++ contrib/ntp/libntp/Makefile.in	(版本 298770)
@@ -182,6 +182,7 @@
 	$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
 	$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
 	$(srcdir)/../lib/isc/sockaddr.c \
+	$(srcdir)/../lib/isc/tsmemcmp.c \
 	$(srcdir)/../lib/isc/pthreads/mutex.c
 am__objects_1 =
 @PTHREADS_TRUE@am__objects_2 = mutex.$(OBJEXT)
@@ -196,7 +197,7 @@
 	result.$(OBJEXT) stdio.$(OBJEXT) stdtime.$(OBJEXT) \
 	strerror.$(OBJEXT) task.$(OBJEXT) thread.$(OBJEXT) \
 	time.$(OBJEXT) sha1.$(OBJEXT) sockaddr.$(OBJEXT) \
-	$(am__objects_1) $(am__objects_2)
+	tsmemcmp.$(OBJEXT) $(am__objects_1) $(am__objects_2)
 am__objects_4 = a_md5encrypt.$(OBJEXT) adjtime.$(OBJEXT) \
 	atoint.$(OBJEXT) atolfp.$(OBJEXT) atouint.$(OBJEXT) \
 	audio.$(OBJEXT) authkeys.$(OBJEXT) authreadkeys.$(OBJEXT) \
@@ -264,6 +265,7 @@
 	$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
 	$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
 	$(srcdir)/../lib/isc/sockaddr.c \
+	$(srcdir)/../lib/isc/tsmemcmp.c \
 	$(srcdir)/../lib/isc/pthreads/mutex.c
 am_libntpsim_a_OBJECTS = systime_s.$(OBJEXT) $(am__objects_4)
 libntpsim_a_OBJECTS = $(am_libntpsim_a_OBJECTS)
@@ -631,7 +633,8 @@
 	$(srcdir)/../lib/isc/task.c \
 	$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
 	$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
-	$(srcdir)/../lib/isc/sockaddr.c $(NULL) $(am__append_1)
+	$(srcdir)/../lib/isc/sockaddr.c \
+	$(srcdir)/../lib/isc/tsmemcmp.c $(NULL) $(am__append_1)
 libntp_a_SRCS = \
 	a_md5encrypt.c					\
 	adjtime.c					\
@@ -862,6 +865,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timetoa.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timevalops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsmemcmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uglydate.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vint64ops.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/work_fork.Po@am__quote@
@@ -1323,6 +1327,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sockaddr.obj `if test -f '$(srcdir)/../lib/isc/sockaddr.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/sockaddr.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/sockaddr.c'; fi`
 
+tsmemcmp.o: $(srcdir)/../lib/isc/tsmemcmp.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tsmemcmp.o -MD -MP -MF $(DEPDIR)/tsmemcmp.Tpo -c -o tsmemcmp.o `test -f '$(srcdir)/../lib/isc/tsmemcmp.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/tsmemcmp.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tsmemcmp.Tpo $(DEPDIR)/tsmemcmp.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$(srcdir)/../lib/isc/tsmemcmp.c' object='tsmemcmp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tsmemcmp.o `test -f '$(srcdir)/../lib/isc/tsmemcmp.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/tsmemcmp.c
+
+tsmemcmp.obj: $(srcdir)/../lib/isc/tsmemcmp.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tsmemcmp.obj -MD -MP -MF $(DEPDIR)/tsmemcmp.Tpo -c -o tsmemcmp.obj `if test -f '$(srcdir)/../lib/isc/tsmemcmp.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/tsmemcmp.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/tsmemcmp.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tsmemcmp.Tpo $(DEPDIR)/tsmemcmp.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$(srcdir)/../lib/isc/tsmemcmp.c' object='tsmemcmp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tsmemcmp.obj `if test -f '$(srcdir)/../lib/isc/tsmemcmp.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/tsmemcmp.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/tsmemcmp.c'; fi`
+
 mutex.o: $(srcdir)/../lib/isc/pthreads/mutex.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mutex.o -MD -MP -MF $(DEPDIR)/mutex.Tpo -c -o mutex.o `test -f '$(srcdir)/../lib/isc/pthreads/mutex.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/pthreads/mutex.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/mutex.Tpo $(DEPDIR)/mutex.Po
Index: contrib/ntp/libntp/authkeys.c
===================================================================
--- contrib/ntp/libntp/authkeys.c	(版本 297264)
+++ contrib/ntp/libntp/authkeys.c	(版本 298770)
@@ -30,7 +30,7 @@
 	u_long		lifetime;	/* remaining lifetime */
 	keyid_t		keyid;		/* key identifier */
 	u_short		type;		/* OpenSSL digest NID */
-	u_short		secretsize;	/* secret octets */
+	size_t		secretsize;	/* secret octets */
 	u_short		flags;		/* KEY_ flags that wave */
 };
 
@@ -51,12 +51,12 @@
 #endif	/* DEBUG */
 
 static u_short	auth_log2(size_t);
-static void	auth_resize_hashtable(void);
-static void	allocsymkey(symkey **, keyid_t,	u_short, u_short,
-			    u_long, u_short, u_char *, KeyAccT *);
-static void	freesymkey(symkey *, symkey **);
+static void		auth_resize_hashtable(void);
+static void		allocsymkey(keyid_t,	u_short,
+				    u_short, u_long, size_t, u_char *, KeyAccT *);
+static void		freesymkey(symkey *);
 #ifdef DEBUG
-static void	free_auth_mem(void);
+static void		free_auth_mem(void);
 #endif
 
 symkey	key_listhead;		/* list of all in-use keys */;
@@ -93,15 +93,88 @@
 
 /*
  * The key cache. We cache the last key we looked at here.
+ * Note: this should hold the last *trusted* key. Also the
+ * cache is only loaded when the digest type / MAC algorithm
+ * is valid.
  */
 keyid_t	cache_keyid;		/* key identifier */
 u_char *cache_secret;		/* secret */
-u_short	cache_secretsize;	/* secret length */
+size_t	cache_secretsize;	/* secret length */
 int	cache_type;		/* OpenSSL digest NID */
 u_short cache_flags;		/* flags that wave */
 KeyAccT *cache_keyacclist;	/* key access list */
 
+/* --------------------------------------------------------------------
+ * manage key access lists
+ * --------------------------------------------------------------------
+ */
+/* allocate and populate new access node and pushes it on the list.
+ * Returns the new head.
+ */
+KeyAccT*
+keyacc_new_push(
+	KeyAccT          * head,
+	const sockaddr_u * addr
+	)
+{
+	KeyAccT *	node = emalloc(sizeof(KeyAccT));
+	
+	memcpy(&node->addr, addr, sizeof(sockaddr_u));
+	node->next = head;
+	return node;
+}
 
+/* ----------------------------------------------------------------- */
+/* pop and deallocate the first node of a list of access nodes, if
+ * the list is not empty. Returns the tail of the list.
+ */
+KeyAccT*
+keyacc_pop_free(
+	KeyAccT *head
+	)
+{
+	KeyAccT *	next = NULL;
+	if (head) {
+		next = head->next;
+		free(head);
+	}
+	return next;
+}
+
+/* ----------------------------------------------------------------- */
+/* deallocate the list; returns an empty list. */
+KeyAccT*
+keyacc_all_free(
+	KeyAccT * head
+	)
+{
+	while (head)
+		head = keyacc_pop_free(head);
+	return head;
+}
+
+/* ----------------------------------------------------------------- */
+/* scan a list to see if it contains a given address. Return the
+ * default result value in case of an empty list.
+ */
+int /*BOOL*/
+keyacc_contains(
+	const KeyAccT    *head,
+	const sockaddr_u *addr,
+	int               defv)
+{
+	if (head) {
+		do {
+			if (SOCK_EQ(&head->addr, addr))
+				return TRUE;
+		} while (NULL != (head = head->next));
+		return FALSE;
+	} else {
+		return !!defv;
+	}
+}
+
+
 /*
  * init_auth - initialize internal data
  */
@@ -139,7 +212,7 @@
 	symkey_alloc *	next_alloc;
 
 	while (NULL != (sk = HEAD_DLIST(key_listhead, llink))) {
-		freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
+		freesymkey(sk);
 	}
 	free(key_hash);
 	key_hash = NULL;
@@ -243,7 +316,22 @@
 	return (u_short)r;
 }
 
+static void
+authcache_flush_id(
+	keyid_t id
+	)
+{
+	if (cache_keyid == id) {
+		cache_keyid = 0;
+		cache_type = 0;
+		cache_flags = 0;
+		cache_secret = NULL;
+		cache_secretsize = 0;
+		cache_keyacclist = NULL;
+	}
+}
 
+
 /*
  * auth_resize_hashtable
  *
@@ -288,18 +376,21 @@
  */
 static void
 allocsymkey(
-	symkey **	bucket,
 	keyid_t		id,
 	u_short		flags,
 	u_short		type,
 	u_long		lifetime,
-	u_short		secretsize,
+	size_t		secretsize,
 	u_char *	secret,
 	KeyAccT *	ka
 	)
 {
 	symkey *	sk;
+	symkey **	bucket;
 
+	bucket = &key_hash[KEYHASH(id)];
+
+
 	if (authnumfreekeys < 1)
 		auth_moremem(-1);
 	UNLINK_HEAD_SLIST(sk, authfreekeys, llink.f);
@@ -323,12 +414,19 @@
  */
 static void
 freesymkey(
-	symkey *	sk,
-	symkey **	bucket
+	symkey *	sk
 	)
 {
+	symkey **	bucket;
 	symkey *	unlinked;
 
+	if (NULL == sk)
+		return;
+
+	authcache_flush_id(sk->keyid);
+	keyacc_all_free(sk->keyacclist);
+	
+	bucket = &key_hash[KEYHASH(sk->keyid)];
 	if (sk->secret != NULL) {
 		memset(sk->secret, '\0', sk->secretsize);
 		free(sk->secret);
@@ -354,18 +452,16 @@
 {
 	symkey *	sk;
 
-	for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
-		if (id == sk->keyid) {
+	for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink)
+		if (id == sk->keyid)
 			return sk;
-		}
-	}
-
 	return NULL;
 }
 
 
 /*
- * auth_havekey - return TRUE if the key id is zero or known
+ * auth_havekey - return TRUE if the key id is zero or known. The
+ * key needs not to be trusted.
  */
 int
 auth_havekey(
@@ -372,19 +468,10 @@
 	keyid_t		id
 	)
 {
-	symkey *	sk;
-
-	if (0 == id || cache_keyid == id) {
-		return TRUE;
-	}
-
-	for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
-		if (id == sk->keyid) {
-			return TRUE;
-		}
-	}
-
-	return FALSE;
+	return
+	    (0           == id) ||
+	    (cache_keyid == id) ||
+	    (NULL        != auth_findkey(id));
 }
 
 
@@ -400,35 +487,25 @@
 	symkey *	sk;
 
 	authkeylookups++;
-	if (0 == id || cache_keyid == id) {
-		return TRUE;
-	}
+	if (0 == id || cache_keyid == id)
+		return !!(KEY_TRUSTED & cache_flags);
 
 	/*
-	 * Seach the bin for the key. If found and the key type
-	 * is zero, somebody marked it trusted without specifying
-	 * a key or key type. In this case consider the key missing.
+	 * Search the bin for the key. If not found, or found but the key
+	 * type is zero, somebody marked it trusted without specifying a
+	 * key or key type. In this case consider the key missing.
 	 */
 	authkeyuncached++;
-	for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
-		if (id == sk->keyid) {
-			if (0 == sk->type) {
-				authkeynotfound++;
-				return FALSE;
-			}
-			break;
-		}
+	sk = auth_findkey(id);
+	if ((sk == NULL) || (sk->type == 0)) {
+		authkeynotfound++;
+		return FALSE;
 	}
 
 	/*
-	 * If the key is not found, or if it is found but not trusted,
-	 * the key is not considered found.
+	 * If the key is not trusted, the key is not considered found.
 	 */
-	if (NULL == sk) {
-		authkeynotfound++;
-		return FALSE;
-	}
-	if (!(KEY_TRUSTED & sk->flags)) {
+	if ( ! (KEY_TRUSTED & sk->flags)) {
 		authnokey++;
 		return FALSE;
 	}
@@ -456,7 +533,6 @@
 	u_long		trust
 	)
 {
-	symkey **	bucket;
 	symkey *	sk;
 	u_long		lifetime;
 
@@ -464,12 +540,9 @@
 	 * Search bin for key; if it does not exist and is untrusted,
 	 * forget it.
 	 */
-	bucket = &key_hash[KEYHASH(id)];
-	for (sk = *bucket; sk != NULL; sk = sk->hlink) {
-		if (id == sk->keyid)
-			break;
-	}
-	if (!trust && NULL == sk)
+
+	sk = auth_findkey(id);
+	if (!trust && sk == NULL)
 		return;
 
 	/*
@@ -478,16 +551,13 @@
 	 * not to be trusted.
 	 */	
 	if (sk != NULL) {
-		if (cache_keyid == id) {
-			cache_flags = 0;
-			cache_keyid = 0;
-			cache_keyacclist = NULL;
-		}
-
 		/*
-		 * Key exists. If it is to be trusted, say so and
-		 * update its lifetime. 
+		 * Key exists. If it is to be trusted, say so and update
+		 * its lifetime. If no longer trusted, return it to the
+		 * free list. Flush the cache first to be sure there are
+		 * no discrepancies.
 		 */
+		authcache_flush_id(id);
 		if (trust > 0) {
 			sk->flags |= KEY_TRUSTED;
 			if (trust > 1)
@@ -494,11 +564,9 @@
 				sk->lifetime = current_time + trust;
 			else
 				sk->lifetime = 0;
-			return;
+		} else {
+			freesymkey(sk);
 		}
-
-		/* No longer trusted, return it to the free list. */
-		freesymkey(sk, bucket);
 		return;
 	}
 
@@ -511,7 +579,7 @@
 	} else {
 		lifetime = 0;
 	}
-	allocsymkey(bucket, id, KEY_TRUSTED, 0, lifetime, 0, NULL, NULL);
+	allocsymkey(id, KEY_TRUSTED, 0, lifetime, 0, NULL, NULL);
 }
 
 
@@ -520,22 +588,17 @@
  */
 int
 authistrusted(
-	keyid_t		keyno
+	keyid_t		id
 	)
 {
 	symkey *	sk;
-	symkey **	bucket;
 
-	if (keyno == cache_keyid)
+	if (id == cache_keyid)
 		return !!(KEY_TRUSTED & cache_flags);
 
 	authkeyuncached++;
-	bucket = &key_hash[KEYHASH(keyno)];
-	for (sk = *bucket; sk != NULL; sk = sk->hlink) {
-		if (keyno == sk->keyid)
-			break;
-	}
-	if (NULL == sk || !(KEY_TRUSTED & sk->flags)) {
+	sk = auth_findkey(id);
+	if (sk == NULL || !(KEY_TRUSTED & sk->flags)) {
 		authkeynotfound++;
 		return FALSE;
 	}
@@ -553,38 +616,23 @@
 	)
 {
 	symkey *	sk;
-	symkey **	bucket;
-	KeyAccT *	kal;
-	KeyAccT *	k;
 
-	if (keyno == cache_keyid)
-		kal = cache_keyacclist;
-	else {
+	/* That specific key was already used to authenticate the
+	 * packet. Therefore, the key *must* exist...  There's a chance
+	 * that is not trusted, though.
+	 */
+	if (keyno == cache_keyid) {
+		return (KEY_TRUSTED & cache_flags) &&
+		    keyacc_contains(cache_keyacclist, sau, TRUE);
+	} else {
 		authkeyuncached++;
-		bucket = &key_hash[KEYHASH(keyno)];
-		for (sk = *bucket; sk != NULL; sk = sk->hlink) {
-			if (keyno == sk->keyid)
-				break;
-		}
-		if (NULL == sk || !(KEY_TRUSTED & sk->flags)) {
-			INSIST(!"authistrustedip: keyid not found/trusted!");
-			return FALSE;
-		}
-		kal = sk->keyacclist;
+		sk = auth_findkey(keyno);
+		INSIST(NULL != sk);
+		return (KEY_TRUSTED & sk->flags) &&
+		    keyacc_contains(sk->keyacclist, sau, TRUE);
 	}
-
-	if (NULL == kal)
-		return TRUE;
-
-	for (k = kal; k; k = k->next) {
-		if (SOCK_EQ(&k->addr, sau))
-			return TRUE;
-	}
-
-	return FALSE;
 }
 
-
 /* Note: There are two locations below where 'strncpy()' is used. While
  * this function is a hazard by itself, it's essential that it is used
  * here. Bug 1243 involved that the secret was filled with NUL bytes
@@ -601,55 +649,49 @@
 	keyid_t keyno,
 	int	keytype,
 	const u_char *key,
-	size_t	len,
+	size_t secretsize,
 	KeyAccT *ka
 	)
 {
 	symkey *	sk;
-	symkey **	bucket;
 	u_char *	secret;
-	size_t		secretsize;
 	
 	DEBUG_ENSURE(keytype <= USHRT_MAX);
-	DEBUG_ENSURE(len < 4 * 1024);
+	DEBUG_ENSURE(secretsize < 4 * 1024);
 	/*
 	 * See if we already have the key.  If so just stick in the
 	 * new value.
 	 */
-	bucket = &key_hash[KEYHASH(keyno)];
-	for (sk = *bucket; sk != NULL; sk = sk->hlink) {
-		if (keyno == sk->keyid) {
+	sk = auth_findkey(keyno);
+	if (sk != NULL && keyno == sk->keyid) {
 			/* TALOS-CAN-0054: make sure we have a new buffer! */
-			if (NULL != sk->secret) {
-				memset(sk->secret, 0, sk->secretsize);
-				free(sk->secret);
-			}
-			sk->secret = emalloc(len);
-			sk->type = (u_short)keytype;
-			secretsize = len;
-			sk->secretsize = (u_short)secretsize;
+		if (NULL != sk->secret) {
+			memset(sk->secret, 0, sk->secretsize);
+			free(sk->secret);
+		}
+		sk->secret = emalloc(secretsize + 1);
+		sk->type = (u_short)keytype;
+		sk->secretsize = secretsize;
+		/* make sure access lists don't leak here! */
+		if (ka != sk->keyacclist) {
+			keyacc_all_free(sk->keyacclist);
 			sk->keyacclist = ka;
+		}
 #ifndef DISABLE_BUG1243_FIX
-			memcpy(sk->secret, key, secretsize);
+		memcpy(sk->secret, key, secretsize);
 #else
-			/* >MUST< use 'strncpy()' here! See above! */
-			strncpy((char *)sk->secret, (const char *)key,
-				secretsize);
+		/* >MUST< use 'strncpy()' here! See above! */
+		strncpy((char *)sk->secret, (const char *)key,
+			secretsize);
 #endif
-			if (cache_keyid == keyno) {
-				cache_flags = 0;
-				cache_keyid = 0;
-				cache_keyacclist = NULL;
-			}
-			return;
-		}
+		authcache_flush_id(keyno);
+		return;
 	}
 
 	/*
 	 * Need to allocate new structure.  Do it.
 	 */
-	secretsize = len;
-	secret = emalloc(secretsize);
+	secret = emalloc(secretsize + 1);
 #ifndef DISABLE_BUG1243_FIX
 	memcpy(secret, key, secretsize);
 #else
@@ -656,8 +698,8 @@
 	/* >MUST< use 'strncpy()' here! See above! */
 	strncpy((char *)secret, (const char *)key, secretsize);
 #endif
-	allocsymkey(bucket, keyno, 0, (u_short)keytype, 0,
-		    (u_short)secretsize, secret, ka);
+	allocsymkey(keyno, 0, (u_short)keytype, 0,
+		    secretsize, secret, ka);
 #ifdef DEBUG
 	if (debug >= 4) {
 		size_t	j;
@@ -664,8 +706,9 @@
 
 		printf("auth_setkey: key %d type %d len %d ", (int)keyno,
 		    keytype, (int)secretsize);
-		for (j = 0; j < secretsize; j++)
+		for (j = 0; j < secretsize; j++) {
 			printf("%02x", secret[j]);
+		}
 		printf("\n");
 	}	
 #endif
@@ -697,10 +740,11 @@
 				free(sk->secret);
 				sk->secret = NULL; /* TALOS-CAN-0054 */
 			}
+			sk->keyacclist = keyacc_all_free(sk->keyacclist);
 			sk->secretsize = 0;
 			sk->lifetime = 0;
 		} else {
-			freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
+			freesymkey(sk);
 		}
 	ITER_DLIST_END()
 }
@@ -716,7 +760,7 @@
 
 	ITER_DLIST_BEGIN(key_listhead, sk, llink, symkey)
 		if (sk->lifetime > 0 && current_time > sk->lifetime) {
-			freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
+			freesymkey(sk);
 			authkeyexpired++;
 		}
 	ITER_DLIST_END()
Index: contrib/ntp/libntp/is_ip_address.c
===================================================================
--- contrib/ntp/libntp/is_ip_address.c	(版本 297264)
+++ contrib/ntp/libntp/is_ip_address.c	(版本 298770)
@@ -7,53 +7,13 @@
 # include <config.h>
 #endif
 
-#if 0
-#include <stdio.h>
-#include <signal.h>
-#ifdef HAVE_FNMATCH_H
-# include <fnmatch.h>
-# if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE)
-#  define FNM_CASEFOLD FNM_IGNORECASE
-# endif
-#endif
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_SOCKIO_H	/* UXPV: SIOC* #defines (Frank Vance <fvance@waii.com>) */
-# include <sys/sockio.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
-# include <sys/uio.h>
-#endif
-#endif
-
 #include "ntp_assert.h"
 #include "ntp_stdlib.h"
 #include "safecast.h"
 
-#if 0
-#include "ntp_machine.h"
-#include "ntpd.h"
-#include "ntp_io.h"
-#include "iosignal.h"
-#include "ntp_lists.h"
-#include "ntp_refclock.h"
-#include "ntp_worker.h"
-#include "ntp_request.h"
-#include "timevalops.h"
-#include "timespecops.h"
-#include "ntpd-opts.h"
-#endif
-
 /* Don't include ISC's version of IPv6 variables and structures */
 #define ISC_IPV6_H 1
-#include <isc/mem.h>
-#include <isc/interfaceiter.h>
 #include <isc/netaddr.h>
-#include <isc/result.h>
 #include <isc/sockaddr.h>
 
 
Index: contrib/ntp/libntp/ntp_worker.c
===================================================================
--- contrib/ntp/libntp/ntp_worker.c	(版本 297264)
+++ contrib/ntp/libntp/ntp_worker.c	(版本 298770)
@@ -267,7 +267,7 @@
 void
 harvest_blocking_responses(void)
 {
-	int		idx;
+	size_t		idx;
 	blocking_child*	cp;
 	u_int		scseen, scdone;
 
Index: contrib/ntp/libntp/work_fork.c
===================================================================
--- contrib/ntp/libntp/work_fork.c	(版本 297264)
+++ contrib/ntp/libntp/work_fork.c	(版本 298770)
@@ -451,7 +451,7 @@
 		}
 	}
 
-#ifdef HAVE_DROPROOT
+#if defined(HAVE_DROPROOT) && !defined(NEED_EARLY_FORK)
 	/* defer the fork until after root is dropped */
 	if (droproot && !root_dropped)
 		return;
@@ -540,6 +540,11 @@
 }
 
 
+void worker_global_lock(int inOrOut)
+{
+	(void)inOrOut;
+}
+
 #else	/* !WORK_FORK follows */
 char work_fork_nonempty_compilation_unit;
 #endif
Index: contrib/ntp/ntpd/invoke-ntp.keys.texi
===================================================================
--- contrib/ntp/ntpd/invoke-ntp.keys.texi	(版本 297264)
+++ contrib/ntp/ntpd/invoke-ntp.keys.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntp.keys.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:18:02 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:28:30 PM by AutoGen 5.18.5
 # From the definitions    ntp.keys.def
 # and the template file   agtexi-file.tpl
 @end ignore
Index: contrib/ntp/ntpd/ntp.conf.5mdoc
===================================================================
--- contrib/ntp/ntpd/ntp.conf.5mdoc	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.5mdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_CONF 5mdoc File Formats
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:07 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -111,8 +111,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC\-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq 1ntpqmdoc
+or
+.Xr ntpdc 1ntpdcmdoc ,
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 .Dq \&:
 in the address field.
@@ -147,6 +153,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
 .Xc
 .It Xo Ic peer Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -154,6 +161,8 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
 .Xc
 .It Xo Ic broadcast Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -161,6 +170,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm ttl Ar ttl
+.Op Cm xleave
 .Xc
 .It Xo Ic manycastclient Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -286,7 +296,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -297,7 +309,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -330,6 +344,11 @@
 .It Cm noselect
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
 .It Cm prefer
 Marks the server as preferred.
 All other things being equal,
@@ -342,6 +361,11 @@
 provided in
 .Pa /usr/share/doc/ntp )
 for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
 .It Cm ttl Ar ttl
 This option is used only with broadcast server and manycast
 client modes.
@@ -360,6 +384,12 @@
 packets.
 Versions 1\-4 are the choices, with version 4 the
 default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
 .El
 .Ss Auxiliary Commands
 .Bl -tag -width indent
@@ -505,7 +535,7 @@
 commands and also by remote
 configuration commands sent by a
 .Xr ntpdc 1ntpdcmdoc
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -695,7 +725,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -893,8 +923,8 @@
 .Pa ntpkey_key_ Ns Ar hostname
 in the keys directory.
 .It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 .Pa ntpkey_iff_ Ns Ar hostname
 in the keys directory.
 .It Cm leap Ar file
@@ -904,8 +934,7 @@
 in the keys directory.
 .It Cm mvpar Ar file
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 .Pa ntpkey_mv_ Ns Ar hostname
 in the keys directory.
 .It Cm pw Ar password
@@ -1046,7 +1075,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 .Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 .Ux
@@ -1380,7 +1409,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 .Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd 1ntpdmdoc
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1423,7 +1454,9 @@
 by a determined cracker.
 .Pp
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1433,9 +1466,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .Ss The Kiss\-of\-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1493,7 +1526,9 @@
 and a kiss\-o'\-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
 for packets that overflow the rate\-control window.
 .It Xo Ic restrict address
 .Op Cm mask Ar mask
@@ -1552,7 +1587,9 @@
 last one, the packet is dropped.
 .It Cm limited
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
 A history of clients is kept using the
 monitoring capability of
 .Xr ntpd 1ntpdmdoc .
@@ -1612,7 +1649,9 @@
 .It Cm notrap
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq 1ntpqmdoc
+control message
 protocol which is intended for use by remote event logging programs.
 .It Cm notrust
 Deny service unless the packet is cryptographically authenticated.
@@ -1679,8 +1718,11 @@
 as well and is highly recommended, especially for broadcast modes.
 .Pp
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
 .Cm D
 or IPv6 prefix
 .Cm FF )
@@ -1750,7 +1792,9 @@
 .Cm maxpolll
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2388,7 +2432,8 @@
 otherwise, should be avoided.
 .It Ic dscp Ar value
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6\-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6\-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .It Xo Ic enable
 .Oo
 .Cm auth | Cm bclient |
@@ -2627,7 +2672,8 @@
 message class may also be followed by the
 .Cm all
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .Bd -literal
 logconfig =syncstatus +sysevents
@@ -2651,7 +2697,9 @@
 be used instead of the default system
 .Xr syslog 3
 facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+.Fl l
+command line option.
 .It Ic setvar Ar variable Op Cm default
 This command adds an additional system variable.
 These
@@ -2803,7 +2851,8 @@
 function.
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .El
 .It Xo Ic trap Ar host_address
 .Op Cm port Ar port_number
Index: UPDATING
===================================================================
--- UPDATING	(版本 297264)
+++ UPDATING	(版本 298770)
@@ -16,6 +16,10 @@
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20150429	p1	FreeBSD-SA-16:16.ntp
+
+	Fix multiple vulnerabilities of ntp.
+
 20160329:
 	10.3-RELEASE.
 
Index: contrib/ntp/ChangeLog
===================================================================
--- contrib/ntp/ChangeLog	(版本 297264)
+++ contrib/ntp/ChangeLog	(版本 298770)
@@ -1,4 +1,65 @@
 ---
+(4.2.8p7) 2016/04/26 Released by Harlan Stenn <stenn@ntp.org>
+
+* [Sec 2901] KoD packets must have non-zero transmit timestamps.  HStenn.
+* [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve
+  time. Include passive servers in this check. HStenn.
+* [Sec 2945] Additional KoD packet checks.  HStenn.
+* [Sec 2978] Interleave can be partially triggered.  HStenn.
+* [Sec 3007] Validate crypto-NAKs.  Danny Mayer.
+* [Sec 3008] Always check the return value of ctl_getitem().
+  - initial work by HStenn
+  - Additional cleanup of ctl_getitem by perlinger@ntp.org
+* [Sec 3009] Crafted addpeer with hmode > 7 causes OOB error. perlinger@ntp.org
+   - added more stringent checks on packet content
+* [Sec 3010] remote configuration trustedkey/requestkey values
+  are not properly validated. perlinger@ntp.org
+  - sidekick: Ignore keys that have an unsupported MAC algorithm
+    but are otherwise well-formed
+* [Sec 3011] Duplicate IPs on unconfig directives will cause an assertion botch
+  - graciously accept the same IP multiple times. perlinger@ntp.org
+* [Sec 3020] Refclock impersonation.  HStenn.
+* [Bug 2831]  Segmentation Fault in DNS lookup during startup. perlinger@ntp.org
+  - fixed yet another race condition in the threaded resolver code.
+* [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+* [Bug 2879] Improve NTP security against timing attacks. perlinger@ntp.org
+  - integrated patches by Loganaden Velvidron <logan@ntp.org>
+    with some modifications & unit tests
+* [Bug 2952] Symmetric active/passive mode is broken.  HStenn.
+* [Bug 2960] async name resolution fixes for chroot() environments.
+  Reinhard Max.
+* [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile. perlinger@ntp.org
+* [Bug 2995] Fixes to compile on Windows
+* [Bug 2999] out-of-bounds access in 'is_safe_filename()'. perlinger@ntp.org
+* [Bug 3013] Fix for ssl_init.c SHA1 test. perlinger@ntp.org
+  - Patch provided by Ch. Weisgerber
+* [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
+  - A change related to [Bug 2853] forbids trailing white space in
+    remote config commands. perlinger@ntp.org
+* [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+  - report and patch from Aleksandr Kostikov.
+  - Overhaul of Windows IO completion port handling. perlinger@ntp.org
+* [Bug 3022] authkeys.c should be refactored. perlinger@ntp.org
+  - fixed memory leak in access list (auth[read]keys.c)
+  - refactored handling of key access lists (auth[read]keys.c)
+  - reduced number of error branches (authreadkeys.c)
+* [Bug 3023] ntpdate cannot correct dates in the future. perlinger@ntp.org
+* [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+* [Bug 3031] ntp broadcastclient unable to synchronize to an server
+             when the time of server changed. perlinger@ntp.org
+  - Check the initial delay calculation and reject/unpeer the broadcast
+    server if the delay exceeds 50ms. Retry again after the next
+    broadcast packet.
+* [Bug 3036] autokey trips an INSIST in authistrustedip().  Harlan Stenn.
+* Document ntp.key's optional IP list in authenetic.html.  Harlan Stenn.
+* Update html/xleave.html documentation.  Harlan Stenn.
+* Update ntp.conf documentation.  Harlan Stenn.
+* Fix some Credit: attributions in the NEWS file.  Harlan Stenn.
+* Fix typo in html/monopt.html.  Harlan Stenn.
+* Add README.pullrequests.  Harlan Stenn.
+* Cleanup to include/ntp.h.  Harlan Stenn.
+
+---
 (4.2.8p6) 2016/01/20 Released by Harlan Stenn <stenn@ntp.org>
 
 * [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode. HStenn.
@@ -92,6 +153,7 @@
 * Update scripts/calc_tickadj/Makefile.am.  Harlan Stenn.
 
 ---
+(4.2.8p4) 2015/10/21 Released by Harlan Stenn <stenn@ntp.org>
 
 * [Sec 2899] CVE-2014-9297  perlinger@ntp.org
 * [Sec 2901] Drop invalid packet before checking KoD. Check for all KoD's.
Index: contrib/ntp/CommitLog
===================================================================
--- contrib/ntp/CommitLog	(版本 297264)
+++ contrib/ntp/CommitLog	(版本 298770)
@@ -1,3 +1,1130 @@
+ChangeSet@1.3669, 2016-04-26 20:30:51-04:00, stenn@deacon.udel.edu
+  NTP_4_2_8P7
+  TAG: NTP_4_2_8P7
+
+  ChangeLog@1.1820 +1 -0
+    NTP_4_2_8P7
+
+  ntpd/invoke-ntp.conf.texi@1.198 +38 -20
+    NTP_4_2_8P7
+
+  ntpd/invoke-ntp.keys.texi@1.189 +1 -1
+    NTP_4_2_8P7
+
+  ntpd/invoke-ntpd.texi@1.505 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntp.conf.5man@1.232 +43 -24
+    NTP_4_2_8P7
+
+  ntpd/ntp.conf.5mdoc@1.232 +40 -18
+    NTP_4_2_8P7
+
+  ntpd/ntp.conf.html@1.184 +34 -10
+    NTP_4_2_8P7
+
+  ntpd/ntp.conf.man.in@1.232 +43 -24
+    NTP_4_2_8P7
+
+  ntpd/ntp.conf.mdoc.in@1.232 +40 -18
+    NTP_4_2_8P7
+
+  ntpd/ntp.keys.5man@1.223 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntp.keys.5mdoc@1.223 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntp.keys.html@1.185 +1 -1
+    NTP_4_2_8P7
+
+  ntpd/ntp.keys.man.in@1.223 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntp.keys.mdoc.in@1.223 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntpd-opts.c@1.527 +7 -7
+    NTP_4_2_8P7
+
+  ntpd/ntpd-opts.h@1.526 +3 -3
+    NTP_4_2_8P7
+
+  ntpd/ntpd.1ntpdman@1.334 +3 -3
+    NTP_4_2_8P7
+
+  ntpd/ntpd.1ntpdmdoc@1.334 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntpd.html@1.178 +2 -2
+    NTP_4_2_8P7
+
+  ntpd/ntpd.man.in@1.334 +3 -3
+    NTP_4_2_8P7
+
+  ntpd/ntpd.mdoc.in@1.334 +2 -2
+    NTP_4_2_8P7
+
+  ntpdc/invoke-ntpdc.texi@1.502 +2 -2
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc-opts.c@1.520 +7 -7
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc-opts.h@1.519 +3 -3
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc.1ntpdcman@1.333 +3 -3
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc.1ntpdcmdoc@1.333 +2 -2
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc.html@1.346 +2 -2
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc.man.in@1.333 +3 -3
+    NTP_4_2_8P7
+
+  ntpdc/ntpdc.mdoc.in@1.333 +2 -2
+    NTP_4_2_8P7
+
+  ntpq/invoke-ntpq.texi@1.510 +2 -2
+    NTP_4_2_8P7
+
+  ntpq/ntpq-opts.c@1.527 +7 -7
+    NTP_4_2_8P7
+
+  ntpq/ntpq-opts.h@1.525 +3 -3
+    NTP_4_2_8P7
+
+  ntpq/ntpq.1ntpqman@1.338 +3 -3
+    NTP_4_2_8P7
+
+  ntpq/ntpq.1ntpqmdoc@1.338 +2 -2
+    NTP_4_2_8P7
+
+  ntpq/ntpq.html@1.175 +36 -6
+    NTP_4_2_8P7
+
+  ntpq/ntpq.man.in@1.338 +3 -3
+    NTP_4_2_8P7
+
+  ntpq/ntpq.mdoc.in@1.338 +2 -2
+    NTP_4_2_8P7
+
+  ntpsnmpd/invoke-ntpsnmpd.texi@1.504 +2 -2
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd-opts.c@1.522 +7 -7
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd-opts.h@1.521 +3 -3
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.333 +3 -3
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.333 +2 -2
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd.html@1.173 +1 -1
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd.man.in@1.333 +3 -3
+    NTP_4_2_8P7
+
+  ntpsnmpd/ntpsnmpd.mdoc.in@1.333 +2 -2
+    NTP_4_2_8P7
+
+  packageinfo.sh@1.526 +2 -2
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.94 +3 -3
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.95 +2 -2
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/calc_tickadj.html@1.96 +1 -1
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/calc_tickadj.man.in@1.93 +3 -3
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/calc_tickadj.mdoc.in@1.95 +2 -2
+    NTP_4_2_8P7
+
+  scripts/calc_tickadj/invoke-calc_tickadj.texi@1.98 +1 -1
+    NTP_4_2_8P7
+
+  scripts/invoke-plot_summary.texi@1.115 +2 -2
+    NTP_4_2_8P7
+
+  scripts/invoke-summary.texi@1.115 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/invoke-ntp-wait.texi@1.325 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait-opts@1.61 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait.1ntp-waitman@1.322 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.323 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait.html@1.342 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait.man.in@1.322 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntp-wait/ntp-wait.mdoc.in@1.323 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/invoke-ntpsweep.texi@1.113 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep-opts@1.63 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep.1ntpsweepman@1.101 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.101 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep.html@1.114 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep.man.in@1.101 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntpsweep/ntpsweep.mdoc.in@1.102 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntptrace/invoke-ntptrace.texi@1.114 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace-opts@1.63 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace.1ntptraceman@1.101 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace.1ntptracemdoc@1.102 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace.html@1.115 +2 -2
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace.man.in@1.101 +3 -3
+    NTP_4_2_8P7
+
+  scripts/ntptrace/ntptrace.mdoc.in@1.103 +2 -2
+    NTP_4_2_8P7
+
+  scripts/plot_summary-opts@1.63 +2 -2
+    NTP_4_2_8P7
+
+  scripts/plot_summary.1plot_summaryman@1.113 +3 -3
+    NTP_4_2_8P7
+
+  scripts/plot_summary.1plot_summarymdoc@1.113 +2 -2
+    NTP_4_2_8P7
+
+  scripts/plot_summary.html@1.116 +2 -2
+    NTP_4_2_8P7
+
+  scripts/plot_summary.man.in@1.113 +3 -3
+    NTP_4_2_8P7
+
+  scripts/plot_summary.mdoc.in@1.113 +2 -2
+    NTP_4_2_8P7
+
+  scripts/summary-opts@1.63 +2 -2
+    NTP_4_2_8P7
+
+  scripts/summary.1summaryman@1.113 +3 -3
+    NTP_4_2_8P7
+
+  scripts/summary.1summarymdoc@1.113 +2 -2
+    NTP_4_2_8P7
+
+  scripts/summary.html@1.116 +2 -2
+    NTP_4_2_8P7
+
+  scripts/summary.man.in@1.113 +3 -3
+    NTP_4_2_8P7
+
+  scripts/summary.mdoc.in@1.113 +2 -2
+    NTP_4_2_8P7
+
+  scripts/update-leap/invoke-update-leap.texi@1.14 +1 -1
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap-opts@1.14 +2 -2
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap.1update-leapman@1.14 +3 -3
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap.1update-leapmdoc@1.14 +2 -2
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap.html@1.14 +1 -1
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap.man.in@1.14 +3 -3
+    NTP_4_2_8P7
+
+  scripts/update-leap/update-leap.mdoc.in@1.14 +2 -2
+    NTP_4_2_8P7
+
+  sntp/invoke-sntp.texi@1.502 +2 -2
+    NTP_4_2_8P7
+
+  sntp/sntp-opts.c@1.521 +7 -7
+    NTP_4_2_8P7
+
+  sntp/sntp-opts.h@1.519 +3 -3
+    NTP_4_2_8P7
+
+  sntp/sntp.1sntpman@1.337 +3 -3
+    NTP_4_2_8P7
+
+  sntp/sntp.1sntpmdoc@1.337 +2 -2
+    NTP_4_2_8P7
+
+  sntp/sntp.html@1.517 +2 -2
+    NTP_4_2_8P7
+
+  sntp/sntp.man.in@1.337 +3 -3
+    NTP_4_2_8P7
+
+  sntp/sntp.mdoc.in@1.337 +2 -2
+    NTP_4_2_8P7
+
+  util/invoke-ntp-keygen.texi@1.505 +2 -2
+    NTP_4_2_8P7
+
+  util/ntp-keygen-opts.c@1.523 +7 -7
+    NTP_4_2_8P7
+
+  util/ntp-keygen-opts.h@1.521 +3 -3
+    NTP_4_2_8P7
+
+  util/ntp-keygen.1ntp-keygenman@1.333 +3 -3
+    NTP_4_2_8P7
+
+  util/ntp-keygen.1ntp-keygenmdoc@1.333 +2 -2
+    NTP_4_2_8P7
+
+  util/ntp-keygen.html@1.179 +2 -2
+    NTP_4_2_8P7
+
+  util/ntp-keygen.man.in@1.333 +3 -3
+    NTP_4_2_8P7
+
+  util/ntp-keygen.mdoc.in@1.333 +2 -2
+    NTP_4_2_8P7
+
+ChangeSet@1.3668, 2016-04-26 20:07:48-04:00, stenn@deacon.udel.edu
+  ntp-4.2.8p7
+
+  packageinfo.sh@1.525 +1 -1
+    ntp-4.2.8p7
+
+ChangeSet@1.3667, 2016-04-26 23:24:25+00:00, stenn@psp-deb1.ntp.org
+  4.2.8p7 documentation cleanup
+
+  ChangeLog@1.1819 +9 -9
+    4.2.8p7 documentation cleanup
+
+  NEWS@1.169 +123 -36
+    4.2.8p7 documentation cleanup
+
+ChangeSet@1.3666, 2016-04-24 09:17:06+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+  ntpd/ntp_proto.c@1.386 +0 -1
+    [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+ChangeSet@1.3665, 2016-04-21 23:42:43+00:00, stenn@psp-deb1.ntp.org
+  Update 3007
+
+  NEWS@1.168 +1 -1
+    Update 3007
+
+ChangeSet@1.3664, 2016-04-21 23:29:30+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3007] Fix bug in crypto-NAK check
+
+  ChangeLog@1.1818 +1 -1
+    [Bug 3007] Fix bug in crypto-NAK check
+
+  ntpd/ntp_proto.c@1.385 +3 -1
+    [Bug 3007] Fix bug in crypto-NAK check
+
+ChangeSet@1.3663, 2016-04-21 09:29:31+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+  NEWS@1.167 +1 -0
+    [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+ChangeSet@1.3661, 2016-04-21 09:24:12+00:00, stenn@psp-deb1.ntp.org
+  tweak some ntp_proto.c timestamp log messages
+
+  ntpd/ntp_proto.c@1.383 +4 -3
+    tweak some ntp_proto.c timestamp log messages
+
+ChangeSet@1.3630.1.17, 2016-04-21 09:11:51+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+  ChangeLog@1.1794.1.15 +1 -0
+    [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+  ntpd/ntp_proto.c@1.373.2.7 +6 -1
+    [Bug 3036] autokey trips an INSIST in authistrustedip()
+
+ChangeSet@1.3660, 2016-04-19 05:29:57+00:00, stenn@psp-deb1.ntp.org
+  Windows cleanup for Bug 2978 mitigation
+
+  ports/winnt/include/config.h@1.114 +6 -0
+    Windows cleanup for Bug 2978 mitigation
+
+ChangeSet@1.3659, 2016-04-18 05:38:06+00:00, stenn@psp-deb1.ntp.org
+  4.2.8p7 update: [Bug 2831] Segmentation Fault in DNS lookup during startup
+
+  NEWS@1.166 +2 -0
+    4.2.8p7 update: [Bug 2831] Segmentation Fault in DNS lookup during startup
+
+ChangeSet@1.3630.15.1, 2016-04-18 06:07:25+02:00, perlinger@ntp.org
+  [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+   - fixed yet another race condition in the threaded resolver code.
+
+  ChangeLog@1.1794.15.1 +2 -0
+    [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+     - fixed yet another race condition in the threaded resolver code.
+
+  include/ntp_worker.h@1.7 +2 -0
+    [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+     - fixed yet another race condition in the threaded resolver code: global locker prototype
+
+  libntp/ntp_intres.c@1.100 +20 -28
+    [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+     - fixed yet another race condition in the threaded resolver code:
+        lock global context table during access
+        remove dangerous wrapper
+
+  libntp/work_fork.c@1.14.1.1 +5 -0
+    [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+     - fixed yet another race condition in the threaded resolver code: global locker dummy
+
+  libntp/work_thread.c@1.21 +23 -0
+    [Bug 2831]  Segmentation Fault in DNS lookup during startup.
+     - fixed yet another race condition in the threaded resolver code: create&handle global lock
+
+ChangeSet@1.3657, 2016-04-16 07:59:23+00:00, stenn@psp-deb1.ntp.org
+  type
+
+  NEWS@1.165 +1 -1
+    type
+
+ChangeSet@1.3656, 2016-04-14 09:03:11+00:00, stenn@psp-deb1.ntp.org
+  Update the NEWS file for 4.2.8p7
+
+  NEWS@1.164 +7 -0
+    Update the NEWS file for 4.2.8p7
+
+ChangeSet@1.3655, 2016-04-14 01:59:45+00:00, stenn@psp-deb1.ntp.org
+  [Sec 2978] Interleave can be partially triggered
+
+  ChangeLog@1.1815 +1 -0
+    [Sec 2978] Interleave can be partially triggered
+
+  configure.ac@1.605 +22 -0
+    [Sec 2978] Interleave can be partially triggered
+
+  ntpd/ntp_proto.c@1.382 +11 -3
+    [Sec 2978] Interleave can be partially triggered
+
+ChangeSet@1.3654, 2016-04-14 01:46:50+00:00, stenn@psp-deb1.ntp.org
+  Update the NEWS file for 4.2.8p7
+
+  NEWS@1.163 +168 -26
+    Update the NEWS file for 4.2.8p7
+
+ChangeSet@1.3653, 2016-04-12 22:29:18+00:00, stenn@psp-deb1.ntp.org
+  4.2.8p7 prep
+
+  NEWS@1.162 +105 -5
+    4.2.8p7 prep
+
+ChangeSet@1.3652, 2016-04-12 09:01:09+00:00, stenn@psp-deb1.ntp.org
+  Credit Aleksandr Kostikov on bug 3019
+
+  ChangeLog@1.1814 +1 -0
+    Credit Aleksandr Kostikov on bug 3019
+
+ChangeSet@1.3630.13.6, 2016-04-12 07:43:08+00:00, stenn@psp-deb1.ntp.org
+  comment tweak
+
+  ntpd/ntp_proto.c@1.373.2.6 +1 -1
+    comment tweak
+
+ChangeSet@1.3650, 2016-04-11 20:26:29-07:00, harlan@max.pfcs.com
+  [Bug 2952] Symmetric active/passive mode is broken
+
+  ChangeLog@1.1812 +1 -0
+    [Bug 2952] Symmetric active/passive mode is broken
+
+  ntpd/ntp_proto.c@1.380 +21 -12
+    [Bug 2952] Symmetric active/passive mode is broken
+
+ChangeSet@1.3649, 2016-04-11 19:56:06-07:00, harlan@max.pfcs.com
+  Cleanup to include/ntp.h
+
+  ChangeLog@1.1811 +1 -0
+    Cleanup to include/ntp.h
+
+  include/ntp.h@1.218 +7 -0
+    cleanup
+
+ChangeSet@1.3630.13.5, 2016-04-01 19:18:25+02:00, jnperlin@nemesis.localnet
+  [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed
+   - adjust pull cycle of broadcast client to trensmission of brodcast server
+
+  libntp/ntp_worker.c@1.7.1.1 +1 -1
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed
+     - side kick: fix annoying signed/unsigned clash
+
+  ntpd/ntp_proto.c@1.373.2.5 +1 -0
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed
+     - adjust pull cycle of broadcast client to trensmission of brodcast server
+
+ChangeSet@1.3630.13.4, 2016-03-30 23:55:33+02:00, jnperlin@nemesis.localnet
+  [Bug 3031] modify deadband
+
+  ntpd/ntp_proto.c@1.373.2.4 +13 -12
+    [Bug 3031] broadcast issues
+     - modify deadband for first round after volley
+
+ChangeSet@1.3630.14.1, 2016-03-30 17:28:04+00:00, perlinger@psp-deb1.ntp.org
+  [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+   - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds
+     the cutoff limit. (default 50ms)
+     Retry again after the next broadcast packet.
+
+  ChangeLog@1.1794.14.1 +5 -0
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+
+  ntpd/ntp_io.c@1.414.3.1 +28 -10
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+     - improve/fix handling of opening broadcast sockets (-> EADDRNOTAVAIL)
+
+  ntpd/ntp_proto.c@1.373.3.1 +23 -4
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+     - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms.
+       Retry again after the next broadcast packet.
+     - the absolute value of negative broadcastdelays is cutoff limit for peer removal.
+
+ChangeSet@1.3630.13.2, 2016-03-30 19:23:06+02:00, jnperlin@nemesis.localnet
+  [Bug 3031]
+
+  ntpd/ntp_io.c@1.414.2.1 +28 -10
+    [Bug 3031]
+     - improve/fix handling of opening broadcast sockets (-> EADDRNOTAVAIL)
+
+  ntpd/ntp_proto.c@1.373.2.2 +14 -6
+    [Bug 3031]
+     - the absolute value of negative broadcastdelays is cutoff limit for peer removal
+
+ChangeSet@1.3630.1.14, 2016-03-30 10:29:07+00:00, stenn@psp-deb1.ntp.org
+  [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+  ChangeLog@1.1794.1.12 +2 -0
+    [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+  libntp/work_fork.c@1.15 +1 -1
+    [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+  ntpd/ntp_timer.c@1.96 +6 -0
+    [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+  ntpd/ntpd.c@1.171 +15 -0
+    [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+  sntp/m4/ntp_libntp.m4@1.33 +1 -0
+    [Bug 2960] async name resolution fixes for chroot() environments.  Reinhard Max
+
+ChangeSet@1.3630.13.1, 2016-03-29 18:22:03+02:00, perlinger@ntp.org
+  [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+   - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms.
+     Retry again after the next broadcast packet.
+
+  ChangeLog@1.1794.13.1 +5 -0
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+
+  ntpd/ntp_proto.c@1.373.2.1 +11 -0
+    [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed.
+     - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms.
+       Retry again after the next broadcast packet.
+
+ChangeSet@1.3630.12.1, 2016-03-27 23:59:51+02:00, jnperlin@nemesis.localnet
+  [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+   - complete refurbishment of overlapped IO engine
+   - cleanup
+
+  ChangeLog@1.1794.12.1 +2 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+      - work around windows network issues, improve overlapped IO. perlinger@ntp.org
+
+  include/ntp.h@1.216.1.1 +1 -0
+    [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE
+     - add IOCPL registration handle to interface
+
+  include/ntp_refclock.h@1.38 +2 -1
+    [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE
+     - add IOCPL registration handle to RIO structure
+
+  include/recvbuff.h@1.26 +2 -2
+    [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE
+     - fix SOCKET vs. FD clash
+     - 'get_free_recv_buffer_alloc()': extended comment
+
+  libntp/ntp_worker.c@1.8 +1 -1
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+      - fix signed/unsigned clash
+
+  libntp/recvbuff.c@1.41 +15 -13
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - API cleanup: accept and silently ignore NULL pointer in 'freerecvbuf()'
+     - fix SOCKET vs. FD clash
+
+  ntpd/ntp_io.c@1.414.1.1 +42 -12
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - first invalidate FDs in shared structure, then close handles
+     - defer free() via cooling pond when doing overlapped IO 
+    ---
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - proper wiring to IO completion ports
+    ---
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - first invalidate FDs in shared structure, then close handles
+     - defer free() via cooling pond when doing overlapped IO 
+     - proper wiring to IO completion ports
+    ---
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - wired the needed unregistration functions for overlapped IO
+
+  ports/winnt/include/ntp_iocompletionport.h@1.22 +17 -10
+    Bug 3019 - NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - extend API to provide essential information
+     - added missing unregistration functions to API
+
+  ports/winnt/include/ntp_iocplmem.h@1.1 +24 -0
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - refactored IOCPL heap into separate file
+
+  ports/winnt/include/ntp_iocplmem.h@1.0 +0 -0
+
+  ports/winnt/include/ntp_iocpltypes.h@1.1 +160 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - refactored helper objects (locks, PPS/device context, IO context,...) into separate file
+
+  ports/winnt/include/ntp_iocpltypes.h@1.0 +0 -0
+
+  ports/winnt/ntpd/ntp_iocompletionport.c@1.73 +875 -791
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - make sure ALL operations are overlapped for sockets
+     - use APC queue for deferred error processing
+     - take extra care to deal with interfaces/clocks being removed while overlapped IO in flight
+     - minor WINAPI cleanups (VS2008 vs VS2013)
+     - extend API to provide essential information
+     - better context checking
+     - implemented the missing unregistration functions
+     - implemented shared locking between clocks/interfaces and IO operations
+     - made sure minimal locking is engaged
+     - fixed / locked / avoided access to global / shared values from IO thread
+     - made sure interfaces and clocks cannot be deleted wile accessed from worker thread
+     - made sure feeding the receive queue stops with deregistration
+    In other words, a complete refurbishment.
+     - further refactoring, better handling of received packets
+
+  ports/winnt/ntpd/ntp_iocplmem.c@1.1 +123 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - refactored IOCPL heap into separate file
+
+  ports/winnt/ntpd/ntp_iocplmem.c@1.0 +0 -0
+
+  ports/winnt/ntpd/ntp_iocpltypes.c@1.1 +366 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - refactored helper objects (locks, PPS/device context, IO context,...) into separate file
+
+  ports/winnt/ntpd/ntp_iocpltypes.c@1.0 +0 -0
+
+  ports/winnt/ntpd/ntservice.c@1.30 +13 -3
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - log request from SCM in INFO level
+
+  ports/winnt/vs2005/ntpd.vcproj@1.21 +8 -18
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - added ntp_iocpl{mem,types}.c to sources.
+
+  ports/winnt/vs2008/ntpd/ntpd.vcproj@1.51 +16 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - added ntp_iocpl{mem,types}.c to sources.
+
+  ports/winnt/vs2013/debug-x64.props@1.2 +1 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - sidekick: property sheet name
+
+  ports/winnt/vs2013/libntp/libntp.vcxproj.filters@1.7.1.1 +3 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - auto update
+
+  ports/winnt/vs2013/ntpd/ntpd.vcxproj@1.9 +4 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - added ntp_iocpl{mem,types}.c to sources.
+
+  ports/winnt/vs2013/ntpd/ntpd.vcxproj.filters@1.6 +12 -0
+    [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE
+     - auto update
+
+  ports/winnt/vs2013/release-x64.props@1.2 +1 -0
+    [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+     - sidekick: property sheet name
+
+ChangeSet@1.3630.1.12, 2016-03-19 09:09:07+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  tests/ntpq/Makefile.am@1.9 +1 -0
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+ChangeSet@1.3630.1.10, 2016-03-16 09:22:31+00:00, stenn@psp-deb1.ntp.org
+  Add README.pullrequests.  Harlan Stenn
+
+  ChangeLog@1.1794.1.9 +1 -0
+    Add README.pullrequests.  Harlan Stenn
+
+  Makefile.am@1.135 +1 -0
+    Add README.pullrequests.  Harlan Stenn
+
+  README.pullrequests@1.1 +90 -0
+    BitKeeper file /home/stenn/ntp-stable/README.pullrequests
+
+  README.pullrequests@1.0 +0 -0
+
+ChangeSet@1.3630.11.1, 2016-03-16 08:46:16+00:00, stenn@psp-deb1.ntp.org
+  [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ChangeLog@1.1794.11.1 +1 -0
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/invoke-ntpq.texi@1.509 +28 -1
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq-opts.c@1.526 +108 -50
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq-opts.def@1.27 +12 -0
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq-opts.h@1.524 +21 -8
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq-subs.c@1.116.1.1 +17 -10
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.1ntpqman@1.337 +24 -3
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.1ntpqmdoc@1.337 +22 -2
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.c@1.169 +53 -2
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.h@1.32 +3 -0
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.man.in@1.337 +24 -3
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+  ntpq/ntpq.mdoc.in@1.337 +22 -2
+    [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+
+ChangeSet@1.3630.10.1, 2016-03-01 08:30:22+01:00, perlinger@ntp.org
+  [Bug 3023] ntpdate cannot correct dates in the future.
+
+  ChangeLog@1.1794.10.1 +1 -0
+    [Bug 3023] ntpdate cannot correct dates in the future.
+
+  ntpdate/ntpdate.c@1.98 +9 -5
+    [Bug 3023] ntpdate cannot correct dates in the future.
+
+ChangeSet@1.3642, 2016-03-01 05:46:29+00:00, stenn@psp-deb1.ntp.org
+  cleanup
+
+  ChangeLog@1.1805 +0 -1
+    cleanup
+
+ChangeSet@1.3641, 2016-02-29 23:01:01+00:00, stenn@psp-deb1.ntp.org
+  [Sec 3020] Refclock impersonation.  HStenn.
+
+  ChangeLog@1.1804 +1 -0
+    [Sec 3020] Refclock impersonation.  HStenn.
+
+  configure.ac@1.604 +18 -0
+    [Sec 3020] Refclock impersonation.  HStenn.
+
+  ntpd/ntp_io.c@1.415 +12 -0
+    [Sec 3020] Refclock impersonation.  HStenn.
+
+ChangeSet@1.3630.9.1, 2016-02-29 20:03:59+01:00, jnperlin@hydra.localnet
+  [Bug 3022] authkeys.c should be refactored
+
+  ChangeLog@1.1794.9.1 +4 -0
+    [Bug 3022] authkeys.c should be refactored
+
+  include/ntp_keyacc.h@1.2 +6 -0
+    [Bug 3022] authkeys.c should be refactored
+     - refactoring of key access handling
+
+  libntp/authkeys.c@1.34 +146 -85
+    [Bug 3022] authkeys.c should be refactored
+     - refactoring of key access handling
+     - fixed memory leak in access list
+
+  libntp/authreadkeys.c@1.25.1.1 +52 -44
+    [Bug 3022] authkeys.c should be refactored
+     - refactoring of key access handling
+     - reduced number of error branches
+
+ChangeSet@1.3638.2.2, 2016-02-22 05:33:56+00:00, stenn@psp-deb1.ntp.org
+  [Sec 3008] Always check the return value of ctl_getitem().  HStenn.
+
+  ChangeLog@1.1801.2.1 +1 -0
+    [Sec 3008] Always check the return value of ctl_getitem().  HStenn.
+
+  ntpd/ntp_control.c@1.206.2.1 +11 -2
+    [Sec 3008] Always check the return value of ctl_getitem().  HStenn.
+
+ChangeSet@1.3638.2.1, 2016-02-22 05:12:39+00:00, stenn@psp-deb1.ntp.org
+  Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.def@1.23 +38 -16
+    Update ntp.conf documentation.  Harlan Stenn.
+
+ChangeSet@1.3638.1.3, 2016-02-22 03:39:39+00:00, stenn@psp-deb1.ntp.org
+  Bug 3007 cleanup
+
+  ntpd/ntp_proto.c@1.379 +4 -1
+    Bug 3007 cleanup
+
+ChangeSet@1.3630.8.1, 2016-02-21 15:09:37+01:00, perlinger@ntp.org
+  [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error
+
+  ChangeLog@1.1794.8.1 +2 -0
+    [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error
+
+  ntpd/ntp_request.c@1.117.2.1 +29 -2
+    [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error
+     - added more stringent checks on packet content:
+       hmode <= 6 (7 is already out of range for a peer mode!)
+
+ChangeSet@1.3630.7.2, 2016-02-21 09:39:25+01:00, perlinger@ntp.org
+  Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+   - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed
+
+  ChangeLog@1.1794.7.2 +2 -0
+    Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+     - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed
+
+  libntp/authreadkeys.c@1.26 +48 -26
+    [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+     - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed
+
+ChangeSet@1.3630.7.1, 2016-02-19 22:42:25+01:00, perlinger@ntp.org
+  [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+
+  ChangeLog@1.1794.7.1 +2 -0
+    [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+
+  ntpd/ntp_request.c@1.117.1.1 +41 -25
+    [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated
+     - make sure the new keyids are valid static key IDs and present in the key table
+
+ChangeSet@1.3630.6.1, 2016-02-19 19:47:31+01:00, perlinger@ntp.org
+  [Bug 3013] Fix for ssl_init.c SHA1 test
+
+  ChangeLog@1.1794.6.1 +2 -0
+    [Bug 3013] Fix for ssl_init.c SHA1 test
+
+  tests/libntp/ssl_init.c@1.9 +2 -2
+    [Bug 3013] Fix for ssl_init.c SHA1 test
+     - Require SHA1 explicitely, to avoid confusion with (deprecated) SHA0.
+       Patch provided by Ch. Weisgerber
+
+ChangeSet@1.3630.5.1, 2016-02-17 18:36:10+01:00, perlinger@ntp.org
+  [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
+
+  ChangeLog@1.1794.5.1 +3 -0
+    [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
+
+  ntpq/ntpq-subs.c@1.117 +35 -16
+    [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
+     - remove trailing whitespace in remote config command
+     - remove comments, too.
+
+ChangeSet@1.3639, 2016-02-17 09:30:05+01:00, jnperlin@hydra.localnet
+  [Bug 3008] ctl_getitem() return value not always checked
+
+  ChangeLog@1.1802 +3 -0
+    [Bug 3008] ctl_getitem() return value not always checked
+
+  ntpd/ntp_control.c@1.206.1.1 +101 -58
+    [Bug 3008] ctl_getitem() return value not always checked
+     - also some cleanup of ctl_getitem
+
+ChangeSet@1.3630.3.3, 2016-02-14 10:15:57+00:00, stenn@psp-deb1.ntp.org
+  Fix typo in html/monopt.html.  Harlan Stenn.
+
+  ChangeLog@1.1794.3.3 +1 -0
+    Fix typo in html/monopt.html.  Harlan Stenn.
+
+  html/monopt.html@1.39 +2 -2
+    Fix typo in html/monopt.html.  Harlan Stenn.
+
+ChangeSet@1.3630.3.2, 2016-02-13 09:15:45+00:00, stenn@psp-deb1.ntp.org
+  Fix some Credit: attributions in the NEWS file.  Harlan Stenn.
+
+  ChangeLog@1.1794.3.2 +1 -0
+    Fix some Credit: attributions in the NEWS file.  Harlan Stenn.
+
+  NEWS@1.161 +3 -2
+    Fix some Credit: attributions in the NEWS file.  Harlan Stenn.
+
+ChangeSet@1.3630.4.1, 2016-02-10 20:11:21+01:00, perlinger@ntp.org
+  [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch
+
+  ChangeLog@1.1794.4.1 +2 -0
+    [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch
+
+  ntpd/ntp_request.c@1.118 +48 -78
+    [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch
+     - reworked 'do_unconf()' to survive the effect of having peers named multiple times
+
+ChangeSet@1.3630.2.3, 2016-02-09 00:46:57+00:00, mayer@psp-deb1.ntp.org
+  Allow Active and Passive peer for crypto-NAK and added reporting
+
+  ntpd/ntp_proto.c@1.373.1.2 +6 -2
+    Allow Active and Passive peer for crypto-NAK and added reporting
+
+ChangeSet@1.3638, 2016-02-07 07:35:03+00:00, stenn@psp-deb1.ntp.org
+  Update ntp.conf documentation.  Harlan Stenn.
+
+  ChangeLog@1.1801 +1 -0
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/invoke-ntp.conf.texi@1.197 +37 -10
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.5man@1.231 +42 -12
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.5mdoc@1.231 +38 -11
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.def@1.22 +36 -9
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.man.in@1.231 +42 -12
+    Update ntp.conf documentation.  Harlan Stenn.
+
+  ntpd/ntp.conf.mdoc.in@1.231 +38 -11
+    Update ntp.conf documentation.  Harlan Stenn.
+
+ChangeSet@1.3637, 2016-02-06 07:39:44+00:00, stenn@psp-deb1.ntp.org
+  Update html/xleave.html documentation.  Harlan Stenn.
+
+  ChangeLog@1.1800 +1 -0
+    Update html/xleave.html documentation.  Harlan Stenn.
+
+  html/xleave.html@1.11 +6 -6
+    Update html/xleave.html documentation.  Harlan Stenn.
+
+ChangeSet@1.3630.2.2, 2016-02-05 10:50:33+00:00, stenn@psp-deb1.ntp.org
+  cleanup
+
+  ChangeLog@1.1794.2.2 +1 -1
+    cleanup
+
+ChangeSet@1.3630.3.1, 2016-02-05 09:21:00+00:00, stenn@psp-deb1.ntp.org
+  Document ntp.key's optional IP list in authenetic.html.  Harlan Stenn.
+
+  ChangeLog@1.1794.3.1 +1 -0
+    Document ntp.key's optional IP list in authenetic.html.  Harlan Stenn.
+
+  html/authentic.html@1.15 +16 -16
+    Document ntp.key's optional IP list in authenetic.html.  Harlan Stenn.
+
+ChangeSet@1.3630.2.1, 2016-02-05 04:29:08+00:00, mayer@psp-deb1.ntp.org
+  Validate crypto-NAK's
+
+  ChangeLog@1.1794.2.1 +1 -0
+    Validate crypto-NAK's
+
+  include/ntp.h@1.217 +2 -0
+    Add badNAM to peer struct and specify min V4 len
+
+  ntpd/ntp_proto.c@1.373.1.1 +78 -2
+    Validate crypto-NAM's
+
+ChangeSet@1.3630.1.4, 2016-01-28 08:08:42+01:00, jnperlin@hydra.localnet
+  [Bug 2999] out-of-bounds access in 'is_safe_filename()'
+
+  ChangeLog@1.1794.1.3 +1 -0
+    [Bug 2999] out-of-bounds access in 'is_safe_filename()'
+
+  ntpd/ntp_control.c@1.207 +3 -3
+    [Bug 2999] out-of-bounds access in 'is_safe_filename()'
+     - fixed array bound test
+     - make function NULL-pointer safe
+
+ChangeSet@1.3635, 2016-01-26 08:47:08+00:00, stenn@psp-deb1.ntp.org
+  cleanup
+
+  ntpd/ntp_proto.c@1.377 +20 -18
+    cleanup
+
+ChangeSet@1.3630.1.2, 2016-01-24 03:02:29+00:00, stenn@psp-deb1.ntp.org
+  cleanup
+
+  libntp/authkeys.c@1.33 +15 -13
+    cleanup
+
+ChangeSet@1.3630.1.1, 2016-01-24 02:11:14+00:00, stenn@psp-deb1.ntp.org
+  ChangeLog cleanup
+
+  ChangeLog@1.1794.1.1 +3 -0
+    ChangeLog cleanup
+
+ChangeSet@1.3628.1.7, 2016-01-23 14:26:48+00:00, stenn@psp-deb1.ntp.org
+  Reclassify KoD timestamp checks to 2945
+
+  ChangeLog@1.1793.1.6 +1 -1
+    Reclassify KoD timestamp checks to 2945
+
+ChangeSet@1.3628.1.6, 2016-01-23 13:52:03+00:00, stenn@psp-deb1.ntp.org
+  revert use of isc_tsmemcmp in sntp/crypto.c until it is in a more accessible place.  This is not a critical use of that function.
+
+  sntp/crypto.c@1.21 +8 -3
+    revert use of isc_tsmemcmp in sntp/crypto.c until it is in a more accessible place.  This is not a critical use of that function.
+
+ChangeSet@1.3628.1.5, 2016-01-23 12:54:39+00:00, stenn@psp-deb1.ntp.org
+  [Sec 2901] Additional KoD packet checks.  HStenn.
+
+  ChangeLog@1.1793.1.5 +1 -0
+    [Sec 2901] Additional KoD packet checks.  HStenn.
+
+  ntpd/ntp_proto.c@1.376 +53 -0
+    [Sec 2901] Additional KoD packet checks.  HStenn.
+
+ChangeSet@1.3628.1.4, 2016-01-23 11:36:37+00:00, stenn@psp-deb1.ntp.org
+  [Sec 2901] KoD packets must have non-zero transmit timestamps.  HStenn.
+
+  ChangeLog@1.1793.1.4 +1 -0
+    [Sec 2901] KoD packets must have non-zero transmit timestamps.  HStenn.
+
+  ntpd/ntp_proto.c@1.375 +10 -0
+    [Sec 2901] KoD packets must have non-zero transmit timestamps.  HStenn.
+
+ChangeSet@1.3628.1.3, 2016-01-23 10:34:17+00:00, stenn@psp-deb1.ntp.org
+  [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve time. Include passive servers in this check. HStenn.
+
+  ChangeLog@1.1793.1.3 +2 -0
+    [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve time. Include passive servers in this check. HStenn.
+
+  ntpd/ntp_proto.c@1.374 +1 -1
+    [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve time. Include passive servers in this check. HStenn.
+
+ChangeSet@1.3628.3.1, 2016-01-21 20:27:05+01:00, jnperlin@hydra.localnet
+  [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile
+
+  ChangeLog@1.1793.3.1 +3 -0
+    [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile
+
+  ntpd/ntp_io.c@1.412.1.1 +0 -4
+    [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile
+     - removed unsetting DEBUG_TIMING. (The timing debugging code is IMHO still not async-safe, but DEBUG_TIMING is a developer-option anyway. perlinger@ntp.org)
+
+ChangeSet@1.3628.2.1, 2016-01-21 00:47:12-08:00, harlan@nb7-a.pfcs.com
+  [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  ChangeLog@1.1793.2.1 +4 -0
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  configure.ac@1.603 +3 -1
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  include/ntp_types.h@1.37 +7 -0
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  tests/libntp/lfpfunc.c@1.16 +0 -3
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  tests/libntp/run-lfpfunc.c@1.19 +9 -9
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  tests/libntp/run-timevalops.c@1.14 +28 -28
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  tests/libntp/timespecops.c@1.11 +0 -2
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+  tests/libntp/timevalops.c@1.14 +0 -2
+    [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+
+ChangeSet@1.3628.1.2, 2016-01-21 07:35:48+00:00, stenn@psp-deb1.ntp.org
+  merge cleanup
+
+  ChangeLog@1.1793.1.2 +7 -3
+    merge cleanup
+
+ChangeSet@1.3630, 2016-01-21 03:55:23+00:00, mayer@psp-deb1.ntp.org
+  Bug fixes to compile Windows
+
+  ChangeLog@1.1794 +1 -0
+    Bug fixes to compile Windows
+
+ChangeSet@1.3629, 2016-01-21 03:52:41+00:00, mayer@psp-deb1.ntp.org
+  Bug fixes to compile Windows
+
+  include/ntp_stdlib.h@1.82 +1 -1
+    Bug fixes to compile Windows
+
+  include/ntp_worker.h@1.6 +2 -2
+    Bug fixes to compile Windows
+
+  libntp/authkeys.c@1.32 +64 -83
+    Bug fixes to compile Windows
+
+  libntp/is_ip_address.c@1.2 +0 -40
+    Bug fixes to compile Windows
+
+  ntpd/ntp_io.c@1.413 +3 -2
+    Bug fixes to compile Windows
+
+  ports/winnt/vs2008/libntp/libntp.vcproj@1.54.1.1 +5 -1
+    Bug fixes to compile Windows
+
+  ports/winnt/vs2013/libntp/libntp.vcxproj@1.9.1.1 +1 -0
+    Bug fixes to compile Windows
+
 ChangeSet@1.3628, 2016-01-20 04:20:12-05:00, stenn@deacon.udel.edu
   NTP_4_2_8P6
   TAG: NTP_4_2_8P6
@@ -382,7 +1509,7 @@
   include/ntp_types.h@1.36 +1 -0
     [Sec 2936] Skeleton Key: Any trusted key system can serve time. HStenn.
 
-  libntp/Makefile.am@1.77 +1 -0
+  libntp/Makefile.am@1.76.1.1 +1 -0
     [Sec 2936] Skeleton Key: Any trusted key system can serve time. HStenn.
 
   libntp/authkeys.c@1.31 +60 -6
@@ -447,10 +1574,10 @@
   NEWS@1.157 +22 -0
     Update NEWS file for 2942
 
-ChangeSet@1.3615.13.1, 2016-01-17 05:07:22+00:00, stenn@psp-deb1.ntp.org
+ChangeSet@1.3615.14.1, 2016-01-17 05:07:22+00:00, stenn@psp-deb1.ntp.org
   [Sec 2942]: Off-path DoS attack on auth broadcast mode.  HStenn.
 
-  ChangeLog@1.1786.13.1 +4 -0
+  ChangeLog@1.1786.14.1 +4 -0
     [Sec 2942]: Off-path DoS attack on auth broadcast mode.  HStenn.
 
   html/miscopt.html@1.85 +11 -3
@@ -519,16 +1646,16 @@
   ChangeLog@1.1786.1.5 +0 -1
     merge cleanup
 
-ChangeSet@1.3615.12.4, 2016-01-14 10:27:23+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.13.4, 2016-01-14 10:27:23+00:00, stenn@psp-at1.ntp.org
   merge cleanup
 
-  ChangeLog@1.1786.12.4 +1 -1
+  ChangeLog@1.1786.13.4 +1 -1
     merge cleanup
 
-ChangeSet@1.3615.12.2, 2016-01-14 09:49:52+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.13.2, 2016-01-14 09:49:52+00:00, stenn@psp-at1.ntp.org
   merge cleanup
 
-  ChangeLog@1.1786.12.2 +2 -2
+  ChangeLog@1.1786.13.2 +2 -2
     merge cleanup
 
 ChangeSet@1.3615.3.17, 2016-01-14 09:33:56+00:00, stenn@psp-at1.ntp.org
@@ -561,16 +1688,16 @@
   NEWS@1.153 +52 -0
     Update NEWS file for bug 2935
 
-ChangeSet@1.3615.7.12, 2016-01-12 09:53:06+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.12, 2016-01-12 09:53:06+00:00, stenn@psp-at1.ntp.org
   [Sec 2935] use L_SUB instead of L_ISGT.  Juergen Perlinger
 
   ntpd/ntp_proto.c@1.368.1.5 +4 -1
     [Sec 2935] use L_SUB instead of L_ISGT.  Juergen Perlinger
 
-ChangeSet@1.3615.7.11, 2016-01-11 03:02:53-08:00, harlan@max.pfcs.com
+ChangeSet@1.3615.8.11, 2016-01-11 03:02:53-08:00, harlan@max.pfcs.com
   [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode.
 
-  ChangeLog@1.1786.9.1 +4 -0
+  ChangeLog@1.1786.10.1 +4 -0
     [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode.
 
   include/ntp.h@1.215 +1 -0
@@ -579,17 +1706,17 @@
   ntpd/ntp_proto.c@1.368.1.4 +67 -0
     [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode.
 
-ChangeSet@1.3615.7.10, 2016-01-11 02:44:25-08:00, harlan@max.pfcs.com
+ChangeSet@1.3615.8.10, 2016-01-11 02:44:25-08:00, harlan@max.pfcs.com
   make leapsec_query messages less verbose.
 
   ntpd/ntp_timer.c@1.93.1.1 +6 -4
     make leapsec_query messages less verbose.
 
-ChangeSet@1.3615.9.1, 2016-01-11 10:26:12+01:00, jnperlin@hydra.localnet
+ChangeSet@1.3615.10.1, 2016-01-11 10:26:12+01:00, jnperlin@hydra.localnet
   [Bug 2985] bogus calculation in authkeys.c
    - implement 'auth_log2()' using integer bithack instead of float calculation
 
-  ChangeLog@1.1786.7.5 +2 -0
+  ChangeLog@1.1786.8.5 +2 -0
     [Bug 2985] bogus calculation in authkeys.c
      - implement 'auth_log2()' using integer bithack instead of float calculation
 
@@ -605,7 +1732,7 @@
     [Bug 2985] bogus calculation in authkeys.c
      - update auto-generated file
 
-ChangeSet@1.3615.7.9, 2016-01-09 09:52:44+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.9, 2016-01-09 09:52:44+00:00, stenn@psp-at1.ntp.org
   Add timelastrec to the peer structure
 
   include/ntp.h@1.214 +2 -1
@@ -617,17 +1744,17 @@
   ChangeLog@1.1786.3.6 +1 -1
     4.2.8p5 merge cleanup
 
-ChangeSet@1.3615.7.8, 2016-01-08 00:26:09+00:00, stenn@deacon.udel.edu
+ChangeSet@1.3615.8.8, 2016-01-08 00:26:09+00:00, stenn@deacon.udel.edu
   Update copyright year
 
   sntp/include/copyright.def@1.26 +1 -1
     Update copyright year
 
-ChangeSet@1.3615.7.7, 2016-01-07 23:33:11+00:00, stenn@deacon.udel.edu
+ChangeSet@1.3615.8.7, 2016-01-07 23:33:11+00:00, stenn@deacon.udel.edu
   NTP_4_2_8P5
   TAG: NTP_4_2_8P5
 
-  ChangeLog@1.1786.7.4 +1 -0
+  ChangeLog@1.1786.8.4 +1 -0
     NTP_4_2_8P5
 
   ntpd/invoke-ntp.conf.texi@1.194 +1 -1
@@ -957,28 +2084,28 @@
   util/ntp-keygen.mdoc.in@1.331 +2 -2
     NTP_4_2_8P5
 
-ChangeSet@1.3615.7.6, 2016-01-07 17:52:24-05:00, stenn@deacon.udel.edu
+ChangeSet@1.3615.8.6, 2016-01-07 17:52:24-05:00, stenn@deacon.udel.edu
   ntp-4.2.8p5
 
   packageinfo.sh@1.521 +1 -1
     ntp-4.2.8p5
 
-ChangeSet@1.3615.7.5, 2016-01-07 22:20:05+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.5, 2016-01-07 22:20:05+00:00, stenn@psp-at1.ntp.org
   cleanup
 
   NEWS@1.152 +2 -2
     cleanup
 
-ChangeSet@1.3615.7.4, 2016-01-07 09:33:11+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.4, 2016-01-07 09:33:11+00:00, stenn@psp-at1.ntp.org
   typo in ntp_proto.c - leap smear.  Reported by Martin Burnicki
 
   ntpd/ntp_proto.c@1.368.1.3 +1 -1
     typo in ntp_proto.c - leap smear.  Reported by Martin Burnicki
 
-ChangeSet@1.3615.7.3, 2016-01-07 06:33:08+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.3, 2016-01-07 06:33:08+00:00, stenn@psp-at1.ntp.org
   Update scripts/calc_tickadj/Makefile.am.  Harlan Stenn.
 
-  ChangeLog@1.1786.7.3 +1 -0
+  ChangeLog@1.1786.8.3 +1 -0
     Update scripts/calc_tickadj/Makefile.am.  Harlan Stenn.
 
   scripts/calc_tickadj/Makefile.am@1.11 +2 -0
@@ -990,25 +2117,25 @@
   ChangeLog@1.1786.3.2 +2 -0
     ntp-4.2.8p6
 
-ChangeSet@1.3615.8.1, 2016-01-05 10:57:45+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.9.1, 2016-01-05 10:57:45+00:00, stenn@psp-at1.ntp.org
   Bug 2952 fixes
 
-  ChangeLog@1.1786.8.1 +1 -0
+  ChangeLog@1.1786.9.1 +1 -0
     Bug 2952 fixes
 
   ntpd/ntp_proto.c@1.368.1.2 +165 -152
     Bug 2952 fixes
 
-ChangeSet@1.3615.7.1, 2016-01-05 09:56:31+00:00, stenn@psp-at1.ntp.org
+ChangeSet@1.3615.8.1, 2016-01-05 09:56:31+00:00, stenn@psp-at1.ntp.org
   ntp-4.2.8p5 prep
 
-  ChangeLog@1.1786.7.1 +2 -1
+  ChangeLog@1.1786.8.1 +2 -1
     ntp-4.2.8p5 prep
 
   NEWS@1.151 +104 -3
     ntp-4.2.8p5 prep
 
-ChangeSet@1.3615.5.1, 2015-12-13 13:35:12+01:00, jnperlin@hydra.localnet
+ChangeSet@1.3615.6.1, 2015-12-13 13:35:12+01:00, jnperlin@hydra.localnet
   [Bug 2892] Several test cases assume IPv6 capabilities even when IPv6 is disabled in the build
     Found this already fixed, but validation lead to further cleanup:
      - source code formatting
@@ -1015,10 +2142,10 @@
      - inline variable definitions moved to start of block
      - made some pure input data pointers 'const void*' instead of 'char*'; avoids casts and warnings
 
-  ChangeLog@1.1786.5.1 +3 -0
+  ChangeLog@1.1786.6.1 +3 -0
     [Bug 2892] Several test cases assume IPv6 capabilities even when IPv6 is disabled in the build
 
-  sntp/crypto.c@1.19 +13 -12
+  sntp/crypto.c@1.18.1.1 +13 -12
     [Bug 2892] Several test cases assume IPv6 capabilities even when IPv6 is disabled in the build
      - sidekick: make pure input pointers 'const void*' instead of 'char*'
      - sidekick: remove unnecessary casts
@@ -1088,6 +2215,77 @@
     [Bug 2892] Several test cases assume IPv6 capabilities even when IPv6 is disabled in the build
      - source code formatting +  cleanup
 
+ChangeSet@1.3615.5.1, 2015-12-12 10:24:19+00:00, perlinger@psp-deb1.ntp.org
+  [Bug 2879] Improve NTP security against timing attacks.
+   - use timing-safe memcmp() for digest tests
+
+  ChangeLog@1.1786.5.1 +3 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - use timing-safe memcmp() for digest test
+
+  lib/isc/hmacmd5.c@1.3 +1 -1
+    [Bug 2879] Improve NTP security against timing attacks.
+     - use timing-safe memcmp() for digest tests
+
+  lib/isc/hmacsha.c@1.3 +5 -5
+    [Bug 2879] Improve NTP security against timing attacks.
+     - use timing-safe memcmp() for digest tests
+
+  lib/isc/include/isc/string.h@1.5 +18 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - prototype for timing-safe 'isc_tsmemcmp()'
+
+  lib/isc/tsmemcmp.c@1.1 +55 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - implement a timing safe (though less efficient) version of 'memcmp()'
+       as 'isc_tsmemcmp()'
+
+  lib/isc/tsmemcmp.c@1.0 +0 -0
+
+  libntp/Makefile.am@1.77 +1 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add new source file 'lib/isc/tsmemcmp.c'
+
+  libntp/a_md5encrypt.c@1.36 +2 -2
+    [Bug 2879] Improve NTP security against timing attacks.
+     - use timing-safe memcmp() for digest tests
+
+  ports/winnt/vs2005/libntp.vcproj@1.25 +4 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add new source file 'lib/isc/tsmemcmp.c'
+
+  ports/winnt/vs2008/libntp/libntp.vcproj@1.55 +4 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add new source file 'lib/isc/tsmemcmp.c'
+
+  ports/winnt/vs2013/libntp/libntp.vcxproj@1.10 +3 -2
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add new source file 'lib/isc/tsmemcmp.c'
+
+  ports/winnt/vs2013/libntp/libntp.vcxproj.filters@1.8 +5 -2
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add new source file 'lib/isc/tsmemcmp.c'
+
+  sntp/crypto.c@1.19 +2 -1
+    [Bug 2879] Improve NTP security against timing attacks.
+     - use timing-safe memcmp() for digest tests
+
+  tests/libntp/Makefile.am@1.94 +12 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - add unit test for timing-safe memcmp
+
+  tests/libntp/run-tsafememcmp.c@1.1 +64 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - auto-generated test runner
+
+  tests/libntp/run-tsafememcmp.c@1.0 +0 -0
+
+  tests/libntp/tsafememcmp.c@1.1 +85 -0
+    [Bug 2879] Improve NTP security against timing attacks.
+     - unit tests for timing-safe memcmp
+
+  tests/libntp/tsafememcmp.c@1.0 +0 -0
+
 ChangeSet@1.3615.4.1, 2015-12-11 18:24:16+01:00, jnperlin@hydra.localnet
   [Bug 2882] Look at ntp_request.c:list_peers_sum()
 
Index: contrib/ntp/Makefile.am
===================================================================
--- contrib/ntp/Makefile.am	(版本 297264)
+++ contrib/ntp/Makefile.am	(版本 298770)
@@ -36,6 +36,7 @@
 	README.hackers		\
 	README.leapsmear	\
 	README.patches		\
+	README.pullrequests	\
 	README.refclocks	\
 	README.versions		\
 	TODO			\
Index: contrib/ntp/Makefile.in
===================================================================
--- contrib/ntp/Makefile.in	(版本 297264)
+++ contrib/ntp/Makefile.in	(版本 298770)
@@ -555,6 +555,7 @@
 	README.hackers		\
 	README.leapsmear	\
 	README.patches		\
+	README.pullrequests	\
 	README.refclocks	\
 	README.versions		\
 	TODO			\
Index: contrib/ntp/NEWS
===================================================================
--- contrib/ntp/NEWS	(版本 297264)
+++ contrib/ntp/NEWS	(版本 298770)
@@ -1,13 +1,353 @@
 ---
+NTP 4.2.8p7 (Harlan Stenn <stenn@ntp.org>, 2016/04/26) 
 
-NTP 4.2.8p6
+Focus: Security, Bug fixes, enhancements.
 
+Severity: MEDIUM
+
+When building NTP from source, there is a new configure option
+available, --enable-dynamic-interleave.  More information on this below.
+
+Also note that ntp-4.2.8p7 logs more "unexpected events" than previous
+versions of ntp.  These events have almost certainly happened in the
+past, it's just that they were silently counted and not logged.  With
+the increasing awareness around security, we feel it's better to clearly
+log these events to help detect abusive behavior.  This increased
+logging can also help detect other problems, too.
+
+In addition to bug fixes and enhancements, this release fixes the
+following 9 low- and medium-severity vulnerabilities:
+
+* Improve NTP security against buffer comparison timing attacks,
+  AKA: authdecrypt-timing
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 2879 / CVE-2016-1550
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+	4.3.0 up to, but not including 4.3.92
+   CVSSv2: LOW 2.6 - (AV:L/AC:H/Au:N/C:P/I:P/A:N)
+   CVSSv3: MED 4.0 - CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
+   Summary: Packet authentication tests have been performed using
+	memcmp() or possibly bcmp(), and it is potentially possible
+	for a local or perhaps LAN-based attacker to send a packet with
+	an authentication payload and indirectly observe how much of
+	the digest has matched.
+   Mitigation:
+	Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page.
+	Properly monitor your ntpd instances.
+   Credit: This weakness was discovered independently by Loganaden
+   	Velvindron, and Matthew Van Gundy and Stephen Gray of Cisco ASIG.
+
+* Zero origin timestamp bypass: Additional KoD checks.
+   References: Sec 2945 / Sec 2901 / CVE-2015-8138
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7,
+   Summary: Improvements to the fixes incorporated in t 4.2.8p6 and 4.3.92.
+
+* peer associations were broken by the fix for NtpBug2899
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 2952 / CVE-2015-7704
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+   	4.3.0 up to, but not including 4.3.92
+   CVSSv2: MED 4.3 - (AV:N/AC:M/Au:N/C:N/I:N/A:P)
+   Summary: The fix for NtpBug2952 in ntp-4.2.8p5 to address broken peer
+   	associations did not address all of the issues.
+   Mitigation:
+        Implement BCP-38.
+        Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+        If you can't upgrade, use "server" associations instead of
+	    "peer" associations.
+        Monitor your ntpd instances. 
+   Credit: This problem was discovered by Michael Tatarinov.
+
+* Validate crypto-NAKs, AKA: CRYPTO-NAK DoS
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3007 / CVE-2016-1547 / VU#718152
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+	4.3.0 up to, but not including 4.3.92
+   CVSS2: MED 4.3 - (AV:N/AC:M/Au:N/C:N/I:N/A:P)
+   CVSS3: MED 3.7 - CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
+   Summary: For ntp-4 versions up to but not including ntp-4.2.8p7, an
+	off-path attacker can cause a preemptable client association to
+	be demobilized by sending a crypto NAK packet to a victim client
+	with a spoofed source address of an existing associated peer.
+	This is true even if authentication is enabled.
+
+	Furthermore, if the attacker keeps sending crypto NAK packets,
+	for example one every second, the victim never has a chance to
+	reestablish the association and synchronize time with that
+	legitimate server.
+
+	For ntp-4.2.8 thru ntp-4.2.8p6 there is less risk because more
+	stringent checks are performed on incoming packets, but there
+	are still ways to exploit this vulnerability in versions before
+	ntp-4.2.8p7.
+   Mitigation:
+	Implement BCP-38.
+	Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+	Properly monitor your =ntpd= instances
+   Credit: This weakness was discovered by Stephen Gray and
+   	Matthew Van Gundy of Cisco ASIG.
+
+* ctl_getitem() return value not always checked
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3008 / CVE-2016-2519
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+	4.3.0 up to, but not including 4.3.92
+   CVSSv2: MED 4.9 - (AV:N/AC:H/Au:S/C:N/I:N/A:C)
+   CVSSv3: MED 4.2 - CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
+   Summary: ntpq and ntpdc can be used to store and retrieve information
+   	in ntpd. It is possible to store a data value that is larger
+	than the size of the buffer that the ctl_getitem() function of
+	ntpd uses to report the return value. If the length of the
+	requested data value returned by ctl_getitem() is too large,
+	the value NULL is returned instead. There are 2 cases where the
+	return value from ctl_getitem() was not directly checked to make
+	sure it's not NULL, but there are subsequent INSIST() checks
+	that make sure the return value is not NULL. There are no data
+	values ordinarily stored in ntpd that would exceed this buffer
+	length. But if one has permission to store values and one stores
+	a value that is "too large", then ntpd will abort if an attempt
+	is made to read that oversized value.
+    Mitigation:
+        Implement BCP-38.
+        Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+        Properly monitor your ntpd instances.
+    Credit: This weakness was discovered by Yihan Lian of the Cloud
+    	Security Team, Qihoo 360. 
+
+* Crafted addpeer with hmode > 7 causes array wraparound with MATCH_ASSOC 
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3009 / CVE-2016-2518 / VU#718152
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+	4.3.0 up to, but not including 4.3.92
+   CVSS2: LOW 2.1 - (AV:N/AC:H/Au:S/C:N/I:N/A:P)
+   CVSS3: LOW 2.0 - CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
+   Summary: Using a crafted packet to create a peer association with
+   	hmode > 7 causes the MATCH_ASSOC() lookup to make an
+	out-of-bounds reference.
+   Mitigation:
+	Implement BCP-38.
+	Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+	Properly monitor your ntpd instances
+   Credit: This weakness was discovered by Yihan Lian of the Cloud
+   	Security Team, Qihoo 360.
+
+* remote configuration trustedkey/requestkey/controlkey values are not
+	properly validated
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3010 / CVE-2016-2517 / VU#718152
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+	4.3.0 up to, but not including 4.3.92
+   CVSS2: MED 4.9 - (AV:N/AC:H/Au:S/C:N/I:N/A:C)
+   CVSS3: MED 4.2 - CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
+   Summary: If ntpd was expressly configured to allow for remote
+   	configuration, a malicious user who knows the controlkey for
+	ntpq or the requestkey for ntpdc (if mode7 is expressly enabled)
+	can create a session with ntpd and then send a crafted packet to
+	ntpd that will change the value of the trustedkey, controlkey,
+	or requestkey to a value that will prevent any subsequent
+	authentication with ntpd until ntpd is restarted.
+   Mitigation:
+	Implement BCP-38.
+	Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+	Properly monitor your =ntpd= instances
+   Credit: This weakness was discovered by Yihan Lian of the Cloud
+   	Security Team, Qihoo 360.
+
+* Duplicate IPs on unconfig directives will cause an assertion botch in ntpd
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3011 / CVE-2016-2516 / VU#718152
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+   	4.3.0 up to, but not including 4.3.92
+   CVSS2: MED 6.3 - (AV:N/AC:M/Au:S/C:N/I:N/A:C)
+   CVSS3: MED 4.2 - CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
+   Summary: If ntpd was expressly configured to allow for remote
+   	configuration, a malicious user who knows the controlkey for
+	ntpq or the requestkey for ntpdc (if mode7 is expressly enabled)
+	can create a session with ntpd and if an existing association is
+	unconfigured using the same IP twice on the unconfig directive
+	line, ntpd will abort.
+   Mitigation:
+	Implement BCP-38.
+	Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+	Properly monitor your ntpd instances
+   Credit: This weakness was discovered by Yihan Lian of the Cloud
+   	Security Team, Qihoo 360.
+
+* Refclock impersonation vulnerability
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3020 / CVE-2016-1551
+   Affects: On a very limited number of OSes, all NTP releases up to but
+	not including 4.2.8p7, and 4.3.0 up to but not including 4.3.92.
+	By "very limited number of OSes" we mean no general-purpose OSes
+	have yet been identified that have this vulnerability.
+   CVSSv2: LOW 2.6 - (AV:N/AC:H/Au:N/C:N/I:P/A:N)
+   CVSSv3: LOW 3.7 - CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
+   Summary: While most OSes implement martian packet filtering in their
+   	network stack, at least regarding 127.0.0.0/8, some will allow
+	packets claiming to be from 127.0.0.0/8 that arrive over a
+	physical network. On these OSes, if ntpd is configured to use a
+	reference clock an attacker can inject packets over the network
+	that look like they are coming from that reference clock.
+   Mitigation:
+        Implement martian packet filtering and BCP-38.
+        Configure ntpd to use an adequate number of time sources.
+        Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page
+        If you are unable to upgrade and if you are running an OS that
+	    has this vulnerability, implement martian packet filters and
+	    lobby your OS vendor to fix this problem, or run your
+	    refclocks on computers that use OSes that are not vulnerable
+	    to these attacks and have your vulnerable machines get their
+	    time from protected resources.
+        Properly monitor your ntpd instances.
+   Credit: This weakness was discovered by Matt Street and others of
+   	Cisco ASIG. 
+
+The following issues were fixed in earlier releases and contain
+improvements in 4.2.8p7:
+
+* Clients that receive a KoD should validate the origin timestamp field.
+   References: Sec 2901 / CVE-2015-7704, CVE-2015-7705
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7,
+   Summary: Improvements to the fixes incorporated into 4.2.8p4 and 4.3.77.
+
+* Skeleton key: passive server with trusted key can serve time.
+   References: Sec 2936 / CVE-2015-7974
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7,
+   Summary: Improvements to the fixes incorporated in t 4.2.8p6 and 4.3.90.
+
+Two other vulnerabilities have been reported, and the mitigations
+for these are as follows:
+
+* Interleave-pivot
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 2978 / CVE-2016-1548
+   Affects: All ntp-4 releases.
+   CVSSv2: MED 6.4 - (AV:N/AC:L/Au:N/C:N/I:P/A:P)
+   CVSSv3: MED 7.2 - CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:L
+   Summary: It is possible to change the time of an ntpd client or deny
+   	service to an ntpd client by forcing it to change from basic
+	client/server mode to interleaved symmetric mode. An attacker
+	can spoof a packet from a legitimate ntpd server with an origin
+	timestamp that matches the peer->dst timestamp recorded for that
+	server. After making this switch, the client will reject all
+	future legitimate server responses. It is possible to force the
+	victim client to move time after the mode has been changed.
+	ntpq gives no indication that the mode has been switched.
+   Mitigation:
+        Implement BCP-38.
+        Upgrade to 4.2.8p7, or later, from the NTP Project Download Page
+	    or the NTP Public Services Project Download Page.  These
+	    versions will not dynamically "flip" into interleave mode
+	    unless configured to do so.
+        Properly monitor your ntpd instances.
+   Credit: This weakness was discovered by Miroslav Lichvar of RedHat
+   	and separately by Jonathan Gardner of Cisco ASIG.
+
+* Sybil vulnerability: ephemeral association attack
+   Date Resolved: Stable (4.2.8p7) 26 Apr 2016; Dev (4.3.92) 26 Apr 2016
+   References: Sec 3012 / CVE-2016-1549
+   Affects: All ntp-4 releases up to, but not including 4.2.8p7, and
+   	4.3.0 up to, but not including 4.3.92
+   CVSSv2: LOW 3.5 - (AV:N/AC:M/Au:S/C:N/I:P/A:N)
+   CVSS3v: MED 5.3 - CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N
+   Summary: ntpd can be vulnerable to Sybil attacks. If one is not using
+   	the feature introduced in ntp-4.2.8p6 allowing an optional 4th
+	field in the ntp.keys file to specify which IPs can serve time,
+	a malicious authenticated peer can create arbitrarily-many
+	ephemeral associations in order to win the clock selection of
+	ntpd and modify a victim's clock.
+   Mitigation:
+        Implement BCP-38.
+        Use the 4th field in the ntp.keys file to specify which IPs
+	    can be time servers.
+        Properly monitor your ntpd instances.
+   Credit: This weakness was discovered by Matthew Van Gundy of Cisco ASIG. 
+
+Other fixes:
+
+* [Bug 2831]  Segmentation Fault in DNS lookup during startup. perlinger@ntp.org
+  - fixed yet another race condition in the threaded resolver code.
+* [Bug 2858] bool support.  Use stdbool.h when available.  HStenn.
+* [Bug 2879] Improve NTP security against timing attacks. perlinger@ntp.org
+  - integrated patches by Loganaden Velvidron <logan@ntp.org>
+    with some modifications & unit tests
+* [Bug 2960] async name resolution fixes for chroot() environments.
+  Reinhard Max.
+* [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile. perlinger@ntp.org
+* [Bug 2995] Fixes to compile on Windows
+* [Bug 2999] out-of-bounds access in 'is_safe_filename()'. perlinger@ntp.org
+* [Bug 3013] Fix for ssl_init.c SHA1 test. perlinger@ntp.org
+  - Patch provided by Ch. Weisgerber
+* [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
+  - A change related to [Bug 2853] forbids trailing white space in
+    remote config commands. perlinger@ntp.org
+* [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
+  - report and patch from Aleksandr Kostikov.
+  - Overhaul of Windows IO completion port handling. perlinger@ntp.org
+* [Bug 3022] authkeys.c should be refactored. perlinger@ntp.org
+  - fixed memory leak in access list (auth[read]keys.c)
+  - refactored handling of key access lists (auth[read]keys.c)
+  - reduced number of error branches (authreadkeys.c)
+* [Bug 3023] ntpdate cannot correct dates in the future. perlinger@ntp.org
+* [Bug 3030] ntpq needs a general way to specify refid output format.  HStenn.
+* [Bug 3031] ntp broadcastclient unable to synchronize to an server
+             when the time of server changed. perlinger@ntp.org
+  - Check the initial delay calculation and reject/unpeer the broadcast
+    server if the delay exceeds 50ms. Retry again after the next
+    broadcast packet.
+* [Bug 3036] autokey trips an INSIST in authistrustedip().  Harlan Stenn.
+* Document ntp.key's optional IP list in authenetic.html.  Harlan Stenn.
+* Update html/xleave.html documentation.  Harlan Stenn.
+* Update ntp.conf documentation.  Harlan Stenn.
+* Fix some Credit: attributions in the NEWS file.  Harlan Stenn.
+* Fix typo in html/monopt.html.  Harlan Stenn.
+* Add README.pullrequests.  Harlan Stenn.
+* Cleanup to include/ntp.h.  Harlan Stenn.
+
+New option to 'configure':
+
+While looking in to the issues around Bug 2978, the "interleave pivot"
+issue, it became clear that there are some intricate and unresolved
+issues with interleave operations.  We also realized that the interleave
+protocol was never added to the NTPv4 Standard, and it should have been.
+
+Interleave mode was first released in July of 2008, and can be engaged
+in two ways.  Any 'peer' and 'broadcast' lines in the ntp.conf file may
+contain the 'xleave' option, which will expressly enable interlave mode
+for that association.  Additionally, if a time packet arrives and is
+found inconsistent with normal protocol behavior but has certain
+characteristics that are compatible with interleave mode, NTP will
+dynamically switch to interleave mode.  With sufficient knowledge, an
+attacker can send a crafted forged packet to an NTP instance that
+triggers only one side to enter interleaved mode.
+
+To prevent this attack until we can thoroughly document, describe,
+fix, and test the dynamic interleave mode, we've added a new
+'configure' option to the build process:
+
+ --enable-dynamic-interleave
+
+This option controls whether or not NTP will, if conditions are right,
+engage dynamic interleave mode.  Dynamic interleave mode is disabled by
+default in ntp-4.2.8p7.
+
+---
+NTP 4.2.8p6 (Harlan Stenn <stenn@ntp.org>, 2016/01/20) 
+
 Focus: Security, Bug fixes, enhancements.
 
 Severity: MEDIUM
 
 In addition to bug fixes and enhancements, this release fixes the
-following X low- and Y medium-severity vulnerabilities:
+following 1 low- and 8 medium-severity vulnerabilities:
 
 * Potential Infinite Loop in 'ntpq'
    Date Resolved: Stable (4.2.8p6) 19 Jan 2016; Dev (4.3.90) 19 Jan 2016
@@ -53,7 +393,8 @@
 	Upgrade to 4.2.8p6, or later, from the NTP Project Download Page
 	    or the NTP Public Services Project Download Page.
 	Monitor your 'ntpd= instances.
-   Credit: This weakness was discovered by Jonathan Gardner of Cisco ASIG.
+   Credit: This weakness was discovered by Matthey Van Gundy and
+	Jonathan Gardner of Cisco ASIG.
 
 * Stack exhaustion in recursive traversal of restriction list
    Date Resolved: Stable (4.2.8p6) 19 Jan 2016
@@ -252,9 +593,8 @@
 * Make leapsec_query debug messages less verbose.  Harlan Stenn.
 
 ---
+NTP 4.2.8p5 (Harlan Stenn <stenn@ntp.org>, 2016/01/07) 
 
-NTP 4.2.8p5
-
 Focus: Security, Bug fixes, enhancements.
 
 Severity: MEDIUM
@@ -353,7 +693,7 @@
 * Quiet a warning from clang.  Harlan Stenn.
 
 ---
-NTP 4.2.8p4
+NTP 4.2.8p4 (Harlan Stenn <stenn@ntp.org>, 2015/10/21) 
 
 Focus: Security, Bug fixes, enhancements.
 
@@ -689,7 +1029,7 @@
 		Apply the patch to the bottom of the "authentic" check
 			block around line 1136 of ntp_proto.c. 
 	Monitor your ntpd instances. 
-  Credit: This weakness was discovered by Stephen Gray <stepgray@cisco.com>. 
+  Credit: This weakness was discovered by Matthew Van Gundy of Cisco ASIG. 
 
 Backward-Incompatible changes:
 * [Bug 2817] Default on Linux is now "rlimit memlock -1".
Index: contrib/ntp/README.pullrequests
===================================================================
--- contrib/ntp/README.pullrequests	(不存在的)
+++ contrib/ntp/README.pullrequests	(版本 298770)
@@ -0,0 +1,90 @@
+See README.hackers for notes on coding styles.
+
+The NTP project's github repository is at https://github.com/ntp-project/ntp.
+
+There are two branches, master and stable.
+
+The stable branch is the current supported production code branch, the
+ntp-stable code (even 2nd number).
+
+The master branch is for new development, also known as ntp-dev (which
+has an odd 2nd number).
+
+If you have some work you'd like to add, then if there is any interest
+in seeing that work in the current production release then base your work
+on the stable branch, and pull your work into a master copy to allow for
+publishing your changes in the ntp-dev or master branch.
+
+If there is no expectation that your work will be included in the
+current stable release (the ntp-stable code) then it's better to do your
+work on a copy of the master branch.
+
+Make sure that any changes you make to stable pull cleanly into master.
+
+It's possible that after pulling your changes from stable to master that
+some additional cleanup will be required in master.  Please do this.
+
+If you follow this method, then if you submit a pull request for either
+master or for master+stable, it will be easy for us to evaluate and
+incorporate your work.
+
+Please also note that your submissions will be able to be evaluated and
+handled sooner if the repo that contains your pull requests also includes
+test cases.
+
+The general workflow is as follows:
+
+1) If you haven't, create a fork of ntp-project/ntp with your github account.
+   i) Log on to github.com with your github account.
+       - If you don't have one, create one first. (read: https://help.github.com/articles/signing-up-for-a-new-github-account)
+       - Make sure you also have a SSH key associated with your github account.
+         (read: https://help.github.com/articles/generating-ssh-keys/)
+   ii) Go to https://github.com/ntp-project/ntp
+   iii) On the top right corner, right below the header bar, there is
+        a button labeled "Fork".  Click on it.  This will fork the current
+	ntp master to your own account. Once done, it will go to your account's
+	version of the ntp repository. (Your fork of ntp source)
+   iv) Clone a local version of your fork. 
+        - git clone git@github.com:<your_username>/ntp
+
+2) Look through the bugs listed in the bug tracker: http://bugs.ntp.org/
+
+3) Once you've found a bug to work on:
+
+   i) Create a branch off your own master branch of your local fork.
+      (the <branchname> can be any valid short string that will tell you
+       what you're working on)
+      - git checkout -b <branchname>
+        
+   ii) Start working on the bug.
+   iii) When you create changes in the source, it would help you to 
+        keep track of your changes by committing to your local repo.
+	(This way, every small change is tracked and when you've
+	 made a mistake, you can always go back.)
+	 - git commit -a -m "description of change"
+   iv) Once you are satisfied, you can push to your github account's
+       repository.
+         - git push origin <branchname>
+    v) (go to step iii).
+
+4) Once you feel you've fixed the bug (and tested it), you need to 
+   create a pull request on your branch on github.  (Read up on
+   pull requests @ https://help.github.com/articles/using-pull-requests)
+
+    i) Create your pullrequest by following the instructions @
+       https://help.github.com/articles/creating-a-pull-request/
+
+5) Your pull request will be reviewed by committers and when it
+   passes review, it will be merged by the reviewer/allowed committer.
+
+6) You have fixed a bug.  Goto step #2.
+
+If these patches are for a bugzilla issue, mark the issue as Resolved/READY
+with a comment of "Please pick up the patches from XXX" where XXX is
+something like:
+
+ hostname:~user/path	if it's a machine the reviewers have access to, or
+ github-pull-request-URI
+
+---
+
Index: contrib/ntp/config.h.in
===================================================================
--- contrib/ntp/config.h.in	(版本 297264)
+++ contrib/ntp/config.h.in	(版本 298770)
@@ -302,9 +302,15 @@
 /* The number of minutes in a DST adjustment */
 #undef DSTMINUTES
 
+/* support dynamic interleave? */
+#undef DYNAMIC_INTERLEAVE
+
 /* number of args to el_init() */
 #undef EL_INIT_ARGS
 
+/* Provide the explicit 127.0.0.0/8 martian filter? */
+#undef ENABLE_BUG3020_FIX
+
 /* nls support in libopts */
 #undef ENABLE_NLS
 
@@ -830,7 +836,7 @@
 /* Define to 1 if you have the <stdatomic.h> header file. */
 #undef HAVE_STDATOMIC_H
 
-/* Define to 1 if you have the <stdbool.h> header file. */
+/* Define to 1 if stdbool.h conforms to C99. */
 #undef HAVE_STDBOOL_H
 
 /* Define to 1 if you have the <stddef.h> header file. */
@@ -1201,6 +1207,9 @@
 /* define if select implicitly yields */
 #undef HAVE_YIELDING_SELECT
 
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
 /* Define to 1 if you have the `_exit' function. */
 #undef HAVE__EXIT
 
@@ -1347,6 +1356,9 @@
    initialization. */
 #undef MISSING_C99_STRUCT_INIT
 
+/* having to fork the DNS worker early when doing chroot? */
+#undef NEED_EARLY_FORK
+
 /* Do we need HPUX adjtime() library support? */
 #undef NEED_HPUX_ADJTIME
 
Index: contrib/ntp/configure
===================================================================
--- contrib/ntp/configure	(版本 297264)
+++ contrib/ntp/configure	(版本 298770)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ntp 4.2.8p6.
+# Generated by GNU Autoconf 2.69 for ntp 4.2.8p7.
 #
 # Report bugs to <http://bugs.ntp.org./>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='ntp'
 PACKAGE_TARNAME='ntp'
-PACKAGE_VERSION='4.2.8p6'
-PACKAGE_STRING='ntp 4.2.8p6'
+PACKAGE_VERSION='4.2.8p7'
+PACKAGE_STRING='ntp 4.2.8p7'
 PACKAGE_BUGREPORT='http://bugs.ntp.org./'
 PACKAGE_URL='http://www.ntp.org./'
 
@@ -1050,6 +1050,7 @@
 enable_hourly_todr_sync
 enable_kernel_fll_bug
 enable_bug1243_fix
+enable_bug3020_fix
 enable_irig_sawtooth
 enable_nist
 enable_ntp_signd
@@ -1058,6 +1059,7 @@
 enable_getifaddrs
 enable_saveconfig
 enable_leap_smear
+enable_dynamic_interleave
 with_gtest
 enable_problem_tests
 '
@@ -1616,7 +1618,7 @@
   # 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.8p6 to adapt to many kinds of systems.
+\`configure' configures ntp 4.2.8p7 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1686,7 +1688,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ntp 4.2.8p6:";;
+     short | recursive ) echo "Configuration of ntp 4.2.8p7:";;
    esac
   cat <<\_ACEOF
 
@@ -1820,6 +1822,7 @@
                           s if we should sync TODR hourly
   --enable-kernel-fll-bug s if we should avoid a kernel FLL bug
   --enable-bug1243-fix    + use unmodified autokey session keys
+  --enable-bug3020-fix    + Provide the explicit 127.0.0.0/8 martian filter
   --enable-irig-sawtooth  s if we should enable the IRIG sawtooth filter
   --enable-nist           - if we should enable the NIST lockclock scheme
   --enable-ntp-signd      - Provide support for Samba's signing daemon,
@@ -1830,6 +1833,8 @@
   --enable-getifaddrs     + Enable the use of getifaddrs() [[yes|no]].
   --enable-saveconfig     + saveconfig mechanism
   --enable-leap-smear     - experimental leap smear code
+  --enable-dynamic-interleave
+                          - dynamic interleave support
   --with-gtest            Use the gtest framework (Default: if it's available)
   --enable-problem-tests  + enable tests with undiagnosed problems
 
@@ -1919,7 +1924,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ntp configure 4.2.8p6
+ntp configure 4.2.8p7
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2749,7 +2754,7 @@
 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.8p6, which was
+It was created by ntp $as_me 4.2.8p7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3750,7 +3755,7 @@
 
 # Define the identity of the package.
  PACKAGE='ntp'
- VERSION='4.2.8p6'
+ VERSION='4.2.8p7'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -22118,6 +22123,9 @@
 
 done
 
+
+$as_echo "#define NEED_EARLY_FORK 1" >>confdefs.h
+
 esac
 
 for ac_header in arpa/nameser.h sys/param.h sys/time.h sys/timers.h
@@ -29706,7 +29714,7 @@
 
 done
 
-for ac_header in sgtty.h stdatomic.h stdlib.h string.h termio.h
+for ac_header in sgtty.h stdatomic.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -29719,6 +29727,112 @@
 
 done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+             #include <stdbool.h>
+             #ifndef bool
+              "error: bool is not defined"
+             #endif
+             #ifndef false
+              "error: false is not defined"
+             #endif
+             #if false
+              "error: false is not 0"
+             #endif
+             #ifndef true
+              "error: true is not defined"
+             #endif
+             #if true != 1
+              "error: true is not 1"
+             #endif
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
+             #endif
+
+             struct s { _Bool s: 1; _Bool t; } s;
+
+             char a[true == 1 ? 1 : -1];
+             char b[false == 0 ? 1 : -1];
+             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+             char d[(bool) 0.5 == true ? 1 : -1];
+             /* See body of main program for 'e'.  */
+             char f[(_Bool) 0.0 == false ? 1 : -1];
+             char g[true];
+             char h[sizeof (_Bool)];
+             char i[sizeof s.t];
+             enum { j = false, k = true, l = false * true, m = true * 256 };
+             /* The following fails for
+                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+             _Bool n[m];
+             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+             /* Catch a bug in an HP-UX C compiler.  See
+                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+              */
+             _Bool q = true;
+             _Bool *pq = &q;
+
+int
+main ()
+{
+
+             bool e = &s;
+             *pq |= q;
+             *pq |= ! q;
+             /* Refer to every declared value, to avoid compiler optimizations.  */
+             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                     + !m + !n + !o + !p + !q + !pq);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdbool_h=yes
+else
+  ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+   ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+for ac_header in stdlib.h string.h termio.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
 for ac_header in termios.h timepps.h timex.h unistd.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -35832,6 +35946,26 @@
 esac
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want the explicit 127.0.0.0/8 martian filter" >&5
+$as_echo_n "checking if we want the explicit 127.0.0.0/8 martian filter... " >&6; }
+# Check whether --enable-bug3020-fix was given.
+if test "${enable_bug3020_fix+set}" = set; then :
+  enableval=$enable_bug3020_fix; ans=$enableval
+else
+  ans=yes
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5
+$as_echo "$ans" >&6; }
+case "$ans" in
+ yes)
+
+$as_echo "#define ENABLE_BUG3020_FIX 1" >>confdefs.h
+
+esac
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should use the IRIG sawtooth filter" >&5
 $as_echo_n "checking if we should use the IRIG sawtooth filter... " >&6; }
 
@@ -36851,7 +36985,33 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_ok" >&5
 $as_echo "$ntp_ok" >&6; }
 
+###
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want dynamic interleave support" >&5
+$as_echo_n "checking if we want dynamic interleave support... " >&6; }
+# Check whether --enable-dynamic-interleave was given.
+if test "${enable_dynamic_interleave+set}" = set; then :
+  enableval=$enable_dynamic_interleave; ntp_ok=$enableval
+else
+  ntp_ok=no
+
+fi
+
+ntp_dynamic_interleave=0
+case "$ntp_ok" in
+ yes)
+    ntp_dynamic_interleave=1
+    ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define DYNAMIC_INTERLEAVE $ntp_dynamic_interleave
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_ok" >&5
+$as_echo "$ntp_ok" >&6; }
+
+
 # We may not need have_unity
 have_unity=false
 # Extract the first word of "ruby", so it can be a program name with args.
@@ -37840,7 +38000,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ntp $as_me 4.2.8p6, which was
+This file was extended by ntp $as_me 4.2.8p7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -37907,7 +38067,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ntp config.status 4.2.8p6
+ntp config.status 4.2.8p7
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
Index: contrib/ntp/configure.ac
===================================================================
--- contrib/ntp/configure.ac	(版本 297264)
+++ contrib/ntp/configure.ac	(版本 298770)
@@ -302,7 +302,9 @@
 AC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
 
 AC_CHECK_HEADERS([memory.h netdb.h poll.h])
-AC_CHECK_HEADERS([sgtty.h stdatomic.h stdlib.h string.h termio.h])
+AC_CHECK_HEADERS([sgtty.h stdatomic.h])
+AC_HEADER_STDBOOL
+AC_CHECK_HEADERS([stdlib.h string.h termio.h])
 AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
 
 case "$host" in
@@ -4158,6 +4160,24 @@
 esac
 
 
+AC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
+AC_ARG_ENABLE(
+    [bug3020-fix],
+    [AS_HELP_STRING(
+	[--enable-bug3020-fix],
+	[+ Provide the explicit 127.0.0.0/8 martian filter]
+    )],
+    [ans=$enableval],
+    [ans=yes]
+)
+AC_MSG_RESULT([$ans])
+case "$ans" in
+ yes)
+    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
+	[Provide the explicit 127.0.0.0/8 martian filter?])
+esac
+
+
 AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
 
 case "$host" in
@@ -4322,6 +4342,28 @@
 esac
 AC_MSG_RESULT([$ntp_ok])
 
+###
+
+AC_MSG_CHECKING([if we want dynamic interleave support])
+AC_ARG_ENABLE(
+    [dynamic-interleave],
+    [AS_HELP_STRING(
+	[--enable-dynamic-interleave],
+	[- dynamic interleave support]
+    )],
+    [ntp_ok=$enableval],
+    [ntp_ok=no]
+)
+ntp_dynamic_interleave=0
+case "$ntp_ok" in
+ yes)
+    ntp_dynamic_interleave=1
+    ;;
+esac
+AC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
+    [support dynamic interleave?])
+AC_MSG_RESULT([$ntp_ok])
+
 NTP_UNITYBUILD
 
 dnl  gtest is needed for our tests subdirs. It would be nice if we could
Index: contrib/ntp/html/authentic.html
===================================================================
--- contrib/ntp/html/authentic.html	(版本 297264)
+++ contrib/ntp/html/authentic.html	(版本 298770)
@@ -20,7 +20,7 @@
 <img src="pic/alice44.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a>
 <p>Our resident cryptographer; now you see him, now you don't.</p>
 <p>Last update:
-  <!-- #BeginDate format:En2m -->1-Dec-2012  04:44<!-- #EndDate -->
+  <!-- #BeginDate format:En2m -->5-Feb-2016  09:13<!-- #EndDate -->
   UTC</p>
 <br clear="left">
 <h4>Related Links</h4>
@@ -35,28 +35,28 @@
 </ul>
 <hr>
 <h4 id="auth">Introduction</h4>
-<p>This page describes the various cryptographic authentication provisions in NTPv4. Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server. A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper <a href="http://www.eecis.udel.edu/~mills/security.html">NTP Security Analysis</a>.</p>
-<p> The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as <em>symmetric key cryptography</em>. It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode. Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server. The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.</p>
-<p>If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1.   However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used. This library is available from <a href="http://www.openssl.org">http://www.openssl.org</a> and can be installed using the procedures outlined in the <a href="build.html">Building and Installing the Distribution</a> page. Once installed, the configure and  build process automatically detects the library and links the library routines
+<p>This page describes the various cryptographic authentication provisions in NTPv4.  Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server.  A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper <a href="http://www.eecis.udel.edu/~mills/security.html">NTP Security Analysis</a>.</p>
+<p> The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as <em>symmetric key cryptography</em>.  It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode.  Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5.  Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server.  The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.</p>
+<p>If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1.  However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used.  This library is available from <a href="http://www.openssl.org">http://www.openssl.org</a> and can be installed using the procedures outlined in the <a href="build.html">Building and Installing the Distribution</a> page.  Once installed, the configure and build process automatically detects the library and links the library routines
 required.</p>
-<p>In addition to  the symmetric key algorithms, this distribution includes support for the  Autokey public key algorithms and protocol specified in RFC-5906 &quot;Network Time Protocol Version 4: Autokey Specification&quot;. This support is available only if the OpenSSL library has been installed and the <tt>--enable-autokey</tt> option   is used when the distribution is built.</p>
-<p> Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed. Autokey uses X.509 public certificates, which can be produced by commercial services,  the OpenSSL application program, or the <a href="keygen.html"><tt>ntp-keygen</tt></a> utility program in the NTP software distribution.</p>
-<p>Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce. Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.</p>
-<p>Authentication is configured separately for each association using the <tt>key</tt> or <tt>autokey</tt> option of the <tt>server</tt> configuration command, as described in the <a href="confopt.html">Server Options</a> page. The <a href="keygen.html">ntp-keygen</a> page describes the files required for the various authentication schemes. Further details are in the briefings, papers and reports at the NTP project page linked from <a href="http://www.ntp.org">www.ntp.org</a>.</p>
-<p>By default, the client sends non-authenticated packets and the server responds with non-authenticated packets. If the client sends authenticated packets, the server  responds with  authenticated packets if correct, or a crypto-NAK packet if not.. In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode  packets, , authentication is required, unless overridden by a <tt>disable auth</tt> command.  In the current climate of targeted broadcast or &quot;letterbomb&quot; attacks, defeating this requirement would be decidedly dangerous. In any case, the <tt>notrust </tt>flag,  described on the <a href="authopt.html">Access Control Options</a> page, can be used to disable access to all but correctly authenticated clients..</p>
+<p>In addition to the symmetric key algorithms, this distribution includes support for the Autokey public key algorithms and protocol specified in RFC-5906 &quot;Network Time Protocol Version 4: Autokey Specification&quot;.  This support is available only if the OpenSSL library has been installed and the <tt>--enable-autokey</tt> option is used when the distribution is built.</p>
+<p> Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed.  Autokey uses X.509 public certificates, which can be produced by commercial services, the OpenSSL application program, or the <a href="keygen.html"><tt>ntp-keygen</tt></a> utility program in the NTP software distribution.</p>
+<p>Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce.  Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.</p>
+<p>Authentication is configured separately for each association using the <tt>key</tt> or <tt>autokey</tt> option of the <tt>server</tt> configuration command, as described in the <a href="confopt.html">Server Options</a> page.  The <a href="keygen.html">ntp-keygen</a> page describes the files required for the various authentication schemes.  Further details are in the briefings, papers and reports at the NTP project page linked from <a href="http://www.ntp.org">www.ntp.org</a>.</p>
+<p>By default, the client sends non-authenticated packets and the server responds with non-authenticated packets.  If the client sends authenticated packets, the server responds with authenticated packets if correct, or a crypto-NAK packet if not.  In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode packets, authentication is required, unless overridden by a <tt>disable auth</tt> command.  In the current climate of targeted broadcast or &quot;letterbomb&quot; attacks, defeating this requirement would be decidedly dangerous.  In any case, the <tt>notrust </tt>flag, described on the <a href="authopt.html">Access Control Options</a> page, can be used to disable access to all but correctly authenticated clients.</p>
 <h4 id="symm">Symmetric Key Cryptography</h4>
-<p>The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association. The servers and clients involved must agree on the  key ID, key type and key to authenticate NTP packets.</p>
-<p>The message digest is a cryptographic hash computed by an   algorithm such as MD5 or SHA. When authentication is specified,  a message authentication code (MAC)  is appended to the NTP packet header. The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit  message digest. The  algorithm computes the digest as the hash of a  128- or 160- bit  message digest key concatenated with the NTP packet header fields with the exception of the MAC. On transmit, the message digest is computed and inserted in the MAC. On receive, the message digest is computed and compared with the MAC. The packet is accepted only if the two MACs are identical. If a discrepancy is found by the client,   the client ignores the packet, but raises an alarm. If this happens at the server, the server returns a special message called a <em>crypto-NAK</em>. Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto-NAK.</p>
-<p>Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself. Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the <tt><a href="ntpq.html">ntpq</a></tt> and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs. Ordinarily, the <tt>ntp.keys</tt> file is generated by the <tt><a href="keygen.html">ntp-keygen</a></tt> program, but it can be constructed and edited using an ordinary text editor.</p>
-<p> Each line of the keys file consists of three fields: a key ID in the range  1 to 65,534, inclusive, a key type, and a  message digest key consisting of a printable ASCII string less than 40 characters, or a 40-character hex digit string. If the OpenSSL library is installed, the key type  can be any message digest algorithm supported by the  library.   If the OpenSSL library is not installed, the only permitted key type is MD5.</p>
+<p>The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association.  The servers and clients involved must agree on the key ID, key type and key to authenticate NTP packets.</p>
+<p>The message digest is a cryptographic hash computed by an algorithm such as MD5 or SHA.  When authentication is specified, a message authentication code (MAC) is appended to the NTP packet header.  The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit message digest.  The algorithm computes the digest as the hash of a 128- or 160- bit message digest key concatenated with the NTP packet header fields with the exception of the MAC.  On transmit, the message digest is computed and inserted in the MAC.  On receive, the message digest is computed and compared with the MAC.  The packet is accepted only if the two MACs are identical.  If a discrepancy is found by the client, the client ignores the packet, but raises an alarm.  If this happens at the server, the server returns a special message called a <em>crypto-NAK</em>.  Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto-NAK.</p>
+<p>Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself.  Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the <tt><a href="ntpq.html">ntpq</a></tt> and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs.  Ordinarily, the <tt>ntp.keys</tt> file is generated by the <tt><a href="keygen.html">ntp-keygen</a></tt> program, but it can be constructed and edited using an ordinary text editor.</p>
+<p> Each line of the keys file consists of three or four fields: a key ID in the range 1 to 65,534, inclusive, a key type, a message digest key consisting of a printable ASCII string less than 40 characters or a 40-character hex digit string, and an optional comma-separated list of IPs that are allowed to serve time.  If the OpenSSL library is installed, the key type can be any message digest algorithm supported by the library.  If the OpenSSL library is not installed, the only permitted key type is MD5.</p>
 <div align="center">
   <p><img src="pic/sx5.gif" alt="gif"></p>
   <p>Figure 1. Typical Symmetric Key File</p>
 </div>
-<p>Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed.   In this figure, for key IDs in he range 1-10, the  key is interpreted as a printable ASCII string. For key IDs in the range 11-20, the key is  a 40-character hex digit string.   The key  is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type. The line can be edited later or new lines can be added to change any field.  The key can be  change  to a  password,  such as   <tt>2late4Me</tt> for key ID 10. Note that two or more keys files can be combined in any order as long as the key IDs are distinct.</p>
-<p>When <tt>ntpd</tt> is  started, it reads the keys file specified by the <tt>keys</tt> command and installs the keys in the key cache. However, individual keys must be activated with the <tt>trustedkey</tt> configuration command before use. This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using <tt>ntpq</tt> or <tt>ntpdc</tt>. The <tt>requestkey</tt> command selects the key ID used as the password for the <tt>ntpdc</tt> utility, while the <tt>controlkey</tt> command selects the key ID used as the password for the <tt>ntpq</tt> utility.</p>
+<p>Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed.  In this figure, for key IDs in he range 1-10, the key is interpreted as a printable ASCII string.  For key IDs in the range 11-20, the key is a 40-character hex digit string.  The key is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type.  The line can be edited later or new lines can be added to change any field.  The key can be change to a password, such as <tt>2late4Me</tt> for key ID 10.  Note that two or more keys files can be combined in any order as long as the key IDs are distinct.</p>
+<p>When <tt>ntpd</tt> is started, it reads the keys file specified by the <tt>keys</tt> command and installs the keys in the key cache.  However, individual keys must be activated with the <tt>trustedkey</tt> configuration command before use.  This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using <tt>ntpq</tt> or <tt>ntpdc</tt>.  The <tt>requestkey</tt> command selects the key ID used as the password for the <tt>ntpdc</tt> utility, while the <tt>controlkey</tt> command selects the key ID used as the password for the <tt>ntpq</tt> utility.</p>
 <h4 id="windows">Microsoft Windows Authentication</h4>
-<p>In addition to the above means, <tt>ntpd</tt> now supports Microsoft Windows MS-SNTP authentication using Active Directory services. This support was contributed by the Samba Team and is still in development. It is enabled using the <tt>mssntp</tt> flag of the <tt>restrict</tt> command described on the <a href="accopt.html#restrict">Access Control Options</a> page. <span class="style1">Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users. Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.</span></p>
+<p>In addition to the above means, <tt>ntpd</tt> now supports Microsoft Windows MS-SNTP authentication using Active Directory services.  This support was contributed by the Samba Team and is still in development.  It is enabled using the <tt>mssntp</tt> flag of the <tt>restrict</tt> command described on the <a href="accopt.html#restrict">Access Control Options</a> page.  <span class="style1">Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users.  Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.</span></p>
 <h4 id="pub">Public Key Cryptography</h4>
 <p>See the <a href="autokey.html">Autokey Public-Key Authentication</a> page.</p>
 <hr>
Index: contrib/ntp/html/monopt.html
===================================================================
--- contrib/ntp/html/monopt.html	(版本 297264)
+++ contrib/ntp/html/monopt.html	(版本 298770)
@@ -11,7 +11,7 @@
 <img src="pic/pogo8.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html"></a> from <i>Pogo</i>, Walt Kelly</a>
 <p>Pig was hired to watch the logs.</p>
 <p>Last update:
-  <!-- #BeginDate format:En2m -->31-Jan-2014  06:54<!-- #EndDate -->
+  <!-- #BeginDate format:En2m -->14-Feb-2016  09:38<!-- #EndDate -->
     UTC</p>
 <br clear="left">
 <h4>Related Links</h4>
@@ -295,7 +295,7 @@
   <dd>The status field is encoded in hex format as described in Appendix B of
     the NTP specification RFC 1305.</dd>
   <dt><tt>protostats</tt></dt>
-  <dd>Record significant peer, system and [rptpcp; events. Each significant event
+  <dd>Record significant peer, system and protocol events. Each significant event
     appends one line to the <tt>protostats</tt> file set:</dd>
   <dd><tt>49213 525.624 128.4.1.1 963a 8a <i>message</i></tt></dd>
   <dd>
Index: contrib/ntp/html/xleave.html
===================================================================
--- contrib/ntp/html/xleave.html	(版本 297264)
+++ contrib/ntp/html/xleave.html	(版本 298770)
@@ -11,17 +11,17 @@
 <img src="pic/pogo4.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
 <p>You need a little magic.</p>
 <p>Last update:
-  <!-- #BeginDate format:En2m -->10-Mar-2014  05:25<!-- #EndDate -->
+  <!-- #BeginDate format:En2m -->6-Feb-2016  07:17<!-- #EndDate -->
     UTC</p>
 <br clear="left">
 <hr>
-<p>In the protocol described in the NTP specification and reference implementation up to now, the transmit timestamp, which is captured before the message digest is computed and the packet  queued for output,  is properly called as a <em>softstamp</em> The receive timestamp, which is captured after the input driver interrupt routine and before  the packet is queued for input,  is properly called  a <em>drivestamp</em>.  For enhanced accuracy it is desirable to capture the transmit timestamp  as close to the wire as possible; for example, after the output driver interrupt routine.</p>
-<p> In other words, we would like to replace the transmit softstamp with a drivestamp, but the problem is the transmit drivestamp is available only after the packet has been sent. A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation. In interleaved modes the transmit drivestamp for one packet is actually carried in the immediately following packet. The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.</p>
-<p> The reference implementation captures a softstamp before the message digest routine and a drivestamp after the output interrupt routine. In this design the latter timestamp can be considered most accurate, as it avoids the various queuing and transmission latencies. The difference between the two timestamps, which is  called the interleaved or output delay, varies from 16 &mu;s for a dual-core Pentium  running FreeBSD 6.1 to 1100 &mu;s for a Sun Blade 1500 running Solaris 10.</p>
+<p>In the protocol described in the NTP specification and reference implementation up to now, the transmit timestamp, which is captured before the message digest is computed and the packet queued for output, is properly called as a <em>softstamp</em>.  The receive timestamp, which is captured after the input driver interrupt routine and before the packet is queued for input, is properly called a <em>drivestamp</em>.  For enhanced accuracy it is desirable to capture the transmit timestamp as close to the wire as possible; for example, after the output driver interrupt routine.</p>
+<p> In other words, we would like to replace the transmit softstamp with a drivestamp, but the problem is the transmit drivestamp is available only after the packet has been sent.  A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation.  In interleaved modes the transmit drivestamp for one packet is actually carried in the immediately following packet.  The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.</p>
+<p> The reference implementation captures a softstamp before the message digest routine and a drivestamp after the output interrupt routine.  In this design the latter timestamp can be considered most accurate, as it avoids the various queuing and transmission latencies.  The difference between the two timestamps, which is called the interleaved or output delay, varies from 16 &mu;s (microseconds) for a dual-core Pentium running FreeBSD 6.1 to 1100 &mu;s (microseconds) for a Sun Blade 1500 running Solaris 10.</p>
 <p>Interleaved mode can be used only in NTP symmetric and broadcast modes.
   It is activated by the <tt>xleave</tt> option with the <tt>peer</tt> or <tt>broadcast</tt> configuration
-commands. A broadcast server configured for interleaved mode is transparent to ordinary broadcast clients, so both ordinary  and interleaved broadcast clients can use the same packets. An interleaved symmetric active peer automatically switches to ordinary symmetric mode if the other peer is not capable of operation in  interleaved mode. </p>
-<p>As demonstrated in the white paper <a href="http://www.eecis.udel.edu/~mills/onwire.html">Analysis and Simulation of the NTP On-Wire Protocols</a>, the interleaved modes have the same resistance to  lost packets, duplicate packets, packets crossed in flight and protocol restarts as the ordinary modes. An application of the interleaved symmetric mode in space missions is presented in the white paper <a href="http://www.eecis.udel.edu/~mills/proximity.html">Time Synchronization for Space Data Links</a>.</p>
+commands.  A broadcast server configured for interleaved mode is transparent to ordinary broadcast clients, so both ordinary and interleaved broadcast clients can use the same packets.  An interleaved symmetric active peer automatically switches to ordinary symmetric mode if the other peer is not capable of operation in interleaved mode.</p>
+<p>As demonstrated in the white paper <a href="http://www.eecis.udel.edu/~mills/onwire.html">Analysis and Simulation of the NTP On-Wire Protocols</a>, the interleaved modes have the same resistance to lost packets, duplicate packets, packets crossed in flight and protocol restarts as the ordinary modes.  An application of the interleaved symmetric mode in space missions is presented in the white paper <a href="http://www.eecis.udel.edu/~mills/proximity.html">Time Synchronization for Space Data Links</a>.</p>
 <hr>
 <div align="center"> <img src="pic/pogo1a.gif" alt="gif"> </div>
 <br>
Index: contrib/ntp/include/ntp.h
===================================================================
--- contrib/ntp/include/ntp.h	(版本 297264)
+++ contrib/ntp/include/ntp.h	(版本 298770)
@@ -175,6 +175,7 @@
 struct interface {
 	endpt *		elink;		/* endpt list link */
 	endpt *		mclink;		/* per-AF_* multicast list */
+	void *		ioreg_ctx;	/* IO registration context */
 	SOCKET		fd;		/* socket descriptor */
 	SOCKET		bfd;		/* for receiving broadcasts */
 	u_int32		ifnum;		/* endpt instance count */
@@ -242,6 +243,13 @@
 #define	PEER_TEST_MASK	(TEST10 | TEST11 | TEST12 | TEST13)
 
 /*
+ * Unused flags
+ */
+#define TEST14		0x2000
+#define TEST15		0x4000
+#define TEST16		0x8000
+
+/*
  * The peer structure. Holds state information relating to the guys
  * we are peering with. Most of this stuff is from section 3.2 of the
  * spec.
@@ -391,6 +399,7 @@
 	u_long	received;	/* packets received */
 	u_long	processed;	/* packets processed */
 	u_long	badauth;	/* bad authentication (TEST5) */
+	u_long	badNAK;		/* invalid crypto-NAK */
 	u_long	bogusorg;	/* bogus origin (TEST2, TEST3) */
 	u_long	oldpkt;		/* old duplicate (TEST1) */
 	u_long	seldisptoolarge; /* bad header (TEST6, TEST7) */
@@ -545,6 +554,7 @@
 	l_fp	rec;		/* receive time stamp */
 	l_fp	xmt;		/* transmit time stamp */
 
+#define	MIN_V4_PKT_LEN	(12 * sizeof(u_int32)) /* min header length */
 #define	LEN_PKT_NOMAC	(12 * sizeof(u_int32)) /* min header length */
 #define MIN_MAC_LEN	(1 * sizeof(u_int32))	/* crypto_NAK */
 #define MAX_MD5_LEN	(5 * sizeof(u_int32))	/* MD5 */
Index: contrib/ntp/include/ntp_keyacc.h
===================================================================
--- contrib/ntp/include/ntp_keyacc.h	(版本 297264)
+++ contrib/ntp/include/ntp_keyacc.h	(版本 298770)
@@ -10,4 +10,10 @@
 	sockaddr_u	addr;
 };
 
+extern KeyAccT* keyacc_new_push(KeyAccT *head, const sockaddr_u *addr);
+extern KeyAccT* keyacc_pop_free(KeyAccT *head);
+extern KeyAccT* keyacc_all_free(KeyAccT *head);
+extern int      keyacc_contains(const KeyAccT *head, const sockaddr_u *addr,
+				int res_on_empty_list);
+
 #endif	/* NTP_KEYACC_H */
Index: contrib/ntp/include/ntp_refclock.h
===================================================================
--- contrib/ntp/include/ntp_refclock.h	(版本 297264)
+++ contrib/ntp/include/ntp_refclock.h	(版本 298770)
@@ -105,7 +105,8 @@
 	int	active;		/* nonzero when in use */
 
 #ifdef HAVE_IO_COMPLETION_PORT
-	void *	device_context;	/* device-related data for i/o subsystem */
+	void *	ioreg_ctx;	/* IO registration context */
+	void *	device_ctx;	/* device-related data for i/o subsystem */
 #endif
 };
 
Index: contrib/ntp/include/ntp_stdlib.h
===================================================================
--- contrib/ntp/include/ntp_stdlib.h	(版本 297264)
+++ contrib/ntp/include/ntp_stdlib.h	(版本 298770)
@@ -200,7 +200,7 @@
 extern keyid_t	cache_keyid;		/* key identifier */
 extern int	cache_type;		/* key type */
 extern u_char *	cache_secret;		/* secret */
-extern u_short	cache_secretsize;	/* secret octets */
+extern size_t	cache_secretsize;	/* secret octets */
 extern u_short	cache_flags;		/* KEY_ bit flags */
 
 /* getopt.c */
Index: contrib/ntp/include/ntp_types.h
===================================================================
--- contrib/ntp/include/ntp_types.h	(版本 297264)
+++ contrib/ntp/include/ntp_types.h	(版本 298770)
@@ -35,6 +35,13 @@
 # define	FALSE	0
 #endif
 
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+typedef int bool;	/* Can't use enum TRUE/FALSE because of above */
+#endif
+
+
 /*
  * This is another naming conflict.
  * On NetBSD for MAC the macro "mac" is defined as 1
Index: contrib/ntp/include/ntp_worker.h
===================================================================
--- contrib/ntp/include/ntp_worker.h	(版本 297264)
+++ contrib/ntp/include/ntp_worker.h	(版本 298770)
@@ -119,11 +119,11 @@
 	int			resp_write_pipe;	/* child */
 	int			ispipe;
 	void *			resp_read_ctx;		/* child */
-	volatile u_int		resp_ready_seen;	/* signal/scan */
-	volatile u_int		resp_ready_done;	/* consumer/mainloop */
 #else
 	sem_ref			responses_pending;	/* signalling */
 #endif
+	volatile u_int		resp_ready_seen;	/* signal/scan */
+	volatile u_int		resp_ready_done;	/* consumer/mainloop */
 	sema_type		sem_table[4];
 	thread_type		thr_table[1];
 } blocking_child;
@@ -171,6 +171,8 @@
 extern	void	kill_asyncio	(int);
 #endif
 
+extern void worker_global_lock(int inOrOut);
+
 # ifdef WORK_PIPE
 typedef	void	(*addremove_io_fd_func)(int, int, int);
 extern	addremove_io_fd_func		addremove_io_fd;
Index: contrib/ntp/include/recvbuff.h
===================================================================
--- contrib/ntp/include/recvbuff.h	(版本 297264)
+++ contrib/ntp/include/recvbuff.h	(版本 298770)
@@ -91,7 +91,7 @@
 
 /* signal safe - no malloc */
 extern	struct recvbuf *get_free_recv_buffer(void);
-/* signal unsafe - may malloc */
+/* signal unsafe - may malloc, never returs NULL */
 extern	struct recvbuf *get_free_recv_buffer_alloc(void);
 
 /*   Add a buffer to the full list
@@ -113,7 +113,7 @@
  * purge_recv_buffers_for_fd() - purges any previously-received input
  *				 from a given file descriptor.
  */
-extern	void purge_recv_buffers_for_fd(SOCKET);
+extern	void purge_recv_buffers_for_fd(int);
 
 /*
  * Checks to see if there are buffers to process
Index: contrib/ntp/lib/isc/hmacmd5.c
===================================================================
--- contrib/ntp/lib/isc/hmacmd5.c	(版本 297264)
+++ contrib/ntp/lib/isc/hmacmd5.c	(版本 298770)
@@ -145,5 +145,5 @@
 
 	REQUIRE(len <= ISC_MD5_DIGESTLENGTH);
 	isc_hmacmd5_sign(ctx, newdigest);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
Index: contrib/ntp/lib/isc/hmacsha.c
===================================================================
--- contrib/ntp/lib/isc/hmacsha.c	(版本 297264)
+++ contrib/ntp/lib/isc/hmacsha.c	(版本 298770)
@@ -538,7 +538,7 @@
 
 	REQUIRE(len <= ISC_SHA1_DIGESTLENGTH);
 	isc_hmacsha1_sign(ctx, newdigest, ISC_SHA1_DIGESTLENGTH);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
 
 /*
@@ -551,7 +551,7 @@
 
 	REQUIRE(len <= ISC_SHA224_DIGESTLENGTH);
 	isc_hmacsha224_sign(ctx, newdigest, ISC_SHA224_DIGESTLENGTH);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
 
 /*
@@ -564,7 +564,7 @@
 
 	REQUIRE(len <= ISC_SHA256_DIGESTLENGTH);
 	isc_hmacsha256_sign(ctx, newdigest, ISC_SHA256_DIGESTLENGTH);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
 
 /*
@@ -577,7 +577,7 @@
 
 	REQUIRE(len <= ISC_SHA384_DIGESTLENGTH);
 	isc_hmacsha384_sign(ctx, newdigest, ISC_SHA384_DIGESTLENGTH);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
 
 /*
@@ -590,5 +590,5 @@
 
 	REQUIRE(len <= ISC_SHA512_DIGESTLENGTH);
 	isc_hmacsha512_sign(ctx, newdigest, ISC_SHA512_DIGESTLENGTH);
-	return (ISC_TF(memcmp(digest, newdigest, len) == 0));
+	return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
 }
Index: contrib/ntp/lib/isc/include/isc/string.h
===================================================================
--- contrib/ntp/lib/isc/include/isc/string.h	(版本 297264)
+++ contrib/ntp/lib/isc/include/isc/string.h	(版本 298770)
@@ -199,6 +199,24 @@
  *
  */
 
+int
+isc_tsmemcmp(const void *p1, const void *p2, size_t len);
+/*
+ * Lexicographic compare 'len' unsigned bytes from 'p1' and 'p2'
+ * like 'memcmp()'.
+ *
+ * This function is safe from timing attacks as it has a runtime that
+ * only depends on 'len' and has no early-out option.
+ *
+ * Use this to check MACs and other material that is security sensitive.
+ *
+ * Returns:
+ *  (let x be the byte offset of the first different byte)
+ *  -1 if (u_char)p1[x] < (u_char)p2[x]
+ *   1 if (u_char)p1[x] > (u_char)p2[x]
+ *   0 if byte series are equal
+ */
+
 char *
 isc_string_separate(char **stringp, const char *delim);
 
Index: contrib/ntp/lib/isc/tsmemcmp.c
===================================================================
--- contrib/ntp/lib/isc/tsmemcmp.c	(不存在的)
+++ contrib/ntp/lib/isc/tsmemcmp.c	(版本 298770)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2004-2007, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id$ */
+
+/*! \file */
+
+#include <config.h>
+#include <limits.h>
+#include <isc/string.h>
+
+/* Making a portable memcmp that has no internal branches and loops always
+ * once for every byte without early-out shortcut has a few challenges.
+ *
+ * Inspired by 'timingsafe_memcmp()' from the BSD system and
+ * https://github.com/libressl-portable/openbsd/blob/master/src/lib/libc/string/timingsafe_memcmp.c
+ *
+ * Sadly, that one is not portable C: It makes assumptions on the representation
+ * of negative integers and assumes sign-preserving right-shift of negative
+ * signed values. This is a rewrite from scratch that should not suffer from
+ * such issues.
+ *
+ * 2015-12-12, J. Perlinger (perlinger-at-ntp-dot-org)
+ */
+int
+isc_tsmemcmp(const void *p1, const void *p2, size_t nb) {
+	const unsigned char *ucp1 = p1;
+	const unsigned char *ucp2 = p2;
+	unsigned int isLT = 0u;
+	unsigned int isGT = 0u;
+	volatile unsigned int mask = (1u << CHAR_BIT);
+
+	for (/*NOP*/; 0 != nb; --nb, ++ucp1, ++ucp2) {
+		isLT |= mask &
+		    ((unsigned int)*ucp1 - (unsigned int)*ucp2);
+		isGT |= mask &
+		    ((unsigned int)*ucp2 - (unsigned int)*ucp1);
+		mask &= ~(isLT | isGT);
+	}
+	return (int)(isGT >> CHAR_BIT) - (int)(isLT >> CHAR_BIT);
+}
Index: contrib/ntp/libntp/Makefile.am
===================================================================
--- contrib/ntp/libntp/Makefile.am	(版本 297264)
+++ contrib/ntp/libntp/Makefile.am	(版本 298770)
@@ -36,6 +36,7 @@
 	$(srcdir)/../lib/isc/unix/time.c				\
 	$(srcdir)/../lib/isc/sha1.c					\
 	$(srcdir)/../lib/isc/sockaddr.c					\
+	$(srcdir)/../lib/isc/tsmemcmp.c					\
 	$(NULL)
 
 if PTHREADS
Index: contrib/ntp/libntp/a_md5encrypt.c
===================================================================
--- contrib/ntp/libntp/a_md5encrypt.c	(版本 297264)
+++ contrib/ntp/libntp/a_md5encrypt.c	(版本 298770)
@@ -10,7 +10,7 @@
 #include "ntp_stdlib.h"
 #include "ntp.h"
 #include "ntp_md5.h"	/* provides OpenSSL digest API */
-
+#include "isc/string.h"
 /*
  * MD5authencrypt - generate message digest
  *
@@ -92,7 +92,7 @@
 		    "MAC decrypt: MAC length error");
 		return (0);
 	}
-	return !memcmp(digest, (const char *)pkt + length + 4, len);
+	return !isc_tsmemcmp(digest, (const char *)pkt + length + 4, len);
 }
 
 /*
Index: contrib/ntp/libntp/authreadkeys.c
===================================================================
--- contrib/ntp/libntp/authreadkeys.c	(版本 297264)
+++ contrib/ntp/libntp/authreadkeys.c	(版本 298770)
@@ -101,7 +101,7 @@
 	...)
 {
 	va_list ap;
-	if (++(*pnerr) <= nerr_loglimit) {
+	if ((NULL == pnerr) || (++(*pnerr) <= nerr_loglimit)) {
 		va_start(ap, fmt);
 		mvsyslog(LOG_ERR, fmt, ap);
 		va_end(ap);
@@ -108,6 +108,26 @@
 	}
 }
 
+static void
+free_keydata(
+	KeyDataT *node
+	)
+{
+	KeyAccT *kap;
+	
+	if (node) {
+		while (node->keyacclist) {
+			kap = node->keyacclist;
+			node->keyacclist = kap->next;
+			free(kap);
+		}
+
+		/* purge secrets from memory before free()ing it */
+		memset(node, 0, sizeof(*node) + node->seclen);
+		free(node);
+	}
+}
+
 /*
  * authreadkeys - (re)read keys from a file.
  */
@@ -156,7 +176,7 @@
 		 * First is key number.  See if it is okay.
 		 */
 		keyno = atoi(token);
-		if (keyno == 0) {
+		if (keyno < 1) {
 			log_maybe(&nerr,
 				  "authreadkeys: cannot change key %s",
 				  token);
@@ -180,6 +200,14 @@
 				  keyno);
 			continue;
 		}
+
+		/* We want to silently ignore keys where we do not
+		 * support the requested digest type. OTOH, we want to
+		 * make sure the file is well-formed.  That means we
+		 * have to process the line completely and have to
+		 * finally throw away the result... This is a bit more
+		 * work, but it also results in better error detection.
+		 */ 
 #ifdef OPENSSL
 		/*
 		 * The key type is the NID used by the message digest 
@@ -189,30 +217,28 @@
 		 */
 		keytype = keytype_from_text(token, NULL);
 		if (keytype == 0) {
-			log_maybe(&nerr,
+			log_maybe(NULL,
 				  "authreadkeys: invalid type for key %d",
 				  keyno);
-			continue;
-		}
-		if (EVP_get_digestbynid(keytype) == NULL) {
-			log_maybe(&nerr,
+		} else if (EVP_get_digestbynid(keytype) == NULL) {
+			log_maybe(NULL,
 				  "authreadkeys: no algorithm for key %d",
 				  keyno);
-			continue;
+			keytype = 0;
 		}
 #else	/* !OPENSSL follows */
-
 		/*
 		 * The key type is unused, but is required to be 'M' or
 		 * 'm' for compatibility.
 		 */
 		if (!(*token == 'M' || *token == 'm')) {
-			log_maybe(&nerr,
+			log_maybe(NULL,
 				  "authreadkeys: invalid type for key %d",
 				  keyno);
-			continue;
+			keytype = 0;
+		} else {
+			keytype = KEY_TYPE_MD5;
 		}
-		keytype = KEY_TYPE_MD5;
 #endif	/* !OPENSSL */
 
 		/*
@@ -269,26 +295,22 @@
 		}
 
 		token = nexttok(&line);
-DPRINTF(0, ("authreadkeys: full access list <%s>\n", (token) ? token : "NULL"));
+		DPRINTF(0, ("authreadkeys: full access list <%s>\n", (token) ? token : "NULL"));
 		if (token != NULL) {	/* A comma-separated IP access list */
 			char *tp = token;
 
 			while (tp) {
 				char *i;
-				KeyAccT ka;
+				sockaddr_u addr;
 
 				i = strchr(tp, (int)',');
 				if (i)
 					*i = '\0';
-DPRINTF(0, ("authreadkeys: access list:  <%s>\n", tp));
+				DPRINTF(0, ("authreadkeys: access list:  <%s>\n", tp));
 
-				if (is_ip_address(tp, AF_UNSPEC, &ka.addr)) {
-					KeyAccT *kap;
-
-					kap = emalloc(sizeof(KeyAccT));
-					memcpy(kap, &ka, sizeof ka);
-					kap->next = next->keyacclist;
-					next->keyacclist = kap;
+				if (is_ip_address(tp, AF_UNSPEC, &addr)) {
+					next->keyacclist = keyacc_new_push(
+						next->keyacclist, &addr);
 				} else {
 					log_maybe(&nerr,
 						  "authreadkeys: invalid IP address <%s> for key %d",
@@ -303,21 +325,25 @@
 			}
 		}
 
+		/* check if this has to be weeded out... */
+		if (0 == keytype) {
+			free_keydata(next);
+			next = NULL;
+			continue;
+		}
+		
 		INSIST(NULL != next);
 		next->next = list;
 		list = next;
 	}
 	fclose(fp);
-	if (nerr > nerr_maxlimit) {
-		msyslog(LOG_ERR,
-			"authreadkeys: rejecting file '%s' after %u errors (emergency break)",
-			file, nerr);
-		goto onerror;
-	}
 	if (nerr > 0) {
+		const char * why = "";
+		if (nerr > nerr_maxlimit)
+			why = " (emergency break)";
 		msyslog(LOG_ERR,
-			"authreadkeys: rejecting file '%s' after %u error(s)",
-			file, nerr);
+			"authreadkeys: rejecting file '%s' after %u error(s)%s",
+			file, nerr, why);
 		goto onerror;
 	}
 
@@ -328,9 +354,8 @@
 		list = next->next;
 		MD5auth_setkey(next->keyid, next->keytype,
 			       next->secbuf, next->seclen, next->keyacclist);
-		/* purge secrets from memory before free()ing it */
-		memset(next, 0, sizeof(*next) + next->seclen);
-		free(next);
+		next->keyacclist = NULL; /* consumed by MD5auth_setkey */
+		free_keydata(next);
 	}
 	return (1);
 
@@ -338,17 +363,7 @@
 	/* Mop up temporary storage before bailing out. */
 	while (NULL != (next = list)) {
 		list = next->next;
-
-		while (next->keyacclist) {
-			KeyAccT *kap = next->keyacclist;
-
-			next->keyacclist = kap->next;
-			free(kap);
-		}
-
-		/* purge secrets from memory before free()ing it */
-		memset(next, 0, sizeof(*next) + next->seclen);
-		free(next);
+		free_keydata(next);
 	}
 	return (0);
 }
Index: contrib/ntp/libntp/ntp_intres.c
===================================================================
--- contrib/ntp/libntp/ntp_intres.c	(版本 297264)
+++ contrib/ntp/libntp/ntp_intres.c	(版本 298770)
@@ -201,8 +201,6 @@
 /* === forward declarations === */
 static	u_int		reserve_dnschild_ctx(void);
 static	u_int		get_dnschild_ctx(void);
-static	void		alloc_dnsworker_context(u_int);
-/* static	void		free_dnsworker_context(u_int); */
 static	dnsworker_ctx *	get_worker_context(blocking_child *, u_int);
 static	void		scheduled_sleep(time_t, time_t,
 					dnsworker_ctx *);
@@ -949,18 +947,6 @@
 }
 
 
-static void
-alloc_dnsworker_context(
-	u_int idx
-	)
-{
-	const size_t worker_context_sz = sizeof(*dnsworker_contexts[0]);
-
-	REQUIRE(NULL == dnsworker_contexts[idx]);
-	dnsworker_contexts[idx] = emalloc_zero(worker_context_sz);
-}
-
-
 static dnsworker_ctx *
 get_worker_context(
 	blocking_child *	c,
@@ -967,29 +953,35 @@
 	u_int			idx
 	)
 {
-	static size_t	ps = sizeof(dnsworker_contexts[0]);
-	u_int	min_new_alloc;
-	u_int	new_alloc;
-	size_t	octets;
-	size_t	new_octets;
+	u_int		min_new_alloc;
+	u_int		new_alloc;
+	size_t		octets;
+	size_t		new_octets;
+	dnsworker_ctx *	retv;
 
+	worker_global_lock(TRUE);
+	
 	if (dnsworker_contexts_alloc <= idx) {
 		min_new_alloc = 1 + idx;
 		/* round new_alloc up to nearest multiple of 4 */
 		new_alloc = (min_new_alloc + 4) & ~(4 - 1);
-		new_octets = new_alloc * ps;
-		octets = dnsworker_contexts_alloc * ps;
+		new_octets = new_alloc * sizeof(dnsworker_ctx*);
+		octets = dnsworker_contexts_alloc * sizeof(dnsworker_ctx*);
 		dnsworker_contexts = erealloc_zero(dnsworker_contexts,
 						   new_octets, octets);
 		dnsworker_contexts_alloc = new_alloc;
+		retv = emalloc_zero(sizeof(dnsworker_ctx));
+		dnsworker_contexts[idx] = retv;
+	} else if (NULL == (retv = dnsworker_contexts[idx])) {
+		retv = emalloc_zero(sizeof(dnsworker_ctx));
+		dnsworker_contexts[idx] = retv;
 	}
-
-	if (NULL == dnsworker_contexts[idx])
-		alloc_dnsworker_context(idx);
-	ZERO(*dnsworker_contexts[idx]);
-	dnsworker_contexts[idx]->c = c;
-
-	return dnsworker_contexts[idx];
+	
+	worker_global_lock(FALSE);
+	
+	ZERO(*retv);
+	retv->c = c;
+	return retv;
 }
 
 
Index: contrib/ntp/libntp/recvbuff.c
===================================================================
--- contrib/ntp/libntp/recvbuff.c	(版本 297264)
+++ contrib/ntp/libntp/recvbuff.c	(版本 298770)
@@ -156,18 +156,15 @@
 void
 freerecvbuf(recvbuf_t *rb)
 {
-	if (rb == NULL) {
-		msyslog(LOG_ERR, "freerecvbuff received NULL buffer");
-		return;
+	if (rb) {
+		LOCK();
+		rb->used--;
+		if (rb->used != 0)
+			msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used);
+		LINK_SLIST(free_recv_list, rb, link);
+		free_recvbufs++;
+		UNLOCK();
 	}
-
-	LOCK();
-	rb->used--;
-	if (rb->used != 0)
-		msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used);
-	LINK_SLIST(free_recv_list, rb, link);
-	free_recvbufs++;
-	UNLOCK();
 }
 
 	
@@ -264,7 +261,7 @@
  */
 void
 purge_recv_buffers_for_fd(
-	SOCKET	fd
+	int	fd
 	)
 {
 	recvbuf_t *rbufp;
@@ -277,7 +274,12 @@
 	     rbufp != NULL;
 	     rbufp = next) {
 		next = rbufp->link;
-		if (rbufp->fd == fd) {
+#	    ifdef HAVE_IO_COMPLETION_PORT
+		if (rbufp->dstadr == NULL && rbufp->fd == fd)
+#	    else
+		if (rbufp->fd == fd)
+#	    endif
+		{
 			UNLINK_MID_FIFO(punlinked, full_recv_fifo,
 					rbufp, link, recvbuf_t);
 			INSIST(punlinked == rbufp);
Index: contrib/ntp/ntpd/invoke-ntp.conf.texi
===================================================================
--- contrib/ntp/ntpd/invoke-ntp.conf.texi	(版本 297264)
+++ contrib/ntp/ntpd/invoke-ntp.conf.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntp.conf.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:17:59 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:28:27 PM by AutoGen 5.18.5
 # From the definitions    ntp.conf.def
 # and the template file   agtexi-file.tpl
 @end ignore
@@ -108,8 +108,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+@code{reslist}
+billboard generated
+by
+@code{ntpq(1ntpqmdoc)}
+or
+@code{ntpdc(1ntpdcmdoc)},
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 @quotedblleft{}:@quotedblright{}
 in the address field.
@@ -129,9 +135,9 @@
 equivalent classes for that address family.
 @table @asis
 @item @code{pool} @kbd{address} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{server} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{peer} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{broadcast} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{ttl} @kbd{ttl}]}
+@item @code{server} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{true}]}
+@item @code{peer} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{true}]} @code{[@code{xleave}]}
+@item @code{broadcast} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{ttl} @kbd{ttl}]} @code{[@code{xleave}]}
 @item @code{manycastclient} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{ttl} @kbd{ttl}]}
 @end table
 
@@ -249,7 +255,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+@code{calldelay}
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -260,7 +268,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+@code{calldelay}
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -293,6 +303,11 @@
 @item @code{noselect}
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
+@item @code{preempt}
+Says the association can be preempted.
+@item @code{true}
+Marks the server as a truechimer.
+Use this option only for testing.
 @item @code{prefer}
 Marks the server as preferred.
 All other things being equal,
@@ -305,6 +320,11 @@
 provided in
 @file{/usr/share/doc/ntp})
 for further information.
+@item @code{true}
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+@emph{only}
+be used while testing an association.
 @item @code{ttl} @kbd{ttl}
 This option is used only with broadcast server and manycast
 client modes.
@@ -323,6 +343,12 @@
 packets.
 Versions 1-4 are the choices, with version 4 the
 default.
+@item @code{xleave}
+Valid in
+@code{peer}
+and
+@code{broadcast}
+modes only, this flag enables interleave mode.
 @end table
 @subsubsection Auxiliary Commands
 @table @asis
@@ -469,7 +495,7 @@
 commands and also by remote
 configuration commands sent by a
 @code{ntpdc(1ntpdcmdoc)}
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -649,7 +675,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -836,8 +862,8 @@
 @file{ntpkey_key_}@kbd{hostname}
 in the keys directory.
 @item @code{iffpar} @kbd{file}
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 @file{ntpkey_iff_}@kbd{hostname}
 in the keys directory.
 @item @code{leap} @kbd{file}
@@ -847,8 +873,7 @@
 in the keys directory.
 @item @code{mvpar} @kbd{file}
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 @file{ntpkey_mv_}@kbd{hostname}
 in the keys directory.
 @item @code{pw} @kbd{password}
@@ -990,7 +1015,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 @file{./scripts}
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 @sc{unix}
@@ -1319,7 +1344,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 @code{C},
-and the pid of the ntpd server process.
+and the pid of the
+@code{ntpd(1ntpdmdoc)}
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1363,7 +1390,9 @@
 by a determined cracker.
 
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+@code{restrict}
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1373,9 +1402,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 @subsubsection The Kiss-of-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1429,7 +1458,9 @@
 and a kiss-o'-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+@code{monitor}
+subcommand specifies the probability of discard
 for packets that overflow the rate-control window.
 @item @code{restrict} @code{address} @code{[@code{mask} @kbd{mask}]} @code{[@kbd{flag} @kbd{...}]}
 The
@@ -1485,7 +1516,9 @@
 last one, the packet is dropped.
 @item @code{limited}
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+@code{discard}
+command.
 A history of clients is kept using the
 monitoring capability of
 @code{ntpd(1ntpdmdoc)}.
@@ -1545,7 +1578,9 @@
 @item @code{notrap}
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+@code{ntpq(1ntpqmdoc)}
+control message
 protocol which is intended for use by remote event logging programs.
 @item @code{notrust}
 Deny service unless the packet is cryptographically authenticated.
@@ -1613,8 +1648,11 @@
 as well and is highly recommended, especially for broadcast modes.
 
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+@code{manycastclient}
+command, which is similar to the
+@code{server}
+command but with a multicast (IPv4 class
 @code{D}
 or IPv6 prefix
 @code{FF})
@@ -1684,7 +1722,9 @@
 @code{maxpolll}
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+@code{ttl}
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2293,7 +2333,8 @@
 otherwise, should be avoided.
 @item @code{dscp} @kbd{value}
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
 @item @code{enable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
 @item @code{disable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
 Provides a way to enable or disable various server options.
@@ -2502,7 +2543,8 @@
 message class may also be followed by the
 @code{all}
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 @verbatim
 logconfig =syncstatus +sysevents
@@ -2526,7 +2568,9 @@
 be used instead of the default system
 @code{syslog(3)}
 facility.
-This is the same operation as the -l command line option.
+This is the same operation as the
+@code{-l}
+command line option.
 @item @code{setvar} @kbd{variable} @code{[@code{default}]}
 This command adds an additional system variable.
 These
@@ -2654,7 +2698,8 @@
 function.
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 @item @code{filenum} @kbd{Nfiledescriptors}
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 @end table
 @item @code{trap} @kbd{host_address} @code{[@code{port} @kbd{port_number}]} @code{[@code{interface} @kbd{interface_address}]}
 This command configures a trap receiver at the given host
Index: contrib/ntp/ntpd/ntp.conf.5man
===================================================================
--- contrib/ntp/ntpd/ntp.conf.5man	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.5man	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp.conf 5man "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.conf 5man "26 Apr 2016" "4.2.8p7" "File Formats"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaOxR/ag-XsaGwR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:45 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
 .\" From the definitions ntp.conf.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
@@ -133,8 +133,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+\f\*[B-Font]reslist\f[]
+billboard generated
+by
+\fCntpq\f[]\fR(1ntpqmdoc)\f[]
+or
+\fCntpdc\f[]\fR(1ntpdcmdoc)\f[],
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 \*[Lq]\&:\*[Rq]
 in the address field.
@@ -157,11 +163,11 @@
 .TP 7
 .NOP \f\*[B-Font]pool\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
 .TP 7
-.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]]
 .TP 7
-.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]] [\f\*[B-Font]xleave\f[]]
 .TP 7
-.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]] [\f\*[B-Font]xleave\f[]]
 .TP 7
 .NOP \f\*[B-Font]manycastclient\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
 .PP
@@ -289,7 +295,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -301,7 +309,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -339,6 +349,13 @@
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
 .TP 7
+.NOP \f\*[B-Font]preempt\f[]
+Says the association can be preempted.
+.TP 7
+.NOP \f\*[B-Font]true\f[]
+Marks the server as a truechimer.
+Use this option only for testing.
+.TP 7
 .NOP \f\*[B-Font]prefer\f[]
 Marks the server as preferred.
 All other things being equal,
@@ -352,6 +369,12 @@
 \fI/usr/share/doc/ntp\f[])
 for further information.
 .TP 7
+.NOP \f\*[B-Font]true\f[]
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+\fIonly\f[]
+be used while testing an association.
+.TP 7
 .NOP \f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]
 This option is used only with broadcast server and manycast
 client modes.
@@ -371,6 +394,13 @@
 packets.
 Versions 1-4 are the choices, with version 4 the
 default.
+.TP 7
+.NOP \f\*[B-Font]xleave\f[]
+Valid in
+\f\*[B-Font]peer\f[]
+and
+\f\*[B-Font]broadcast\f[]
+modes only, this flag enables interleave mode.
 .PP
 .SS Auxiliary Commands
 .TP 7
@@ -529,7 +559,7 @@
 commands and also by remote
 configuration commands sent by a
 \fCntpdc\f[]\fR(1ntpdcmdoc)\f[]
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -735,7 +765,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -942,8 +972,8 @@
 in the keys directory.
 .TP 7
 .NOP \f\*[B-Font]iffpar\f[] \f\*[I-Font]file\f[]
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 \fIntpkey_iff_\f[]\f\*[I-Font]hostname\f[]
 in the keys directory.
 .TP 7
@@ -955,8 +985,7 @@
 .TP 7
 .NOP \f\*[B-Font]mvpar\f[] \f\*[I-Font]file\f[]
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 \fIntpkey_mv_\f[]\f\*[I-Font]hostname\f[]
 in the keys directory.
 .TP 7
@@ -1118,7 +1147,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 \fI./scripts\f[]
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 UNIX
@@ -1511,7 +1540,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 \f\*[B-Font]C\f[],
-and the pid of the ntpd server process.
+and the pid of the
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1559,7 +1590,9 @@
 .ne 2
 
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+\f\*[B-Font]restrict\f[]
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1569,9 +1602,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .SS The Kiss-of-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1627,7 +1660,9 @@
 and a kiss-o'-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+\f\*[B-Font]monitor\f[]
+subcommand specifies the probability of discard
 for packets that overflow the rate-control window.
 .TP 7
 .NOP \f\*[B-Font]restrict\f[] \f\*[B-Font]address\f[] [\f\*[B-Font]mask\f[] \f\*[I-Font]mask\f[]] [\f\*[I-Font]flag\f[] \f\*[I-Font]...\f[]]
@@ -1687,7 +1722,9 @@
 .TP 7
 .NOP \f\*[B-Font]limited\f[]
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+\f\*[B-Font]discard\f[]
+command.
 A history of clients is kept using the
 monitoring capability of
 \fCntpd\f[]\fR(1ntpdmdoc)\f[].
@@ -1754,7 +1791,9 @@
 .NOP \f\*[B-Font]notrap\f[]
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+\fCntpq\f[]\fR(1ntpqmdoc)\f[]
+control message
 protocol which is intended for use by remote event logging programs.
 .TP 7
 .NOP \f\*[B-Font]notrust\f[]
@@ -1832,8 +1871,11 @@
 .ne 2
 
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+\f\*[B-Font]manycastclient\f[]
+command, which is similar to the
+\f\*[B-Font]server\f[]
+command but with a multicast (IPv4 class
 \f\*[B-Font]D\f[]
 or IPv6 prefix
 \f\*[B-Font]FF\f[])
@@ -1909,7 +1951,9 @@
 \f\*[B-Font]maxpolll\f[]
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+\f\*[B-Font]ttl\f[]
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2571,7 +2615,8 @@
 .TP 7
 .NOP \f\*[B-Font]dscp\f[] \f\*[I-Font]value\f[]
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .TP 7
 .NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
 .TP 7
@@ -2798,7 +2843,8 @@
 message class may also be followed by the
 \f\*[B-Font]all\f[]
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .br
 .in +4
@@ -2833,7 +2879,9 @@
 be used instead of the default system
 \fCsyslog\f[]\fR(3)\f[]
 facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+\f\*[B-Font]\-l\f[]
+command line option.
 .TP 7
 .NOP \f\*[B-Font]setvar\f[] \f\*[I-Font]variable\f[] [\f\*[B-Font]default\f[]]
 This command adds an additional system variable.
@@ -2978,7 +3026,8 @@
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .TP 7
 .NOP \f\*[B-Font]filenum\f[] \f\*[I-Font]Nfiledescriptors\f[]
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .RE
 .TP 7
 .NOP \f\*[B-Font]trap\f[] \f\*[I-Font]host_address\f[] [\f\*[B-Font]port\f[] \f\*[I-Font]port_number\f[]] [\f\*[B-Font]interface\f[] \f\*[I-Font]interface_address\f[]]
Index: contrib/ntp/ntpd/ntp.conf.html
===================================================================
--- contrib/ntp/ntpd/ntp.conf.html	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.html	(版本 298770)
@@ -33,7 +33,7 @@
 <p>This document describes the configuration file for the NTP Project's
 <code>ntpd</code> program.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntp.conf</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntp.conf</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -296,7 +296,9 @@
 instead of the usual one. 
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+<code>calldelay</code>
+command to allow
 additional time for a modem or ISDN call to complete. 
 This is designed to improve timekeeping quality
 with the
@@ -306,7 +308,9 @@
 instead of the usual one. 
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+<code>calldelay</code>
+command to allow
 additional time for a modem or ISDN call to complete. 
 This is designed to speed the initial synchronization
 acquisition with the
@@ -335,6 +339,8 @@
 option to a lower limit of 4 (16 s). 
 <br><dt><code>noselect</code><dd>Marks the server as unused, except for display purposes. 
 The server is discarded by the selection algroithm. 
+<br><dt><code>preempt</code><dd>Says the association can be preempted. 
+<br><dt><code>true</code><dd>Marks the server as a truechimer. 
 <br><dt><code>prefer</code><dd>Marks the server as preferred. 
 All other things being equal,
 this host will be chosen for synchronization among a set of
@@ -362,6 +368,11 @@
 packets. 
 Versions 1-4 are the choices, with version 4 the
 default. 
+<br><dt><code>xleave</code><dd>Valid in
+<code>peer</code>
+and
+<code>broadcast</code>
+modes only, this flag enables interleave mode. 
 </dl>
 
 <h5 class="subsubsection">Auxiliary Commands</h5>
@@ -1369,7 +1380,9 @@
 by a determined cracker.
 
   <p>Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+<code>restrict</code>
+command
 or implicitly as the result of cryptographic or rate limit
 violations. 
 Cryptographic violations include certificate
@@ -1438,7 +1451,9 @@
 and a kiss-o'-death packet returned if enabled. 
 The default
 minimum average and minimum are 5 and 2, respectively. 
-The monitor subcommand specifies the probability of discard
+The
+<code>monitor</code>
+subcommand specifies the probability of discard
 for packets that overflow the rate-control window. 
 <br><dt><code>restrict</code> <code>address</code> <code>[mask </code><kbd>mask</kbd><code>]</code> <code>[</code><kbd>flag</kbd> <kbd>...</kbd><code>]</code><dd>The
 <kbd>address</kbd>
@@ -1490,7 +1505,9 @@
 If another KoD packet occurs within one second after the
 last one, the packet is dropped. 
 <br><dt><code>limited</code><dd>Deny service if the packet spacing violates the lower limits specified
-in the discard command. 
+in the
+<code>discard</code>
+command. 
 A history of clients is kept using the
 monitoring capability of
 <code>ntpd(1ntpdmdoc)</code>. 
@@ -1615,8 +1632,11 @@
 as well and is highly recommended, especially for broadcast modes.
 
   <p>A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+<code>manycastclient</code>
+command, which is similar to the
+<code>server</code>
+command but with a multicast (IPv4 class
 <code>D</code>
 or IPv6 prefix
 <code>FF</code>)
@@ -1686,7 +1706,9 @@
 <code>maxpolll</code>
 value specified in this command. 
 Initially, the TTL is
-set at the minimum hops specified by the ttl command. 
+set at the minimum hops specified by the
+<code>ttl</code>
+command. 
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found. 
@@ -2503,7 +2525,9 @@
 be used instead of the default system
 <code>syslog(3)</code>
 facility. 
-This is the same operation as the -l command line option. 
+This is the same operation as the
+<code>-l</code>
+command line option. 
 <br><dt><code>setvar</code> <kbd>variable</kbd> <code>[default]</code><dd>This command adds an additional system variable. 
 These
 variables can be used to distribute additional information such as
Index: contrib/ntp/ntpd/ntp.keys.5mdoc
===================================================================
--- contrib/ntp/ntpd/ntp.keys.5mdoc	(版本 297264)
+++ contrib/ntp/ntpd/ntp.keys.5mdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYS 5mdoc File Formats
 .Os SunOS 5.10
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:10 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.keys.def
 .\"  and the template file   agmdoc-file.tpl
 .Sh NAME
Index: contrib/ntp/ntpd/ntp_control.c
===================================================================
--- contrib/ntp/ntpd/ntp_control.c	(版本 297264)
+++ contrib/ntp/ntpd/ntp_control.c	(版本 298770)
@@ -911,7 +911,7 @@
 	};
 
 	u_int widx, bidx, mask;
-	if (!*name)
+	if ( ! (name && *name))
 		return FALSE;
 	
 	mask = 1u;
@@ -918,11 +918,11 @@
 	while (0 != (widx = (u_char)*name++)) {
 		bidx = (widx & 15) << 1;
 		widx = widx >> 4;
-		if (widx >= sizeof(chclass))
+		if (widx >= sizeof(chclass)/sizeof(chclass[0]))
 			return FALSE;
 		if (0 == ((chclass[widx] >> bidx) & mask))
 			return FALSE;
-		mask |= 2u;
+		mask = 2u;
 	}
 	return TRUE;
 }
@@ -3081,17 +3081,25 @@
 	char **data
 	)
 {
+	/* [Bug 3008] First check the packet data sanity, then search
+	 * the key. This improves the consistency of result values: If
+	 * the result is NULL once, it will never be EOV again for this
+	 * packet; If it's EOV, it will never be NULL again until the
+	 * variable is found and processed in a given 'var_list'. (That
+	 * is, a result is returned that is neither NULL nor EOV).
+	 */ 
 	static const struct ctl_var eol = { 0, EOV, NULL };
 	static char buf[128];
 	static u_long quiet_until;
 	const struct ctl_var *v;
-	const char *pch;
 	char *cp;
 	char *tp;
 
 	/*
-	 * Delete leading commas and white space
+	 * Part One: Validate the packet state
 	 */
+
+	/* Delete leading commas and white space */
 	while (reqpt < reqend && (*reqpt == ',' ||
 				  isspace((unsigned char)*reqpt)))
 		reqpt++;
@@ -3098,66 +3106,92 @@
 	if (reqpt >= reqend)
 		return NULL;
 
+	/* Scan the string in the packet until we hit comma or
+	 * EoB. Register position of first '=' on the fly. */
+	for (tp = NULL, cp = reqpt; cp != reqend; ++cp) {
+		if (*cp == '=' && tp == NULL)
+			tp = cp;
+		if (*cp == ',')
+			break;
+	}
+
+	/* Process payload, if any. */
+	*data = NULL;
+	if (NULL != tp) {
+		/* eventually strip white space from argument. */
+		const char *plhead = tp + 1; /* skip the '=' */
+		const char *pltail = cp;
+		size_t      plsize;
+
+		while (plhead != pltail && isspace((u_char)plhead[0]))
+			++plhead;
+		while (plhead != pltail && isspace((u_char)pltail[-1]))
+			--pltail;
+		
+		/* check payload size, terminate packet on overflow */
+		plsize = (size_t)(pltail - plhead);
+		if (plsize >= sizeof(buf))
+			goto badpacket;
+
+		/* copy data, NUL terminate, and set result data ptr */
+		memcpy(buf, plhead, plsize);
+		buf[plsize] = '\0';
+		*data = buf;
+	} else {
+		/* no payload, current end --> current name termination */
+		tp = cp;
+	}
+
+	/* Part Two
+	 *
+	 * Now we're sure that the packet data itself is sane. Scan the
+	 * list now. Make sure a NULL list is properly treated by
+	 * returning a synthetic End-Of-Values record. We must not
+	 * return NULL pointers after this point, or the behaviour would
+	 * become inconsistent if called several times with different
+	 * variable lists after an EoV was returned.  (Such a behavior
+	 * actually caused Bug 3008.)
+	 */
+	
 	if (NULL == var_list)
 		return &eol;
 
-	/*
-	 * Look for a first character match on the tag.  If we find
-	 * one, see if it is a full match.
-	 */
-	cp = reqpt;
-	for (v = var_list; !(EOV & v->flags); v++) {
-		if (!(PADDING & v->flags) && *cp == *(v->text)) {
-			pch = v->text;
-			while ('\0' != *pch && '=' != *pch && cp < reqend
-			       && *cp == *pch) {
-				cp++;
-				pch++;
+	for (v = var_list; !(EOV & v->flags); ++v)
+		if (!(PADDING & v->flags)) {
+			/* check if the var name matches the buffer */
+			const char *sp1 = reqpt;
+			const char *sp2 = v->text;
+			
+			while ((sp1 != tp) && *sp2 && (*sp1 == *sp2)) {
+				++sp1;
+				++sp2;
 			}
-			if ('\0' == *pch || '=' == *pch) {
-				while (cp < reqend && isspace((u_char)*cp))
-					cp++;
-				if (cp == reqend || ',' == *cp) {
-					buf[0] = '\0';
-					*data = buf;
-					if (cp < reqend)
-						cp++;
-					reqpt = cp;
-					return v;
-				}
-				if ('=' == *cp) {
-					cp++;
-					tp = buf;
-					while (cp < reqend && isspace((u_char)*cp))
-						cp++;
-					while (cp < reqend && *cp != ',') {
-						*tp++ = *cp++;
-						if ((size_t)(tp - buf) >= sizeof(buf)) {
-							ctl_error(CERR_BADFMT);
-							numctlbadpkts++;
-							NLOG(NLOG_SYSEVENT)
-								if (quiet_until <= current_time) {
-									quiet_until = current_time + 300;
-									msyslog(LOG_WARNING,
-"Possible 'ntpdx' exploit from %s#%u (possibly spoofed)", stoa(rmt_addr), SRCPORT(rmt_addr));
-								}
-							return NULL;
-						}
-					}
-					if (cp < reqend)
-						cp++;
-					*tp-- = '\0';
-					while (tp >= buf && isspace((u_char)*tp))
-						*tp-- = '\0';
-					reqpt = cp;
-					*data = buf;
-					return v;
-				}
-			}
-			cp = reqpt;
+			if (sp1 == tp && !*sp2)
+				break;
 		}
-	}
+
+	/* See if we have found a valid entry or not. If found, advance
+	 * the request pointer for the next round; if not, clear the
+	 * data pointer so we have no dangling garbage here.
+	 */
+	if (EOV & v->flags)
+		*data = NULL;
+	else
+		reqpt = cp + (cp != reqend);
 	return v;
+
+  badpacket:
+	/*TODO? somehow indicate this packet was bad, apart from syslog? */
+	numctlbadpkts++;
+	NLOG(NLOG_SYSEVENT)
+	    if (quiet_until <= current_time) {
+		    quiet_until = current_time + 300;
+		    msyslog(LOG_WARNING,
+			    "Possible 'ntpdx' exploit from %s#%u (possibly spoofed)",
+			    stoa(rmt_addr), SRCPORT(rmt_addr));
+	    }
+	reqpt = reqend; /* never again for this packet! */
+	return NULL;
 }
 
 
@@ -3334,7 +3368,11 @@
 			gotvar = 1;
 		} else {
 			v = ctl_getitem(ext_sys_var, &valuep);
-			INSIST(v != NULL);
+			if (NULL == v) {
+				ctl_error(CERR_BADVALUE);
+				free(wants);
+				return;
+			}
 			if (EOV & v->flags) {
 				ctl_error(CERR_UNKNOWNVAR);
 				free(wants);
@@ -4575,7 +4613,12 @@
 			gotvar = TRUE;
 		} else {
 			v = ctl_getitem(kv, &valuep);
-			INSIST(NULL != v);
+			if (NULL == v) {
+				ctl_error(CERR_BADVALUE);
+				free(wants);
+				free_varlist(cs.kv_list);
+				return;
+			}
 			if (EOV & v->flags) {
 				ctl_error(CERR_UNKNOWNVAR);
 				free(wants);
Index: contrib/ntp/ntpd/ntp_timer.c
===================================================================
--- contrib/ntp/ntpd/ntp_timer.c	(版本 297264)
+++ contrib/ntp/ntpd/ntp_timer.c	(版本 298770)
@@ -276,6 +276,12 @@
 	u_int	seconds		/* 0 cancels */
 	)
 {
+#if defined(HAVE_DROPROOT) && defined(NEED_EARLY_FORK)
+	if (droproot) {
+		worker_idle_timer = 0;
+		return;
+	}
+#endif
 	if (0 == seconds) {
 		worker_idle_timer = 0;
 		return;
Index: contrib/ntp/ntpd/ntpd.1ntpdmdoc
===================================================================
--- contrib/ntp/ntpd/ntpd.1ntpdmdoc	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.1ntpdmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPD 1ntpdmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpd-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpd/ntpd.mdoc.in
===================================================================
--- contrib/ntp/ntpd/ntpd.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPD @NTPD_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpd-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpdc/ntpdc-opts.h
===================================================================
--- contrib/ntp/ntpdc/ntpdc-opts.h	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:18:21 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:28:50 PM by AutoGen 5.18.5
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  *
@@ -83,9 +83,9 @@
 /** count of all options for ntpdc */
 #define OPTION_CT    15
 /** ntpdc version */
-#define NTPDC_VERSION       "4.2.8p6"
+#define NTPDC_VERSION       "4.2.8p7"
 /** Full ntpdc version text */
-#define NTPDC_FULL_VERSION  "ntpdc 4.2.8p6"
+#define NTPDC_FULL_VERSION  "ntpdc 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
Index: contrib/ntp/ntpd/ntp.conf.def
===================================================================
--- contrib/ntp/ntpd/ntp.conf.def	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.def	(版本 298770)
@@ -113,8 +113,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq 1ntpqmdoc
+or
+.Xr ntpdc 1ntpdcmdoc ,
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 .Dq \&:
 in the address field.
@@ -149,6 +155,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
 .Xc
 .It Xo Ic peer Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -156,6 +163,8 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
 .Xc
 .It Xo Ic broadcast Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -163,6 +172,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm ttl Ar ttl
+.Op Cm xleave
 .Xc
 .It Xo Ic manycastclient Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -288,7 +298,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -299,7 +311,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -332,6 +346,11 @@
 .It Cm noselect
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
 .It Cm prefer
 Marks the server as preferred.
 All other things being equal,
@@ -344,6 +363,11 @@
 provided in
 .Pa /usr/share/doc/ntp )
 for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
 .It Cm ttl Ar ttl
 This option is used only with broadcast server and manycast
 client modes.
@@ -362,6 +386,12 @@
 packets.
 Versions 1-4 are the choices, with version 4 the
 default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
 .El
 .Ss Auxiliary Commands
 .Bl -tag -width indent
@@ -507,7 +537,7 @@
 commands and also by remote
 configuration commands sent by a
 .Xr ntpdc 1ntpdcmdoc
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -697,7 +727,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -895,8 +925,8 @@
 .Pa ntpkey_key_ Ns Ar hostname
 in the keys directory.
 .It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 .Pa ntpkey_iff_ Ns Ar hostname
 in the keys directory.
 .It Cm leap Ar file
@@ -906,8 +936,7 @@
 in the keys directory.
 .It Cm mvpar Ar file
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 .Pa ntpkey_mv_ Ns Ar hostname
 in the keys directory.
 .It Cm pw Ar password
@@ -1048,7 +1077,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 .Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 .Ux
@@ -1382,7 +1411,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 .Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd 1ntpdmdoc
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1425,7 +1456,9 @@
 by a determined cracker.
 .Pp
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1435,9 +1468,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .Ss The Kiss-of-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1495,7 +1528,9 @@
 and a kiss-o'-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
 for packets that overflow the rate-control window.
 .It Xo Ic restrict address
 .Op Cm mask Ar mask
@@ -1554,7 +1589,9 @@
 last one, the packet is dropped.
 .It Cm limited
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
 A history of clients is kept using the
 monitoring capability of
 .Xr ntpd 1ntpdmdoc .
@@ -1614,7 +1651,9 @@
 .It Cm notrap
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq 1ntpqmdoc
+control message
 protocol which is intended for use by remote event logging programs.
 .It Cm notrust
 Deny service unless the packet is cryptographically authenticated.
@@ -1681,8 +1720,11 @@
 as well and is highly recommended, especially for broadcast modes.
 .Pp
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
 .Cm D
 or IPv6 prefix
 .Cm FF )
@@ -1752,7 +1794,9 @@
 .Cm maxpolll
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2390,7 +2434,8 @@
 otherwise, should be avoided.
 .It Ic dscp Ar value
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .It Xo Ic enable
 .Oo
 .Cm auth | Cm bclient |
@@ -2629,7 +2674,8 @@
 message class may also be followed by the
 .Cm all
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .Bd -literal
 logconfig =syncstatus +sysevents
@@ -2653,7 +2699,9 @@
 be used instead of the default system
 .Xr syslog 3
 facility.
-This is the same operation as the -l command line option.
+This is the same operation as the
+.Fl l
+command line option.
 .It Ic setvar Ar variable Op Cm default
 This command adds an additional system variable.
 These
@@ -2805,7 +2853,8 @@
 function.
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .El
 .It Xo Ic trap Ar host_address
 .Op Cm port Ar port_number
Index: contrib/ntp/ntpd/ntp.keys.5man
===================================================================
--- contrib/ntp/ntpd/ntp.keys.5man	(版本 297264)
+++ contrib/ntp/ntpd/ntp.keys.5man	(版本 298770)
@@ -1,8 +1,8 @@
-.TH ntp.keys 5man "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.keys 5man "26 Apr 2016" "4.2.8p7" "File Formats"
 .\"
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.man)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:17:51 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.keys.def
 .\"  and the template file   agman-file.tpl
 .Sh NAME
Index: contrib/ntp/ntpd/ntp.keys.mdoc.in
===================================================================
--- contrib/ntp/ntpd/ntp.keys.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpd/ntp.keys.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYS 5 File Formats
 .Os SunOS 5.10
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:10 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.keys.def
 .\"  and the template file   agmdoc-file.tpl
 .Sh NAME
Index: contrib/ntp/ntpd/ntp.conf.mdoc.in
===================================================================
--- contrib/ntp/ntpd/ntp.conf.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_CONF 5 File Formats
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:07 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -111,8 +111,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC\-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq @NTPQ_MS@
+or
+.Xr ntpdc @NTPDC_MS@ ,
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 .Dq \&:
 in the address field.
@@ -147,6 +153,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
 .Xc
 .It Xo Ic peer Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -154,6 +161,8 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
 .Xc
 .It Xo Ic broadcast Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -161,6 +170,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm ttl Ar ttl
+.Op Cm xleave
 .Xc
 .It Xo Ic manycastclient Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -286,7 +296,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -297,7 +309,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -330,6 +344,11 @@
 .It Cm noselect
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
 .It Cm prefer
 Marks the server as preferred.
 All other things being equal,
@@ -342,6 +361,11 @@
 provided in
 .Pa /usr/share/doc/ntp )
 for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
 .It Cm ttl Ar ttl
 This option is used only with broadcast server and manycast
 client modes.
@@ -360,6 +384,12 @@
 packets.
 Versions 1\-4 are the choices, with version 4 the
 default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
 .El
 .Ss Auxiliary Commands
 .Bl -tag -width indent
@@ -505,7 +535,7 @@
 commands and also by remote
 configuration commands sent by a
 .Xr ntpdc @NTPDC_MS@
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -695,7 +725,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -893,8 +923,8 @@
 .Pa ntpkey_key_ Ns Ar hostname
 in the keys directory.
 .It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 .Pa ntpkey_iff_ Ns Ar hostname
 in the keys directory.
 .It Cm leap Ar file
@@ -904,8 +934,7 @@
 in the keys directory.
 .It Cm mvpar Ar file
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 .Pa ntpkey_mv_ Ns Ar hostname
 in the keys directory.
 .It Cm pw Ar password
@@ -1046,7 +1075,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 .Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 .Ux
@@ -1380,7 +1409,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 .Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd @NTPD_MS@
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1423,7 +1454,9 @@
 by a determined cracker.
 .Pp
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1433,9 +1466,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .Ss The Kiss\-of\-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1493,7 +1526,9 @@
 and a kiss\-o'\-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
 for packets that overflow the rate\-control window.
 .It Xo Ic restrict address
 .Op Cm mask Ar mask
@@ -1552,7 +1587,9 @@
 last one, the packet is dropped.
 .It Cm limited
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
 A history of clients is kept using the
 monitoring capability of
 .Xr ntpd @NTPD_MS@ .
@@ -1612,7 +1649,9 @@
 .It Cm notrap
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq @NTPQ_MS@
+control message
 protocol which is intended for use by remote event logging programs.
 .It Cm notrust
 Deny service unless the packet is cryptographically authenticated.
@@ -1679,8 +1718,11 @@
 as well and is highly recommended, especially for broadcast modes.
 .Pp
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
 .Cm D
 or IPv6 prefix
 .Cm FF )
@@ -1750,7 +1792,9 @@
 .Cm maxpolll
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2388,7 +2432,8 @@
 otherwise, should be avoided.
 .It Ic dscp Ar value
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6\-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6\-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .It Xo Ic enable
 .Oo
 .Cm auth | Cm bclient |
@@ -2627,7 +2672,8 @@
 message class may also be followed by the
 .Cm all
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .Bd -literal
 logconfig =syncstatus +sysevents
@@ -2651,7 +2697,9 @@
 be used instead of the default system
 .Xr syslog 3
 facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+.Fl l
+command line option.
 .It Ic setvar Ar variable Op Cm default
 This command adds an additional system variable.
 These
@@ -2803,7 +2851,8 @@
 function.
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .El
 .It Xo Ic trap Ar host_address
 .Op Cm port Ar port_number
Index: contrib/ntp/ntpd/ntp.keys.man.in
===================================================================
--- contrib/ntp/ntpd/ntp.keys.man.in	(版本 297264)
+++ contrib/ntp/ntpd/ntp.keys.man.in	(版本 298770)
@@ -1,8 +1,8 @@
-.TH ntp.keys 5 "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.keys 5 "26 Apr 2016" "4.2.8p7" "File Formats"
 .\"
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.man)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:17:51 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.keys.def
 .\"  and the template file   agman-file.tpl
 .Sh NAME
Index: contrib/ntp/ntpd/ntp_proto.c
===================================================================
--- contrib/ntp/ntpd/ntp_proto.c	(版本 297264)
+++ contrib/ntp/ntpd/ntp_proto.c	(版本 298770)
@@ -25,6 +25,11 @@
 #include <unistd.h>
 #endif
 
+/* [Bug 3031] define automatic broadcastdelay cutoff preset */
+#ifndef BDELAY_DEFAULT
+# define BDELAY_DEFAULT (-0.050)
+#endif
+
 /*
  * This macro defines the authentication state. If x is 1 authentication
  * is required; othewise it is optional.
@@ -50,6 +55,12 @@
 	UNKNOWNKISS			/* Unknown Kiss Code */
 };
 
+enum nak_error_codes {
+	NONAK,				/* No NAK seen */
+	INVALIDNAK,			/* NAK cannot be used */
+	VALIDNAK			/* NAK is valid */
+};
+
 /*
  * traffic shaping parameters
  */
@@ -166,7 +177,10 @@
 int unpeer_crypto_nak_early	= 1;	/* crypto_NAK (TEST5) */
 int unpeer_digest_early		= 1;	/* bad digest (TEST5) */
 
-static int kiss_code_check(u_char hisleap, u_char hisstratum, u_char hismode, u_int32 refid);
+int dynamic_interleave = DYNAMIC_INTERLEAVE;	/* Bug 2978 mitigation */
+
+int kiss_code_check(u_char hisleap, u_char hisstratum, u_char hismode, u_int32 refid);
+enum nak_error_codes valid_NAK(struct peer *peer, struct recvbuf *rbufp, u_char hismode);
 static	double	root_distance	(struct peer *);
 static	void	clock_combine	(peer_select *, int, int);
 static	void	peer_xmit	(struct peer *);
@@ -253,6 +267,68 @@
 }
 
 
+/* 
+ * Check that NAK is valid
+ */
+enum nak_error_codes
+valid_NAK(
+	  struct peer *peer,
+	  struct recvbuf *rbufp,
+	  u_char hismode
+	  )
+{
+	int base_packet_length = MIN_V4_PKT_LEN;
+	int remainder_size;
+	struct pkt *rpkt;
+	int keyid;
+
+	/*
+	 * Check to see if there is something beyond the basic packet
+	 */
+	if (rbufp->recv_length == base_packet_length) {
+		return NONAK;
+	}
+
+	remainder_size = rbufp->recv_length - base_packet_length;
+	/*
+	 * Is this a potential NAK?
+	 */
+	if (remainder_size != 4) {
+		return NONAK;
+	}
+
+	/*
+	 * Only server responses can contain NAK's
+	 */
+
+	if (hismode != MODE_SERVER &&
+	    hismode != MODE_ACTIVE &&
+	    hismode != MODE_PASSIVE
+	    ) {
+		return (INVALIDNAK);
+	}
+
+	/* 
+	 * Make sure that the extra field in the packet is all zeros
+	 */
+	rpkt = &rbufp->recv_pkt;
+	keyid = ntohl(((u_int32 *)rpkt)[base_packet_length / 4]);
+	if (keyid != 0) {
+		return (INVALIDNAK);
+	}
+
+	/* 
+	 * Only valid if peer uses a key
+	 */
+	if (peer->keyid > 0 || peer->flags & FLAG_SKEY) {
+		return (VALIDNAK);
+	}
+	else {
+		return (INVALIDNAK);
+	}
+}
+
+
 /*
  * transmit - transmit procedure called by poll timeout
  */
@@ -493,6 +569,7 @@
 	int	has_mac;		/* length of MAC field */
 	int	authlen;		/* offset of MAC field */
 	int	is_authentic = 0;	/* cryptosum ok */
+	int	crypto_nak_test;	/* result of crypto-NAK check */
 	int	retcode = AM_NOMATCH;	/* match code */
 	keyid_t	skeyid = 0;		/* key IDs */
 	u_int32	opcode = 0;		/* extension field opcode */
@@ -617,6 +694,7 @@
 	 * extension field is present, so we subtract the length of the
 	 * field and go around again.
 	 */
+
 	authlen = LEN_PKT_NOMAC;
 	has_mac = rbufp->recv_length - authlen;
 	while (has_mac > 0) {
@@ -767,7 +845,21 @@
 	 * is zero, acceptable outcomes of y are NONE and OK. If x is
 	 * one, the only acceptable outcome of y is OK.
 	 */
+	crypto_nak_test = valid_NAK(peer, rbufp, hismode);
 
+	/*
+	 * Drop any invalid crypto-NAKs
+	 */
+	if (crypto_nak_test == INVALIDNAK) {
+		report_event(PEVNT_AUTH, peer, "Invalid_NAK");
+		if (0 != peer) {
+			peer->badNAK++;
+		}
+		msyslog(LOG_ERR, "Invalid-NAK error at %ld %s<-%s", 
+			current_time, stoa(dstadr_sin), stoa(&rbufp->recv_srcadr));
+		return;
+	}
+
 	if (has_mac == 0) {
 		restrict_mask &= ~RES_MSSNTP;
 		is_authentic = AUTH_NONE; /* not required */
@@ -777,7 +869,7 @@
 			    authlen,
 			    ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
 			    ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
-	} else if (has_mac == 4) {
+	} else if (crypto_nak_test == VALIDNAK) {
 		restrict_mask &= ~RES_MSSNTP;
 		is_authentic = AUTH_CRYPTO; /* crypto-NAK */
 		DPRINTF(2, ("receive: at %ld %s<-%s mode %d/%s:%s keyid %08x len %d auth %d org %#010x.%08x xmt %#010x.%08x MAC4\n",
@@ -1144,7 +1236,7 @@
 		/*
 		 * Determine whether to execute the initial volley.
 		 */
-		if (sys_bdelay != 0) {
+		if (sys_bdelay > 0.0) {
 #ifdef AUTOKEY
 			/*
 			 * If a two-way exchange is not possible,
@@ -1303,9 +1395,9 @@
 #endif /* AUTOKEY */
 
 		if (MODE_BROADCAST == hismode) {
-			u_char poll;
-			int bail = 0;
-			l_fp tdiff;
+			int	bail = 0;
+			l_fp	tdiff;
+			u_long	deadband;
 
 			DPRINTF(2, ("receive: PROCPKT/BROADCAST: prev pkt %ld seconds ago, ppoll: %d, %d secs\n",
 				    (current_time - peer->timelastrec),
@@ -1327,11 +1419,9 @@
 					peer->ppoll, pkt->ppoll);
 			}
 
-			poll = min(peer->maxpoll,
-				   max(peer->minpoll, pkt->ppoll));
-
 			/* This is error-worthy */
-			if (pkt->ppoll != poll) {
+			if (pkt->ppoll < peer->minpoll ||
+			    pkt->ppoll > peer->maxpoll  ) {
 				msyslog(LOG_INFO, "receive: broadcast poll of %ud from %s is out-of-range (%d to %d)!",
 					pkt->ppoll, stoa(&rbufp->recv_srcadr),
 					peer->minpoll, peer->maxpoll);
@@ -1338,16 +1428,19 @@
 				++bail;
 			}
 
-			if (  (current_time - peer->timelastrec)
-			    < (1 << pkt->ppoll)) {
-				msyslog(LOG_INFO, "receive: broadcast packet from %s arrived after %ld, not %d seconds!",
+			/* too early? worth an error, too! */
+			deadband = (1u << pkt->ppoll);
+			if (FLAG_BC_VOL & peer->flags)
+				deadband -= 3;	/* allow greater fuzz after volley */
+			if ((current_time - peer->timelastrec) < deadband) {
+				msyslog(LOG_INFO, "receive: broadcast packet from %s arrived after %lu, not %lu seconds!",
 					stoa(&rbufp->recv_srcadr),
 					(current_time - peer->timelastrec),
-					(1 << pkt->ppoll)
-					);
+					deadband);
 				++bail;
 			}
 
+			/* Alert if time from the server is non-monotonic */
 			tdiff = p_xmt;
 			L_SUB(&tdiff, &peer->bxmt);
 			if (tdiff.l_i < 0) {
@@ -1401,6 +1494,7 @@
 		return;
 	}
 #endif	/* AUTOKEY */
+
 	peer->received++;
 	peer->flash &= ~PKT_TEST_MASK;
 	if (peer->flags & FLAG_XBOGUS) {
@@ -1412,12 +1506,22 @@
 	 * Next comes a rigorous schedule of timestamp checking. If the
 	 * transmit timestamp is zero, the server has not initialized in
 	 * interleaved modes or is horribly broken.
+	 *
+	 * A KoD packet we pay attention to cannot have a 0 transmit
+	 * timestamp.
 	 */
 	if (L_ISZERO(&p_xmt)) {
 		peer->flash |= TEST3;			/* unsynch */
+		if (0 == hisstratum) {			/* KoD packet */
+			peer->bogusorg++;		/* for TEST2 or TEST3 */
+			msyslog(LOG_INFO,
+				"receive: Unexpected zero transmit timestamp in KoD from %s",
+				ntoa(&peer->srcadr));
+			return;
+		}
 
 	/*
-	 * If the transmit timestamp duplicates a previous one, the
+	 * If the transmit timestamp duplicates our previous one, the
 	 * packet is a replay. This prevents the bad guys from replaying
 	 * the most recent packet, authenticated or not.
 	 */
@@ -1442,14 +1546,66 @@
 		}
 
 	/*
+	 * Basic KoD validation checking:
+	 *
+	 * KoD packets are a mixed-blessing.  Forged KoD packets
+	 * are DoS attacks.  There are rare situations where we might
+	 * get a valid KoD response, though.  Since KoD packets are
+	 * a special case that complicate the checks we do next, we
+	 * handle the basic KoD checks here.
+	 *
+	 * Note that we expect the incoming KoD packet to have its
+	 * (nonzero) org, rec, and xmt timestamps set to the xmt timestamp
+	 * that we have previously sent out.  Watch interleave mode.
+	 */
+	} else if (0 == hisstratum) {
+		DEBUG_INSIST(!L_ISZERO(&p_xmt));
+		if (   L_ISZERO(&p_org)		/* We checked p_xmt above */
+		    || L_ISZERO(&p_rec)) {
+			peer->bogusorg++;
+			msyslog(LOG_INFO,
+				"receive: KoD packet from %s has a zero org or rec timestamp.  Ignoring.",
+				ntoa(&peer->srcadr));
+			return;
+		}
+
+		if (   !L_ISEQU(&p_xmt, &p_org)
+		    || !L_ISEQU(&p_xmt, &p_rec)) {
+			peer->bogusorg++;
+			msyslog(LOG_INFO,
+				"receive: KoD packet from %s has inconsistent xmt/org/rec timestamps.  Ignoring.",
+				ntoa(&peer->srcadr));
+			return;
+		}
+
+		/* Be conservative */
+		if (peer->flip == 0 && !L_ISEQU(&p_org, &peer->aorg)) {
+			peer->bogusorg++;
+			msyslog(LOG_INFO,
+				"receive: flip 0 KoD origin timestamp %#010x.%08x from %s does not match %#010x.%08x - ignoring.",
+				p_org.l_ui, p_org.l_uf,
+				ntoa(&peer->srcadr),
+				peer->aorg.l_ui, peer->aorg.l_uf);
+			return;
+		} else if (peer->flip == 1 && !L_ISEQU(&p_org, &peer->borg)) {
+			peer->bogusorg++;
+			msyslog(LOG_INFO,
+				"receive: flip 1 KoD origin timestamp %#010x.%08x from %s does not match interleave %#010x.%08x - ignoring.",
+				p_org.l_ui, p_org.l_uf,
+				ntoa(&peer->srcadr),
+				peer->borg.l_ui, peer->borg.l_uf);
+			return;
+		}
+	
+	/*
 	 * Basic mode checks:
 	 *
 	 * If there is no origin timestamp, it's either an initial packet
 	 * or we've already received a response to our query.  Of course,
 	 * should 'aorg' be all-zero because this really was the original
-	 * transmit timestamp, we'll drop the reply.  There is a window of
-	 * one nanosecond once every 136 years' time where this is possible.
-	 * We currently ignore this situation.
+	 * transmit timestamp, we'll ignore this reply.  There is a window
+	 * of one nanosecond once every 136 years' time where this is
+	 * possible.  We currently ignore this situation.
 	 *
 	 * Otherwise, check for bogus packet in basic mode.
 	 * If it is bogus, switch to interleaved mode and resynchronize,
@@ -1460,24 +1616,37 @@
 	 * be from us, attempting to cause our server to KoD us.
 	 */
 	} else if (peer->flip == 0) {
-		if (0 < hisstratum && L_ISZERO(&p_org)) {
+		INSIST(0 != hisstratum);
+		if (0) {
+		} else if (L_ISZERO(&p_org)) {
+			msyslog(LOG_INFO,
+				"receive: Got 0 origin timestamp from %s@%s xmt %#010x.%08x",
+				hm_str, ntoa(&peer->srcadr),
+				ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
 			L_CLR(&peer->aorg);
-		} else if (    L_ISZERO(&peer->aorg)
-			   || !L_ISEQU(&p_org, &peer->aorg)) {
+		} else if (!L_ISEQU(&p_org, &peer->aorg)) {
+			/* are there cases here where we should bail? */
+			/* Should we set TEST2 if we decide to try xleave? */
 			peer->bogusorg++;
 			peer->flash |= TEST2;	/* bogus */
 			msyslog(LOG_INFO,
-				"receive: Unexpected origin timestamp %#010x.%08x from %s xmt %#010x.%08x",
+				"receive: Unexpected origin timestamp %#010x.%08x does not match aorg %#010x.%08x from %s@%s xmt %#010x.%08x",
 				ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
-				ntoa(&peer->srcadr),
+				peer->aorg.l_ui, peer->aorg.l_uf,
+				hm_str, ntoa(&peer->srcadr),
 				ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
 			if (  !L_ISZERO(&peer->dst)
 			    && L_ISEQU(&p_org, &peer->dst)) {
 				/* Might be the start of an interleave */
-				peer->flip = 1;
-				report_event(PEVNT_XLEAVE, peer, NULL);
+				if (dynamic_interleave) {
+					peer->flip = 1;
+					report_event(PEVNT_XLEAVE, peer, NULL);
+				} else {
+					msyslog(LOG_INFO,
+						"receive: Dynamic interleave from %s@%s denied",
+						hm_str, ntoa(&peer->srcadr));
+				}
 			}
-			return; /* Bogus or possible interleave packet */
 		} else {
 			L_CLR(&peer->aorg);
 		}
@@ -1507,7 +1676,7 @@
 	 * client packet. The server might have just changed keys. Clear
 	 * the association and restart the protocol.
 	 */
-	if (is_authentic == AUTH_CRYPTO) {
+	if (crypto_nak_test == VALIDNAK) {
 		report_event(PEVNT_AUTH, peer, "crypto_NAK");
 		peer->flash |= TEST5;		/* bad auth */
 		peer->badauth++;
@@ -1600,10 +1769,12 @@
 	/*
 	 * If:
 	 *	- this is a *cast (uni-, broad-, or m-) server packet
-	 *	- and it's authenticated
+	 *	- and it's symmetric-key authenticated
 	 * then see if the sender's IP is trusted for this keyid.
 	 * If it is, great - nothing special to do here.
 	 * Otherwise, we should report and bail.
+	 *
+	 * Autokey-authenticated packets are accepted.
 	 */
 
 	switch (hismode) {
@@ -1610,7 +1781,10 @@
 	    case MODE_SERVER:		/* server mode */
 	    case MODE_BROADCAST:	/* broadcast mode */
 	    case MODE_ACTIVE:		/* symmetric active mode */
+	    case MODE_PASSIVE:		/* symmetric passive mode */
 		if (   is_authentic == AUTH_OK
+		    && skeyid
+		    && skeyid <= NTP_MAXKEY
 		    && !authistrustedip(skeyid, &peer->srcadr)) {
 			report_event(PEVNT_AUTH, peer, "authIP");
 			peer->badauth++;
@@ -1618,8 +1792,6 @@
 		}
 	    	break;
 
-	    case MODE_UNSPEC:		/* unspecified (old version) */
-	    case MODE_PASSIVE:		/* symmetric passive mode */
 	    case MODE_CLIENT:		/* client mode */
 #if 0		/* At this point, MODE_CONTROL is overloaded by MODE_BCLIENT */
 	    case MODE_CONTROL:		/* control mode */
@@ -1627,7 +1799,12 @@
 	    case MODE_PRIVATE:		/* private mode */
 	    case MODE_BCLIENT:		/* broadcast client mode */
 	    	break;
+
+	    case MODE_UNSPEC:		/* unspecified (old version) */
 	    default:
+		msyslog(LOG_INFO,
+			"receive: Unexpected mode (%d) in packet from %s",
+			hismode, ntoa(&peer->srcadr));
 	    	break;
 	}
 
@@ -1958,6 +2135,9 @@
 			peer->aorg = p_xmt;
 			peer->borg = peer->dst;
 			if (t34 < 0 || t34 > 1.) {
+				/* drop all if in the initial volley */
+				if (FLAG_BC_VOL & peer->flags)
+					goto bcc_init_volley_fail;
 				snprintf(statstr, sizeof(statstr),
 				    "offset %.6f delay %.6f", t21, t34);
 				report_event(PEVNT_XERR, peer, statstr);
@@ -1983,11 +2163,23 @@
 		 * between the unicast timestamp and the broadcast
 		 * timestamp. This works for both basic and interleaved
 		 * modes.
+		 * [Bug 3031] Don't keep this peer when the delay 
+		 * calculation gives reason to suspect clock steps.
+		 * This is assumed for delays > 50ms.
 		 */
 		if (FLAG_BC_VOL & peer->flags) {
 			peer->flags &= ~FLAG_BC_VOL;
 			peer->delay = fabs(peer->offset - p_offset) * 2;
+			DPRINTF(2, ("broadcast volley: initial delay=%.6f\n",
+				peer->delay));
+			if (peer->delay > fabs(sys_bdelay)) {
+		bcc_init_volley_fail:
+				DPRINTF(2, ("%s", "broadcast volley: initial delay exceeds limit\n"));
+				unpeer(peer);
+				return;
+			}
 		}
+		peer->nextdate = current_time + (1u << peer->ppoll) - 2u;
 		p_del = peer->delay;
 		p_offset += p_del / 2;
 
@@ -4018,6 +4210,7 @@
 }
 #endif /* AUTOKEY */
 
+
 #ifdef WORKER
 void
 pool_name_resolved(
@@ -4333,7 +4526,7 @@
 	sys_survivors = 0;
 	sys_manycastserver = 0;
 	sys_bclient = 0;
-	sys_bdelay = 0;
+	sys_bdelay = BDELAY_DEFAULT;	/*[Bug 3031] delay cutoff */
 	sys_authenticate = 1;
 	sys_stattime = current_time;
 	orphwait = current_time + sys_orphwait;
@@ -4426,7 +4619,7 @@
 		break;
 
 	case PROTO_BROADDELAY:	/* default broadcast delay (bdelay) */
-		sys_bdelay = dvalue;
+		sys_bdelay = (dvalue ? dvalue : BDELAY_DEFAULT);
 		break;
 
 	case PROTO_CEILING:	/* stratum ceiling (ceiling) */
Index: contrib/ntp/ntpd/ntpd-opts.h
===================================================================
--- contrib/ntp/ntpd/ntpd-opts.h	(版本 297264)
+++ contrib/ntp/ntpd/ntpd-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:15:43 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:26:13 PM by AutoGen 5.18.5
  *  From the definitions    ntpd-opts.def
  *  and the template file   options
  *
@@ -106,9 +106,9 @@
 /** count of all options for ntpd */
 #define OPTION_CT    38
 /** ntpd version */
-#define NTPD_VERSION       "4.2.8p6"
+#define NTPD_VERSION       "4.2.8p7"
 /** Full ntpd version text */
-#define NTPD_FULL_VERSION  "ntpd 4.2.8p6"
+#define NTPD_FULL_VERSION  "ntpd 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
Index: contrib/ntp/ntpd/ntpd.html
===================================================================
--- contrib/ntp/ntpd/ntpd.html	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.html	(版本 298770)
@@ -39,7 +39,7 @@
 symmetric and broadcast modes, and with both symmetric-key and public-key
 cryptography.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntpd</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntpd</code>.
 
 <ul class="menu">
 <li><a accesskey="1" href="#ntpd-Description">ntpd Description</a>:             Description
@@ -220,7 +220,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p5
+<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p6
 Usage:  ntpd [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
                 [ &lt;server1&gt; ... &lt;serverN&gt; ]
   Flg Arg Option-Name    Description
Index: contrib/ntp/ntpdc/invoke-ntpdc.texi
===================================================================
--- contrib/ntp/ntpdc/invoke-ntpdc.texi	(版本 297264)
+++ contrib/ntp/ntpdc/invoke-ntpdc.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntpdc.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:18:37 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:29:05 PM by AutoGen 5.18.5
 # From the definitions    ntpdc-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -76,7 +76,7 @@
 
 @exampleindent 0
 @example
-ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7
 Usage:  ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
Index: contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
===================================================================
--- contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPDC 1ntpdcmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:39 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpdc-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpq/invoke-ntpq.texi
===================================================================
--- contrib/ntp/ntpq/invoke-ntpq.texi	(版本 297264)
+++ contrib/ntp/ntpq/invoke-ntpq.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntpq.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:19:10 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:29:39 PM by AutoGen 5.18.5
 # From the definitions    ntpq-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -826,6 +826,7 @@
 * ntpq numeric::                numeric option (-n)
 * ntpq old-rv::                 old-rv option
 * ntpq peers::                  peers option (-p)
+* ntpq refid::                  refid option (-r)
 * ntpq wide::                   wide option (-w)
 * ntpq config::                 presetting/configuring ntpq
 * ntpq exit status::            exit status
@@ -847,7 +848,7 @@
 
 @exampleindent 0
 @example
-ntpq - standard NTP query program - Ver. 4.2.8p6
+ntpq - standard NTP query program - Ver. 4.2.8p7
 Usage:  ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
@@ -868,6 +869,7 @@
       no  old-rv         Always output status line with readvar
    -p no  peers          Print a list of the peers
                                 - prohibits the option 'interactive'
+   -r KWd refid          Set default display type for S2+ refids
    -w no  wide           Display the full 'remote' value
       opt version        output version information and exit
    -? no  help           display extended usage information and exit
@@ -885,6 +887,10 @@
  - reading file ./.ntprc
  - examining environment variables named NTPQ_*
 
+The valid "refid" option keywords are:
+  hash ipv4
+  or an integer from 0 through 1
+
 Please send bug reports to:  <http://bugs.ntp.org, bugs@@ntp.org>
 @end example
 @exampleindent 4
@@ -992,6 +998,27 @@
 
 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.
+@node ntpq refid
+@subsection refid option (-r)
+@cindex ntpq-refid
+
+This is the ``set default display type for s2+ refids'' option.
+This option takes a keyword argument.
+
+@noindent
+This option has some usage constraints.  It:
+@itemize @bullet
+@item
+This option takes a keyword as its argument.
+The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_REFID).
+The available keywords are:
+@example
+    hash ipv4
+@end example
+
+or their numeric equivalent.@end itemize
+
+Set the default display format for S2+ refids.
 @node ntpq wide
 @subsection wide option (-w)
 @cindex ntpq-wide
Index: contrib/ntp/ntpd/ntp.conf.man.in
===================================================================
--- contrib/ntp/ntpd/ntp.conf.man.in	(版本 297264)
+++ contrib/ntp/ntpd/ntp.conf.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp.conf 5 "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.conf 5 "26 Apr 2016" "4.2.8p7" "File Formats"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaOxR/ag-XsaGwR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:45 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
 .\" From the definitions ntp.conf.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
@@ -133,8 +133,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+\f\*[B-Font]reslist\f[]
+billboard generated
+by
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[]
+or
+\fCntpdc\f[]\fR(@NTPDC_MS@)\f[],
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 \*[Lq]\&:\*[Rq]
 in the address field.
@@ -157,11 +163,11 @@
 .TP 7
 .NOP \f\*[B-Font]pool\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
 .TP 7
-.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]]
 .TP 7
-.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]] [\f\*[B-Font]xleave\f[]]
 .TP 7
-.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]] [\f\*[B-Font]xleave\f[]]
 .TP 7
 .NOP \f\*[B-Font]manycastclient\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
 .PP
@@ -289,7 +295,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -301,7 +309,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -339,6 +349,13 @@
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
 .TP 7
+.NOP \f\*[B-Font]preempt\f[]
+Says the association can be preempted.
+.TP 7
+.NOP \f\*[B-Font]true\f[]
+Marks the server as a truechimer.
+Use this option only for testing.
+.TP 7
 .NOP \f\*[B-Font]prefer\f[]
 Marks the server as preferred.
 All other things being equal,
@@ -352,6 +369,12 @@
 \fI/usr/share/doc/ntp\f[])
 for further information.
 .TP 7
+.NOP \f\*[B-Font]true\f[]
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+\fIonly\f[]
+be used while testing an association.
+.TP 7
 .NOP \f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]
 This option is used only with broadcast server and manycast
 client modes.
@@ -371,6 +394,13 @@
 packets.
 Versions 1-4 are the choices, with version 4 the
 default.
+.TP 7
+.NOP \f\*[B-Font]xleave\f[]
+Valid in
+\f\*[B-Font]peer\f[]
+and
+\f\*[B-Font]broadcast\f[]
+modes only, this flag enables interleave mode.
 .PP
 .SS Auxiliary Commands
 .TP 7
@@ -529,7 +559,7 @@
 commands and also by remote
 configuration commands sent by a
 \fCntpdc\f[]\fR(@NTPDC_MS@)\f[]
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -735,7 +765,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -942,8 +972,8 @@
 in the keys directory.
 .TP 7
 .NOP \f\*[B-Font]iffpar\f[] \f\*[I-Font]file\f[]
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 \fIntpkey_iff_\f[]\f\*[I-Font]hostname\f[]
 in the keys directory.
 .TP 7
@@ -955,8 +985,7 @@
 .TP 7
 .NOP \f\*[B-Font]mvpar\f[] \f\*[I-Font]file\f[]
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 \fIntpkey_mv_\f[]\f\*[I-Font]hostname\f[]
 in the keys directory.
 .TP 7
@@ -1118,7 +1147,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 \fI./scripts\f[]
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 UNIX
@@ -1511,7 +1540,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 \f\*[B-Font]C\f[],
-and the pid of the ntpd server process.
+and the pid of the
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1559,7 +1590,9 @@
 .ne 2
 
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+\f\*[B-Font]restrict\f[]
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1569,9 +1602,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .SS The Kiss-of-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1627,7 +1660,9 @@
 and a kiss-o'-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+\f\*[B-Font]monitor\f[]
+subcommand specifies the probability of discard
 for packets that overflow the rate-control window.
 .TP 7
 .NOP \f\*[B-Font]restrict\f[] \f\*[B-Font]address\f[] [\f\*[B-Font]mask\f[] \f\*[I-Font]mask\f[]] [\f\*[I-Font]flag\f[] \f\*[I-Font]...\f[]]
@@ -1687,7 +1722,9 @@
 .TP 7
 .NOP \f\*[B-Font]limited\f[]
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+\f\*[B-Font]discard\f[]
+command.
 A history of clients is kept using the
 monitoring capability of
 \fCntpd\f[]\fR(@NTPD_MS@)\f[].
@@ -1754,7 +1791,9 @@
 .NOP \f\*[B-Font]notrap\f[]
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[]
+control message
 protocol which is intended for use by remote event logging programs.
 .TP 7
 .NOP \f\*[B-Font]notrust\f[]
@@ -1832,8 +1871,11 @@
 .ne 2
 
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+\f\*[B-Font]manycastclient\f[]
+command, which is similar to the
+\f\*[B-Font]server\f[]
+command but with a multicast (IPv4 class
 \f\*[B-Font]D\f[]
 or IPv6 prefix
 \f\*[B-Font]FF\f[])
@@ -1909,7 +1951,9 @@
 \f\*[B-Font]maxpolll\f[]
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+\f\*[B-Font]ttl\f[]
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2571,7 +2615,8 @@
 .TP 7
 .NOP \f\*[B-Font]dscp\f[] \f\*[I-Font]value\f[]
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .TP 7
 .NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
 .TP 7
@@ -2798,7 +2843,8 @@
 message class may also be followed by the
 \f\*[B-Font]all\f[]
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .br
 .in +4
@@ -2833,7 +2879,9 @@
 be used instead of the default system
 \fCsyslog\f[]\fR(3)\f[]
 facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+\f\*[B-Font]\-l\f[]
+command line option.
 .TP 7
 .NOP \f\*[B-Font]setvar\f[] \f\*[I-Font]variable\f[] [\f\*[B-Font]default\f[]]
 This command adds an additional system variable.
@@ -2978,7 +3026,8 @@
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .TP 7
 .NOP \f\*[B-Font]filenum\f[] \f\*[I-Font]Nfiledescriptors\f[]
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .RE
 .TP 7
 .NOP \f\*[B-Font]trap\f[] \f\*[I-Font]host_address\f[] [\f\*[B-Font]port\f[] \f\*[I-Font]port_number\f[]] [\f\*[B-Font]interface\f[] \f\*[I-Font]interface_address\f[]]
Index: contrib/ntp/ntpd/ntp.keys.html
===================================================================
--- contrib/ntp/ntpd/ntp.keys.html	(版本 297264)
+++ contrib/ntp/ntpd/ntp.keys.html	(版本 298770)
@@ -33,7 +33,7 @@
 <p>This document describes the symmetric key file for the NTP Project's
 <code>ntpd</code> program.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntp.keys</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntp.keys</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
Index: contrib/ntp/ntpd/ntp_io.c
===================================================================
--- contrib/ntp/ntpd/ntp_io.c	(版本 297264)
+++ contrib/ntp/ntpd/ntp_io.c	(版本 298770)
@@ -62,10 +62,6 @@
 # endif
 #endif
 
-#if defined(HAVE_SIGNALED_IO) && defined(DEBUG_TIMING)
-# undef DEBUG_TIMING
-#endif
-
 /*
  * setsockopt does not always have the same arg declaration
  * across all platforms. If it's not defined we make it empty
@@ -778,6 +774,12 @@
 	iface->ifnum = sys_ifnum++;
 	iface->starttime = current_time;
 
+#   ifdef HAVE_IO_COMPLETION_PORT
+	if (!io_completion_port_add_interface(iface)) {
+		msyslog(LOG_EMERG, "cannot register interface with IO engine -- will exit now");
+		exit(1);
+	}
+#   endif
 	return iface;
 }
 
@@ -785,11 +787,14 @@
 /*
  * return interface storage into free memory pool
  */
-static inline void
+static void
 delete_interface(
 	endpt *ep
 	)
 {
+#    ifdef HAVE_IO_COMPLETION_PORT
+	io_completion_port_remove_interface(ep);
+#    endif
 	free(ep);
 }
 
@@ -1007,6 +1012,9 @@
 			ep->sent,
 			ep->notsent,
 			current_time - ep->starttime);
+#	    ifdef HAVE_IO_COMPLETION_PORT
+		io_completion_port_remove_socket(ep->fd, ep);
+#	    endif
 		close_and_delete_fd_from_list(ep->fd);
 		ep->fd = INVALID_SOCKET;
 	}
@@ -1015,10 +1023,15 @@
 		msyslog(LOG_INFO,
 			"stop listening for broadcasts to %s on interface #%d %s",
 			stoa(&ep->bcast), ep->ifnum, ep->name);
+#	    ifdef HAVE_IO_COMPLETION_PORT
+		io_completion_port_remove_socket(ep->bfd, ep);
+#	    endif
 		close_and_delete_fd_from_list(ep->bfd);
 		ep->bfd = INVALID_SOCKET;
-		ep->flags &= ~INT_BCASTOPEN;
 	}
+#   ifdef HAVE_IO_COMPLETION_PORT
+	io_completion_port_remove_interface(ep);
+#   endif
 
 	ninterfaces--;
 	mon_clearinterface(ep);
@@ -2569,7 +2582,7 @@
 			continue;
 
 		/* Only IPv4 addresses are valid for broadcast */
-		REQUIRE(IS_IPV4(&interf->sin));
+		REQUIRE(IS_IPV4(&interf->bcast));
 
 		/* Do we already have the broadcast address open? */
 		if (interf->flags & INT_BCASTOPEN) {
@@ -2597,13 +2610,31 @@
 			msyslog(LOG_INFO,
 				"Listen for broadcasts to %s on interface #%d %s",
 				stoa(&interf->bcast), interf->ifnum, interf->name);
-		} else {
-			/* silently ignore EADDRINUSE as we probably opened
-			   the socket already for an address in the same network */
-			if (errno != EADDRINUSE)
-				msyslog(LOG_INFO,
-					"failed to listen for broadcasts to %s on interface #%d %s",
-					stoa(&interf->bcast), interf->ifnum, interf->name);
+		} else switch (errno) {
+			/* Silently ignore EADDRINUSE as we probably
+			 * opened the socket already for an address in
+			 * the same network */
+		case EADDRINUSE:
+			/* Some systems cannot bind a socket to a broadcast
+			 * address, as that is not a valid host address. */
+		case EADDRNOTAVAIL:
+#		    ifdef SYS_WINNT	/*TODO: use for other systems, too? */
+			/* avoid recurrence here -- if we already have a
+			 * regular socket, it's quite useless to try this
+			 * again.
+			 */
+			if (interf->fd != INVALID_SOCKET) {
+				interf->flags |= INT_BCASTOPEN;
+				nif++;
+			}
+#		    endif
+			break;
+
+		default:
+			msyslog(LOG_INFO,
+				"failed to listen for broadcasts to %s on interface #%d %s",
+				stoa(&interf->bcast), interf->ifnum, interf->name);
+			break;
 		}
 	}
 	set_reuseaddr(0);
@@ -2641,10 +2672,13 @@
 			msyslog(LOG_INFO,
 				"stop listening for broadcasts to %s on interface #%d %s",
 				stoa(&ep->bcast), ep->ifnum, ep->name);
+#		    ifdef HAVE_IO_COMPLETION_PORT
+			io_completion_port_remove_socket(ep->bfd, ep);
+#		    endif
 			close_and_delete_fd_from_list(ep->bfd);
 			ep->bfd = INVALID_SOCKET;
-			ep->flags &= ~INT_BCASTOPEN;
 		}
+		ep->flags &= ~INT_BCASTOPEN;
 	}
 	broadcast_client_enabled = ISC_FALSE;
 }
@@ -3020,11 +3054,11 @@
 		    fcntl(fd, F_GETFL, 0)));
 #endif /* SYS_WINNT || VMS */
 
-#if defined (HAVE_IO_COMPLETION_PORT)
+#if defined(HAVE_IO_COMPLETION_PORT)
 /*
  * Add the socket to the completion port
  */
-	if (io_completion_port_add_socket(fd, interf)) {
+	if (!io_completion_port_add_socket(fd, interf, bcast)) {
 		msyslog(LOG_ERR, "unable to set up io completion port - EXITING");
 		exit(1);
 	}
@@ -3033,10 +3067,6 @@
 }
 
 
-#ifdef SYS_WINNT
-#define sendto(fd, buf, len, flags, dest, destsz)	\
-	io_completion_port_sendto(fd, buf, len, (sockaddr_u *)(dest))
-#endif
 
 /* XXX ELIMINATE sendpkt similar in ntpq.c, ntpdc.c, ntp_io.c, ntptrace.c */
 /*
@@ -3124,6 +3154,9 @@
 
 #ifdef SIM
 		cc = simulate_server(dest, src, pkt);
+#elif defined(HAVE_IO_COMPLETION_PORT)
+		cc = io_completion_port_sendto(src, src->fd, pkt,
+			(size_t)len, (sockaddr_u *)&dest->sa);
 #else
 		cc = sendto(src->fd, (char *)pkt, (u_int)len, 0,
 			    &dest->sa, SOCKLEN(dest));
@@ -3141,7 +3174,8 @@
 }
 
 
-#if !defined(HAVE_IO_COMPLETION_PORT) && !defined(HAVE_SIGNALED_IO)
+#if !defined(HAVE_IO_COMPLETION_PORT)
+#if !defined(HAVE_SIGNALED_IO)
 /*
  * fdbits - generate ascii representation of fd_set (FAU debug support)
  * HFDF format - highest fd first.
@@ -3450,6 +3484,18 @@
 	DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
 		    fd, buflen, stoa(&rb->recv_srcadr)));
 
+#ifdef ENABLE_BUG3020_FIX
+	if (ISREFCLOCKADR(&rb->recv_srcadr)) {
+		msyslog(LOG_ERR, "recvfrom(%s) fd=%d: refclock srcadr on a network interface!",
+			stoa(&rb->recv_srcadr), fd);
+		DPRINTF(1, ("read_network_packet: fd=%d dropped (refclock srcadr))\n",
+			    fd));
+		packets_dropped++;
+		freerecvbuf(rb);
+		return (buflen);
+	}
+#endif
+
 	/*
 	** Bug 2672: Some OSes (MacOSX and Linux) don't block spoofed ::1
 	*/
@@ -3789,8 +3835,8 @@
 			lfptoms(&ts_e, 6));
 #endif /* DEBUG_TIMING */
 }
+#endif /* !HAVE_IO_COMPLETION_PORT */
 
-
 /*
  * find an interface suitable for the src address
  */
@@ -4279,7 +4325,7 @@
 		return 0;
 	}
 # elif defined(HAVE_IO_COMPLETION_PORT)
-	if (io_completion_port_add_clock_io(rio)) {
+	if (!io_completion_port_add_clock_io(rio)) {
 		UNBLOCKIO();
 		return 0;
 	}
@@ -4318,13 +4364,23 @@
 	rio->active = FALSE;
 	UNLINK_SLIST(unlinked, refio, rio, next, struct refclockio);
 	if (NULL != unlinked) {
-		purge_recv_buffers_for_fd(rio->fd);
-		/*
-		 * Close the descriptor.
+		/* Close the descriptor. The order of operations is
+		 * important here in case of async / overlapped IO:
+		 * only after we have removed the clock from the
+		 * IO completion port we can be sure no further
+		 * input is queued. So...
+		 *  - we first disable feeding to the queu by removing
+		 *    the clock from the IO engine
+		 *  - close the file (which brings down any IO on it)
+		 *  - clear the buffer from results for this fd
 		 */
+#	    ifdef HAVE_IO_COMPLETION_PORT
+		io_completion_port_remove_clock_io(rio);
+#	    endif
 		close_and_delete_fd_from_list(rio->fd);
+		purge_recv_buffers_for_fd(rio->fd);
+		rio->fd = -1;
 	}
-	rio->fd = -1;
 
 	UNBLOCKIO();
 }
Index: contrib/ntp/ntpd/ntpd-opts.c
===================================================================
--- contrib/ntp/ntpd/ntpd-opts.c	(版本 297264)
+++ contrib/ntp/ntpd/ntpd-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:15:45 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:26:14 PM by AutoGen 5.18.5
  *  From the definitions    ntpd-opts.def
  *  and the template file   options
  *
@@ -75,7 +75,7 @@
  *  static const strings for ntpd options
  */
 static char const ntpd_opt_strs[3129] =
-/*     0 */ "ntpd 4.2.8p6\n"
+/*     0 */ "ntpd 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -205,12 +205,12 @@
 /*  2900 */ "output version information and exit\0"
 /*  2936 */ "version\0"
 /*  2944 */ "NTPD\0"
-/*  2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p6\n"
+/*  2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
             "\t\t[ <server1> ... <serverN> ]\n\0"
 /*  3080 */ "http://bugs.ntp.org, bugs@ntp.org\0"
 /*  3114 */ "\n\0"
-/*  3116 */ "ntpd 4.2.8p6";
+/*  3116 */ "ntpd 4.2.8p7";
 
 /**
  *  ipv4 option description with
@@ -1529,7 +1529,7 @@
      translate option names.
    */
   /* referenced via ntpdOptions.pzCopyright */
-  puts(_("ntpd 4.2.8p6\n\
+  puts(_("ntpd 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -1670,7 +1670,7 @@
   puts(_("output version information and exit"));
 
   /* referenced via ntpdOptions.pzUsageTitle */
-  puts(_("ntpd - NTP daemon program - Ver. 4.2.8p6\n\
+  puts(_("ntpd - NTP daemon program - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
 \t\t[ <server1> ... <serverN> ]\n"));
 
@@ -1678,7 +1678,7 @@
   puts(_("\n"));
 
   /* referenced via ntpdOptions.pzFullVersion */
-  puts(_("ntpd 4.2.8p6"));
+  puts(_("ntpd 4.2.8p7"));
 
   /* referenced via ntpdOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/ntpd/ntpd.c
===================================================================
--- contrib/ntp/ntpd/ntpd.c	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.c	(版本 298770)
@@ -332,7 +332,17 @@
 
 #endif /*defined(NEED_PTHREAD_WARMUP)*/
 
+#ifdef NEED_EARLY_FORK
+static void
+dummy_callback(void) { return; }
 
+static void
+fork_nonchroot_worker(void) {
+	getaddrinfo_sometime("localhost", "ntp", NULL, INITIAL_DNS_RETRY,
+			     (gai_sometime_callback)&dummy_callback, NULL);
+}
+#endif /* NEED_EARLY_FORK */
+
 void
 parse_cmdline_opts(
 	int *	pargc,
@@ -931,6 +941,11 @@
 
 # ifdef HAVE_DROPROOT
 	if (droproot) {
+
+#ifdef NEED_EARLY_FORK
+		fork_nonchroot_worker();
+#endif
+
 		/* Drop super-user privileges and chroot now if the OS supports this */
 
 #  ifdef HAVE_LINUX_CAPABILITIES
Index: contrib/ntp/ntpdate/ntpdate.c
===================================================================
--- contrib/ntp/ntpdate/ntpdate.c	(版本 297264)
+++ contrib/ntp/ntpdate/ntpdate.c	(版本 298770)
@@ -1247,7 +1247,6 @@
 clock_adjust(void)
 {
 	register struct server *sp, *server;
-	s_fp absoffset;
 	int dostep;
 
 	for (sp = sys_servers; sp != NULL; sp = sp->next_server)
@@ -1270,10 +1269,15 @@
 	} else if (never_step) {
 		dostep = 0;
 	} else {
-		absoffset = server->soffset;
-		if (absoffset < 0)
-			absoffset = -absoffset;
-		dostep = (absoffset >= NTPDATE_THRESHOLD || absoffset < 0);
+		/* [Bug 3023] get absolute difference, avoiding signed
+		 * integer overflow like hell.
+		 */
+		u_fp absoffset;
+		if (server->soffset < 0)
+			absoffset = 1u + (u_fp)(-(server->soffset + 1));
+		else
+			absoffset = (u_fp)server->soffset;
+		dostep = (absoffset >= NTPDATE_THRESHOLD);
 	}
 
 	if (dostep) {
Index: contrib/ntp/ntpdc/ntpdc.1ntpdcman
===================================================================
--- contrib/ntp/ntpdc/ntpdc.1ntpdcman	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc.1ntpdcman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpdc 1ntpdcman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpdc 1ntpdcman "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-n4aaHU/ag-A4a4FU)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-bTaatH/ag-nTa4rH)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:33 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:01 PM by AutoGen 5.18.5
 .\" From the definitions ntpdc-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/ntpdc/ntpdc.mdoc.in
===================================================================
--- contrib/ntp/ntpdc/ntpdc.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPDC @NTPDC_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:39 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpdc-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpq/ntpq-opts.h
===================================================================
--- contrib/ntp/ntpq/ntpq-opts.h	(版本 297264)
+++ contrib/ntp/ntpq/ntpq-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpq-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:18:42 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:29:10 PM by AutoGen 5.18.5
  *  From the definitions    ntpq-opts.def
  *  and the template file   options
  *
@@ -73,19 +73,20 @@
     INDEX_OPT_NUMERIC          =  6,
     INDEX_OPT_OLD_RV           =  7,
     INDEX_OPT_PEERS            =  8,
-    INDEX_OPT_WIDE             =  9,
-    INDEX_OPT_VERSION          = 10,
-    INDEX_OPT_HELP             = 11,
-    INDEX_OPT_MORE_HELP        = 12,
-    INDEX_OPT_SAVE_OPTS        = 13,
-    INDEX_OPT_LOAD_OPTS        = 14
+    INDEX_OPT_REFID            =  9,
+    INDEX_OPT_WIDE             = 10,
+    INDEX_OPT_VERSION          = 11,
+    INDEX_OPT_HELP             = 12,
+    INDEX_OPT_MORE_HELP        = 13,
+    INDEX_OPT_SAVE_OPTS        = 14,
+    INDEX_OPT_LOAD_OPTS        = 15
 } teOptIndex;
 /** count of all options for ntpq */
-#define OPTION_CT    15
+#define OPTION_CT    16
 /** ntpq version */
-#define NTPQ_VERSION       "4.2.8p6"
+#define NTPQ_VERSION       "4.2.8p7"
 /** Full ntpq version text */
-#define NTPQ_FULL_VERSION  "ntpq 4.2.8p6"
+#define NTPQ_FULL_VERSION  "ntpq 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
@@ -174,6 +175,10 @@
 #  warning undefining PEERS due to option name conflict
 #  undef   PEERS
 # endif
+# ifdef    REFID
+#  warning undefining REFID due to option name conflict
+#  undef   REFID
+# endif
 # ifdef    WIDE
 #  warning undefining WIDE due to option name conflict
 #  undef   WIDE
@@ -188,6 +193,7 @@
 # undef NUMERIC
 # undef OLD_RV
 # undef PEERS
+# undef REFID
 # undef WIDE
 #endif  /*  NO_OPTION_NAME_WARNINGS */
 
@@ -206,6 +212,13 @@
 #define VALUE_OPT_NUMERIC        'n'
 #define VALUE_OPT_OLD_RV         0x1001
 #define VALUE_OPT_PEERS          'p'
+#define VALUE_OPT_REFID          'r'
+
+typedef enum {
+    REFID_HASH, REFID_IPV4
+} te_Refid;
+#define OPT_REFID_VAL2STR(_v)    optionKeywordName(&DESC(REFID), (_v))
+#define OPT_VALUE_REFID          (DESC(REFID).optArg.argEnum)
 #define VALUE_OPT_WIDE           'w'
 /** option flag (value) for help-value option */
 #define VALUE_OPT_HELP          '?'
Index: contrib/ntp/ntpq/ntpq.c
===================================================================
--- contrib/ntp/ntpq/ntpq.c	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.c	(版本 298770)
@@ -38,7 +38,6 @@
 #include <ssl_applink.c>
 
 #include "ntp_libopts.h"
-#include "ntpq-opts.h"
 #include "safecast.h"
 
 #ifdef SYS_VXWORKS		/* vxWorks needs mode flag -casey*/
@@ -67,6 +66,11 @@
  */
 int	old_rv = 1;
 
+/*
+ * How should we display the refid?
+ * REFID_HASH, REFID_IPV4
+ */
+te_Refid drefid = -1;
 
 /*
  * for get_systime()
@@ -198,6 +202,7 @@
 static	void	hostnames	(struct parse *, FILE *);
 static	void	setdebug	(struct parse *, FILE *);
 static	void	quit		(struct parse *, FILE *);
+static	void	showdrefid	(struct parse *, FILE *);
 static	void	version		(struct parse *, FILE *);
 static	void	raw		(struct parse *, FILE *);
 static	void	cooked		(struct parse *, FILE *);
@@ -269,6 +274,9 @@
 	{ "keyid",	keyid,		{ OPT|NTP_UINT, NO, NO, NO },
 	  { "key#", "", "", "" },
 	  "set keyid to use for authenticated requests" },
+	{ "drefid",	showdrefid,	{ OPT|NTP_STR, NO, NO, NO },
+	  { "hash|ipv4", "", "", "" },
+	  "display refid's as IPv4 or hash" },
 	{ "version",	version,	{ NO, NO, NO, NO },
 	  { "", "", "", "" },
 	  "print version number" },
@@ -532,6 +540,8 @@
 
 	old_rv = HAVE_OPT(OLD_RV);
 
+	drefid = OPT_VALUE_REFID;
+
 	if (0 == argc) {
 		ADDHOST(DEFHOST);
 	} else {
@@ -1327,7 +1337,7 @@
 	if (numhosts > 1)
 		fprintf(stderr, "server=%s ", currenthost);
 
-	switch(m6resp) {
+	switch (m6resp) {
 
 	case CERR_BADFMT:
 		fprintf(stderr,
@@ -2441,6 +2451,47 @@
 
 
 /*
+ * showdrefid2str - return a string explanation of the value of drefid
+ */
+static char *
+showdrefid2str(void)
+{
+	switch (drefid) {
+	    case REFID_HASH:
+	    	return "hash";
+	    case REFID_IPV4:
+	    	return "ipv4";
+	    default:
+	    	return "Unknown";
+	}
+}
+
+
+/*
+ * drefid - display/change "display hash" 
+ */
+static void
+showdrefid(
+	struct parse *pcmd,
+	FILE *fp
+	)
+{
+	if (pcmd->nargs == 0) {
+		(void) fprintf(fp, "drefid value is %s\n", showdrefid2str());
+		return;
+	} else if (STREQ(pcmd->argval[0].string, "hash")) {
+		drefid = REFID_HASH;
+	} else if (STREQ(pcmd->argval[0].string, "ipv4")) {
+		drefid = REFID_IPV4;
+	} else {
+		(void) fprintf(fp, "What?\n");
+		return;
+	}
+	(void) fprintf(fp, "drefid value set to %s\n", showdrefid2str());
+}
+
+
+/*
  * keyid - get a keyid to use for authenticating requests
  */
 static void
Index: contrib/ntp/ntpq/ntpq.mdoc.in
===================================================================
--- contrib/ntp/ntpq/ntpq.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPQ @NTPQ_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpq-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpq-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -898,6 +898,26 @@
 .sp
 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.
+.It  Fl r Ar keyword , Fl \-refid Ns = Ns Ar keyword 
+Set default display type for S2+ refids.
+This option takes a keyword as its argument.  The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+hash ipv4
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default
+.Ar keyword
+for this option is:
+.ti +4
+ ipv4
+.sp
+Set the default display format for S2+ refids.
 .It  Fl w , Fl \-wide 
 Display the full 'remote' value.
 .sp
Index: contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpsnmpd 1ntpsnmpdman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpsnmpd 1ntpsnmpdman "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FaaWZW/ag-SaaOYW)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sYaGMJ/ag-EYayLJ)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:22 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:51 PM by AutoGen 5.18.5
 .\" From the definitions ntpsnmpd-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPSNMPD @NTPSNMPD_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:28 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:57 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpsnmpd-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
===================================================================
--- contrib/ntp/scripts/calc_tickadj/calc_tickadj.html	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/calc_tickadj.html	(版本 298770)
@@ -31,7 +31,7 @@
 <h2 class="unnumbered">calc_tickadj User's Manual</h2>
 
 <p>This document describes the use of the NTP Project's <code>calc_tickadj</code> program. 
-This document applies to version 4.2.8p6 of <code>calc_tickadj</code>.
+This document applies to version 4.2.8p7 of <code>calc_tickadj</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
Index: contrib/ntp/scripts/invoke-plot_summary.texi
===================================================================
--- contrib/ntp/scripts/invoke-plot_summary.texi	(版本 297264)
+++ contrib/ntp/scripts/invoke-plot_summary.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-plot_summary.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:34 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:25:00 PM by AutoGen 5.18.5
 # From the definitions    plot_summary-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -41,7 +41,7 @@
 
 @exampleindent 0
 @example
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p6
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
 USAGE: plot_summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... 
 
         --directory=str          Where the summary files are
Index: contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp-wait 1ntp-waitman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntp-wait 1ntp-waitman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4fay4H/ag-fgaG3H)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LcaO9v/ag-XcaW8v)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:09:53 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:20 PM by AutoGen 5.18.5
 .\" From the definitions ntp-wait-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_WAIT @NTP_WAIT_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp-wait-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:09:59 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:26 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp-wait-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPSWEEP 1ntpsweepmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpsweep-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:09 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:35 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpsweep-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpq/ntpq-subs.c
===================================================================
--- contrib/ntp/ntpq/ntpq-subs.c	(版本 297264)
+++ contrib/ntp/ntpq/ntpq-subs.c	(版本 298770)
@@ -1679,7 +1679,8 @@
 		} else if (!strcmp("hmode", name)) {
 			decodeint(value, &hmode);
 		} else if (!strcmp("refid", name)) {
-			if (pvl == peervarlist) {
+			if (   (pvl == peervarlist)
+			    && (drefid == REFID_IPV4)) {
 				have_da_rid = TRUE;
 				drlen = strlen(value);
 				if (0 == drlen) {
@@ -1700,7 +1701,9 @@
 				} else {
 					have_da_rid = FALSE;
 				}
-			} else if (pvl == apeervarlist) {
+			} else if (   (pvl == apeervarlist)
+				   || (pvl == peervarlist)) {
+				/* no need to check drefid == REFID_HASH */
 				have_da_rid = TRUE;
 				drlen = strlen(value);
 				if (0 == drlen) {
@@ -2030,15 +2033,19 @@
 	FILE *fp
 	)
 {
-	int af = 0;
+	if (drefid == REFID_HASH) {
+		apeers(pcmd, fp);
+	} else {
+		int af = 0;
 
-	if (pcmd->nargs == 1) {
-		if (pcmd->argval->ival == 6)
-			af = AF_INET6;
-		else
-			af = AF_INET;
+		if (pcmd->nargs == 1) {
+			if (pcmd->argval->ival == 6)
+				af = AF_INET6;
+			else
+				af = AF_INET;
+		}
+		dopeers(0, fp, af);
 	}
-	dopeers(0, fp, af);
 }
 
 
@@ -2244,6 +2251,10 @@
  *    Longer lines will lead to unpredictable results.
  * 3. Since this function is sending a line at a time, we can't update
  *    the control key through the configuration file (YUCK!!)
+ *
+ * Pearly: There are a few places where 'size_t' is cast to 'int' based
+ * on the assumption that 'int' can hold the size of the involved
+ * buffers without overflow.
  */
 static void 
 config_from_file (
@@ -2254,6 +2265,7 @@
 	u_short rstatus;
 	size_t rsize;
 	const char *rdata;
+	char * cp;
 	int res;
 	FILE *config_fd;
 	char config_cmd[MAXLINE];
@@ -2278,33 +2290,47 @@
 	printf("Sending configuration file, one line at a time.\n");
 	i = 0;
 	while (fgets(config_cmd, MAXLINE, config_fd) != NULL) {
-		config_len = strlen(config_cmd);
-		/* ensure even the last line has newline, if possible */
-		if (config_len > 0 && 
-		    config_len + 2 < sizeof(config_cmd) &&
-		    '\n' != config_cmd[config_len - 1])
-			config_cmd[config_len++] = '\n';
+		/* Eliminate comments first. */
+		cp = strchr(config_cmd, '#');
+		config_len = (NULL != cp)
+		    ? (size_t)(cp - config_cmd)
+		    : strlen(config_cmd);
+		
+		/* [Bug 3015] make sure there's no trailing whitespace;
+		 * the fix for [Bug 2853] on the server side forbids
+		 * those. And don't transmit empty lines, as this would
+		 * just be waste.
+		 */
+		while (config_len != 0 &&
+		       (u_char)config_cmd[config_len-1] <= ' ')
+			--config_len;
+		config_cmd[config_len] = '\0';
+
 		++i;
+		if (0 == config_len)
+			continue;
+
 		retry_limit = 2;
 		do 
 			res = doquery(CTL_OP_CONFIGURE, 0, 1,
-				      strlen(config_cmd), config_cmd,
+				      config_len, config_cmd,
 				      &rstatus, &rsize, &rdata);
 		while (res != 0 && retry_limit--);
 		if (res != 0) {
-			printf("Line No: %d query failed: %s", i,
-			       config_cmd);
-			printf("Subsequent lines not sent.\n");
+			printf("Line No: %d query failed: %.*s\n"
+			       "Subsequent lines not sent.\n",
+			       i, (int)config_len, config_cmd);
 			fclose(config_fd);
 			return;
 		}
 
-		if (rsize > 0 && '\n' == rdata[rsize - 1])
-			rsize--;
-		if (rsize > 0 && '\r' == rdata[rsize - 1])
-			rsize--;
-		printf("Line No: %d %.*s: %s", i, (int)rsize, rdata, /* cast is wobbly */
-		       config_cmd);
+		/* Right-strip the result code string, then output the
+		 * last line executed, with result code. */
+		while (rsize != 0 && (u_char)rdata[rsize - 1] <= ' ')
+			--rsize;
+		printf("Line No: %d %.*s: %.*s\n", i,
+		       (int)rsize, rdata,
+		       (int)config_len, config_cmd);
 	}
 	printf("Done sending file\n");
 	fclose(config_fd);
Index: contrib/ntp/ntpq/ntpq.h
===================================================================
--- contrib/ntp/ntpq/ntpq.h	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.h	(版本 298770)
@@ -13,6 +13,8 @@
 #include "ntp_control.h"
 #include "lib_strbuf.h"
 
+#include "ntpq-opts.h"
+
 /*
  * Maximum number of arguments
  */
@@ -126,6 +128,7 @@
 
 extern int	interactive;	/* are we prompting? */
 extern int	old_rv;		/* use old rv behavior? --old-rv */
+extern te_Refid	drefid;		/* How should we display a refid? */
 extern u_int	assoc_cache_slots;/* count of allocated array entries */
 extern u_int	numassoc;	/* number of cached associations */
 extern u_int	numhosts;
Index: contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
===================================================================
--- contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi	(版本 297264)
+++ contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntpsnmpd.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:19:26 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:29:54 PM by AutoGen 5.18.5
 # From the definitions    ntpsnmpd-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -47,7 +47,7 @@
 
 @exampleindent 0
 @example
-ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p6
+ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7
 Usage:  ntpsnmpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
   Flg Arg Option-Name    Description
    -n no  nofork         Do not fork
Index: contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPSNMPD 1ntpsnmpdmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:28 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:57 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpsnmpd-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/packageinfo.sh
===================================================================
--- contrib/ntp/packageinfo.sh	(版本 297264)
+++ contrib/ntp/packageinfo.sh	(版本 298770)
@@ -83,7 +83,7 @@
 # - Numeric values increment
 # - empty 'increments' to 1
 # - NEW 'increments' to empty
-point=6
+point=7
 
 ### betapoint is normally modified by script.
 # ntp-stable Beta number (betapoint)
Index: contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
===================================================================
--- contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-lWayEG/ag-yWaGDG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-b1aGJu/ag-n1aOIu)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:09:44 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:11 PM by AutoGen 5.18.5
 .\" From the definitions calc_tickadj-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/invoke-summary.texi
===================================================================
--- contrib/ntp/scripts/invoke-summary.texi	(版本 297264)
+++ contrib/ntp/scripts/invoke-summary.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-summary.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:40 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:25:06 PM by AutoGen 5.18.5
 # From the definitions    summary-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -42,7 +42,7 @@
 
 @exampleindent 0
 @example
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p6
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
 USAGE: summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... 
 
         --directory=str          Directory containing stat files
Index: contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_WAIT 1ntp-waitmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp-wait-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:09:59 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:26 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp-wait-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
===================================================================
--- contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntpsweep.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:03 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:29 PM by AutoGen 5.18.5
 # From the definitions    ntpsweep-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -45,7 +45,7 @@
 
 @exampleindent 0
 @example
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p6
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
 USAGE: ntpsweep [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [hostfile]
 
     -l, --host-list=str          Host to execute actions on
Index: contrib/ntp/ntpdc/ntpdc.man.in
===================================================================
--- contrib/ntp/ntpdc/ntpdc.man.in	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpdc @NTPDC_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpdc @NTPDC_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-n4aaHU/ag-A4a4FU)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-bTaatH/ag-nTa4rH)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:33 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:01 PM by AutoGen 5.18.5
 .\" From the definitions ntpdc-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/ntpq/ntpq-opts.def
===================================================================
--- contrib/ntp/ntpq/ntpq-opts.def	(版本 297264)
+++ contrib/ntp/ntpq/ntpq-opts.def	(版本 298770)
@@ -100,6 +100,18 @@
 };
 
 flag = {
+    name      = refid;
+    value     = r;
+    descrip   = "Set default display type for S2+ refids";
+    arg-type  = keyword;
+    keyword   = hash, ipv4;
+    arg-default = ipv4;
+    doc = <<-  _EndOfDoc_
+	Set the default display format for S2+ refids.
+	_EndOfDoc_;
+};
+
+flag = {
     name      = wide;
     value     = w;
     descrip   = "Display the full 'remote' value";
Index: contrib/ntp/ntpq/ntpq.1ntpqmdoc
===================================================================
--- contrib/ntp/ntpq/ntpq.1ntpqmdoc	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.1ntpqmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPQ 1ntpqmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpq-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpq-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -898,6 +898,26 @@
 .sp
 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.
+.It  Fl r Ar keyword , Fl \-refid Ns = Ns Ar keyword 
+Set default display type for S2+ refids.
+This option takes a keyword as its argument.  The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+hash ipv4
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default
+.Ar keyword
+for this option is:
+.ti +4
+ ipv4
+.sp
+Set the default display format for S2+ refids.
 .It  Fl w , Fl \-wide 
 Display the full 'remote' value.
 .sp
Index: contrib/ntp/ntpq/ntpq.man.in
===================================================================
--- contrib/ntp/ntpq/ntpq.man.in	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpq @NTPQ_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpq @NTPQ_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Z7aWRV/ag-_7aOQV)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-11aqEI/ag-c2aiDI)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:06 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:35 PM by AutoGen 5.18.5
 .\" From the definitions ntpq-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
@@ -1347,6 +1347,27 @@
 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
+.NOP \f\*[B-Font]\-r\f[] \f\*[I-Font]keyword\f[], \f\*[B-Font]\-\-refid\f[]=\f\*[I-Font]keyword\f[]
+Set default display type for S2+ refids.
+This option takes a keyword as its argument.  The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+hash ipv4
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default
+\f\*[I-Font]keyword\f[]
+for this option is:
+.ti +4
+ ipv4
+.sp
+Set the default display format for S2+ refids.
+.TP
 .NOP \f\*[B-Font]\-w\f[], \f\*[B-Font]\-\-wide\f[]
 Display the full 'remote' value.
 .sp
Index: contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:19:14 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:29:43 PM by AutoGen 5.18.5
  *  From the definitions    ntpsnmpd-opts.def
  *  and the template file   options
  *
@@ -76,9 +76,9 @@
 /** count of all options for ntpsnmpd */
 #define OPTION_CT    8
 /** ntpsnmpd version */
-#define NTPSNMPD_VERSION       "4.2.8p6"
+#define NTPSNMPD_VERSION       "4.2.8p7"
 /** Full ntpsnmpd version text */
-#define NTPSNMPD_FULL_VERSION  "ntpsnmpd 4.2.8p6"
+#define NTPSNMPD_FULL_VERSION  "ntpsnmpd 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
Index: contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd.man.in	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpsnmpd @NTPSNMPD_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpsnmpd @NTPSNMPD_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FaaWZW/ag-SaaOYW)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sYaGMJ/ag-EYayLJ)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:22 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:51 PM by AutoGen 5.18.5
 .\" From the definitions ntpsnmpd-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
===================================================================
--- contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (calc_tickadj-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:09:46 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:13 PM by AutoGen 5.18.5
 .\"  From the definitions    calc_tickadj-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
===================================================================
--- contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-calc_tickadj.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:09:47 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:15 PM by AutoGen 5.18.5
 # From the definitions    calc_tickadj-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
Index: contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
===================================================================
--- contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntptrace.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:16 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:42 PM by AutoGen 5.18.5
 # From the definitions    ntptrace-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -62,7 +62,7 @@
 
 @exampleindent 0
 @example
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p6
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
 USAGE: ntptrace [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [host]
 
     -n, --numeric                Print IP addresses instead of hostnames
Index: contrib/ntp/ntpd/ntp_request.c
===================================================================
--- contrib/ntp/ntpd/ntp_request.c	(版本 297264)
+++ contrib/ntp/ntpd/ntp_request.c	(版本 298770)
@@ -1342,11 +1342,38 @@
 		peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
 #endif
 
-		/* XXX W2DO? minpoll/maxpoll arguments ??? */
+		/* check mode value: 0 <= hmode <= 6
+		 *
+		 * There's no good global define for that limit, and
+		 * using a magic define is as good (or bad, actually) as
+		 * a magic number. So we use the highest possible peer
+		 * mode, and that is MODE_BCLIENT.
+		 *
+		 * [Bug 3009] claims that a problem occurs for hmode > 7,
+		 * but the code in ntp_peer.c indicates trouble for any
+		 * hmode > 6 ( --> MODE_BCLIENT).
+		 */
+		if (temp_cp.hmode > MODE_BCLIENT) {
+			req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
+			return;
+		}
+		
+		/* Any more checks on the values? Unchecked at this
+		 * point:
+		 *   - version
+		 *   - ttl
+		 *   - keyid
+		 *
+		 *   - minpoll/maxpoll, but they are treated properly
+		 *     for all cases internally. Checking not necessary.
+		 */
+		
+		/* finally create the peer */
 		if (peer_config(&peeraddr, NULL, NULL,
 		    temp_cp.hmode, temp_cp.version, temp_cp.minpoll, 
 		    temp_cp.maxpoll, fl, temp_cp.ttl, temp_cp.keyid,
-		    NULL) == 0) {
+		    NULL) == 0)
+		{
 			req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
 			return;
 		}
@@ -1373,8 +1400,7 @@
 	struct conf_unpeer	temp_cp;
 	struct peer *		p;
 	sockaddr_u		peeraddr;
-	int			bad;
-	int			found;
+	int			loops;
 
 	/*
 	 * This is a bit unstructured, but I like to be careful.
@@ -1381,95 +1407,66 @@
 	 * We check to see that every peer exists and is actually
 	 * configured.  If so, we remove them.  If not, we return
 	 * an error.
+	 *
+	 * [Bug 3011] Even if we checked all peers given in the request
+	 * in a dry run, there's still a chance that the caller played
+	 * unfair and gave the same peer multiple times. So we still
+	 * have to be prepared for nasty surprises in the second run ;)
 	 */
-	items = INFO_NITEMS(inpkt->err_nitems);
+
+	/* basic consistency checks */
 	item_sz = INFO_ITEMSIZE(inpkt->mbz_itemsize);
-	datap = inpkt->u.data;
 	if (item_sz > sizeof(temp_cp)) {
 		req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
 		return;
 	}
 
-	bad = FALSE;
-	while (items-- > 0 && !bad) {
-		ZERO(temp_cp);
-		memcpy(&temp_cp, datap, item_sz);
-		ZERO_SOCK(&peeraddr);
-		if (client_v6_capable && temp_cp.v6_flag) {
-			AF(&peeraddr) = AF_INET6;
-			SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
-		} else {
-			AF(&peeraddr) = AF_INET;
-			NSRCADR(&peeraddr) = temp_cp.peeraddr;
-		}
-		SET_PORT(&peeraddr, NTP_PORT);
+	/* now do two runs: first a dry run, then a busy one */
+	for (loops = 0; loops != 2; ++loops) {
+		items = INFO_NITEMS(inpkt->err_nitems);
+		datap = inpkt->u.data;
+		while (items-- > 0) {
+			/* copy from request to local */
+			ZERO(temp_cp);
+			memcpy(&temp_cp, datap, item_sz);
+			/* get address structure */
+			ZERO_SOCK(&peeraddr);
+			if (client_v6_capable && temp_cp.v6_flag) {
+				AF(&peeraddr) = AF_INET6;
+				SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
+			} else {
+				AF(&peeraddr) = AF_INET;
+				NSRCADR(&peeraddr) = temp_cp.peeraddr;
+			}
+			SET_PORT(&peeraddr, NTP_PORT);
 #ifdef ISC_PLATFORM_HAVESALEN
-		peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
+			peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
 #endif
-		found = FALSE;
-		p = NULL;
+			DPRINTF(1, ("searching for %s\n",
+				    stoa(&peeraddr)));
 
-		DPRINTF(1, ("searching for %s\n", stoa(&peeraddr)));
-
-		while (!found) {
-			p = findexistingpeer(&peeraddr, NULL, p, -1, 0);
-			if (NULL == p)
-				break;
-			if (FLAG_CONFIG & p->flags)
-				found = TRUE;
+			/* search for matching configred(!) peer */
+			p = NULL;
+			do {
+				p = findexistingpeer(
+					&peeraddr, NULL, p, -1, 0);
+			} while (p && !(FLAG_CONFIG & p->flags));
+			
+			if (!loops && !p) {
+				/* Item not found in dry run -- bail! */
+				req_ack(srcadr, inter, inpkt,
+					INFO_ERR_NODATA);
+				return;
+			} else if (loops && p) {
+				/* Item found in busy run -- remove! */
+				peer_clear(p, "GONE");
+				unpeer(p);
+			}
+			datap += item_sz;
 		}
-		if (!found)
-			bad = TRUE;
-
-		datap += item_sz;
 	}
 
-	if (bad) {
-		req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
-		return;
-	}
-
-	/*
-	 * Now do it in earnest.
-	 */
-
-	items = INFO_NITEMS(inpkt->err_nitems);
-	datap = inpkt->u.data;
-
-	while (items-- > 0) {
-		ZERO(temp_cp);
-		memcpy(&temp_cp, datap, item_sz);
-		ZERO(peeraddr);
-		if (client_v6_capable && temp_cp.v6_flag) {
-			AF(&peeraddr) = AF_INET6;
-			SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
-		} else {
-			AF(&peeraddr) = AF_INET;
-			NSRCADR(&peeraddr) = temp_cp.peeraddr;
-		}
-		SET_PORT(&peeraddr, NTP_PORT);
-#ifdef ISC_PLATFORM_HAVESALEN
-		peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
-#endif
-		found = FALSE;
-		p = NULL;
-
-		while (!found) {
-			p = findexistingpeer(&peeraddr, NULL, p, -1, 0);
-			if (NULL == p)
-				break;
-			if (FLAG_CONFIG & p->flags)
-				found = TRUE;
-		}
-		INSIST(found);
-		INSIST(NULL != p);
-
-		peer_clear(p, "GONE");
-		unpeer(p);
-
-		datap += item_sz;
-	}
-
+	/* report success */
 	req_ack(srcadr, inter, inpkt, INFO_OKAY);
 }
 
@@ -2297,36 +2294,64 @@
 	return;
 }
 
-
-
 /*
- * set_request_keyid - set the keyid used to authenticate requests
+ * Validate a request packet for a new request or control key:
+ *  - only one item allowed
+ *  - key must be valid (that is, known, and not in the autokey range)
  */
 static void
-set_request_keyid(
-	sockaddr_u *srcadr,
-	endpt *inter,
+set_keyid_checked(
+	keyid_t        *into,
+	const char     *what,
+	sockaddr_u     *srcadr,
+	endpt          *inter,
 	struct req_pkt *inpkt
 	)
 {
 	keyid_t *pkeyid;
+	keyid_t  tmpkey;
 
-	/*
-	 * Restrict ourselves to one item only.
-	 */
+	/* restrict ourselves to one item only */
 	if (INFO_NITEMS(inpkt->err_nitems) > 1) {
-		msyslog(LOG_ERR, "set_request_keyid: err_nitems > 1");
+		msyslog(LOG_ERR, "set_keyid_checked[%s]: err_nitems > 1",
+			what);
 		req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
 		return;
 	}
 
+	/* plug the new key from the packet */
 	pkeyid = (keyid_t *)&inpkt->u;
-	info_auth_keyid = ntohl(*pkeyid);
+	tmpkey = ntohl(*pkeyid);
+
+	/* validate the new key id, claim data error on failure */
+	if (tmpkey < 1 || tmpkey > NTP_MAXKEY || !auth_havekey(tmpkey)) {
+		msyslog(LOG_ERR, "set_keyid_checked[%s]: invalid key id: %ld",
+			what, (long)tmpkey);
+		req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
+		return;
+	}
+
+	/* if we arrive here, the key is good -- use it */
+	*into = tmpkey;
 	req_ack(srcadr, inter, inpkt, INFO_OKAY);
 }
 
+/*
+ * set_request_keyid - set the keyid used to authenticate requests
+ */
+static void
+set_request_keyid(
+	sockaddr_u *srcadr,
+	endpt *inter,
+	struct req_pkt *inpkt
+	)
+{
+	set_keyid_checked(&info_auth_keyid, "request",
+			  srcadr, inter, inpkt);
+}
 
 
+
 /*
  * set_control_keyid - set the keyid used to authenticate requests
  */
@@ -2337,20 +2362,8 @@
 	struct req_pkt *inpkt
 	)
 {
-	keyid_t *pkeyid;
-
-	/*
-	 * Restrict ourselves to one item only.
-	 */
-	if (INFO_NITEMS(inpkt->err_nitems) > 1) {
-		msyslog(LOG_ERR, "set_control_keyid: err_nitems > 1");
-		req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
-		return;
-	}
-
-	pkeyid = (keyid_t *)&inpkt->u;
-	ctl_auth_keyid = ntohl(*pkeyid);
-	req_ack(srcadr, inter, inpkt, INFO_OKAY);
+	set_keyid_checked(&ctl_auth_keyid, "control",
+			  srcadr, inter, inpkt);
 }
 
 
Index: contrib/ntp/ntpd/ntpd.1ntpdman
===================================================================
--- contrib/ntp/ntpd/ntpd.1ntpdman	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.1ntpdman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpd 1ntpdman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpd 1ntpdman "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9JaiRS/ag-jKaaQS)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:54 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
 .\" From the definitions ntpd-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/ntpd/ntpd.man.in
===================================================================
--- contrib/ntp/ntpd/ntpd.man.in	(版本 297264)
+++ contrib/ntp/ntpd/ntpd.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpd @NTPD_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpd @NTPD_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9JaiRS/ag-jKaaQS)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:54 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
 .\" From the definitions ntpd-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/ntpdc/ntpdc-opts.c
===================================================================
--- contrib/ntp/ntpdc/ntpdc-opts.c	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:18:22 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:28:50 PM by AutoGen 5.18.5
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  *
@@ -69,7 +69,7 @@
  *  static const strings for ntpdc options
  */
 static char const ntpdc_opt_strs[1911] =
-/*     0 */ "ntpdc 4.2.8p6\n"
+/*     0 */ "ntpdc 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -128,7 +128,7 @@
 /*  1694 */ "no-load-opts\0"
 /*  1707 */ "no\0"
 /*  1710 */ "NTPDC\0"
-/*  1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6\n"
+/*  1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
 /*  1846 */ "$HOME\0"
 /*  1852 */ ".\0"
@@ -135,7 +135,7 @@
 /*  1854 */ ".ntprc\0"
 /*  1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
 /*  1895 */ "\n\0"
-/*  1897 */ "ntpdc 4.2.8p6";
+/*  1897 */ "ntpdc 4.2.8p7";
 
 /**
  *  ipv4 option description with
@@ -796,7 +796,7 @@
      translate option names.
    */
   /* referenced via ntpdcOptions.pzCopyright */
-  puts(_("ntpdc 4.2.8p6\n\
+  puts(_("ntpdc 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -862,7 +862,7 @@
   puts(_("load options from a config file"));
 
   /* referenced via ntpdcOptions.pzUsageTitle */
-  puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6\n\
+  puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
 
   /* referenced via ntpdcOptions.pzExplain */
@@ -869,7 +869,7 @@
   puts(_("\n"));
 
   /* referenced via ntpdcOptions.pzFullVersion */
-  puts(_("ntpdc 4.2.8p6"));
+  puts(_("ntpdc 4.2.8p7"));
 
   /* referenced via ntpdcOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/ntpdc/ntpdc.html
===================================================================
--- contrib/ntp/ntpdc/ntpdc.html	(版本 297264)
+++ contrib/ntp/ntpdc/ntpdc.html	(版本 298770)
@@ -36,7 +36,7 @@
 clock.  Run as root, it can correct the system clock to this offset as
 well.  It can be run as an interactive command or from a cron job.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntpdc</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntpdc</code>.
 
   <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
 IETF specification.
@@ -152,7 +152,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6
+<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7
 Usage:  ntpdc [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
Index: contrib/ntp/scripts/ntpsweep/ntpsweep.html
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep.html	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep.html	(版本 298770)
@@ -30,7 +30,7 @@
 
   <p>This document describes the use of the NTP Project's <code>ntpsweep</code> program.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntpsweep</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntpsweep</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -90,7 +90,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p6
+<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
 USAGE: ntpsweep [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [hostfile]
 
     -l, --host-list=str          Host to execute actions on
Index: contrib/ntp/scripts/ntptrace/ntptrace-opts
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace-opts	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (ntptrace-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:10 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:37 PM by AutoGen 5.18.5
 # From the definitions    ntptrace-opts.def
 # and the template file   perlopt
 
@@ -40,7 +40,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p6
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
 USAGE: ntptrace [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [host]
 
     -n, --numeric                Print IP addresses instead of hostnames
Index: contrib/ntp/scripts/ntptrace/ntptrace.man.in
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace.man.in	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntptrace @NTPTRACE_MS@ "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntptrace @NTPTRACE_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-s0aOMK/ag-G0aWLK)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-1QaORy/ag-bRaWQy)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:13 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:39 PM by AutoGen 5.18.5
 .\" From the definitions ntptrace-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/plot_summary.1plot_summarymdoc
===================================================================
--- contrib/ntp/scripts/plot_summary.1plot_summarymdoc	(版本 297264)
+++ contrib/ntp/scripts/plot_summary.1plot_summarymdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (plot_summary-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:38 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:25:04 PM by AutoGen 5.18.5
 .\"  From the definitions    plot_summary-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/summary-opts
===================================================================
--- contrib/ntp/scripts/summary-opts	(版本 297264)
+++ contrib/ntp/scripts/summary-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (summary-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:32 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:58 PM by AutoGen 5.18.5
 # From the definitions    summary-opts.def
 # and the template file   perlopt
 
@@ -44,7 +44,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p6
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
 USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
 
         --directory=str          Directory containing stat files
Index: contrib/ntp/scripts/summary.man.in
===================================================================
--- contrib/ntp/scripts/summary.man.in	(版本 297264)
+++ contrib/ntp/scripts/summary.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH summary 1summaryman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH summary 1summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-z8aWPN/ag-M8a4ON)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gNaWUB/ag-tNa4TB)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:42 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:25:07 PM by AutoGen 5.18.5
 .\" From the definitions summary-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/update-leap/update-leap.1update-leapman
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap.1update-leapman	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap.1update-leapman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH update-leap 1update-leapman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH update-leap 1update-leapman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-iOaqCL/ag-uOayBL)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FCaqHz/ag-RCayGz)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:20 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:46 PM by AutoGen 5.18.5
 .\" From the definitions update-leap-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/update-leap/update-leap.mdoc.in
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt UPDATE_LEAP 1update-leapmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (update-leap-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:28 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:54 PM by AutoGen 5.18.5
 .\"  From the definitions    update-leap-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/ntpq/ntpq-opts.c
===================================================================
--- contrib/ntp/ntpq/ntpq-opts.c	(版本 297264)
+++ contrib/ntp/ntpq/ntpq-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpq-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:18:42 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:29:11 PM by AutoGen 5.18.5
  *  From the definitions    ntpq-opts.def
  *  and the template file   options
  *
@@ -68,8 +68,8 @@
 /**
  *  static const strings for ntpq options
  */
-static char const ntpq_opt_strs[1925] =
-/*     0 */ "ntpq 4.2.8p6\n"
+static char const ntpq_opt_strs[1982] =
+/*     0 */ "ntpq 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -113,29 +113,33 @@
 /*  1404 */ "Print a list of the peers\0"
 /*  1430 */ "PEERS\0"
 /*  1436 */ "peers\0"
-/*  1442 */ "Display the full 'remote' value\0"
-/*  1474 */ "WIDE\0"
-/*  1479 */ "wide\0"
-/*  1484 */ "display extended usage information and exit\0"
-/*  1528 */ "help\0"
-/*  1533 */ "extended usage information passed thru pager\0"
-/*  1578 */ "more-help\0"
-/*  1588 */ "output version information and exit\0"
-/*  1624 */ "version\0"
-/*  1632 */ "save the option state to a config file\0"
-/*  1671 */ "save-opts\0"
-/*  1681 */ "load options from a config file\0"
-/*  1713 */ "LOAD_OPTS\0"
-/*  1723 */ "no-load-opts\0"
-/*  1736 */ "no\0"
-/*  1739 */ "NTPQ\0"
-/*  1744 */ "ntpq - standard NTP query program - Ver. 4.2.8p6\n"
+/*  1442 */ "Set default display type for S2+ refids\0"
+/*  1482 */ "REFID\0"
+/*  1488 */ "refid\0"
+/*  1494 */ "Display the full 'remote' value\0"
+/*  1526 */ "WIDE\0"
+/*  1531 */ "wide\0"
+/*  1536 */ "display extended usage information and exit\0"
+/*  1580 */ "help\0"
+/*  1585 */ "extended usage information passed thru pager\0"
+/*  1630 */ "more-help\0"
+/*  1640 */ "output version information and exit\0"
+/*  1676 */ "version\0"
+/*  1684 */ "save the option state to a config file\0"
+/*  1723 */ "save-opts\0"
+/*  1733 */ "load options from a config file\0"
+/*  1765 */ "LOAD_OPTS\0"
+/*  1775 */ "no-load-opts\0"
+/*  1788 */ "no\0"
+/*  1791 */ "NTPQ\0"
+/*  1796 */ "ntpq - standard NTP query program - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
-/*  1863 */ "$HOME\0"
-/*  1869 */ ".\0"
-/*  1871 */ ".ntprc\0"
-/*  1878 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/*  1912 */ "ntpq 4.2.8p6";
+/*  1915 */ "$HOME\0"
+/*  1921 */ ".\0"
+/*  1923 */ ".ntprc\0"
+/*  1930 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/*  1964 */ "ntpq 4.2.8p7\0"
+/*  1977 */ "hash";
 
 /**
  *  ipv4 option description with
@@ -265,14 +269,29 @@
 #define PEERS_FLAGS     (OPTST_DISABLED)
 
 /**
+ *  refid option description:
+ */
+/** Descriptive text for the refid option */
+#define REFID_DESC      (ntpq_opt_strs+1442)
+/** Upper-cased name for the refid option */
+#define REFID_NAME      (ntpq_opt_strs+1482)
+/** Name string for the refid option */
+#define REFID_name      (ntpq_opt_strs+1488)
+/** The compiled in default value for the refid option argument */
+#define REFID_DFT_ARG   ((char const*)REFID_IPV4)
+/** Compiled in flag settings for the refid option */
+#define REFID_FLAGS     (OPTST_DISABLED \
+        | OPTST_SET_ARGTYPE(OPARG_TYPE_ENUMERATION))
+
+/**
  *  wide option description:
  */
 /** Descriptive text for the wide option */
-#define WIDE_DESC      (ntpq_opt_strs+1442)
+#define WIDE_DESC      (ntpq_opt_strs+1494)
 /** Upper-cased name for the wide option */
-#define WIDE_NAME      (ntpq_opt_strs+1474)
+#define WIDE_NAME      (ntpq_opt_strs+1526)
 /** Name string for the wide option */
-#define WIDE_name      (ntpq_opt_strs+1479)
+#define WIDE_name      (ntpq_opt_strs+1531)
 /** Compiled in flag settings for the wide option */
 #define WIDE_FLAGS     (OPTST_DISABLED)
 
@@ -279,11 +298,11 @@
 /*
  *  Help/More_Help/Version option descriptions:
  */
-#define HELP_DESC       (ntpq_opt_strs+1484)
-#define HELP_name       (ntpq_opt_strs+1528)
+#define HELP_DESC       (ntpq_opt_strs+1536)
+#define HELP_name       (ntpq_opt_strs+1580)
 #ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC  (ntpq_opt_strs+1533)
-#define MORE_HELP_name  (ntpq_opt_strs+1578)
+#define MORE_HELP_DESC  (ntpq_opt_strs+1585)
+#define MORE_HELP_name  (ntpq_opt_strs+1630)
 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
 #else
 #define MORE_HELP_DESC  HELP_DESC
@@ -296,14 +315,14 @@
 #  define VER_FLAGS     (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
                          OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
 #endif
-#define VER_DESC        (ntpq_opt_strs+1588)
-#define VER_name        (ntpq_opt_strs+1624)
-#define SAVE_OPTS_DESC  (ntpq_opt_strs+1632)
-#define SAVE_OPTS_name  (ntpq_opt_strs+1671)
-#define LOAD_OPTS_DESC     (ntpq_opt_strs+1681)
-#define LOAD_OPTS_NAME     (ntpq_opt_strs+1713)
-#define NO_LOAD_OPTS_name  (ntpq_opt_strs+1723)
-#define LOAD_OPTS_pfx      (ntpq_opt_strs+1736)
+#define VER_DESC        (ntpq_opt_strs+1640)
+#define VER_name        (ntpq_opt_strs+1676)
+#define SAVE_OPTS_DESC  (ntpq_opt_strs+1684)
+#define SAVE_OPTS_name  (ntpq_opt_strs+1723)
+#define LOAD_OPTS_DESC     (ntpq_opt_strs+1733)
+#define LOAD_OPTS_NAME     (ntpq_opt_strs+1765)
+#define NO_LOAD_OPTS_name  (ntpq_opt_strs+1775)
+#define LOAD_OPTS_pfx      (ntpq_opt_strs+1788)
 #define LOAD_OPTS_name     (NO_LOAD_OPTS_name + 3)
 /**
  *  Declare option callback procedures
@@ -314,7 +333,7 @@
     optionResetOpt,          optionStackArg,          optionTimeDate,
     optionTimeVal,           optionUnstackArg,        optionVendorOption;
 static tOptProc
-    doOptDebug_Level, doUsageOpt;
+    doOptDebug_Level, doOptRefid, doUsageOpt;
 #define VER_PROC        ntpOptionPrintVersion
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -432,10 +451,22 @@
      /* desc, NAME, name */ PEERS_DESC, PEERS_NAME, PEERS_name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 9, VALUE_OPT_WIDE,
-     /* equiv idx, value */ 9, VALUE_OPT_WIDE,
+  {  /* entry idx, value */ 9, VALUE_OPT_REFID,
+     /* equiv idx, value */ 9, VALUE_OPT_REFID,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
+     /* opt state flags  */ REFID_FLAGS, 0,
+     /* last opt argumnt */ { REFID_DFT_ARG },
+     /* arg list/cookie  */ NULL,
+     /* must/cannot opts */ NULL, NULL,
+     /* option proc      */ doOptRefid,
+     /* desc, NAME, name */ REFID_DESC, REFID_NAME, REFID_name,
+     /* disablement strs */ NULL, NULL },
+
+  {  /* entry idx, value */ 10, VALUE_OPT_WIDE,
+     /* equiv idx, value */ 10, VALUE_OPT_WIDE,
+     /* equivalenced to  */ NO_EQUIVALENT,
+     /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ WIDE_FLAGS, 0,
      /* last opt argumnt */ { NULL }, /* --wide */
      /* arg list/cookie  */ NULL,
@@ -512,24 +543,24 @@
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 /** Reference to the upper cased version of ntpq. */
-#define zPROGNAME       (ntpq_opt_strs+1739)
+#define zPROGNAME       (ntpq_opt_strs+1791)
 /** Reference to the title line for ntpq usage. */
-#define zUsageTitle     (ntpq_opt_strs+1744)
+#define zUsageTitle     (ntpq_opt_strs+1796)
 /** ntpq configuration file name. */
-#define zRcName         (ntpq_opt_strs+1871)
+#define zRcName         (ntpq_opt_strs+1923)
 /** Directories to search for ntpq config files. */
 static char const * const apzHomeList[3] = {
-    ntpq_opt_strs+1863,
-    ntpq_opt_strs+1869,
+    ntpq_opt_strs+1915,
+    ntpq_opt_strs+1921,
     NULL };
 /** The ntpq program bug email address. */
-#define zBugsAddr       (ntpq_opt_strs+1878)
+#define zBugsAddr       (ntpq_opt_strs+1930)
 /** Clarification/explanation of what ntpq does. */
 #define zExplain        (NULL)
 /** Extra detail explaining what ntpq does. */
 #define zDetail         (NULL)
 /** The full version string for ntpq. */
-#define zFullVersion    (ntpq_opt_strs+1912)
+#define zFullVersion    (ntpq_opt_strs+1964)
 /* extracted from optcode.tlib near line 364 */
 
 #if defined(ENABLE_NLS)
@@ -588,6 +619,30 @@
     (void)pOptDesc;
     (void)pOptions;
 }
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the refid option.
+ * Set the default display format for S2+ refids.
+ * @param[in] pOptions the ntpq options data structure
+ * @param[in,out] pOptDesc the option descriptor for this option.
+ */
+static void
+doOptRefid(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+
+/* extracted from optmain.tlib near line 945 */
+    static char const * const names[2] = {
+        ntpq_opt_strs+1977, ntpq_opt_strs+1044 };
+
+    if (pOptions <= OPTPROC_EMIT_LIMIT) {
+        (void) optionEnumerationVal(pOptions, pOptDesc, names, 2);
+        return; /* protect AutoOpts client code from internal callbacks */
+    }
+
+    pOptDesc->optArg.argEnum =
+        optionEnumerationVal(pOptions, pOptDesc, names, 2);
+}
 /* extracted from optmain.tlib near line 1250 */
 
 /**
@@ -651,7 +706,7 @@
       NO_EQUIVALENT, /* '-#' option index */
       NO_EQUIVALENT /* index of default opt */
     },
-    15 /* full option count */, 10 /* user option count */,
+    16 /* full option count */, 11 /* user option count */,
     ntpq_full_usage, ntpq_short_usage,
     NULL, NULL,
     PKGDATADIR, ntpq_packager_info
@@ -786,7 +841,7 @@
      translate option names.
    */
   /* referenced via ntpqOptions.pzCopyright */
-  puts(_("ntpq 4.2.8p6\n\
+  puts(_("ntpq 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -834,6 +889,9 @@
   puts(_("Print a list of the peers"));
 
   /* referenced via ntpqOptions.pOptDesc->pzText */
+  puts(_("Set default display type for S2+ refids"));
+
+  /* referenced via ntpqOptions.pOptDesc->pzText */
   puts(_("Display the full 'remote' value"));
 
   /* referenced via ntpqOptions.pOptDesc->pzText */
@@ -852,11 +910,11 @@
   puts(_("load options from a config file"));
 
   /* referenced via ntpqOptions.pzUsageTitle */
-  puts(_("ntpq - standard NTP query program - Ver. 4.2.8p6\n\
+  puts(_("ntpq - standard NTP query program - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
 
   /* referenced via ntpqOptions.pzFullVersion */
-  puts(_("ntpq 4.2.8p6"));
+  puts(_("ntpq 4.2.8p7"));
 
   /* referenced via ntpqOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/ntpq/ntpq.1ntpqman
===================================================================
--- contrib/ntp/ntpq/ntpq.1ntpqman	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.1ntpqman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpq 1ntpqman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpq 1ntpqman "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Z7aWRV/ag-_7aOQV)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-11aqEI/ag-c2aiDI)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:06 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:29:35 PM by AutoGen 5.18.5
 .\" From the definitions ntpq-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
@@ -1347,6 +1347,27 @@
 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
+.NOP \f\*[B-Font]\-r\f[] \f\*[I-Font]keyword\f[], \f\*[B-Font]\-\-refid\f[]=\f\*[I-Font]keyword\f[]
+Set default display type for S2+ refids.
+This option takes a keyword as its argument.  The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+hash ipv4
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default
+\f\*[I-Font]keyword\f[]
+for this option is:
+.ti +4
+ ipv4
+.sp
+Set the default display format for S2+ refids.
+.TP
 .NOP \f\*[B-Font]\-w\f[], \f\*[B-Font]\-\-wide\f[]
 Display the full 'remote' value.
 .sp
Index: contrib/ntp/ntpq/ntpq.html
===================================================================
--- contrib/ntp/ntpq/ntpq.html	(版本 297264)
+++ contrib/ntp/ntpq/ntpq.html	(版本 298770)
@@ -44,7 +44,7 @@
 and determine the performance of
 <code>ntpd</code>, the NTP daemon.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntpq</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntpq</code>.
 
 <ul class="menu">
 <li><a accesskey="1" href="#ntpq-Description">ntpq Description</a>
@@ -744,7 +744,8 @@
 <li><a accesskey="6" href="#ntpq-numeric">ntpq numeric</a>:                 numeric option (-n)
 <li><a accesskey="7" href="#ntpq-old_002drv">ntpq old-rv</a>:                  old-rv option
 <li><a accesskey="8" href="#ntpq-peers">ntpq peers</a>:                   peers option (-p)
-<li><a accesskey="9" href="#ntpq-wide">ntpq wide</a>:                    wide option (-w)
+<li><a accesskey="9" href="#ntpq-refid">ntpq refid</a>:                   refid option (-r)
+<li><a href="#ntpq-wide">ntpq wide</a>:                    wide option (-w)
 <li><a href="#ntpq-config">ntpq config</a>:                  presetting/configuring ntpq
 <li><a href="#ntpq-exit-status">ntpq exit status</a>:             exit status
 </ul>
@@ -769,7 +770,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p5
+<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p6
 Usage:  ntpq [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
@@ -790,6 +791,7 @@
       no  old-rv         Always output status line with readvar
    -p no  peers          Print a list of the peers
                                 - prohibits the option 'interactive'
+   -r KWd refid          Set default display type for S2+ refids
    -w no  wide           Display the full 'remote' value
       opt version        output version information and exit
    -? no  help           display extended usage information and exit
@@ -807,6 +809,10 @@
  - reading file ./.ntprc
  - examining environment variables named NTPQ_*
 
+The valid "refid" option keywords are:
+  hash ipv4
+  or an integer from 0 through 1
+
 Please send bug reports to:  &lt;http://bugs.ntp.org, bugs@ntp.org&gt;
 </pre>
   <div class="node">
@@ -932,7 +938,7 @@
 newer <code>ntpq</code> to behave identically in this regard. 
 <div class="node">
 <p><hr>
-<a name="ntpq-peers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-wide">ntpq wide</a>,
+<a name="ntpq-peers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-refid">ntpq refid</a>,
 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-old_002drv">ntpq old-rv</a>,
 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
 <br>
@@ -953,15 +959,39 @@
 of their state. This is equivalent to the 'peers' interactive command. 
 <div class="node">
 <p><hr>
-<a name="ntpq-wide"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-config">ntpq config</a>,
+<a name="ntpq-refid"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-wide">ntpq wide</a>,
 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-peers">ntpq peers</a>,
 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
 <br>
 </div>
 
+<h4 class="subsection">refid option (-r)</h4>
+
+<p><a name="index-ntpq_002drefid-11"></a>
+This is the &ldquo;set default display type for s2+ refids&rdquo; option. 
+This option takes a keyword argument.
+
+<p class="noindent">This option has some usage constraints.  It:
+     <ul>
+<li>This option takes a keyword as its argument. 
+The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_REFID). 
+The available keywords are:
+     <pre class="example">             hash ipv4
+    </pre>
+     <p>or their numeric equivalent.</ul>
+
+  <p>Set the default display format for S2+ refids. 
+<div class="node">
+<p><hr>
+<a name="ntpq-wide"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-config">ntpq config</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-refid">ntpq refid</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
+<br>
+</div>
+
 <h4 class="subsection">wide option (-w)</h4>
 
-<p><a name="index-ntpq_002dwide-11"></a>
+<p><a name="index-ntpq_002dwide-12"></a>
 This is the &ldquo;display the full 'remote' value&rdquo; option. 
 Display the full value of the 'remote' value.  If this requires
 more than 15 characters, display the full value, emit a newline,
Index: contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:19:15 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:29:44 PM by AutoGen 5.18.5
  *  From the definitions    ntpsnmpd-opts.def
  *  and the template file   options
  *
@@ -61,7 +61,7 @@
  *  static const strings for ntpsnmpd options
  */
 static char const ntpsnmpd_opt_strs[1610] =
-/*     0 */ "ntpsnmpd 4.2.8p6\n"
+/*     0 */ "ntpsnmpd 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -101,7 +101,7 @@
 /*  1414 */ "no-load-opts\0"
 /*  1427 */ "no\0"
 /*  1430 */ "NTPSNMPD\0"
-/*  1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p6\n"
+/*  1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
 /*  1542 */ "$HOME\0"
 /*  1548 */ ".\0"
@@ -108,7 +108,7 @@
 /*  1550 */ ".ntprc\0"
 /*  1557 */ "http://bugs.ntp.org, bugs@ntp.org\0"
 /*  1591 */ "\n\0"
-/*  1593 */ "ntpsnmpd 4.2.8p6";
+/*  1593 */ "ntpsnmpd 4.2.8p7";
 
 /**
  *  nofork option description:
@@ -554,7 +554,7 @@
      translate option names.
    */
   /* referenced via ntpsnmpdOptions.pzCopyright */
-  puts(_("ntpsnmpd 4.2.8p6\n\
+  puts(_("ntpsnmpd 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -599,7 +599,7 @@
   puts(_("load options from a config file"));
 
   /* referenced via ntpsnmpdOptions.pzUsageTitle */
-  puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p6\n\
+  puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
 
   /* referenced via ntpsnmpdOptions.pzExplain */
@@ -606,7 +606,7 @@
   puts(_("\n"));
 
   /* referenced via ntpsnmpdOptions.pzFullVersion */
-  puts(_("ntpsnmpd 4.2.8p6"));
+  puts(_("ntpsnmpd 4.2.8p7"));
 
   /* referenced via ntpsnmpdOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/ntpsnmpd/ntpsnmpd.html
===================================================================
--- contrib/ntp/ntpsnmpd/ntpsnmpd.html	(版本 297264)
+++ contrib/ntp/ntpsnmpd/ntpsnmpd.html	(版本 298770)
@@ -42,7 +42,7 @@
 <p>The <code>ntpsnmpd</code> utility program is used to monitor NTP daemon <code>ntpd</code>
 operations and determine performance.  It uses the standard NTP mode 6 control
 
-  <p>This document applies to version 4.2.8p6 of <code>ntpsnmpd</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntpsnmpd</code>.
 
 <ul class="menu">
 <li><a accesskey="1" href="#ntpsnmpd-Description">ntpsnmpd Description</a>:             Description
Index: contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
===================================================================
--- contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-lWayEG/ag-yWaGDG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-b1aGJu/ag-n1aOIu)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:09:44 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:11 PM by AutoGen 5.18.5
 .\" From the definitions calc_tickadj-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
===================================================================
--- contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (calc_tickadj-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:09:46 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:13 PM by AutoGen 5.18.5
 .\"  From the definitions    calc_tickadj-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
===================================================================
--- contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntp-wait.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:09:57 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:23 PM by AutoGen 5.18.5
 # From the definitions    ntp-wait-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -61,7 +61,7 @@
 
 @exampleindent 0
 @example
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p6
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
 USAGE: ntp-wait [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... 
 
     -n, --tries=num              Number of times to check ntpd
Index: contrib/ntp/scripts/ntp-wait/ntp-wait.html
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait.html	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait.html	(版本 298770)
@@ -39,7 +39,7 @@
 and only then start any applicaitons (like database servers) that require
 accurate and stable time.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntp-wait</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntp-wait</code>.
 
 <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -114,7 +114,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p6
+<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
 USAGE: ntp-wait [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
 
     -n, --tries=num              Number of times to check ntpd
Index: contrib/ntp/scripts/ntpsweep/ntpsweep-opts
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep-opts	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (ntpsweep-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:01 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:28 PM by AutoGen 5.18.5
 # From the definitions    ntpsweep-opts.def
 # and the template file   perlopt
 
@@ -43,7 +43,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p6
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
 USAGE: ntpsweep [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostfile]
 
     -l, --host-list=str          Host to execute actions on
Index: contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep.man.in	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpsweep 1ntpsweepman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntpsweep 1ntpsweepman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3aaGuJ/ag-ebaOtJ)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-L6aGzx/ag-Y6aOyx)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:05 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:32 PM by AutoGen 5.18.5
 .\" From the definitions ntpsweep-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntptrace 1ntptraceman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntptrace 1ntptraceman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-s0aOMK/ag-G0aWLK)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-1QaORy/ag-bRaWQy)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:13 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:39 PM by AutoGen 5.18.5
 .\" From the definitions ntptrace-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPTRACE @NTPTRACE_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntptrace-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:18 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:44 PM by AutoGen 5.18.5
 .\"  From the definitions    ntptrace-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/plot_summary.html
===================================================================
--- contrib/ntp/scripts/plot_summary.html	(版本 297264)
+++ contrib/ntp/scripts/plot_summary.html	(版本 298770)
@@ -31,7 +31,7 @@
 <h2 class="unnumbered">Plot_summary User Manual</h2>
 
 <p>This document describes the use of the NTP Project's <code>plot_summary</code> program. 
-This document applies to version 4.2.8p6 of <code>plot_summary</code>.
+This document applies to version 4.2.8p7 of <code>plot_summary</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -89,7 +89,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p6
+<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
 USAGE: plot_summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
 
         --directory=str          Where the summary files are
Index: contrib/ntp/scripts/summary.1summaryman
===================================================================
--- contrib/ntp/scripts/summary.1summaryman	(版本 297264)
+++ contrib/ntp/scripts/summary.1summaryman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH summary 1summaryman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH summary 1summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-z8aWPN/ag-M8a4ON)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gNaWUB/ag-tNa4TB)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:42 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:25:07 PM by AutoGen 5.18.5
 .\" From the definitions summary-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/summary.mdoc.in
===================================================================
--- contrib/ntp/scripts/summary.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/summary.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt SUMMARY 1summarymdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (summary-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:44 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:25:09 PM by AutoGen 5.18.5
 .\"  From the definitions    summary-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt UPDATE_LEAP 1update-leapmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (update-leap-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:28 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:54 PM by AutoGen 5.18.5
 .\"  From the definitions    update-leap-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/ntptrace/ntptrace.html
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace.html	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace.html	(版本 298770)
@@ -31,7 +31,7 @@
 <h2 class="unnumbered">Simple Network Time Protocol User Manual</h2>
 
 <p>This document describes the use of the NTP Project's <code>ntptrace</code> program. 
-This document applies to version 4.2.8p6 of <code>ntptrace</code>.
+This document applies to version 4.2.8p7 of <code>ntptrace</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -107,7 +107,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p6
+<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
 USAGE: ntptrace [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [host]
 
     -n, --numeric                Print IP addresses instead of hostnames
Index: contrib/ntp/scripts/plot_summary.1plot_summaryman
===================================================================
--- contrib/ntp/scripts/plot_summary.1plot_summaryman	(版本 297264)
+++ contrib/ntp/scripts/plot_summary.1plot_summaryman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH plot_summary 1plot_summaryman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH plot_summary 1plot_summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-CNaiCN/ag-PNaqBN)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaiHB/ag-ssaqGB)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:36 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:25:02 PM by AutoGen 5.18.5
 .\" From the definitions plot_summary-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/plot_summary.mdoc.in
===================================================================
--- contrib/ntp/scripts/plot_summary.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/plot_summary.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (plot_summary-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:38 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:25:04 PM by AutoGen 5.18.5
 .\"  From the definitions    plot_summary-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/summary.html
===================================================================
--- contrib/ntp/scripts/summary.html	(版本 297264)
+++ contrib/ntp/scripts/summary.html	(版本 298770)
@@ -31,7 +31,7 @@
 <h2 class="unnumbered">Summary User Manual</h2>
 
 <p>This document describes the use of the NTP Project's <code>summary</code> program. 
-This document applies to version 4.2.8p6 of <code>summary</code>.
+This document applies to version 4.2.8p7 of <code>summary</code>.
 
   <div class="shortcontents">
 <h2>Short Contents</h2>
@@ -88,7 +88,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p6
+<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
 USAGE: summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
 
         --directory=str          Directory containing stat files
Index: contrib/ntp/scripts/update-leap/update-leap-opts
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap-opts	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (update-leap-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:30 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:56 PM by AutoGen 5.18.5
 # From the definitions    update-leap-opts.def
 # and the template file   perlopt
 
@@ -46,7 +46,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-update-leap - leap-seconds file manager/updater - Ver. 4.2.8p6
+update-leap - leap-seconds file manager/updater - Ver. 4.2.8p7
 USAGE: update-leap [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
 
     -s, --source-url=str         The URL of the master copy of the leapseconds file
Index: contrib/ntp/scripts/update-leap/update-leap.man.in
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap.man.in	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH update-leap 1update-leapman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH update-leap 1update-leapman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-iOaqCL/ag-uOayBL)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FCaqHz/ag-RCayGz)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:20 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:46 PM by AutoGen 5.18.5
 .\" From the definitions update-leap-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/sntp/include/version.def
===================================================================
--- contrib/ntp/sntp/include/version.def	(版本 297264)
+++ contrib/ntp/sntp/include/version.def	(版本 298770)
@@ -1 +1 @@
-version = '4.2.8p6';
+version = '4.2.8p7';
Index: contrib/ntp/sntp/m4/version.m4
===================================================================
--- contrib/ntp/sntp/m4/version.m4	(版本 297264)
+++ contrib/ntp/sntp/m4/version.m4	(版本 298770)
@@ -1 +1 @@
-m4_define([VERSION_NUMBER],[4.2.8p6])
+m4_define([VERSION_NUMBER],[4.2.8p7])
Index: contrib/ntp/sntp/sntp.1sntpmdoc
===================================================================
--- contrib/ntp/sntp/sntp.1sntpmdoc	(版本 297264)
+++ contrib/ntp/sntp/sntp.1sntpmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt SNTP 1sntpmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:06:45 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
 .\"  From the definitions    sntp-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/sntp/version.c
===================================================================
--- contrib/ntp/sntp/version.c	(版本 297264)
+++ contrib/ntp/sntp/version.c	(版本 298770)
@@ -2,4 +2,4 @@
  * version file for sntp
  */
 #include <config.h>
-const char * Version = "sntp 4.2.8p5@1.3265-o Wed Jan 20 09:06:36 UTC 2016 (27)";
+const char * Version = "sntp 4.2.8p6@1.3265-o Wed Apr 27 00:21:06 UTC 2016 (28)";
Index: contrib/ntp/tests/libntp/run-lfpfunc.c
===================================================================
--- contrib/ntp/tests/libntp/run-lfpfunc.c	(版本 297264)
+++ contrib/ntp/tests/libntp/run-lfpfunc.c	(版本 298770)
@@ -58,15 +58,15 @@
 {
   progname = argv[0];
   UnityBegin("lfpfunc.c");
-  RUN_TEST(test_AdditionLR, 51);
-  RUN_TEST(test_AdditionRL, 52);
-  RUN_TEST(test_SubtractionLR, 53);
-  RUN_TEST(test_SubtractionRL, 54);
-  RUN_TEST(test_Negation, 55);
-  RUN_TEST(test_Absolute, 56);
-  RUN_TEST(test_FDF_RoundTrip, 57);
-  RUN_TEST(test_SignedRelOps, 58);
-  RUN_TEST(test_UnsignedRelOps, 59);
+  RUN_TEST(test_AdditionLR, 48);
+  RUN_TEST(test_AdditionRL, 49);
+  RUN_TEST(test_SubtractionLR, 50);
+  RUN_TEST(test_SubtractionRL, 51);
+  RUN_TEST(test_Negation, 52);
+  RUN_TEST(test_Absolute, 53);
+  RUN_TEST(test_FDF_RoundTrip, 54);
+  RUN_TEST(test_SignedRelOps, 55);
+  RUN_TEST(test_UnsignedRelOps, 56);
 
   return (UnityEnd());
 }
Index: contrib/ntp/tests/libntp/timespecops.c
===================================================================
--- contrib/ntp/tests/libntp/timespecops.c	(版本 297264)
+++ contrib/ntp/tests/libntp/timespecops.c	(版本 298770)
@@ -63,8 +63,6 @@
 void test_LFProundtrip(void);
 void test_ToString(void);
 
-typedef int bool;
-
 const bool	timespec_isValid(struct timespec V);
 struct timespec timespec_init(time_t hi, long lo);
 l_fp		l_fp_init(int32 i, u_int32 f);
Index: contrib/ntp/tests/ntpq/Makefile.in
===================================================================
--- contrib/ntp/tests/ntpq/Makefile.in	(版本 297264)
+++ contrib/ntp/tests/ntpq/Makefile.in	(版本 298770)
@@ -720,7 +720,8 @@
 
 AM_CFLAGS = $(CFLAGS_NTP)
 AM_CPPFLAGS = $(NTP_INCS) -I$(top_srcdir)/ntpq $(CPPFLAGS_NTP) \
-	-DUNITY_INCLUDE_CONFIG_H -I$(top_srcdir)/sntp/unity
+	-DUNITY_INCLUDE_CONFIG_H -I$(top_srcdir)/sntp/unity \
+	$(LIBOPTS_CFLAGS)
 AM_LDFLAGS = $(LDFLAGS_NTP)
 noinst_HEADERS = \
 	$(NULL)
Index: contrib/ntp/util/ntp-keygen.1ntp-keygenman
===================================================================
--- contrib/ntp/util/ntp-keygen.1ntp-keygenman	(版本 297264)
+++ contrib/ntp/util/ntp-keygen.1ntp-keygenman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp-keygen 1ntp-keygenman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntp-keygen 1ntp-keygenman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Dua4pY/ag-PuaWoY)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FRa4eL/ag-RRaWdL)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:44 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:30:15 PM by AutoGen 5.18.5
 .\" From the definitions ntp-keygen-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/sntp/config.h.in
===================================================================
--- contrib/ntp/sntp/config.h.in	(版本 297264)
+++ contrib/ntp/sntp/config.h.in	(版本 298770)
@@ -719,6 +719,9 @@
 /* Does the target support multicast IP? */
 #undef MCAST
 
+/* having to fork the DNS worker early when doing chroot? */
+#undef NEED_EARLY_FORK
+
 /* pthread_init() required? */
 #undef NEED_PTHREAD_INIT
 
Index: contrib/ntp/sntp/include/version.texi
===================================================================
--- contrib/ntp/sntp/include/version.texi	(版本 297264)
+++ contrib/ntp/sntp/include/version.texi	(版本 298770)
@@ -1,3 +1,3 @@
-@set UPDATED 20 January 2016
-@set EDITION 4.2.8p6
-@set VERSION 4.2.8p6
+@set UPDATED 26 April 2016
+@set EDITION 4.2.8p7
+@set VERSION 4.2.8p7
Index: contrib/ntp/sntp/sntp-opts.c
===================================================================
--- contrib/ntp/sntp/sntp-opts.c	(版本 297264)
+++ contrib/ntp/sntp/sntp-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:06:07 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:20:39 PM by AutoGen 5.18.5
  *  From the definitions    sntp-opts.def
  *  and the template file   options
  *
@@ -70,7 +70,7 @@
  *  static const strings for sntp options
  */
 static char const sntp_opt_strs[2549] =
-/*     0 */ "sntp 4.2.8p6\n"
+/*     0 */ "sntp 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -155,7 +155,7 @@
 /*  2298 */ "LOAD_OPTS\0"
 /*  2308 */ "no-load-opts\0"
 /*  2321 */ "SNTP\0"
-/*  2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p6\n"
+/*  2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
             "\t\t[ hostname-or-IP ...]\n\0"
 /*  2485 */ "$HOME\0"
@@ -163,7 +163,7 @@
 /*  2493 */ ".ntprc\0"
 /*  2500 */ "http://bugs.ntp.org, bugs@ntp.org\0"
 /*  2534 */ "\n\0"
-/*  2536 */ "sntp 4.2.8p6";
+/*  2536 */ "sntp 4.2.8p7";
 
 /**
  *  ipv4 option description with
@@ -1173,7 +1173,7 @@
      translate option names.
    */
   /* referenced via sntpOptions.pzCopyright */
-  puts(_("sntp 4.2.8p6\n\
+  puts(_("sntp 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -1263,7 +1263,7 @@
   puts(_("load options from a config file"));
 
   /* referenced via sntpOptions.pzUsageTitle */
-  puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p6\n\
+  puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
 \t\t[ hostname-or-IP ...]\n"));
 
@@ -1271,7 +1271,7 @@
   puts(_("\n"));
 
   /* referenced via sntpOptions.pzFullVersion */
-  puts(_("sntp 4.2.8p6"));
+  puts(_("sntp 4.2.8p7"));
 
   /* referenced via sntpOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/sntp/sntp.html
===================================================================
--- contrib/ntp/sntp/sntp.html	(版本 297264)
+++ contrib/ntp/sntp/sntp.html	(版本 298770)
@@ -36,7 +36,7 @@
 clock.  Run as root, it can correct the system clock to this offset as
 well.  It can be run as an interactive command or from a cron job.
 
-  <p>This document applies to version 4.2.8p6 of <code>sntp</code>.
+  <p>This document applies to version 4.2.8p7 of <code>sntp</code>.
 
   <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
 IETF specification.
@@ -176,7 +176,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p6
+<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7
 Usage:  sntp [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
                 [ hostname-or-IP ...]
   Flg Arg Option-Name    Description
Index: contrib/ntp/tests/libntp/Makefile.am
===================================================================
--- contrib/ntp/tests/libntp/Makefile.am	(版本 297264)
+++ contrib/ntp/tests/libntp/Makefile.am	(版本 298770)
@@ -42,6 +42,7 @@
 	test-strtolfp		\
 	test-timespecops	\
 	test-timevalops		\
+	test-tsafememcmp	\
 	test-tstotv		\
 	test-tvtots		\
 	test-uglydate		\
@@ -102,6 +103,7 @@
 	$(srcdir)/run-strtolfp.c	\
 	$(srcdir)/run-timevalops.c	\
 	$(srcdir)/run-timespecops.c	\
+	$(srcdir)/run-tsafememcmp.c	\
 	$(srcdir)/run-tstotv.c		\
 	$(srcdir)/run-tvtots.c		\
 	$(srcdir)/run-uglydate.c	\
@@ -477,6 +479,16 @@
 
 ###
 
+test_tsafememcmp_SOURCES =	\
+	tsafememcmp.c		\
+	run-tsafememcmp.c	\
+	$(NULL)
+
+$(srcdir)/run-tsafememcmp.c: $(srcdir)/tsafememcmp.c $(std_unity_list)
+	$(run_unity) tsafememcmp.c run-tsafememcmp.c
+
+###
+
 test_tstotv_SOURCES =		\
 	tstotv.c		\
 	run-tstotv.c		\
Index: contrib/ntp/tests/libntp/run-timevalops.c
===================================================================
--- contrib/ntp/tests/libntp/run-timevalops.c	(版本 297264)
+++ contrib/ntp/tests/libntp/run-timevalops.c	(版本 298770)
@@ -77,34 +77,34 @@
 {
   progname = argv[0];
   UnityBegin("timevalops.c");
-  RUN_TEST(test_Helpers1, 39);
-  RUN_TEST(test_Normalise, 40);
-  RUN_TEST(test_SignNoFrac, 41);
-  RUN_TEST(test_SignWithFrac, 42);
-  RUN_TEST(test_CmpFracEQ, 43);
-  RUN_TEST(test_CmpFracGT, 44);
-  RUN_TEST(test_CmpFracLT, 45);
-  RUN_TEST(test_AddFullNorm, 46);
-  RUN_TEST(test_AddFullOflow1, 47);
-  RUN_TEST(test_AddUsecNorm, 48);
-  RUN_TEST(test_AddUsecOflow1, 49);
-  RUN_TEST(test_SubFullNorm, 50);
-  RUN_TEST(test_SubFullOflow, 51);
-  RUN_TEST(test_SubUsecNorm, 52);
-  RUN_TEST(test_SubUsecOflow, 53);
-  RUN_TEST(test_Neg, 54);
-  RUN_TEST(test_AbsNoFrac, 55);
-  RUN_TEST(test_AbsWithFrac, 56);
-  RUN_TEST(test_Helpers2, 57);
-  RUN_TEST(test_ToLFPbittest, 58);
-  RUN_TEST(test_ToLFPrelPos, 59);
-  RUN_TEST(test_ToLFPrelNeg, 60);
-  RUN_TEST(test_ToLFPabs, 61);
-  RUN_TEST(test_FromLFPbittest, 62);
-  RUN_TEST(test_FromLFPrelPos, 63);
-  RUN_TEST(test_FromLFPrelNeg, 64);
-  RUN_TEST(test_LFProundtrip, 65);
-  RUN_TEST(test_ToString, 66);
+  RUN_TEST(test_Helpers1, 37);
+  RUN_TEST(test_Normalise, 38);
+  RUN_TEST(test_SignNoFrac, 39);
+  RUN_TEST(test_SignWithFrac, 40);
+  RUN_TEST(test_CmpFracEQ, 41);
+  RUN_TEST(test_CmpFracGT, 42);
+  RUN_TEST(test_CmpFracLT, 43);
+  RUN_TEST(test_AddFullNorm, 44);
+  RUN_TEST(test_AddFullOflow1, 45);
+  RUN_TEST(test_AddUsecNorm, 46);
+  RUN_TEST(test_AddUsecOflow1, 47);
+  RUN_TEST(test_SubFullNorm, 48);
+  RUN_TEST(test_SubFullOflow, 49);
+  RUN_TEST(test_SubUsecNorm, 50);
+  RUN_TEST(test_SubUsecOflow, 51);
+  RUN_TEST(test_Neg, 52);
+  RUN_TEST(test_AbsNoFrac, 53);
+  RUN_TEST(test_AbsWithFrac, 54);
+  RUN_TEST(test_Helpers2, 55);
+  RUN_TEST(test_ToLFPbittest, 56);
+  RUN_TEST(test_ToLFPrelPos, 57);
+  RUN_TEST(test_ToLFPrelNeg, 58);
+  RUN_TEST(test_ToLFPabs, 59);
+  RUN_TEST(test_FromLFPbittest, 60);
+  RUN_TEST(test_FromLFPrelPos, 61);
+  RUN_TEST(test_FromLFPrelNeg, 62);
+  RUN_TEST(test_LFProundtrip, 63);
+  RUN_TEST(test_ToString, 64);
 
   return (UnityEnd());
 }
Index: contrib/ntp/tests/libntp/timevalops.c
===================================================================
--- contrib/ntp/tests/libntp/timevalops.c	(版本 297264)
+++ contrib/ntp/tests/libntp/timevalops.c	(版本 298770)
@@ -27,8 +27,6 @@
 	u_int32	frac;
 } lfpfracdata ;
 
-typedef int bool;
-
 struct timeval timeval_init( time_t hi, long lo);
 const bool timeval_isValid(struct timeval V);
 l_fp l_fp_init(int32 i, u_int32 f);
Index: contrib/ntp/util/invoke-ntp-keygen.texi
===================================================================
--- contrib/ntp/util/invoke-ntp-keygen.texi	(版本 297264)
+++ contrib/ntp/util/invoke-ntp-keygen.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntp-keygen.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:19:48 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:30:20 PM by AutoGen 5.18.5
 # From the definitions    ntp-keygen-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -886,7 +886,7 @@
 
 @exampleindent 0
 @example
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p6
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7
 Usage:  ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
   Flg Arg Option-Name    Description
    -b Num imbits         identity modulus bits
Index: contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
===================================================================
--- contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc	(版本 297264)
+++ contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:51 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp-keygen-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/sntp/crypto.c
===================================================================
--- contrib/ntp/sntp/crypto.c	(版本 297264)
+++ contrib/ntp/sntp/crypto.c	(版本 298770)
@@ -1,6 +1,7 @@
 #include <config.h>
 #include "crypto.h"
 #include <ctype.h>
+#include "isc/string.h"
 
 struct key *key_ptr;
 size_t key_cnt = 0;
@@ -56,11 +57,16 @@
 	pkt_ptr = pkt_data;
 	hash_len = make_mac(pkt_ptr, pkt_size, sizeof(digest), cmp_key,
 			    digest);
-	if (!hash_len)
+	if (!hash_len) {
 		authentic = FALSE;
-	else
-		authentic = !memcmp(digest, pkt_ptr + pkt_size + 4,
+	} else {
+		/* isc_tsmemcmp will be better when its easy to link
+		 * with.  sntp is a 1-shot program, so snooping for
+		 * timing attacks is Harder.
+		 */
+		authentic = !memcmp(digest, pkt_data + pkt_size + 4,
 				    hash_len);
+	}
 	return authentic;
 }
 
Index: contrib/ntp/sntp/m4/ntp_libntp.m4
===================================================================
--- contrib/ntp/sntp/m4/ntp_libntp.m4	(版本 297264)
+++ contrib/ntp/sntp/m4/ntp_libntp.m4	(版本 298770)
@@ -163,6 +163,7 @@
 	# include <sys/socket.h>
 	#endif
     ])
+    AC_DEFINE([NEED_EARLY_FORK], [1], [having to fork the DNS worker early when doing chroot?])
 esac
 
 AC_CHECK_HEADERS([arpa/nameser.h sys/param.h sys/time.h sys/timers.h])
Index: contrib/ntp/sntp/sntp.1sntpman
===================================================================
--- contrib/ntp/sntp/sntp.1sntpman	(版本 297264)
+++ contrib/ntp/sntp/sntp.1sntpman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH sntp 1sntpman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH sntp 1sntpman "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-vxaitn/ag-Ixaasn)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EjaOrb/ag-RjaGqb)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:06:38 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:21:08 PM by AutoGen 5.18.5
 .\" From the definitions sntp-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/sntp/sntp.mdoc.in
===================================================================
--- contrib/ntp/sntp/sntp.mdoc.in	(版本 297264)
+++ contrib/ntp/sntp/sntp.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt SNTP @SNTP_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:06:45 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
 .\"  From the definitions    sntp-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/tests/libntp/lfpfunc.c
===================================================================
--- contrib/ntp/tests/libntp/lfpfunc.c	(版本 297264)
+++ contrib/ntp/tests/libntp/lfpfunc.c	(版本 298770)
@@ -21,9 +21,6 @@
 }
 
 
-typedef int bool; // typedef enum { FALSE, TRUE } boolean; -> can't use this because TRUE and FALSE are already defined
-
-
 typedef struct  {
 	uint32_t h, l;
 } lfp_hl;
Index: contrib/ntp/tests/libntp/ssl_init.c
===================================================================
--- contrib/ntp/tests/libntp/ssl_init.c	(版本 297264)
+++ contrib/ntp/tests/libntp/ssl_init.c	(版本 298770)
@@ -43,7 +43,7 @@
 	size_t digestLength;
 	size_t expected = TEST_SHA1_DIGEST_LENGTH;
 
-	TEST_ASSERT_EQUAL(NID_sha, keytype_from_text("SHA", &digestLength));
+	TEST_ASSERT_EQUAL(NID_sha1, keytype_from_text("SHA1", &digestLength));
 	TEST_ASSERT_EQUAL(expected, digestLength);
 	/* OPENSSL */
 #else 
@@ -62,7 +62,7 @@
 void
 test_SHA1KeyName(void) {
 #ifdef OPENSSL
-	TEST_ASSERT_EQUAL_STRING("SHA", keytype_name(NID_sha));
+	TEST_ASSERT_EQUAL_STRING("SHA1", keytype_name(NID_sha1));
 #else
 	TEST_IGNORE_MESSAGE("Skipping because OPENSSL isn't defined");
 #endif	/* OPENSSL */
Index: contrib/ntp/tests/ntpq/Makefile.am
===================================================================
--- contrib/ntp/tests/ntpq/Makefile.am	(版本 297264)
+++ contrib/ntp/tests/ntpq/Makefile.am	(版本 298770)
@@ -34,6 +34,7 @@
 AM_CPPFLAGS += $(CPPFLAGS_NTP)
 AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
 AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
+AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
 
 AM_LDFLAGS = $(LDFLAGS_NTP)
 
Index: contrib/ntp/scripts/ntp-wait/ntp-wait-opts
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait-opts	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (ntp-wait-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:09:51 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:18 PM by AutoGen 5.18.5
 # From the definitions    ntp-wait-opts.def
 # and the template file   perlopt
 
@@ -40,7 +40,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p6
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
 USAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
 
     -n, --tries=num              Number of times to check ntpd
Index: contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
===================================================================
--- contrib/ntp/scripts/ntp-wait/ntp-wait.man.in	(版本 297264)
+++ contrib/ntp/scripts/ntp-wait/ntp-wait.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp-wait @NTP_WAIT_MS@ "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntp-wait @NTP_WAIT_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4fay4H/ag-fgaG3H)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LcaO9v/ag-XcaW8v)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:09:53 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:20 PM by AutoGen 5.18.5
 .\" From the definitions ntp-wait-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntpsweep 1ntpsweepman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntpsweep 1ntpsweepman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3aaGuJ/ag-ebaOtJ)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-L6aGzx/ag-Y6aOyx)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:05 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:24:32 PM by AutoGen 5.18.5
 .\" From the definitions ntpsweep-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
===================================================================
--- contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in	(版本 297264)
+++ contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPSWEEP 1ntpsweepmdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpsweep-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:09 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:35 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpsweep-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
===================================================================
--- contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc	(版本 297264)
+++ contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPTRACE 1ntptracemdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntptrace-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:18 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:24:44 PM by AutoGen 5.18.5
 .\"  From the definitions    ntptrace-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/plot_summary-opts
===================================================================
--- contrib/ntp/scripts/plot_summary-opts	(版本 297264)
+++ contrib/ntp/scripts/plot_summary-opts	(版本 298770)
@@ -1,6 +1,6 @@
 # EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:30 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:56 PM by AutoGen 5.18.5
 # From the definitions    plot_summary-opts.def
 # and the template file   perlopt
 
@@ -46,7 +46,7 @@
         'help|?', 'more-help'));
 
     $usage = <<'USAGE';
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p6
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
 USAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
 
         --directory=str          Where the summary files are
Index: contrib/ntp/scripts/plot_summary.man.in
===================================================================
--- contrib/ntp/scripts/plot_summary.man.in	(版本 297264)
+++ contrib/ntp/scripts/plot_summary.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH plot_summary 1plot_summaryman "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH plot_summary 1plot_summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-CNaiCN/ag-PNaqBN)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaiHB/ag-ssaqGB)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:10:36 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:25:02 PM by AutoGen 5.18.5
 .\" From the definitions plot_summary-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/scripts/summary.1summarymdoc
===================================================================
--- contrib/ntp/scripts/summary.1summarymdoc	(版本 297264)
+++ contrib/ntp/scripts/summary.1summarymdoc	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt SUMMARY 1summarymdoc User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (summary-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:10:44 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:25:09 PM by AutoGen 5.18.5
 .\"  From the definitions    summary-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/scripts/update-leap/invoke-update-leap.texi
===================================================================
--- contrib/ntp/scripts/update-leap/invoke-update-leap.texi	(版本 297264)
+++ contrib/ntp/scripts/update-leap/invoke-update-leap.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-update-leap.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:10:24 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:24:50 PM by AutoGen 5.18.5
 # From the definitions    update-leap-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
Index: contrib/ntp/scripts/update-leap/update-leap.html
===================================================================
--- contrib/ntp/scripts/update-leap/update-leap.html	(版本 297264)
+++ contrib/ntp/scripts/update-leap/update-leap.html	(版本 298770)
@@ -30,7 +30,7 @@
 
   <p>This document describes the use of the NTP Project's <code>update-leap</code> program.
 
-  <p>This document applies to version 4.2.8p6 of <code>update-leap</code>.
+  <p>This document applies to version 4.2.8p7 of <code>update-leap</code>.
 
 <div class="shortcontents">
 <h2>Short Contents</h2>
Index: contrib/ntp/sntp/configure
===================================================================
--- contrib/ntp/sntp/configure	(版本 297264)
+++ contrib/ntp/sntp/configure	(版本 298770)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sntp 4.2.8p6.
+# Generated by GNU Autoconf 2.69 for sntp 4.2.8p7.
 #
 # Report bugs to <http://bugs.ntp.org./>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='sntp'
 PACKAGE_TARNAME='sntp'
-PACKAGE_VERSION='4.2.8p6'
-PACKAGE_STRING='sntp 4.2.8p6'
+PACKAGE_VERSION='4.2.8p7'
+PACKAGE_STRING='sntp 4.2.8p7'
 PACKAGE_BUGREPORT='http://bugs.ntp.org./'
 PACKAGE_URL='http://www.ntp.org./'
 
@@ -1491,7 +1491,7 @@
   # 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 sntp 4.2.8p6 to adapt to many kinds of systems.
+\`configure' configures sntp 4.2.8p7 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1561,7 +1561,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sntp 4.2.8p6:";;
+     short | recursive ) echo "Configuration of sntp 4.2.8p7:";;
    esac
   cat <<\_ACEOF
 
@@ -1706,7 +1706,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sntp configure 4.2.8p6
+sntp configure 4.2.8p7
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2536,7 +2536,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sntp $as_me 4.2.8p6, which was
+It was created by sntp $as_me 4.2.8p7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3533,7 +3533,7 @@
 
 # Define the identity of the package.
  PACKAGE='sntp'
- VERSION='4.2.8p6'
+ VERSION='4.2.8p7'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -9689,6 +9689,9 @@
 
 done
 
+
+$as_echo "#define NEED_EARLY_FORK 1" >>confdefs.h
+
 esac
 
 for ac_header in arpa/nameser.h sys/param.h sys/time.h sys/timers.h
@@ -31110,7 +31113,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sntp $as_me 4.2.8p6, which was
+This file was extended by sntp $as_me 4.2.8p7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -31177,7 +31180,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-sntp config.status 4.2.8p6
+sntp config.status 4.2.8p7
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
Index: contrib/ntp/sntp/invoke-sntp.texi
===================================================================
--- contrib/ntp/sntp/invoke-sntp.texi	(版本 297264)
+++ contrib/ntp/sntp/invoke-sntp.texi	(版本 298770)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-sntp.texi)
 #
-# It has been AutoGen-ed  January 20, 2016 at 04:06:42 AM by AutoGen 5.18.5
+# It has been AutoGen-ed  April 26, 2016 at 08:21:12 PM by AutoGen 5.18.5
 # From the definitions    sntp-opts.def
 # and the template file   agtexi-cmd.tpl
 @end ignore
@@ -101,7 +101,7 @@
 
 @exampleindent 0
 @example
-sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p6
+sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7
 Usage:  sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
                 [ hostname-or-IP ...]
   Flg Arg Option-Name    Description
Index: contrib/ntp/sntp/sntp-opts.h
===================================================================
--- contrib/ntp/sntp/sntp-opts.h	(版本 297264)
+++ contrib/ntp/sntp/sntp-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:06:06 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:20:38 PM by AutoGen 5.18.5
  *  From the definitions    sntp-opts.def
  *  and the template file   options
  *
@@ -91,9 +91,9 @@
 /** count of all options for sntp */
 #define OPTION_CT    23
 /** sntp version */
-#define SNTP_VERSION       "4.2.8p6"
+#define SNTP_VERSION       "4.2.8p7"
 /** Full sntp version text */
-#define SNTP_FULL_VERSION  "sntp 4.2.8p6"
+#define SNTP_FULL_VERSION  "sntp 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
Index: contrib/ntp/sntp/sntp.man.in
===================================================================
--- contrib/ntp/sntp/sntp.man.in	(版本 297264)
+++ contrib/ntp/sntp/sntp.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH sntp @SNTP_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH sntp @SNTP_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-vxaitn/ag-Ixaasn)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EjaOrb/ag-RjaGqb)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:06:38 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:21:08 PM by AutoGen 5.18.5
 .\" From the definitions sntp-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: contrib/ntp/tests/libntp/Makefile.in
===================================================================
--- contrib/ntp/tests/libntp/Makefile.in	(版本 297264)
+++ contrib/ntp/tests/libntp/Makefile.in	(版本 298770)
@@ -104,9 +104,10 @@
 	test-sfptostr$(EXEEXT) test-socktoa$(EXEEXT) \
 	test-ssl_init$(EXEEXT) test-statestr$(EXEEXT) \
 	test-strtolfp$(EXEEXT) test-timespecops$(EXEEXT) \
-	test-timevalops$(EXEEXT) test-tstotv$(EXEEXT) \
-	test-tvtots$(EXEEXT) test-uglydate$(EXEEXT) \
-	test-vi64ops$(EXEEXT) test-ymd2yd$(EXEEXT) $(am__EXEEXT_1)
+	test-timevalops$(EXEEXT) test-tsafememcmp$(EXEEXT) \
+	test-tstotv$(EXEEXT) test-tvtots$(EXEEXT) \
+	test-uglydate$(EXEEXT) test-vi64ops$(EXEEXT) \
+	test-ymd2yd$(EXEEXT) $(am__EXEEXT_1)
 @NTP_CROSSCOMPILE_FALSE@am__append_1 = $(check_PROGRAMS)
 subdir = tests/libntp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -446,6 +447,14 @@
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/sntp/unity/libunity.a $(am__DEPENDENCIES_1)
+am_test_tsafememcmp_OBJECTS = tsafememcmp.$(OBJEXT) \
+	run-tsafememcmp.$(OBJEXT) $(am__objects_1)
+test_tsafememcmp_OBJECTS = $(am_test_tsafememcmp_OBJECTS)
+test_tsafememcmp_LDADD = $(LDADD)
+test_tsafememcmp_DEPENDENCIES = $(top_builddir)/libntp/libntp.a \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(top_builddir)/sntp/unity/libunity.a $(am__DEPENDENCIES_1)
 am_test_tstotv_OBJECTS = tstotv.$(OBJEXT) run-tstotv.$(OBJEXT) \
 	$(am__objects_1)
 test_tstotv_OBJECTS = $(am_test_tstotv_OBJECTS)
@@ -536,9 +545,10 @@
 	$(test_sfptostr_SOURCES) $(test_socktoa_SOURCES) \
 	$(test_ssl_init_SOURCES) $(test_statestr_SOURCES) \
 	$(test_strtolfp_SOURCES) $(test_timespecops_SOURCES) \
-	$(test_timevalops_SOURCES) $(test_tstotv_SOURCES) \
-	$(test_tvtots_SOURCES) $(test_uglydate_SOURCES) \
-	$(test_vi64ops_SOURCES) $(test_ymd2yd_SOURCES)
+	$(test_timevalops_SOURCES) $(test_tsafememcmp_SOURCES) \
+	$(test_tstotv_SOURCES) $(test_tvtots_SOURCES) \
+	$(test_uglydate_SOURCES) $(test_vi64ops_SOURCES) \
+	$(test_ymd2yd_SOURCES)
 DIST_SOURCES = $(test_a_md5encrypt_SOURCES) $(test_atoint_SOURCES) \
 	$(test_atouint_SOURCES) $(test_authkeys_SOURCES) \
 	$(test_buftvtots_SOURCES) $(test_calendar_SOURCES) \
@@ -555,9 +565,10 @@
 	$(test_sfptostr_SOURCES) $(test_socktoa_SOURCES) \
 	$(test_ssl_init_SOURCES) $(test_statestr_SOURCES) \
 	$(test_strtolfp_SOURCES) $(test_timespecops_SOURCES) \
-	$(test_timevalops_SOURCES) $(test_tstotv_SOURCES) \
-	$(test_tvtots_SOURCES) $(test_uglydate_SOURCES) \
-	$(test_vi64ops_SOURCES) $(test_ymd2yd_SOURCES)
+	$(test_timevalops_SOURCES) $(test_tsafememcmp_SOURCES) \
+	$(test_tstotv_SOURCES) $(test_tvtots_SOURCES) \
+	$(test_uglydate_SOURCES) $(test_vi64ops_SOURCES) \
+	$(test_ymd2yd_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -1077,10 +1088,11 @@
 	$(srcdir)/run-sfptostr.c $(srcdir)/run-socktoa.c \
 	$(srcdir)/run-ssl_init.c $(srcdir)/run-statestr.c \
 	$(srcdir)/run-strtolfp.c $(srcdir)/run-timevalops.c \
-	$(srcdir)/run-timespecops.c $(srcdir)/run-tstotv.c \
-	$(srcdir)/run-tvtots.c $(srcdir)/run-uglydate.c \
-	$(srcdir)/run-vi64ops.c $(srcdir)/run-ymd2yd.c $(NULL) \
-	check-libntp check-libunity .deps-ver
+	$(srcdir)/run-timespecops.c $(srcdir)/run-tsafememcmp.c \
+	$(srcdir)/run-tstotv.c $(srcdir)/run-tvtots.c \
+	$(srcdir)/run-uglydate.c $(srcdir)/run-vi64ops.c \
+	$(srcdir)/run-ymd2yd.c $(NULL) check-libntp check-libunity \
+	.deps-ver
 CLEANFILES = check-libntp check-libunity .deps-ver
 std_unity_list = \
 	$(top_srcdir)/sntp/unity/auto/generate_test_runner.rb	\
@@ -1369,6 +1381,13 @@
 
 
 ###
+test_tsafememcmp_SOURCES = \
+	tsafememcmp.c		\
+	run-tsafememcmp.c	\
+	$(NULL)
+
+
+###
 test_tstotv_SOURCES = \
 	tstotv.c		\
 	run-tstotv.c		\
@@ -1586,6 +1605,10 @@
 	@rm -f test-timevalops$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_timevalops_OBJECTS) $(test_timevalops_LDADD) $(LIBS)
 
+test-tsafememcmp$(EXEEXT): $(test_tsafememcmp_OBJECTS) $(test_tsafememcmp_DEPENDENCIES) $(EXTRA_test_tsafememcmp_DEPENDENCIES) 
+	@rm -f test-tsafememcmp$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_tsafememcmp_OBJECTS) $(test_tsafememcmp_LDADD) $(LIBS)
+
 test-tstotv$(EXEEXT): $(test_tstotv_OBJECTS) $(test_tstotv_DEPENDENCIES) $(EXTRA_test_tstotv_DEPENDENCIES) 
 	@rm -f test-tstotv$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_tstotv_OBJECTS) $(test_tstotv_LDADD) $(LIBS)
@@ -1665,6 +1688,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-statestr.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-timespecops.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-timevalops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tsafememcmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tstotv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tvtots.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-uglydate.Po@am__quote@
@@ -1689,6 +1713,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_strtolfp-strtolfp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timespecops.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timevalops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsafememcmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstotv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvtots.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uglydate.Po@am__quote@
@@ -2300,6 +2325,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+test-tsafememcmp.log: test-tsafememcmp$(EXEEXT)
+	@p='test-tsafememcmp$(EXEEXT)'; \
+	b='test-tsafememcmp'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 test-tstotv.log: test-tstotv$(EXEEXT)
 	@p='test-tstotv$(EXEEXT)'; \
 	b='test-tstotv'; \
@@ -2612,6 +2644,9 @@
 $(srcdir)/run-timevalops.c: $(srcdir)/timevalops.c $(std_unity_list)
 	$(run_unity) timevalops.c run-timevalops.c
 
+$(srcdir)/run-tsafememcmp.c: $(srcdir)/tsafememcmp.c $(std_unity_list)
+	$(run_unity) tsafememcmp.c run-tsafememcmp.c
+
 $(srcdir)/run-tstotv.c: $(srcdir)/tstotv.c $(std_unity_list)
 	$(run_unity) tstotv.c run-tstotv.c
 
Index: contrib/ntp/tests/libntp/run-tsafememcmp.c
===================================================================
--- contrib/ntp/tests/libntp/run-tsafememcmp.c	(不存在的)
+++ contrib/ntp/tests/libntp/run-tsafememcmp.c	(版本 298770)
@@ -0,0 +1,64 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+  Unity.CurrentTestName = #TestFunc; \
+  Unity.CurrentTestLineNumber = TestLineNum; \
+  Unity.NumberOfTests++; \
+  if (TEST_PROTECT()) \
+  { \
+      setUp(); \
+      TestFunc(); \
+  } \
+  if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+  { \
+    tearDown(); \
+  } \
+  UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_stdlib.h"
+#include "isc/string.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_Empty(void);
+extern void test_Equal(void);
+extern void test_FirstByte(void);
+extern void test_LastByte(void);
+extern void test_MiddleByte(void);
+extern void test_MiddleByteUpLo(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+  tearDown();
+  setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+  progname = argv[0];
+  UnityBegin("tsafememcmp.c");
+  RUN_TEST(test_Empty, 10);
+  RUN_TEST(test_Equal, 11);
+  RUN_TEST(test_FirstByte, 12);
+  RUN_TEST(test_LastByte, 13);
+  RUN_TEST(test_MiddleByte, 14);
+  RUN_TEST(test_MiddleByteUpLo, 15);
+
+  return (UnityEnd());
+}
Index: contrib/ntp/tests/libntp/tsafememcmp.c
===================================================================
--- contrib/ntp/tests/libntp/tsafememcmp.c	(不存在的)
+++ contrib/ntp/tests/libntp/tsafememcmp.c	(版本 298770)
@@ -0,0 +1,85 @@
+#include "config.h"
+
+#include "ntp_stdlib.h"
+#include "isc/string.h"
+
+#include "unity.h"
+
+/* Basisc test for timingsafe_memcmp() */
+
+void test_Empty(void);
+void test_Equal(void);
+void test_FirstByte(void);
+void test_LastByte(void);
+void test_MiddleByte(void);
+void test_MiddleByteUpLo(void);
+
+void test_Empty(void)
+{
+	static const char dummy[1];
+	TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(NULL , NULL , 0));
+	TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(dummy, dummy, 0));
+}
+
+void test_Equal(void)
+{
+	static const char dummy[2][4] = {
+		"blob", "blob"
+	};
+	TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(dummy[0],
+					      dummy[1],
+					      sizeof(dummy[0])));
+}
+
+void test_FirstByte(void)
+{
+	static const char dummy[2][4] = {
+		"Blob", "Clob"
+	};
+	TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
+					       dummy[1],
+					       sizeof(dummy[0])));
+	TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
+					       dummy[0],
+					       sizeof(dummy[0])));
+}
+
+void test_LastByte(void)
+{
+	static const char dummy[2][4] = {
+		"Blob", "Bloc"
+	};
+	TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
+					       dummy[1],
+					       sizeof(dummy[0])));
+	TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
+					       dummy[0],
+					       sizeof(dummy[0])));
+}
+
+void test_MiddleByte(void)
+{
+	static const char dummy[2][4] = {
+		"Blob", "Blpb"
+	};
+	TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
+					       dummy[1],
+					       sizeof(dummy[0])));
+	TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
+					       dummy[0],
+					       sizeof(dummy[0])));
+}
+
+void test_MiddleByteUpLo(void)
+{
+	static const char dummy[2][4] = {
+		"Blob", "Blpa"
+	};
+	TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
+					       dummy[1],
+					       sizeof(dummy[0])));
+	TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
+					       dummy[0],
+					       sizeof(dummy[0])));
+}
+
Index: contrib/ntp/util/ntp-keygen-opts.c
===================================================================
--- contrib/ntp/util/ntp-keygen-opts.c	(版本 297264)
+++ contrib/ntp/util/ntp-keygen-opts.c	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.c)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:19:33 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:30:03 PM by AutoGen 5.18.5
  *  From the definitions    ntp-keygen-opts.def
  *  and the template file   options
  *
@@ -72,7 +72,7 @@
  *  static const strings for ntp-keygen options
  */
 static char const ntp_keygen_opt_strs[2419] =
-/*     0 */ "ntp-keygen (ntp) 4.2.8p6\n"
+/*     0 */ "ntp-keygen (ntp) 4.2.8p7\n"
             "Copyright (C) 1992-2016 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"
@@ -164,7 +164,7 @@
 /*  2202 */ "no-load-opts\0"
 /*  2215 */ "no\0"
 /*  2218 */ "NTP_KEYGEN\0"
-/*  2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p6\n"
+/*  2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7\n"
             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
 /*  2343 */ "$HOME\0"
 /*  2349 */ ".\0"
@@ -171,7 +171,7 @@
 /*  2351 */ ".ntprc\0"
 /*  2358 */ "http://bugs.ntp.org, bugs@ntp.org\0"
 /*  2392 */ "\n\0"
-/*  2394 */ "ntp-keygen (ntp) 4.2.8p6";
+/*  2394 */ "ntp-keygen (ntp) 4.2.8p7";
 
 /**
  *  imbits option description:
@@ -1309,7 +1309,7 @@
      translate option names.
    */
   /* referenced via ntp_keygenOptions.pzCopyright */
-  puts(_("ntp-keygen (ntp) 4.2.8p6\n\
+  puts(_("ntp-keygen (ntp) 4.2.8p7\n\
 Copyright (C) 1992-2016 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\
@@ -1408,7 +1408,7 @@
   puts(_("load options from a config file"));
 
   /* referenced via ntp_keygenOptions.pzUsageTitle */
-  puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p6\n\
+  puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7\n\
 Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
 
   /* referenced via ntp_keygenOptions.pzExplain */
@@ -1415,7 +1415,7 @@
   puts(_("\n"));
 
   /* referenced via ntp_keygenOptions.pzFullVersion */
-  puts(_("ntp-keygen (ntp) 4.2.8p6"));
+  puts(_("ntp-keygen (ntp) 4.2.8p7"));
 
   /* referenced via ntp_keygenOptions.pzFullUsage */
   puts(_("<<<NOT-FOUND>>>"));
Index: contrib/ntp/util/ntp-keygen.html
===================================================================
--- contrib/ntp/util/ntp-keygen.html	(版本 297264)
+++ contrib/ntp/util/ntp-keygen.html	(版本 298770)
@@ -70,7 +70,7 @@
 printable ASCII format so they can be embedded as MIME attachments in
 mail to other sites.
 
-  <p>This document applies to version 4.2.8p6 of <code>ntp-keygen</code>.
+  <p>This document applies to version 4.2.8p7 of <code>ntp-keygen</code>.
 
 <div class="node">
 <p><hr>
@@ -1085,7 +1085,7 @@
 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
 with a status code of 0.
 
-<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p5
+<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p6
 Usage:  ntp-keygen [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
   Flg Arg Option-Name    Description
    -b Num imbits         identity modulus bits
Index: usr.sbin/ntp/config.h
===================================================================
--- usr.sbin/ntp/config.h	(版本 297264)
+++ usr.sbin/ntp/config.h	(版本 298770)
@@ -304,9 +304,15 @@
 /* The number of minutes in a DST adjustment */
 #define DSTMINUTES 60
 
+/* support dynamic interleave? */
+#define DYNAMIC_INTERLEAVE 0
+
 /* number of args to el_init() */
 #define EL_INIT_ARGS 4
 
+/* Provide the explicit 127.0.0.0/8 martian filter? */
+#define ENABLE_BUG3020_FIX 1
+
 /* nls support in libopts */
 /* #undef ENABLE_NLS */
 
@@ -832,7 +838,7 @@
 /* Define to 1 if you have the <stdatomic.h> header file. */
 #define HAVE_STDATOMIC_H 1
 
-/* Define to 1 if you have the <stdbool.h> header file. */
+/* Define to 1 if stdbool.h conforms to C99. */
 #define HAVE_STDBOOL_H 1
 
 /* Define to 1 if you have the <stddef.h> header file. */
@@ -1203,6 +1209,9 @@
 /* define if select implicitly yields */
 #define HAVE_YIELDING_SELECT 1
 
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
 /* Define to 1 if you have the `_exit' function. */
 #define HAVE__EXIT 1
 
@@ -1349,6 +1358,9 @@
    initialization. */
 /* #undef MISSING_C99_STRUCT_INIT */
 
+/* having to fork the DNS worker early when doing chroot? */
+/* #undef NEED_EARLY_FORK */
+
 /* Do we need HPUX adjtime() library support? */
 /* #undef NEED_HPUX_ADJTIME */
 
@@ -1437,7 +1449,7 @@
 #define PACKAGE_NAME "ntp"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "ntp 4.2.8p6"
+#define PACKAGE_STRING "ntp 4.2.8p7"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "ntp"
@@ -1446,7 +1458,7 @@
 #define PACKAGE_URL "http://www.ntp.org./"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "4.2.8p6"
+#define PACKAGE_VERSION "4.2.8p7"
 
 /* data dir */
 #define PERLLIBDIR "/usr/local/share/ntp/lib"
@@ -1487,7 +1499,7 @@
 /* Do we want the SCO clock hacks? */
 /* #undef SCO5_CLOCK */
 
-/* The size of `char*', as computed by sizeof. */
+/* The size of `char *', as computed by sizeof. */
 #ifdef __LP64__
 #define SIZEOF_CHARP 8
 #else
@@ -1627,7 +1639,7 @@
 /* #undef USE_UDP_SIGPOLL */
 
 /* Version number of package */
-#define VERSION "4.2.8p6"
+#define VERSION "4.2.8p7"
 
 /* vsnprintf expands "%m" to strerror(errno) */
 /* #undef VSNPRINTF_PERCENT_M */
@@ -1804,5 +1816,5 @@
 /*
  * FreeBSD specific: Explicitly specify date/time for reproducible build.
  */
-#define	MKREPRO_DATE "Jan 21 2016"
-#define	MKREPRO_TIME "01:03:28"
+#define	MKREPRO_DATE "Apr 27 2016"
+#define	MKREPRO_TIME "05:53:49"
Index: usr.sbin/ntp/doc/ntpd.8
===================================================================
--- usr.sbin/ntp/doc/ntpd.8	(版本 297264)
+++ usr.sbin/ntp/doc/ntpd.8	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPD 8 User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpd-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: usr.sbin/ntp/libntp/Makefile
===================================================================
--- usr.sbin/ntp/libntp/Makefile	(版本 297264)
+++ usr.sbin/ntp/libntp/Makefile	(版本 298770)
@@ -41,7 +41,8 @@
 	stdio.c \
 	stdtime.c \
 	strerror.c \
-	time.c
+	time.c \
+	tsmemcmp.c
 
 ISC_NLS_SRCS= msgcat.c
 
Index: contrib/ntp/util/ntp-keygen.mdoc.in
===================================================================
--- contrib/ntp/util/ntp-keygen.mdoc.in	(版本 297264)
+++ contrib/ntp/util/ntp-keygen.mdoc.in	(版本 298770)
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.mdoc)
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:51 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp-keygen-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: usr.sbin/ntp/doc/ntp.conf.5
===================================================================
--- usr.sbin/ntp/doc/ntp.conf.5	(版本 297264)
+++ usr.sbin/ntp/doc/ntp.conf.5	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_CONF 5 File Formats
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:07 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -113,8 +113,14 @@
 If the Basic Socket Interface Extensions for IPv6 (RFC\-2553)
 is detected, support for the IPv6 address family is generated
 in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq 8
+or
+.Xr ntpdc 8 ,
+IPv6 addresses are automatically generated.
 IPv6 addresses can be identified by the presence of colons
 .Dq \&:
 in the address field.
@@ -149,6 +155,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
 .Xc
 .It Xo Ic peer Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -156,6 +163,8 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
 .Xc
 .It Xo Ic broadcast Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -163,6 +172,7 @@
 .Op Cm prefer
 .Op Cm minpoll Ar minpoll
 .Op Cm ttl Ar ttl
+.Op Cm xleave
 .Xc
 .It Xo Ic manycastclient Ar address
 .Op Cm key Ar key \&| Cm autokey
@@ -288,7 +298,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to improve timekeeping quality
 with the
@@ -299,7 +311,9 @@
 instead of the usual one.
 The packet spacing is normally 2 s;
 however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
 additional time for a modem or ISDN call to complete.
 This is designed to speed the initial synchronization
 acquisition with the
@@ -332,6 +346,11 @@
 .It Cm noselect
 Marks the server as unused, except for display purposes.
 The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
 .It Cm prefer
 Marks the server as preferred.
 All other things being equal,
@@ -344,6 +363,11 @@
 provided in
 .Pa /usr/share/doc/ntp )
 for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
 .It Cm ttl Ar ttl
 This option is used only with broadcast server and manycast
 client modes.
@@ -362,6 +386,12 @@
 packets.
 Versions 1\-4 are the choices, with version 4 the
 default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
 .El
 .Ss Auxiliary Commands
 .Bl -tag -width indent
@@ -507,7 +537,7 @@
 commands and also by remote
 configuration commands sent by a
 .Xr ntpdc 8
-program running in
+program running on
 another machine.
 If this flag is enabled, which is the default
 case, new broadcast client and symmetric passive associations and
@@ -697,7 +727,7 @@
 all of which are bound together by the protocol specifically
 to deflect masquerade attacks.
 For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
 computations and so the same addresses must be available
 at both the server and client.
 For this reason operation
@@ -895,8 +925,8 @@
 .Pa ntpkey_key_ Ns Ar hostname
 in the keys directory.
 .It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
 .Pa ntpkey_iff_ Ns Ar hostname
 in the keys directory.
 .It Cm leap Ar file
@@ -906,8 +936,7 @@
 in the keys directory.
 .It Cm mvpar Ar file
 Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
 .Pa ntpkey_mv_ Ns Ar hostname
 in the keys directory.
 .It Cm pw Ar password
@@ -1048,7 +1077,7 @@
 Statistic files are managed using file generation sets
 and scripts in the
 .Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
 Using
 these facilities and
 .Ux
@@ -1382,7 +1411,9 @@
 the number of links of this file is one, it is renamed appending a
 dot, the letter
 .Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd 8
+server process.
 When the
 number of links is greater than one, the file is unlinked.
 This
@@ -1425,7 +1456,9 @@
 by a determined cracker.
 .Pp
 Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
 or implicitly as the result of cryptographic or rate limit
 violations.
 Cryptographic violations include certificate
@@ -1435,9 +1468,9 @@
 Some violations cause denied service
 only for the offending packet, others cause denied service
 for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
 When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
 the restrictions is by restarting the server.
 .Ss The Kiss\-of\-Death Packet
 Ordinarily, packets denied service are simply dropped with no
@@ -1495,7 +1528,9 @@
 and a kiss\-o'\-death packet returned if enabled.
 The default
 minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
 for packets that overflow the rate\-control window.
 .It Xo Ic restrict address
 .Op Cm mask Ar mask
@@ -1554,7 +1589,9 @@
 last one, the packet is dropped.
 .It Cm limited
 Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
 A history of clients is kept using the
 monitoring capability of
 .Xr ntpd 8 .
@@ -1614,7 +1651,9 @@
 .It Cm notrap
 Decline to provide mode 6 control message trap service to matching
 hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq 8
+control message
 protocol which is intended for use by remote event logging programs.
 .It Cm notrust
 Deny service unless the packet is cryptographically authenticated.
@@ -1681,8 +1720,11 @@
 as well and is highly recommended, especially for broadcast modes.
 .Pp
 A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
 .Cm D
 or IPv6 prefix
 .Cm FF )
@@ -1752,7 +1794,9 @@
 .Cm maxpolll
 value specified in this command.
 Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
 At each retransmission the TTL is increased until reaching
 the maximum hops specified by this command or a sufficient
 number client associations have been found.
@@ -2390,7 +2434,8 @@
 otherwise, should be avoided.
 .It Ic dscp Ar value
 This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6\-bit code.  The default value is 46, signifying Expedited Forwarding.
+a 6\-bit code.
+The default value is 46, signifying Expedited Forwarding.
 .It Xo Ic enable
 .Oo
 .Cm auth | Cm bclient |
@@ -2629,7 +2674,8 @@
 message class may also be followed by the
 .Cm all
 keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
 could look like this:
 .Bd -literal
 logconfig =syncstatus +sysevents
@@ -2653,7 +2699,9 @@
 be used instead of the default system
 .Xr syslog 3
 facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+.Fl l
+command line option.
 .It Ic setvar Ar variable Op Cm default
 This command adds an additional system variable.
 These
@@ -2805,7 +2853,8 @@
 function.
 Defaults to 50 4k pages (200 4k pages in OpenBSD).
 .It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
 .El
 .It Xo Ic trap Ar host_address
 .Op Cm port Ar port_number
Index: usr.sbin/ntp/doc/ntpq.8
===================================================================
--- usr.sbin/ntp/doc/ntpq.8	(版本 297264)
+++ usr.sbin/ntp/doc/ntpq.8	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPQ 8 User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpq-opts.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:12 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpq-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -900,6 +900,26 @@
 .sp
 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.
+.It  Fl r Ar keyword , Fl \-refid Ns = Ns Ar keyword 
+Set default display type for S2+ refids.
+This option takes a keyword as its argument.  The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+hash ipv4
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default
+.Ar keyword
+for this option is:
+.ti +4
+ ipv4
+.sp
+Set the default display format for S2+ refids.
 .It  Fl w , Fl \-wide 
 Display the full 'remote' value.
 .sp
Index: sys/conf/newvers.sh
===================================================================
--- sys/conf/newvers.sh	(版本 297264)
+++ sys/conf/newvers.sh	(版本 298770)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.3"
-BRANCH="RELEASE"
+BRANCH="RELEASE-p1"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi
Index: usr.sbin/ntp/doc/ntp.keys.5
===================================================================
--- usr.sbin/ntp/doc/ntp.keys.5	(版本 297264)
+++ usr.sbin/ntp/doc/ntp.keys.5	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYS 5 File Formats
 .Os SunOS 5.10
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:10 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp.keys.def
 .\"  and the template file   agmdoc-file.tpl
 .Sh NAME
Index: usr.sbin/ntp/doc/sntp.8
===================================================================
--- usr.sbin/ntp/doc/sntp.8	(版本 297264)
+++ usr.sbin/ntp/doc/sntp.8	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt SNTP 8 User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:06:45 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
 .\"  From the definitions    sntp-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: contrib/ntp/util/ntp-keygen-opts.h
===================================================================
--- contrib/ntp/util/ntp-keygen-opts.h	(版本 297264)
+++ contrib/ntp/util/ntp-keygen-opts.h	(版本 298770)
@@ -1,7 +1,7 @@
 /*
  *  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.h)
  *
- *  It has been AutoGen-ed  January 20, 2016 at 04:19:32 AM by AutoGen 5.18.5
+ *  It has been AutoGen-ed  April 26, 2016 at 08:30:02 PM by AutoGen 5.18.5
  *  From the definitions    ntp-keygen-opts.def
  *  and the template file   options
  *
@@ -94,9 +94,9 @@
 /** count of all options for ntp-keygen */
 #define OPTION_CT    26
 /** ntp-keygen version */
-#define NTP_KEYGEN_VERSION       "4.2.8p6"
+#define NTP_KEYGEN_VERSION       "4.2.8p7"
 /** Full ntp-keygen version text */
-#define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) 4.2.8p6"
+#define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) 4.2.8p7"
 
 /**
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
Index: contrib/ntp/util/ntp-keygen.man.in
===================================================================
--- contrib/ntp/util/ntp-keygen.man.in	(版本 297264)
+++ contrib/ntp/util/ntp-keygen.man.in	(版本 298770)
@@ -10,11 +10,11 @@
 .ds B-Font B
 .ds I-Font I
 .ds R-Font R
-.TH ntp-keygen @NTP_KEYGEN_MS@ "20 Jan 2016" "ntp (4.2.8p6)" "User Commands"
+.TH ntp-keygen @NTP_KEYGEN_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
 .\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Dua4pY/ag-PuaWoY)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FRa4eL/ag-RRaWdL)
 .\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:19:44 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:30:15 PM by AutoGen 5.18.5
 .\" From the definitions ntp-keygen-opts.def
 .\" and the template file agman-cmd.tpl
 .SH NAME
Index: usr.sbin/ntp/doc/ntp-keygen.8
===================================================================
--- usr.sbin/ntp/doc/ntp-keygen.8	(版本 297264)
+++ usr.sbin/ntp/doc/ntp-keygen.8	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTP_KEYGEN 8 User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:51 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
 .\"  From the definitions    ntp-keygen-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: usr.sbin/ntp/doc/ntpdc.8
===================================================================
--- usr.sbin/ntp/doc/ntpdc.8	(版本 297264)
+++ usr.sbin/ntp/doc/ntpdc.8	(版本 298770)
@@ -1,4 +1,4 @@
-.Dd January 20 2016
+.Dd April 26 2016
 .Dt NTPDC 8 User Commands
 .Os
 .\"  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.mdoc)
@@ -5,7 +5,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.\"  It has been AutoGen-ed  January 20, 2016 at 04:18:39 AM by AutoGen 5.18.5
+.\"  It has been AutoGen-ed  April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
 .\"  From the definitions    ntpdc-opts.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
Index: usr.sbin/ntp/scripts/mkver
===================================================================
--- usr.sbin/ntp/scripts/mkver	(版本 297264)
+++ usr.sbin/ntp/scripts/mkver	(版本 298770)
@@ -6,7 +6,7 @@
 
 ConfStr="$PROG"
 
-ConfStr="$ConfStr 4.2.8p6"
+ConfStr="$ConfStr 4.2.8p7"
 
 case "$CSET" in
  '') ;;
