]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
merge repair
authorDave Hart <hart@ntp.org>
Tue, 16 Nov 2010 00:07:47 +0000 (00:07 +0000)
committerDave Hart <hart@ntp.org>
Tue, 16 Nov 2010 00:07:47 +0000 (00:07 +0000)
bk: 4ce1cb53qdzJH3LeFWhd2CwwrihrhQ

include/ntpd.h
libntp/ntp_calendar.c
ntpd/ntp_control.c
ntpd/ntp_filegen.c
ntpd/ntp_io.c
ntpd/ntp_peer.c
sntp/tests/Makefile.am
sntp/tests/data/log-expected-debug [deleted file]
sntp/tests/data/log-expected-log [deleted file]
sntp/tests/logFile.cpp [deleted file]

index f2ddbc68d545c3f4c689a514f0d7134d500c6a54..4a4bff5e13f0c051a6f74b64808f1174a7eeb307 100644 (file)
@@ -390,7 +390,7 @@ extern u_int        sys_ifnum;              /* next .ifnum to assign */
 extern endpt * any_interface;          /* IPv4 wildcard */
 extern endpt * any6_interface;         /* IPv6 wildcard */
 extern endpt * loopback_interface;     /* IPv4 loopback for refclocks */
-extern struct interface *inter_list;   /* linked list */
+extern endpt * ep_list;                /* linked list */
 
 /* ntp_loopfilter.c */
 extern double  drift_comp;             /* clock frequency (s/s) */
index 9bed5dc63a50f5cfc764a9e7124a114084a5c2c7..81110ac8059853e4839bf6a231ffcbb2e23fda2f 100644 (file)
@@ -553,17 +553,17 @@ ntpcal_rd_to_date(
        split = ntpcal_split_eradays(rd - 1, &leaps);
        retv  = leaps;
        /* get year and day-of-year */
-       jd->year = split.hi + 1;
+       jd->year = (u_short)split.hi + 1;
        if (jd->year != split.hi + 1) {
                jd->year = 0;
                retv     = -1;  /* bletch. overflow trouble. */
        }
-       jd->yearday = split.lo + 1;
+       jd->yearday = (u_short)split.lo + 1;
 
        /* convert to month and mday */
        split = ntpcal_split_yeardays(split.lo, leaps);
-       jd->month    = split.hi + 1;
-       jd->monthday = split.lo + 1;
+       jd->month    = (u_char)split.hi + 1;
+       jd->monthday = (u_char)split.lo + 1;
 
        return retv ? retv : leaps;
 }
@@ -1286,9 +1286,9 @@ isocal_ntp_to_date(
 
        /* split time part */
        ds.hi += priv_timesplit(ts, ds.lo);
-       id->hour   = ts[0];
-       id->minute = ts[1];
-       id->second = ts[2];
+       id->hour   = (u_char)ts[0];
+       id->minute = (u_char)ts[1];
+       id->second = (u_char)ts[2];
 
        /* split date part */
        ds.lo = ds.hi + DAY_NTP_STARTS - 1;     /* elapsed era days  */
@@ -1298,11 +1298,11 @@ isocal_ntp_to_date(
                ds.hi -= 1;
                ds.lo += 7;
        }
-       id->weekday = ds.lo + 1;                /* weekday result    */
+       id->weekday = (u_char)ds.lo + 1;        /* weekday result    */
 
        ds = isocal_split_eraweeks(ds.hi);      /* elapsed years&week*/
-       id->year = ds.hi + 1;                   /* shift to current  */
-       id->week = ds.lo + 1;
+       id->year = (u_short)ds.hi + 1;          /* shift to current  */
+       id->week = (u_char)ds.lo + 1;
 
        return (ds.hi >= 0 && ds.hi < 0xFFFFU);
 }
index 39d17772a0f57347f37b19e93c2b9ea669596f09..9ff5a8f113fd79ac917ff6231c8c6167772596e4 100644 (file)
@@ -3334,11 +3334,11 @@ static void read_ifstats(
        struct interface *      la;
 
        /*
-        * loop over [0..sys_ifnum] searching inter_list for each
+        * loop over [0..sys_ifnum] searching ep_list for each
         * ifnum in turn.
         */
        for (ifidx = 0; ifidx < sys_ifnum; ifidx++) {
-               for (la = inter_list; la != NULL; la = la->link)
+               for (la = ep_list; la != NULL; la = la->elink)
                        if (ifidx == la->ifnum)
                                break;
                if (NULL == la)
index 38aeedaece71c4099f751b534dc7835926df7dad..fb2690a6ce228a3abd5ba80ec25e05814379ecb2 100644 (file)
@@ -349,7 +349,6 @@ filegen_setup(
        )
 {
        int    current = 0;
-       u_long new_gen = ~ (u_long) 0;
        time_t pivot   = time(NULL);
 
        if (!(gen->flag & FGEN_FLAG_ENABLED)) {
@@ -368,7 +367,7 @@ filegen_setup(
                break;
 
        case FILEGEN_PID:
-               current = (gen->id_lo == getpid());
+               current = ((int)gen->id_lo == getpid());
                break;
 
        case FILEGEN_AGE:
index 0a07bf9f257435bb1dc4db0ff53c9628078d41a9..53ecd96d7d959d4fe33661baa2937aaf21fa15d8 100644 (file)
@@ -291,7 +291,6 @@ static void delete_interface_from_list(endpt *);
 static void    close_and_delete_fd_from_list(SOCKET);
 static void    add_addr_to_list        (sockaddr_u *, endpt *);
 static void    create_wildcards        (u_short);
-static endpt * getinterface            (sockaddr_u *, u_int32);
 static endpt * findlocalinterface      (sockaddr_u *, int, int);
 static endpt * findclosestinterface    (sockaddr_u *, int);
 #ifdef MULTICAST_NONEWSOCKET
@@ -1094,7 +1093,7 @@ remove_interface(
        }
 
        ninterfaces--;
-       ntp_monclearinterface(ep);
+       mon_clearinterface(ep);
 
        /* remove restrict interface entry */
        SET_HOSTMASK(&resmask, AF(&ep->sin));
@@ -2170,7 +2169,7 @@ enable_broadcast(
 #ifdef OPEN_BCAST_SOCKET 
 /*
  * Enable a broadcast address to a given socket
- * The socket is in the inter_list all we need to do is enable
+ * The socket is in the ep_list all we need to do is enable
  * broadcasting. It is not this function's job to select the socket
  */
 static isc_boolean_t
@@ -2204,7 +2203,7 @@ socket_broadcast_enable(
 
 /*
  * Remove a broadcast address from a given socket
- * The socket is in the inter_list all we need to do is disable
+ * The socket is in the ep_list all we need to do is disable
  * broadcasting. It is not this function's job to select the socket
  */
 static isc_boolean_t
@@ -2357,7 +2356,7 @@ enable_multicast_if(
 
 /*
  * Add a multicast address to a given socket
- * The socket is in the inter_list all we need to do is enable
+ * The socket is in the ep_list all we need to do is enable
  * multicasting. It is not this function's job to select the socket
  */
 #ifdef MCAST
@@ -2441,7 +2440,7 @@ socket_multicast_enable(
 
 /*
  * Remove a multicast address from a given socket
- * The socket is in the inter_list all we need to do is disable
+ * The socket is in the ep_list all we need to do is disable
  * multicasting. It is not this function's job to select the socket
  */
 static isc_boolean_t
index 66ab0cf7b85da10c34da40917a24a5a294f981ce..e74eca7ca40ae141cbc175aacef6456dc43d6dea 100644 (file)
@@ -622,16 +622,14 @@ peer_refresh_interface(
        endpt * niface;
        endpt * piface;
 
-       niface = select_peerinterface(peer, &peer->srcadr, NULL,
-                                     peer->cast_flags);
+       niface = select_peerinterface(p, &p->srcadr, NULL);
 
        DPRINTF(4, (
            "peer_refresh_interface: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %d key %08x: new interface: ",
-           peer->dstadr == NULL ? "<null>" :
-           stoa(&peer->dstadr->sin), stoa(&peer->srcadr),
-           peer->hmode, peer->version, peer->minpoll,
-           peer->maxpoll, peer->flags, peer->cast_flags,
-           peer->ttl, peer->keyid));
+           p->dstadr == NULL ? "<null>" :
+           stoa(&p->dstadr->sin), stoa(&p->srcadr), p->hmode,
+           p->version, p->minpoll, p->maxpoll, p->flags, p->cast_flags,
+           p->ttl, p->keyid));
        if (niface != NULL) {
                DPRINTF(4, (
                    "fd=%d, bfd=%d, name=%.16s, flags=0x%x, scope=%d, sin=%s",
@@ -646,9 +644,9 @@ peer_refresh_interface(
                DPRINTF(4, ("<NONE>\n"));
        }
 
-       piface = peer->dstadr;
-       set_peerdstadr(peer, niface);
-       if (peer->dstadr) {
+       piface = p->dstadr;
+       set_peerdstadr(p, niface);
+       if (p->dstadr) {
                /*
                 * clear crypto if we change the local address
                 */
index eb983773bef97e9faf9100583482c21ca6a3d5e9..7cee30bd02bb3fda2ac39bd45e36b58cf52a614a 100644 (file)
@@ -22,7 +22,6 @@ tests_SOURCES = $(base_SOURCES)               \
                keyFile.cpp             \
                kodDatabase.cpp         \
                kodFile.cpp             \
-               logFile.cpp             \
                networking.cpp          \
                packetHandling.cpp      \
                packetProcessing.cpp    \
@@ -37,13 +36,11 @@ dist_check_SCRIPTS =        test-driver
 
 EXTRA_DIST =   data
 
-CLEANFILES =   data/log-output-debug           \
-               data/kod-output-multiple        \
+CLEANFILES =   data/kod-output-multiple        \
                data/kod-output-single          \
                data/debug-output-pkt           \
                data/debug-output-lfp-dec       \
                data/kod-output-blank           \
-               data/log-output-log             \
                data/debug-output-lfp-bin       \
                data/debug-output-lfp-hex       \
                $(NULL)
diff --git a/sntp/tests/data/log-expected-debug b/sntp/tests/data/log-expected-debug
deleted file mode 100644 (file)
index 3e747b7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Thu Jul 29 13:01:00 2010
-: This is a debug message
-Thu Jul 29 13:01:00 2010
-: Another debug message
diff --git a/sntp/tests/data/log-expected-log b/sntp/tests/data/log-expected-log
deleted file mode 100644 (file)
index d41ae7c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Thu Jul 29 13:01:00 2010
-: Test log message
-Thu Jul 29 13:01:00 2010
-: Test message 2
diff --git a/sntp/tests/logFile.cpp b/sntp/tests/logFile.cpp
deleted file mode 100644 (file)
index 6f66d13..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "fileHandlingTest.h"
-
-extern "C" {
-#include "log.h"
-#include <fcntl.h>
-};
-
-class logFileTest : public fileHandlingTest {
-};
-
-#if 0  /* temporarily disable, needs rework */
-TEST_F(logFileTest, WriteLogFile) {
-       std::string filename = CreatePath("log-output-log", OUTPUT_DIR);
-
-       ClearFile(filename);
-
-       init_log(filename.c_str());
-       
-       log_msg("Test log message", 0);
-       log_msg("Test message 2", 0);
-
-       /*
-        * Compare the file size, since the contents differs in the
-        * timestamp.
-        */
-       ifstream expected(CreatePath("log-expected-log", INPUT_DIR).c_str());
-       ifstream actual(CreatePath("log-output-log", OUTPUT_DIR).c_str());
-       ASSERT_TRUE(expected.good());
-       ASSERT_TRUE(actual.good());
-
-       EXPECT_EQ(GetFileSize(expected), GetFileSize(actual));
-}
-
-TEST_F(logFileTest, WriteDebugMessage) {
-       ActivateOption("-l", "/dev/null");
-
-       std::string filename = CreatePath("log-output-debug", OUTPUT_DIR);
-
-       // Create and/or truncate the file.
-       FILE* debugFile = fopen(filename.c_str(), "w");
-
-       fflush(stderr);
-
-       /* 
-        * Copy stderr's original file handle, so we can restore
-        * it later on. Then redirect stderr to our debugFile.
-        */
-       int orig = dup(fileno(stderr));
-       dup2(fileno(debugFile), fileno(stderr));
-       fclose(debugFile);
-
-       debug_msg("This is a debug message");
-       debug_msg("Another debug message");
-
-       // Restore the original stderr handle.
-       fflush(stderr);
-       dup2(orig, fileno(stderr));
-       close(orig);
-
-       /*
-        * Compare the file size, since the contents differs in the
-        * timestamp.
-        */
-       ifstream expected(CreatePath("log-expected-debug", INPUT_DIR).c_str());
-       ifstream actual(filename.c_str());
-       ASSERT_TRUE(expected.good());
-       ASSERT_TRUE(actual.good());
-
-       EXPECT_EQ(GetFileSize(expected), GetFileSize(actual));
-}
-#endif