]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Miscellaneous updates and cosmetic changes.
authorDanny Mayer <mayer@ntp.org>
Thu, 22 May 2003 02:43:30 +0000 (22:43 -0400)
committerDanny Mayer <mayer@ntp.org>
Thu, 22 May 2003 02:43:30 +0000 (22:43 -0400)
Updates to ntptrace to get it to build properly.

bk: 3ecc3952BF1Bbz1kkvD_Q2yMXR_LNA

html/hints/winnt.html
ntpd/ntp_io.c
ntpdate/ntpdate.c
ntptrace/ntptrace.c
ntptrace/ntptrace.h
ports/winnt/ntpdate/ntpdate.dsp

index 1f722e1eef9e8b641b15364970b7089d3d71abe0..2ff893df2443865ea66bd211a6aa50d11bd54a1c 100644 (file)
 
     <body>
         <h1>NTP 4.x for Windows NT</h1>
-        <h2>Do not try to compile NTP-4.0.99i under WINNT, it will not work. Fixed NTP-4.0.99i; look for next release to be functional. Sven - May 11 2000</h2>
-        <h2>Download NTP-4.0.99g for the last stable WINNT port. I am working on adapting the major changes starting with 99i and getting things running again. Sven - April 25 2000</h2>
+
         <h2>Introduction</h2>
-        The NTP 4 distribution runs as service on (i386) Windows NT 4.0 and Windows 2000. The binaries work on dual processor systems. This port has not been tested on the Alpha platform.
+        The NTP 4 distribution runs as service on Windows NT 4.0, Windows 2000, Windows XP,
+        Windows .NET Server 2003. It will NOT run on Windows 95, 98, ME, etc.
+        The binaries work on dual processor systems. This port has not been tested
+        on the Alpha platform. This release now uses OpenSSL for authentication.
         <p>Refer to System Requirements and Instructions for how to compile the program.</p>
         <h2>Reference Clocks</h2>
-        Refernce clock support under Windows NT is tricky because the IO functions are so much different. The following reference clocks are supported by Windows NT:
+        Reference clock support under Windows NT is tricky because the IO functions are
+        so much different. Most of the clock types have been built into the ntpd executable
+        and should work but have not been tested by the ntp project. The following reference
+        clocks are known to work and are supported by Windows NT:
         <p><a href="../driver1.html">Type 1</a> Undisciplined Local Clock (LOCAL)<br>
             <a href="../driver29.html">Type 29</a> Trimble Navigation Palisade GPS (GPS_PALISADE)</p>
         <h2>Functions Supported</h2>
         All NTP functions are supported with some constraints. See the TODO list below.
+        Note that the ntptrace executable is not supported and you should use the PERL script
+        version instead.
         <h2>Accuracy</h2>
         Greg Brackley has implemented a fantastic interpolation scheme that improves the precision of the NTP clock using a realtime thread (is that poetic or what!) which captures a tick count from the 8253 counter after each OS tick. The count is used to interpolate the time between operating system ticks.
         <p>On a typical 200+ MHz system NTP achieves a precision of about 5 microseconds and synchronizes the clock to +/-500 microseconds using the <a href="http://www.trimble.com/products/ntp">Trimble Palisade</a> as UTC reference. This allows distributed applications to use the 10 milliseconds ticks available to them with high confidence.</p>
         <a href="http://www.trimble.com/oem/ntp">http://www.trimble.com/oem/ntp</a> and <a href="http://www.five-ten-sg.com/">http://www.five-ten-sg.com/</a>
         <h2>ToDo</h2>
         <ul>
-            <li>MD5 authentication causes problems with DNS. If you use encryption/authentication, you have to use IP numbers in <tt>ntp.conf.</tt>
-            <li>NMEA refclock support is in development.
             <li>See if precision can be improved by using CPU cycle counter for tick interpolation.
             <li>Make precision time available to applications using NTP_GETTIME API
         </ul>
         <h2>Compiling Requirements</h2>
         <ul>
-            <li><tt>Windows NT 4.0 or 5.0 (2000)</tt>
-            <li><tt>Microsoft Visual C++ 6.0</tt>
-            <li>Some version of the archiving program <tt>ZIP</tt>.
+            <li>Windows NT 4.0 Windows 2000, Windows XP, or Windows.NET Server 2003
+            <li>Microsoft Visual C++ 6.0
+            <li>Some way of uncompressing and untarring the gzipped tar file.
+            <li>OpenSSL must be built on the box before building NTP. Additional steps would
+            be required to not use OpenSSL.
         </ul>
         <h2>Compiling Instructions</h2>
         <ol>
+            <li>Unpack and build OpenSSL according to the OpenSSL instructions for building on
+            Windows. Currently the NTP build requires OpenSSL 0.9.6g as it looks for the path
+            to that build for the include and libeay32.lib files.
             <li>Unpack the NTP-4.x.tar.gz
             <li>Open the .\ports\winnt\ntp.dsw Visual C workspace
             <li>Batch build all projects
+            <li>The built binaries can be found in the port\winnt\bin\Release subdirectory
+            <li>In addition you will need to install the OpenSSL libeay32.dll
         </ol>
         <h2>Configuration File</h2>
         The default NTP configuration file path is %SystemRoot%<tt>\system32\drivers\etc\. </tt>(%SystemRoot% is an environmental variable that can be determined by typing &quot;set&quot; at the &quot;Command Prompt&quot; or from the &quot;System&quot; icon in the &quot;Control Panel&quot;).<br>
         <p>Use the registry editor to edit the value for the ntpd executable under LocalMachine\System\CurrentControlSet\Services\NTP.</p>
         <p>Add the -g option to the ImagePath key, behind &quot;%INSTALLDIR&gt;\ntpd.exe&quot;. This will force NTP to accept large time errors (including 1.1.1980 00:00)</p>
         <h2>Bug Reports</h2>
-        Send bug reports to <a href="news://comp.protocols.time.ntp">news://comp.protocols.time.ntp</a> and Sven_Dietrich@Trimble.COM
+        Send questions to <a href="news://comp.protocols.time.ntp">news://comp.protocols.time.ntp</a>
+        and bug reports should be entered in <a href="http://bugzilla.ntp.org/">Bugzilla</a> on the
+        NTP Web site.
         <h2>Change Log</h2>
+        <h3>Last revision 22 May 2003&nbsp; Version 4.2.0</h3>
+        <b>by Danny Mayer (mayer@ntp.org>)</b>
+        <h3>Significant Changes:</h3>
+        This latest release of NTP constitutes a major upgrade to its ability to build and
+        run on Windows platforms and should now build and run cleanly. More importantly it
+        is now able to support all authentication in the same way as Unix boxes. This does
+        require the usage of OpenSSL which is now a prerequisite for build on Windows.
+
         <h3>Last revision 16 February 1999&nbsp; Version 4.0.99e.</h3>
         <b>by Sven Dietrich (sven_dietrich@trimble.com)</b>
         <p><b>Significant Changes:</b></p>
             <a href="mailto://sven_dietrich@trimble.com">Sven_Dietrich@Trimble.COM</a></p>
     </body>
 
-</html>
\ No newline at end of file
+</html>
index 897665e4597a6401f8d000baa4aa9aea04d3e40b..8947fba6a671331edd399eeae5f886bad4d3efc4 100644 (file)
@@ -425,6 +425,16 @@ create_sockets(
        for (i = 0; i < ninterfaces; i++) {
                inter_list[i].fd = open_socket(&inter_list[i].sin,
                    inter_list[i].flags & INT_BROADCAST, 0);
+               if (inter_list[i].bfd != INVALID_SOCKET)
+                       msyslog(LOG_INFO, "Listening on interface %s, %s#%d",
+                               inter_list[i].name,
+                               stoa((&inter_list[i].sin)),
+                               NTP_PORT);
+               if ((inter_list[i].flags & INT_BROADCAST) &&
+                    inter_list[i].bfd != INVALID_SOCKET)
+                       msyslog(LOG_INFO, "Listening on broadcast address %s#%d",
+                               stoa((&inter_list[i].bcast)),
+                               NTP_PORT);
        }
 
        /*
@@ -449,15 +459,6 @@ create_sockets(
         */
        for (i = 0; i < ninterfaces; i++) {
                inter_list[i].addr_refid = addr2refid(&inter_list[i].sin);
-               msyslog(LOG_INFO, "Listening on %s interface, %s#%d",
-                       inter_list[i].name,
-                       stoa((&inter_list[i].sin)),
-                       NTP_PORT);
-               if ((inter_list[i].flags & INT_BROADCAST) &&
-                    inter_list[i].bfd != INVALID_SOCKET)
-                       msyslog(LOG_INFO, "Listening on broadcast address %s#%d",
-                               stoa((&inter_list[i].bcast)),
-                               NTP_PORT);
        }
 
 
index 08a0b6c2cb78c506e8c701dd7f2c4e638166adfc..398d194660380910185d5cd41a4a505d4eec77c6 100644 (file)
@@ -115,7 +115,7 @@ volatile int debug = 0;
 int ai_fam_templ;
 int nbsock;
 SOCKET fd[MAX_AF];     /* support up to 2 sockets */
-SOCKET fd_family[MAX_AF];      /* to remember the socket family */
+int fd_family[MAX_AF]; /* to remember the socket family */
 #ifdef HAVE_POLL_H
 struct pollfd fdmask[MAX_AF];
 #else
@@ -334,7 +334,7 @@ ntpdatemain (
 
        wVersionRequested = MAKEWORD(1,1);
        if (WSAStartup(wVersionRequested, &wsaData)) {
-               msyslog(LOG_ERR, "No useable winsock.dll: %m");
+               netsyslog(LOG_ERR, "No useable winsock.dll: %m");
                exit(1);
        }
 
@@ -609,7 +609,7 @@ ntpdatemain (
 #ifndef SYS_WINNT
                                if (errno != EINTR)
 #endif
-                                       msyslog(LOG_ERR,
+                                       netsyslog(LOG_ERR,
 #ifdef HAVE_POLL_H
                                                "poll() error: %m"
 #else
@@ -618,7 +618,7 @@ ntpdatemain (
                                                );
                        } else {
 #ifndef SYS_VXWORKS
-                               msyslog(LOG_DEBUG,
+                               netsyslog(LOG_DEBUG,
 #ifdef HAVE_POLL_H
                                        "poll(): nfound = %d, error: %m",
 #else
@@ -1683,13 +1683,13 @@ init_io(void)
                if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT ||
                    errno == EPFNOSUPPORT)
                        continue;
-               msyslog(LOG_ERR, "socket() failed: %m");
+               netsyslog(LOG_ERR, "socket() failed: %m");
                exit(1);
                /*NOTREACHED*/
        }
            /* set socket to reuse address */
            if (setsockopt(fd[nbsock], SOL_SOCKET, SO_REUSEADDR, (void*) &optval, sizeof(optval)) < 0) {
-                  msyslog(LOG_ERR, "setsockopt() SO_REUSEADDR failed: %m");
+                  netsyslog(LOG_ERR, "setsockopt() SO_REUSEADDR failed: %m");
                   exit(1);
                   /*NOTREACHED*/
           }
@@ -1697,7 +1697,7 @@ init_io(void)
            /* Restricts AF_INET6 socket to IPv6 communications (see RFC 2553bis-03) */
            if (res->ai_family == AF_INET6)
                 if (setsockopt(fd[nbsock], IPPROTO_IPV6, IPV6_V6ONLY, (void*) &optval, sizeof(optval)) < 0) {
-                          msyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m");
+                          netsyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m");
                           exit(1);
                           /*NOTREACHED*/
                }
@@ -1716,10 +1716,10 @@ init_io(void)
 #else
                                if (WSAGetLastError() == WSAEADDRINUSE)
 #endif /* SYS_WINNT */
-                               msyslog(LOG_ERR,
+                               netsyslog(LOG_ERR,
                                        "the NTP socket is in use, exiting");
                                else
-                               msyslog(LOG_ERR, "bind() fails: %m");
+                               netsyslog(LOG_ERR, "bind() fails: %m");
                        exit(1);
                }
        }
@@ -1729,7 +1729,7 @@ init_io(void)
            fdmask[nbsock].events = POLLIN;
 #else
            FD_SET(fd[nbsock], &fdmask);
-            if (maxfd < fd[nbsock]+1) {
+            if ((SOCKET) maxfd < fd[nbsock]+1) {
                 maxfd = fd[nbsock]+1;
             }
 #endif
@@ -1743,21 +1743,21 @@ init_io(void)
        int on = TRUE;
 
           if (ioctl(fd[nbsock],FIONBIO, &on) == ERROR) {
-         msyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m");
+         netsyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m");
          exit(1);
        }
   }
 # else /* not SYS_VXWORKS */
 #  if defined(O_NONBLOCK)
           if (fcntl(fd[nbsock], F_SETFL, O_NONBLOCK) < 0) {
-               msyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
+               netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
                exit(1);
                /*NOTREACHED*/
        }
 #  else /* not O_NONBLOCK */
 #      if defined(FNDELAY)
           if (fcntl(fd[nbsock], F_SETFL, FNDELAY) < 0) {
-               msyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
+               netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m");
                exit(1);
                /*NOTREACHED*/
        }
@@ -1768,7 +1768,7 @@ init_io(void)
 # endif /* SYS_VXWORKS */
 #else /* SYS_WINNT */
        if (ioctlsocket(fd[nbsock], FIONBIO, (u_long *) &on) == SOCKET_ERROR) {
-               msyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m");
+               netsyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m");
                exit(1);
        }
 #endif /* SYS_WINNT */
@@ -1804,7 +1804,7 @@ sendpkt(
         }
 
         if ( sock == 0 ) {
-                msyslog(LOG_ERR, "cannot find family compatible socket to send ntp packet");
+                netsyslog(LOG_ERR, "cannot find family compatible socket to send ntp packet");
                 exit(1);
                 /*NOTREACHED*/
         }
@@ -1820,7 +1820,7 @@ sendpkt(
                err = WSAGetLastError();
                if (err != WSAEWOULDBLOCK && err != WSAENOBUFS)
 #endif /* SYS_WINNT */
-                        msyslog(LOG_ERR, "sendto(%s): %m", stohost(dest));
+                        netsyslog(LOG_ERR, "sendto(%s): %m", stohost(dest));
        }
 }
 
@@ -1890,7 +1890,7 @@ input_handler(void)
                        return;
                else if (n == -1) {
                        if (errno != EINTR)
-                               msyslog(LOG_ERR,
+                               netsyslog(LOG_ERR,
 #ifdef HAVE_POLL_H
                                        "poll() error: %m"
 #else
index 8115c50a0bd9e8463ad148da21d7ce06bd9d844c..8e45e344867c94754eb1627798dbde69ef6caef8 100644 (file)
@@ -74,7 +74,7 @@ int sys_version = NTP_OLDVERSION;     /* version to poll with */
 /*
  * File descriptor masks etc. for call to select
  */
-int fd;
+SOCKET fd;
 fd_set fdmask;
 
 /*
@@ -91,7 +91,7 @@ static        int             ReceiveBuf      P((struct server *, struct recvbuf *));
 static struct  server *addserver       P((struct in_addr *));
 static struct  server *addservbyname   P((const char *));
 static void    setup_io        P((void));
-static void    sendpkt P((struct sockaddr_in *, struct pkt *, int));
+static void    sendpkt P((struct sockaddr_storage *, struct pkt *, int));
 static int             getipaddr       P((const char *, u_int32 *));
 static int             decodeipaddr    P((const char *, u_int32 *));
 static void    printserver     P((struct server *, FILE *));
@@ -199,7 +199,7 @@ ntptracemain(
 #ifdef SYS_WINNT
        wVersionRequested = MAKEWORD(1,1);
        if (WSAStartup(wVersionRequested, &wsaData)) {
-               msyslog(LOG_ERR, "No useable winsock.dll: %m");
+               netsyslog(LOG_ERR, "No useable winsock.dll: %m");
                exit(1);
        }
 #endif /* SYS_WINNT */
@@ -250,7 +250,7 @@ DoTrace(
 {
        int retries = sys_retries;
 
-       if (!server->srcadr.sin_addr.s_addr) {
+       if (!GET_INADDR(server->srcadr)) {
                if (nonames)
                    printf("%s:\t*Not Synchronized*\n", ntoa(&server->srcadr));
                else
@@ -351,7 +351,7 @@ DoReceive(
                        return(0);
                }
                else if (n == -1) {
-                       msyslog(LOG_ERR, "select() error: %m");
+                       netsyslog(LOG_ERR, "select() error: %m");
                        return(0);
                }
                get_systime(&ts);
@@ -422,7 +422,7 @@ ReceiveBuf(
                           rbufp->recv_length);
                return(0);              /* funny length packet */
        }
-       if (rbufp->recv_srcadr.sin_addr.s_addr != server->srcadr.sin_addr.s_addr) {
+       if (GET_INADDR(rbufp->recv_srcadr) != GET_INADDR(server->srcadr)) {
                if (debug)
                    printf("receive: wrong server\n");
                return(0);              /* funny length packet */
@@ -552,9 +552,9 @@ addserver(
        server = (struct server *)emalloc(sizeof(struct server));
        memset((char *)server, 0, sizeof(struct server));
 
-       server->srcadr.sin_family = AF_INET;
-       server->srcadr.sin_addr = *iap;
-       server->srcadr.sin_port = htons(NTP_PORT);
+       server->srcadr.ss_family = AF_INET;
+       ((struct sockaddr_in *)&server->srcadr)->sin_addr = *iap;
+       ((struct sockaddr_in *)&server->srcadr)->sin_port = htons(NTP_PORT);
 
        sys_servers[sys_numservers++] = server;
        
@@ -600,7 +600,7 @@ setup_io(void)
            == INVALID_SOCKET
 #endif
            ) {
-               msyslog(LOG_ERR, "socket() failed: %m");
+               netsyslog(LOG_ERR, "socket() failed: %m");
                exit(1);
                /*NOTREACHED*/
        }
@@ -617,7 +617,7 @@ setup_io(void)
  */
 static void
 sendpkt(
-       struct sockaddr_in *dest,
+       struct sockaddr_storage *dest,
        struct pkt *pkt,
        int len
        )
@@ -625,18 +625,19 @@ sendpkt(
        int cc;
 
        cc = sendto(fd, (char *)pkt, (size_t)len, 0, (struct sockaddr *)dest,
-                   sizeof(struct sockaddr_in));
-       if (cc == -1) {
+                   SOCKLEN(dest));
+       if (cc == SOCKET_ERROR) {
 #ifndef SYS_WINNT
                if (errno != EWOULDBLOCK && errno != ENOBUFS)
 #else /* SYS_WINNT */
                    int iSockErr = WSAGetLastError();
                if (iSockErr != WSAEWOULDBLOCK && iSockErr != WSAENOBUFS)
 #endif /* SYS_WINNT */
-                   msyslog(LOG_ERR, "sendto(%s): %m", ntoa(dest));
+                   netsyslog(LOG_ERR, "sendto(%s): %m", ntoa(dest));
        }
 }
 
+
 /*
  * getipaddr - given a host name, return its host address
  */
@@ -728,7 +729,7 @@ printserver(
        }
 
        (void) fprintf(fp, "server %s, port %d\n", ntoa(&pp->srcadr),
-           ntohs(pp->srcadr.sin_port));
+           SRCPORT(&pp->srcadr));
 
        (void) fprintf(fp, "stratum %d, precision %d, leap %c%c\n",
            pp->stratum, pp->precision, pp->leap & 0x2 ? '1' : '0',
index 53cbe0107649ff0c73e0ccc1e3219039e5c0f370..3bf97fdc5cc59a1776b27ba74fa664e87142508b 100644 (file)
@@ -10,7 +10,7 @@
  * remember about the server.
  */
 struct server {
-       struct sockaddr_in srcadr;      /* address of remote host */
+       struct sockaddr_storage srcadr; /* address of remote host */
        u_char leap;                    /* leap indicator */
        u_char stratum;                 /* stratum of remote server */
        s_char precision;               /* server's clock precision */
index 9d0a24c8199211afc38b351dd9d4b876c68ecaf0..1b3bb364bbc776df44ea851d830d856ed2e9732b 100644 (file)
@@ -66,7 +66,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
 BSC32=bscmake.exe