[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at whimsy.udel.edu
Wed Jun 27 06:37:33 UTC 2007


#### ChangeSet ####
2007-06-23 09:19:06-04:00, mayer at pogo.udel.edu 
  Added Bug #863

==== ChangeLog ====
2007-06-23 09:18:34-04:00, mayer at pogo.udel.edu +2 -0
  Added Bug #863

--- 1.76/ChangeLog	2007-06-22 23:50:51 -04:00
+++ 1.77/ChangeLog	2007-06-23 09:18:34 -04:00
@@ -1,3 +1,5 @@
+* [Bug 863] unable to stop ntpd on Windows as the handle reference for events
+            changed
 * Use emalloc() instead of malloc() in refclock_datum.c (Calypso).
 * Start using 'design by contract' assertions.
 * Allow null driftfile.

#### ChangeSet ####
2007-06-23 08:50:46-04:00, mayer at pogo.udel.edu 
  Bug #863 Unable to stop ntpd because the handle index changed

==== ports/winnt/include/ntp_iocompletionport.h ====
2007-06-23 08:50:21-04:00, mayer at pogo.udel.edu +3 -0
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.12/ports/winnt/include/ntp_iocompletionport.h	2006-01-06 16:47:39 -05:00
+++ 1.12.1.1/ports/winnt/include/ntp_iocompletionport.h	2007-06-23 08:50:21 -04:00
@@ -1,6 +1,7 @@
 #if !defined __ntp_iocompletionport_h
 # define __ntp_iocompletionport_h
 
+#include "ntp_fp.h"
 #include "ntp.h"
 
 # if defined(HAVE_IO_COMPLETION_PORT)
@@ -18,6 +19,8 @@ extern	int	io_completion_port_add_socket
 extern	DWORD	io_completion_port_sendto (struct interface *, struct pkt *, int, struct sockaddr_storage*);
 
 extern	HANDLE get_io_event (void);
+
+extern HANDLE get_exit_event(void);		/* Handle of the exit event */
 
 int GetReceivedBuffers(void);
 

==== ports/winnt/ntpd/ntp_iocompletionport.c ====
2007-06-23 08:50:21-04:00, mayer at pogo.udel.edu +15 -1
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.28/ports/winnt/ntpd/ntp_iocompletionport.c	2007-06-19 08:36:52 -04:00
+++ 1.29/ports/winnt/ntpd/ntp_iocompletionport.c	2007-06-23 08:50:21 -04:00
@@ -59,6 +59,7 @@ static HANDLE hHeapHandle = NULL;
 static HANDLE hIoCompletionPort = NULL;
 
 static HANDLE WaitableIoEventHandle = NULL;
+static HANDLE WaitableExitEventHandle = NULL;
 
 #define MAXHANDLES 3
 HANDLE WaitHandles[MAXHANDLES] = { NULL, NULL, NULL };
@@ -122,6 +123,11 @@ get_io_event()
 {
 	return( WaitableIoEventHandle );
 }
+HANDLE
+get_exit_event()
+{
+	return( WaitableExitEventHandle );
+}
 
 /*  This function will add an entry to the I/O completion port
  *  that will signal the I/O thread to exit (gracefully)
@@ -244,6 +250,14 @@ init_io_completion_port(
 		"Can't create I/O event handle: %m - another process may be running - EXITING");
 		exit(1);
 	}
+	/* Create the event used to signal an exit event
+	 */
+	WaitableExitEventHandle = CreateEvent(NULL, FALSE, FALSE, "WaitableExitEventHandle");
+	if (WaitableExitEventHandle == NULL) {
+		msyslog(LOG_ERR,
+		"Can't create exit event handle: %m - another process may be running - EXITING");
+		exit(1);
+	}
 
 	/* Create the IO completion port
 	 */
@@ -257,7 +271,7 @@ init_io_completion_port(
 	 * Initialize the Wait Handles
 	 */
 	WaitHandles[0] = get_io_event();
-	WaitHandles[1] = CreateEvent(NULL, FALSE, FALSE, "WaitHandles0"); /* exit request */
+	WaitHandles[1] = get_exit_event(); /* exit request */
 	WaitHandles[2] = get_timer_handle();
 
 	/* Have one thread servicing I/O - there were 4, but this would 

==== ports/winnt/ntpd/ntservice.c ====
2007-06-23 08:50:21-04:00, mayer at pogo.udel.edu +9 -5
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.8/ports/winnt/ntpd/ntservice.c	2006-08-15 13:29:47 -04:00
+++ 1.8.1.1/ports/winnt/ntpd/ntservice.c	2007-06-23 08:50:21 -04:00
@@ -25,6 +25,7 @@
 #include "syslog.h"
 #include "ntservice.h"
 #include "clockstuff.h"
+#include "ntp_iocompletionport.h"
 #ifdef DEBUG
 #include <crtdbg.h>
 #endif
@@ -36,7 +37,6 @@ static char ConsoleTitle[128];
 static int glb_argc;
 static char **glb_argv;
 HANDLE hServDoneEvent = NULL;
-extern HANDLE WaitHandles[3];
 extern volatile int debug;
 extern char *progname;
 
@@ -172,13 +172,15 @@ ntservice_exit( void )
 void
 ServiceControl(DWORD dwCtrlCode) {
 	/* Handle the requested control code */
+	HANDLE exitEvent = get_exit_event();
+
 	switch(dwCtrlCode) {
 
 	case SERVICE_CONTROL_SHUTDOWN:
 	case SERVICE_CONTROL_STOP:
 		UpdateSCM(SERVICE_STOP_PENDING);
-		if (WaitHandles[0] != NULL) {
-			SetEvent(WaitHandles[0]);
+		if (exitEvent != NULL) {
+			SetEvent(exitEvent);
 			Sleep( 100 );  //##++
 		}
 		return;
@@ -225,6 +227,8 @@ OnConsoleEvent(  
 	DWORD dwCtrlType
 	)
 {
+	HANDLE exitEvent = get_exit_event();
+
 	switch (dwCtrlType) {
 #ifdef DEBUG
 		case CTRL_BREAK_EVENT :
@@ -244,8 +248,8 @@ OnConsoleEvent(  
 		case CTRL_C_EVENT  :
 		case CTRL_CLOSE_EVENT :
 		case CTRL_SHUTDOWN_EVENT :
-			if (WaitHandles[0] != NULL) {
-				SetEvent(WaitHandles[0]);
+			if (exitEvent != NULL) {
+				SetEvent(exitEvent);
 				Sleep( 100 );  //##++
 			}
 		break;

#### ChangeSet ####
2007-06-23 08:47:07-04:00, mayer at pogo.udel.edu 
  Added Bug #863

==== ChangeLog ====
2007-06-23 08:46:51-04:00, mayer at pogo.udel.edu +2 -0
  Added Bug #863

--- 1.1.1.19/ChangeLog	2007-06-20 04:07:25 -04:00
+++ 1.1.1.20/ChangeLog	2007-06-23 08:46:51 -04:00
@@ -1,3 +1,5 @@
+* {Bug 863] unable to stop ntpd on Windows as the handle reference for events
+	    changed
 (4.2.4p2) Released by Harlan Stenn <stenn at ntp.org>
 * [Bug 854] Broadcast address was not correctly set for interface addresses
 * [Bug 829] reduce syslog noise, while there fix Enabled/Disable logging

#### ChangeSet ####
2007-06-23 08:42:58-04:00, mayer at pogo.udel.edu 
  Bug #863 Unable to stop ntpd because the handle index changed

==== ports/winnt/include/ntp_iocompletionport.h ====
2007-06-23 08:42:41-04:00, mayer at pogo.udel.edu +3 -0
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.12/ports/winnt/include/ntp_iocompletionport.h	2006-01-06 16:47:39 -05:00
+++ 1.13/ports/winnt/include/ntp_iocompletionport.h	2007-06-23 08:42:41 -04:00
@@ -1,6 +1,7 @@
 #if !defined __ntp_iocompletionport_h
 # define __ntp_iocompletionport_h
 
+#include "ntp_fp.h"
 #include "ntp.h"
 
 # if defined(HAVE_IO_COMPLETION_PORT)
@@ -18,6 +19,8 @@ extern	int	io_completion_port_add_socket
 extern	DWORD	io_completion_port_sendto (struct interface *, struct pkt *, int, struct sockaddr_storage*);
 
 extern	HANDLE get_io_event (void);
+
+extern HANDLE get_exit_event(void);		/* Handle of the exit event */
 
 int GetReceivedBuffers(void);
 

==== ports/winnt/ntpd/ntp_iocompletionport.c ====
2007-06-23 08:42:41-04:00, mayer at pogo.udel.edu +15 -1
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.21.1.1/ports/winnt/ntpd/ntp_iocompletionport.c	2007-05-24 08:08:03 -04:00
+++ 1.21.1.2/ports/winnt/ntpd/ntp_iocompletionport.c	2007-06-23 08:42:41 -04:00
@@ -57,6 +57,7 @@ static HANDLE hHeapHandle = NULL;
 static HANDLE hIoCompletionPort = NULL;
 
 static HANDLE WaitableIoEventHandle = NULL;
+static HANDLE WaitableExitEventHandle = NULL;
 
 #define MAXHANDLES 3
 HANDLE WaitHandles[MAXHANDLES] = { NULL, NULL, NULL };
@@ -120,6 +121,11 @@ get_io_event()
 {
 	return( WaitableIoEventHandle );
 }
+HANDLE
+get_exit_event()
+{
+	return( WaitableExitEventHandle );
+}
 
 /*  This function will add an entry to the I/O completion port
  *  that will signal the I/O thread to exit (gracefully)
@@ -242,6 +248,14 @@ init_io_completion_port(
 		"Can't create I/O event handle: %m - another process may be running - EXITING");
 		exit(1);
 	}
+	/* Create the event used to signal an exit event
+	 */
+	WaitableExitEventHandle = CreateEvent(NULL, FALSE, FALSE, "WaitableExitEventHandle");
+	if (WaitableExitEventHandle == NULL) {
+		msyslog(LOG_ERR,
+		"Can't create exit event handle: %m - another process may be running - EXITING");
+		exit(1);
+	}
 
 	/* Create the IO completion port
 	 */
@@ -255,7 +269,7 @@ init_io_completion_port(
 	 * Initialize the Wait Handles
 	 */
 	WaitHandles[0] = get_io_event();
-	WaitHandles[1] = CreateEvent(NULL, FALSE, FALSE, "WaitHandles0"); /* exit request */
+	WaitHandles[1] = get_exit_event(); /* exit request */
 	WaitHandles[2] = get_timer_handle();
 
 	/* Have one thread servicing I/O - there were 4, but this would 

==== ports/winnt/ntpd/ntservice.c ====
2007-06-23 08:42:41-04:00, mayer at pogo.udel.edu +9 -5
  Bug #863 Unable to stop ntpd because the handle index changed

--- 1.8/ports/winnt/ntpd/ntservice.c	2006-08-15 13:29:47 -04:00
+++ 1.9/ports/winnt/ntpd/ntservice.c	2007-06-23 08:42:41 -04:00
@@ -25,6 +25,7 @@
 #include "syslog.h"
 #include "ntservice.h"
 #include "clockstuff.h"
+#include "ntp_iocompletionport.h"
 #ifdef DEBUG
 #include <crtdbg.h>
 #endif
@@ -36,7 +37,6 @@ static char ConsoleTitle[128];
 static int glb_argc;
 static char **glb_argv;
 HANDLE hServDoneEvent = NULL;
-extern HANDLE WaitHandles[3];
 extern volatile int debug;
 extern char *progname;
 
@@ -172,13 +172,15 @@ ntservice_exit( void )
 void
 ServiceControl(DWORD dwCtrlCode) {
 	/* Handle the requested control code */
+	HANDLE exitEvent = get_exit_event();
+
 	switch(dwCtrlCode) {
 
 	case SERVICE_CONTROL_SHUTDOWN:
 	case SERVICE_CONTROL_STOP:
 		UpdateSCM(SERVICE_STOP_PENDING);
-		if (WaitHandles[0] != NULL) {
-			SetEvent(WaitHandles[0]);
+		if (exitEvent != NULL) {
+			SetEvent(exitEvent);
 			Sleep( 100 );  //##++
 		}
 		return;
@@ -225,6 +227,8 @@ OnConsoleEvent(  
 	DWORD dwCtrlType
 	)
 {
+	HANDLE exitEvent = get_exit_event();
+
 	switch (dwCtrlType) {
 #ifdef DEBUG
 		case CTRL_BREAK_EVENT :
@@ -244,8 +248,8 @@ OnConsoleEvent(  
 		case CTRL_C_EVENT  :
 		case CTRL_CLOSE_EVENT :
 		case CTRL_SHUTDOWN_EVENT :
-			if (WaitHandles[0] != NULL) {
-				SetEvent(WaitHandles[0]);
+			if (exitEvent != NULL) {
+				SetEvent(exitEvent);
 				Sleep( 100 );  //##++
 			}
 		break;

#### ChangeSet ####
2007-06-20 07:45:57-04:00, stenn at whimsy.udel.edu 
  NTP_4_2_4P2
  TAG: NTP_4_2_4P2

==== util/ntp-keygen-opts.c ====
2007-06-20 07:45:49-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.49.7.1/util/ntp-keygen-opts.c	2007-06-10 07:58:51 -04:00
+++ 1.49.8.1/util/ntp-keygen-opts.c	2007-06-20 07:45:49 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntp-keygen-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:58:03 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:57 AM EDT
  *  From the definitions    ntp-keygen-opts.def
  *  and the template file   options
  *
@@ -800,7 +800,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTP_KEYGEN";
 tSCC   zUsageTitle[] =
-"ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p2-RC6\n\
+"ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {

==== util/ntp-keygen-opts.h ====
2007-06-20 07:45:50-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.49.7.1/util/ntp-keygen-opts.h	2007-06-10 07:58:52 -04:00
+++ 1.49.8.1/util/ntp-keygen-opts.h	2007-06-20 07:45:50 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntp-keygen-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:58:02 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:56 AM EDT
  *  From the definitions    ntp-keygen-opts.def
  *  and the template file   options
  *
@@ -80,8 +80,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    24
-#define NTP_KEYGEN_VERSION       "4.2.4p2-RC6"
-#define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p2-RC6"
+#define NTP_KEYGEN_VERSION       "4.2.4p2"
+#define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== util/ntp-keygen-opts.texi ====
2007-06-20 07:45:51-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.47.7.1/util/ntp-keygen-opts.texi	2007-06-10 07:58:53 -04:00
+++ 1.47.8.1/util/ntp-keygen-opts.texi	2007-06-20 07:45:51 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntp-keygen-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:58:05 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:59 AM EDT
 # From the definitions    ntp-keygen-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -53,7 +53,7 @@ This is the automatically generated usag
 @exampleindent 0
 @example
 Using OpenSSL version 90704f
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.5p29
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.5p52
 USAGE:  ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
   Flg Arg Option-Name    Description
    -c Str certificate    certificate scheme

==== util/ntp-keygen.1 ====
2007-06-20 07:45:52-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.47.7.1/util/ntp-keygen.1	2007-06-10 07:58:54 -04:00
+++ 1.47.8.1/util/ntp-keygen.1	2007-06-20 07:45:52 -04:00
@@ -1,7 +1,7 @@
-.TH NTP-KEYGEN 1 2007-06-10 "(ntp 4.2.4p2-RC6)" "Programmer's Manual"
+.TH NTP-KEYGEN 1 2007-06-20 "(ntp 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntp-keygen.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:58:05 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:58 AM EDT
 .\"  From the definitions    ntp-keygen-opts.def
 .\"  and the template file   agman1.tpl
 .\"

==== ntpd/ntpd-opts.c ====
2007-06-20 07:45:33-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.50.7.1/ntpd/ntpd-opts.c	2007-06-10 07:58:37 -04:00
+++ 1.50.8.1/ntpd/ntpd-opts.c	2007-06-20 07:45:33 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpd-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:21 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:23 AM EDT
  *  From the definitions    ntpd-opts.def
  *  and the template file   options
  *
@@ -836,7 +836,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTPD";
 tSCC   zUsageTitle[] =
-"ntpd - NTP daemon program - Ver. 4.2.4p2-RC6\n\
+"ntpd - NTP daemon program - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 #define zRcName     NULL
 #define apzHomeList NULL

==== ntpd/ntpd-opts.h ====
2007-06-20 07:45:33-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.50.7.1/ntpd/ntpd-opts.h	2007-06-10 07:58:37 -04:00
+++ 1.50.8.1/ntpd/ntpd-opts.h	2007-06-20 07:45:33 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpd-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:21 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:22 AM EDT
  *  From the definitions    ntpd-opts.def
  *  and the template file   options
  *
@@ -88,8 +88,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    32
-#define NTPD_VERSION       "4.2.4p2-RC6"
-#define NTPD_FULL_VERSION  "ntpd - NTP daemon program - Ver. 4.2.4p2-RC6"
+#define NTPD_VERSION       "4.2.4p2"
+#define NTPD_FULL_VERSION  "ntpd - NTP daemon program - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== ntpd/ntpd-opts.texi ====
2007-06-20 07:45:34-04:00, stenn at whimsy.udel.edu +4 -4
  NTP_4_2_4P2

--- 1.49.7.1/ntpd/ntpd-opts.texi	2007-06-10 07:58:38 -04:00
+++ 1.49.8.1/ntpd/ntpd-opts.texi	2007-06-20 07:45:34 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntpd-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:24 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:26 AM EDT
 # From the definitions    ntpd-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -61,7 +61,7 @@ This is the automatically generated usag
 
 @exampleindent 0
 @example
-ntpd - NTP daemon program - Ver. 4.2.5p29
+ntpd - NTP daemon program - Ver. 4.2.5p52
 USAGE:  ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
@@ -98,9 +98,9 @@ USAGE:  ntpd [ -<flag> [<val>] | --<name
    -t Str trustedkey     Trusted key number
                                 - may appear multiple times
    -u Str user           Run as userid (or userid:groupid)
-   -v Str var            make ARG an ntp variable (RW)
+      Str var            make ARG an ntp variable (RW)
                                 - may appear multiple times
-   -V Str dvar           make ARG an ntp variable (RW|DEF)
+      Str dvar           make ARG an ntp variable (RW|DEF)
                                 - may appear multiple times
    -x no  slew           Slew up to 600 seconds
    -v opt version        Output version information and exit

==== ntpd/ntpd.1 ====
2007-06-20 07:45:35-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.48.7.1/ntpd/ntpd.1	2007-06-10 07:58:39 -04:00
+++ 1.48.8.1/ntpd/ntpd.1	2007-06-20 07:45:35 -04:00
@@ -1,7 +1,7 @@
-.TH NTPD 1 2007-06-10 "( 4.2.4p2-RC6)" "Programmer's Manual"
+.TH NTPD 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntpd.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:23 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:24 AM EDT
 .\"  From the definitions    ntpd-opts.def
 .\"  and the template file   agman1.tpl
 .\"

==== ntpdc/ntpdc-opts.c ====
2007-06-20 07:45:39-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.50.7.1/ntpdc/ntpdc-opts.c	2007-06-10 07:58:42 -04:00
+++ 1.50.8.1/ntpdc/ntpdc-opts.c	2007-06-20 07:45:39 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdc-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:56:53 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:43:48 AM EDT
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  *
@@ -463,7 +463,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTPDC";
 tSCC   zUsageTitle[] =
-"ntpdc - vendor-specific NTP query program - Ver. 4.2.4p2-RC6\n\
+"ntpdc - vendor-specific NTP query program - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {

==== ntpdc/ntpdc-opts.h ====
2007-06-20 07:45:39-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.50.7.1/ntpdc/ntpdc-opts.h	2007-06-10 07:58:43 -04:00
+++ 1.50.8.1/ntpdc/ntpdc-opts.h	2007-06-20 07:45:39 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdc-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:56:52 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:43:47 AM EDT
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  *
@@ -71,8 +71,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    15
-#define NTPDC_VERSION       "4.2.4p2-RC6"
-#define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p2-RC6"
+#define NTPDC_VERSION       "4.2.4p2"
+#define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== ntpdc/ntpdc-opts.texi ====
2007-06-20 07:45:40-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.48.7.1/ntpdc/ntpdc-opts.texi	2007-06-10 07:58:44 -04:00
+++ 1.48.8.1/ntpdc/ntpdc-opts.texi	2007-06-20 07:45:40 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntpdc-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:56:55 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:43:50 AM EDT
 # From the definitions    ntpdc-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -59,7 +59,7 @@ This is the automatically generated usag
 
 @exampleindent 0
 @example
-ntpdc - vendor-specific NTP query program - Ver. 4.2.5p29
+ntpdc - vendor-specific NTP query program - Ver. 4.2.5p52
 USAGE:  ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution

==== ntpdc/ntpdc.1 ====
2007-06-20 07:45:41-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.48.7.1/ntpdc/ntpdc.1	2007-06-10 07:58:44 -04:00
+++ 1.48.8.1/ntpdc/ntpdc.1	2007-06-20 07:45:41 -04:00
@@ -1,7 +1,7 @@
-.TH NTPDC 1 2007-06-10 "( 4.2.4p2-RC6)" "Programmer's Manual"
+.TH NTPDC 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntpdc.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:56:54 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:43:49 AM EDT
 .\"  From the definitions    ntpdc-opts.def
 .\"  and the template file   agman1.tpl
 .\"

==== ntpd/ntpdsim-opts.c ====
2007-06-20 07:45:35-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.50.7.1/ntpd/ntpdsim-opts.c	2007-06-10 07:58:40 -04:00
+++ 1.50.8.1/ntpd/ntpdsim-opts.c	2007-06-20 07:45:35 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdsim-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:26 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:28 AM EDT
  *  From the definitions    ntpdsim-opts.def
  *  and the template file   options
  *
@@ -1073,7 +1073,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTPDSIM";
 tSCC   zUsageTitle[] =
-"ntpdsim - NTP daemon simulation program - Ver. 4.2.4p2-RC6\n\
+"ntpdsim - NTP daemon simulation program - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {

==== ntpd/ntpdsim-opts.h ====
2007-06-20 07:45:36-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.50.7.1/ntpd/ntpdsim-opts.h	2007-06-10 07:58:41 -04:00
+++ 1.50.8.1/ntpd/ntpdsim-opts.h	2007-06-20 07:45:36 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdsim-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:25 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:27 AM EDT
  *  From the definitions    ntpdsim-opts.def
  *  and the template file   options
  *
@@ -99,8 +99,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    43
-#define NTPDSIM_VERSION       "4.2.4p2-RC6"
-#define NTPDSIM_FULL_VERSION  "ntpdsim - NTP daemon simulation program - Ver. 4.2.4p2-RC6"
+#define NTPDSIM_VERSION       "4.2.4p2"
+#define NTPDSIM_FULL_VERSION  "ntpdsim - NTP daemon simulation program - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== ntpd/ntpdsim-opts.texi ====
2007-06-20 07:45:37-04:00, stenn at whimsy.udel.edu +1 -1
  NTP_4_2_4P2

--- 1.48.7.1/ntpd/ntpdsim-opts.texi	2007-06-10 07:58:41 -04:00
+++ 1.48.8.1/ntpd/ntpdsim-opts.texi	2007-06-20 07:45:37 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntpdsim-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:29 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:30 AM EDT
 # From the definitions    ntpdsim-opts.def
 # and the template file   aginfo.tpl
 @end ignore

==== ntpd/ntpdsim.1 ====
2007-06-20 07:45:38-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.48.7.1/ntpd/ntpdsim.1	2007-06-10 07:58:42 -04:00
+++ 1.48.8.1/ntpd/ntpdsim.1	2007-06-20 07:45:38 -04:00
@@ -1,7 +1,7 @@
-.TH NTPDSIM 1 2007-06-10 "( 4.2.4p2-RC6)" "Programmer's Manual"
+.TH NTPDSIM 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntpdsim.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:50:28 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:37:29 AM EDT
 .\"  From the definitions    ntpdsim-opts.def
 .\"  and the template file   agman1.tpl
 .\"

==== ntpq/ntpq-opts.c ====
2007-06-20 07:45:42-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.52.7.1/ntpq/ntpq-opts.c	2007-06-10 07:58:45 -04:00
+++ 1.52.8.1/ntpq/ntpq-opts.c	2007-06-20 07:45:42 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpq-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:23 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:19 AM EDT
  *  From the definitions    ntpq-opts.def
  *  and the template file   options
  *
@@ -411,7 +411,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTPQ";
 tSCC   zUsageTitle[] =
-"ntpq - standard NTP query program - Ver. 4.2.4p2-RC6\n\
+"ntpq - standard NTP query program - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {

==== ntpq/ntpq-opts.h ====
2007-06-20 07:45:43-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.52.7.1/ntpq/ntpq-opts.h	2007-06-10 07:58:46 -04:00
+++ 1.52.8.1/ntpq/ntpq-opts.h	2007-06-20 07:45:43 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpq-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:23 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:19 AM EDT
  *  From the definitions    ntpq-opts.def
  *  and the template file   options
  *
@@ -69,8 +69,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    13
-#define NTPQ_VERSION       "4.2.4p2-RC6"
-#define NTPQ_FULL_VERSION  "ntpq - standard NTP query program - Ver. 4.2.4p2-RC6"
+#define NTPQ_VERSION       "4.2.4p2"
+#define NTPQ_FULL_VERSION  "ntpq - standard NTP query program - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== ntpq/ntpq-opts.texi ====
2007-06-20 07:45:43-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.49.7.1/ntpq/ntpq-opts.texi	2007-06-10 07:58:46 -04:00
+++ 1.49.8.1/ntpq/ntpq-opts.texi	2007-06-20 07:45:43 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntpq-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:25 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:21 AM EDT
 # From the definitions    ntpq-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -47,7 +47,7 @@ This is the automatically generated usag
 
 @exampleindent 0
 @example
-ntpq - standard NTP query program - Ver. 4.2.5p29
+ntpq - standard NTP query program - Ver. 4.2.5p52
 USAGE:  ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution

==== ntpq/ntpq.1 ====
2007-06-20 07:45:45-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.48.7.1/ntpq/ntpq.1	2007-06-10 07:58:47 -04:00
+++ 1.48.8.1/ntpq/ntpq.1	2007-06-20 07:45:45 -04:00
@@ -1,7 +1,7 @@
-.TH NTPQ 1 2007-06-10 "( 4.2.4p2-RC6)" "Programmer's Manual"
+.TH NTPQ 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntpq.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:24 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:20 AM EDT
 .\"  From the definitions    ntpq-opts.def
 .\"  and the template file   agman1.tpl
 .\"

==== packageinfo.sh ====
2007-06-20 07:45:45-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.65.14.1/packageinfo.sh	2007-06-20 04:07:26 -04:00
+++ 1.65.14.2/packageinfo.sh	2007-06-20 07:45:45 -04:00
@@ -16,7 +16,7 @@ special=
 # [???] To start an RC cycle: RC->yes
 # To release from an RC cycle: rcpoint-> GO
 # ReleaseCandidate. 'yes' or 'no'.
-releasecandidate=yes
+releasecandidate=no
 #releasecandidate=no
 # ChangeLog tag
 CLTAG=NTP_4_2_0
@@ -27,5 +27,5 @@ CLTAG=NTP_4_2_0
 # - - rcpoint gets set to 0
 # - - releasecandidate gets set to no
 # - GRONK is for -dev
-rcpoint=GO
+rcpoint=
 #rcpoint=GRONK

==== sntp/sntp-opts.c ====
2007-06-20 07:45:46-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.49.7.1/sntp/sntp-opts.c	2007-06-10 07:58:49 -04:00
+++ 1.49.8.1/sntp/sntp-opts.c	2007-06-20 07:45:46 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (sntp-opts.c)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:52 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:48 AM EDT
  *  From the definitions    sntp-opts.def
  *  and the template file   options
  *
@@ -514,7 +514,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "SNTP";
 tSCC   zUsageTitle[] =
-"sntp - standard SNTP program - Ver. 4.2.4p2-RC6\n\
+"sntp - standard SNTP program - Ver. 4.2.4p2\n\
 USAGE:  %s [ -<flag> | --<name> ]...\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {

==== sntp/sntp-opts.h ====
2007-06-20 07:45:47-04:00, stenn at whimsy.udel.edu +3 -3
  NTP_4_2_4P2

--- 1.49.7.1/sntp/sntp-opts.h	2007-06-10 07:58:50 -04:00
+++ 1.49.8.1/sntp/sntp-opts.h	2007-06-20 07:45:47 -04:00
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (sntp-opts.h)
  *  
- *  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:52 AM EDT
+ *  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:47 AM EDT
  *  From the definitions    sntp-opts.def
  *  and the template file   options
  *
@@ -148,8 +148,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    13
-#define SNTP_VERSION       "4.2.4p2-RC6"
-#define SNTP_FULL_VERSION  "sntp - standard SNTP program - Ver. 4.2.4p2-RC6"
+#define SNTP_VERSION       "4.2.4p2"
+#define SNTP_FULL_VERSION  "sntp - standard SNTP program - Ver. 4.2.4p2"
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED

==== sntp/sntp-opts.texi ====
2007-06-20 07:45:47-04:00, stenn at whimsy.udel.edu +1 -1
  NTP_4_2_4P2

--- 1.46.7.1/sntp/sntp-opts.texi	2007-06-10 07:58:50 -04:00
+++ 1.46.8.1/sntp/sntp-opts.texi	2007-06-20 07:45:47 -04:00
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (sntp-opts.texi)
 # 
-# It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:55 AM EDT
+# It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:50 AM EDT
 # From the definitions    sntp-opts.def
 # and the template file   aginfo.tpl
 @end ignore

==== sntp/sntp.1 ====
2007-06-20 07:45:48-04:00, stenn at whimsy.udel.edu +2 -2
  NTP_4_2_4P2

--- 1.49.7.1/sntp/sntp.1	2007-06-10 07:58:51 -04:00
+++ 1.49.8.1/sntp/sntp.1	2007-06-20 07:45:48 -04:00
@@ -1,7 +1,7 @@
-.TH SNTP 1 2007-06-10 "( 4.2.4p2-RC6)" "Programmer's Manual"
+.TH SNTP 1 2007-06-20 "( 4.2.4p2)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (sntp.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday June 10, 2007 at 07:57:54 AM EDT
+.\"  It has been AutoGen-ed  Wednesday June 20, 2007 at 07:44:49 AM EDT
 .\"  From the definitions    sntp-opts.def
 .\"  and the template file   agman1.tpl
 .\"

#### ChangeSet ####
2007-06-20 04:07:34-04:00, stenn at deacon.udel.edu 
  4.2.4p2

==== packageinfo.sh ====
2007-06-20 04:07:26-04:00, stenn at deacon.udel.edu +1 -1
  4.2.4p2

--- 1.65.13.1/packageinfo.sh	2007-06-10 07:58:48 -04:00
+++ 1.65.14.1/packageinfo.sh	2007-06-20 04:07:26 -04:00
@@ -27,5 +27,5 @@ CLTAG=NTP_4_2_0
 # - - rcpoint gets set to 0
 # - - releasecandidate gets set to no
 # - GRONK is for -dev
-rcpoint=6
+rcpoint=GO
 #rcpoint=GRONK

==== ChangeLog ====
2007-06-20 04:07:25-04:00, stenn at deacon.udel.edu +1 -0
  4.2.4p2

--- 1.1.1.18/ChangeLog	2007-06-07 09:28:05 -04:00
+++ 1.1.1.19/ChangeLog	2007-06-20 04:07:25 -04:00
@@ -1,3 +1,4 @@
+(4.2.4p2) Released by Harlan Stenn <stenn at ntp.org>
 * [Bug 854] Broadcast address was not correctly set for interface addresses
 * [Bug 829] reduce syslog noise, while there fix Enabled/Disable logging
 	    to reflect the actual configuration.

==== NEWS ====
2007-06-20 04:07:25-04:00, stenn at deacon.udel.edu +8 -13
  4.2.4p2

--- 1.86.1.7/NEWS	2007-05-29 01:32:15 -04:00
+++ 1.86.1.8/NEWS	2007-06-20 04:07:25 -04:00
@@ -1,18 +1,13 @@
-NTP 4.2.4p2 (Harlan Stenn <stenn at ntp.org>, 2007/05/18)
+NTP 4.2.4p2 (Harlan Stenn <stenn at ntp.org>, 2007/06/19)
 
-Focus: bug fix.
+Focus: Minor Bugfixes
 
-[Bug 829] reduce syslog noise, while there fix Enabled/Disable logging
-	  to reflect the actual configuration.
-[Bug 795] Moved declaration of variable to top of function.
-[Bug 789] Fix multicast client crypto authentication and make sure arriving
-         multicast packets do not disturb the autokey dance.
-[Bug 785] improve handling of multicast interfaces
-         (multicast routers still need to run a multicast routing
-         software/daemon)
-[Bug 527] Don't write from source address length to wrong location (Windows).
-(Upgraded autogen and libopts.)
-[Bug 811] ntpd should not read a .ntprc file.
+This release fixes a multicast mode authentication problem, 
+an error in NTP packet handling on Windows that could lead to 
+ntpd crashing, and several other minor bugs. Handling of 
+multicast interfaces and logging configuration were improved. 
+The required versions of autogen and libopts were incremented.
+This is a recommended upgrade for Windows and multicast users.
 ---
 NTP 4.2.4 (Harlan Stenn <stenn at ntp.org>, 2006/12/31)
 

#### ChangeSet ####
2007-06-19 08:37:26-04:00, mayer at pogo.udel.edu 
  Bug 629 Check for broadcast mode was in wrong place

==== ntpd/ntp_io.c ====
2007-06-19 08:35:52-04:00, mayer at pogo.udel.edu +35 -11
  Bug 629 Check for broadcast mode was in wrong place

--- 1.253/ntpd/ntp_io.c	2007-06-15 07:48:30 -04:00
+++ 1.253.1.1/ntpd/ntp_io.c	2007-06-19 08:35:52 -04:00
@@ -268,7 +268,7 @@ static void	create_wildcards	(u_short);
 static isc_boolean_t	address_okay	(isc_interface_t *);
 static void		convert_isc_if		(isc_interface_t *, struct interface *, u_short);
 static struct interface *getinterface	(struct sockaddr_storage *, int);
-static struct interface *findlocalinterface	(struct sockaddr_storage *, int);
+static struct interface *findlocalinterface	(struct sockaddr_storage *, int, int);
 static struct interface *findlocalcastinterface	(struct sockaddr_storage *, int);
 
 /*
@@ -2855,6 +2855,7 @@ read_network_packet(SOCKET fd, struct in
 	GETSOCKNAME_SOCKLEN_TYPE fromlen;
 	int buflen;
 	isc_boolean_t ignore_this;
+	isc_boolean_t ignore_later = ISC_FALSE;
 	register struct recvbuf *rb;
 #ifdef HAVE_TIMESTAMP
 	struct msghdr msghdr;
@@ -2873,18 +2874,18 @@ read_network_packet(SOCKET fd, struct in
 
 	/* For broadcast packet received on the IPv4 wildcard socket
 	 * we carve out an exception but only if the client has requested
-	 * to receive wildcard sockets
+	 * to receive wildcard sockets. The final check is later when we
+	 * have read the packet.
 	 */
 	ignore_this = itf->ignore_packets;
 	if (ignore_this == ISC_TRUE && itf->family == AF_INET &&
-	    itf->flags == (INT_BROADCAST | INT_WILDCARD) &&
-	    get_packet_mode(rb) == MODE_BROADCAST &&
+	    (itf->flags & (INT_BROADCAST | INT_WILDCARD)) &&
 	    get_broadcastclient_flag() == ISC_TRUE
 	    )
-	    ignore_this = ISC_FALSE;
+	    ignore_later = ISC_TRUE;
 
-	if (rb == NULL || ignore_this == ISC_TRUE)
-	{
+	if (rb == NULL ||
+	    (ignore_this == ISC_TRUE && ignore_later == ISC_FALSE)) {
 		char buf[RX_BUFF_SIZE];
 		struct sockaddr_storage from;
 		if (rb != NULL)
@@ -2943,6 +2944,19 @@ read_network_packet(SOCKET fd, struct in
 		return (rb->recv_length);
 	}
 
+	/*
+	 * Make sure only a valide broadcast packet was received
+	 * on the wildcard address
+	 */
+	if (ignore_later == ISC_TRUE && get_packet_mode(rb) != MODE_BROADCAST) {
+		freerecvbuf(rb);
+		DPRINTF(4, ("%s on (%lu) fd=%d from %s\n",
+			"ignore", free_recvbuffs(), fd, stoa(&rb->recv_srcadr)));
+		packets_ignored++;
+		return (rb->recv_length);
+	}
+
+
 #ifdef DEBUG
 	if (debug > 2) {
 		if(rb->recv_srcadr.ss_family == AF_INET)
@@ -3166,7 +3180,7 @@ findinterface(
 {
 	struct interface *interface;
 	
-	interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD);
+	interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD, 0);
 
 	if (interface == NULL)
 	{
@@ -3200,7 +3214,8 @@ findinterface(
 static struct interface *
 findlocalinterface(
 	struct sockaddr_storage *addr,
-	int flags
+	int flags,
+	int bflag
 	)
 {
 	SOCKET s;
@@ -3208,6 +3223,7 @@ findlocalinterface(
 	struct sockaddr_storage saddr;
 	GETSOCKNAME_SOCKLEN_TYPE saddrlen = SOCKLEN(addr);
 	struct interface *iface;
+	int on = 1;
 
 	DPRINTF(4, ("Finding interface for addr %s in list of addresses\n",
 		    stoa(addr));)
@@ -3232,6 +3248,14 @@ findlocalinterface(
 	if (s == INVALID_SOCKET)
 		return NULL;
 
+	/*
+	 * If we are looking for broadcast interface we need to set this
+	 * socket to allow broadcast
+	 */
+	if (bflag & INT_BROADCAST)
+		setsockopt(s, SOL_SOCKET, SO_BROADCAST,
+			  (char *)&on, sizeof(on));
+
 	rtn = connect(s, (struct sockaddr *)&saddr, SOCKLEN(&saddr));
 #ifndef SYS_WINNT
 	if (rtn < 0)
@@ -3304,7 +3328,7 @@ findlocalcastinterface(
 	/*
 	 * see how kernel maps the mcast address
 	 */
-        nif = findlocalinterface(addr, 0);
+        nif = findlocalinterface(addr, 0, 0);
 
 	if (nif) {
 		DPRINTF(2, ("findlocalcastinterface: kernel recommends interface #%d %s\n", nif->ifnum, nif->name));
@@ -3393,7 +3417,7 @@ findbcastinter(
 	DPRINTF(4, ("Finding broadcast/multicast interface for addr %s in list of addresses\n",
 		    stoa(addr)));
 
-	interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD);
+	interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD, INT_BROADCAST);
 	
 	if (interface != NULL)
 	{

==== ports/winnt/ntpd/ntp_iocompletionport.c ====
2007-06-19 08:36:52-04:00, mayer at pogo.udel.edu +8 -2
  Bug 629 Additional debug info

--- 1.27/ports/winnt/ntpd/ntp_iocompletionport.c	2007-06-14 23:06:16 -04:00
+++ 1.28/ports/winnt/ntpd/ntp_iocompletionport.c	2007-06-19 08:36:52 -04:00
@@ -517,16 +517,22 @@ OnSocketRecv(DWORD i, IoCompletionInfo *
 #endif
 		ignore_this = inter->ignore_packets;
 		if (ignore_this == ISC_TRUE && inter->family == AF_INET &&
-		    inter->flags == (INT_BROADCAST | INT_WILDCARD) &&
+		    (inter->flags & (INT_BROADCAST | INT_WILDCARD)) &&
 		    get_packet_mode(buff) == MODE_BROADCAST &&
 		    get_broadcastclient_flag() == ISC_TRUE
 		    ) {
 			ignore_this = ISC_FALSE;
 #ifdef DEBUG
-			if (debug > 3)
+			if (debug > 1)
   				printf("****Accepting ignored packet on fd %d from %s\n", buff->fd, stoa(&buff->recv_srcadr));
 #endif
 		}
+#ifdef DEBUG
+		else {
+			if (debug > 3)
+				printf(" Packet mode is %d\n", get_packet_mode(buff));
+		}
+#endif
 
 		/*
 		 * If we keep it add some info to the structure


More information about the bk-ntp-dev-send mailing list