]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1411] Fix status messages in refclock_oncore.c
authorHarlan Stenn <stenn@ntp.org>
Tue, 22 Dec 2009 07:26:26 +0000 (02:26 -0500)
committerHarlan Stenn <stenn@ntp.org>
Tue, 22 Dec 2009 07:26:26 +0000 (02:26 -0500)
bk: 4b3074a2wZFH8aM6pzFLqC9T18HJ3g

ChangeLog
ntpd/refclock_oncore.c

index a52f5a6e9981f0cc06a2b4a9aaa65ef18a8daff8..07cf9396cfab5760e59b3153ccfaab5b4321604b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 ---
 
+* [Bug 1411] Fix status messages in refclock_oncore.c.
 * [Bug 1419] ntpdate, ntpdc, sntp, ntpd ignore configure --bindir.
 * [Bug 1426] scripts/VersionName needs . on the search path.
 * [Bug 1427] quote missing in ./build - shows up on NetBSD.
index 44887233f2a3db9d13855cd14b2ef69662b28a46..80ffc2bdd9b6a2cfa91f15579cd55dc0568e7e51 100644 (file)
@@ -631,6 +631,7 @@ oncore_start(
 
        oncore_log(instance, LOG_NOTICE, "ONCORE DRIVER -- CONFIGURING");
        instance->o_state = ONCORE_NO_IDEA;
+       oncore_log(instance, LOG_NOTICE, "state = ONCORE_NO_IDEA");
 
        /* Now open files.
         * This is a bit complicated, a we dont want to open the same file twice
@@ -845,12 +846,14 @@ oncore_ppsapi(
        char *cp, Msg[160];
 
        if (time_pps_getcap(instance->pps_h, &cap) < 0) {
-               oncore_log(instance, LOG_ERR, "time_pps_getcap failed: %m");
+               snprintf(Msg, sizeof(Msg), "time_pps_getcap failed: %m");
+               oncore_log(instance, LOG_ERR, Msg);
                return (0);
        }
 
        if (time_pps_getparams(instance->pps_h, &instance->pps_p) < 0) {
-               oncore_log(instance, LOG_ERR, "time_pps_getparams failed: %m");
+               snprintf(Msg, sizeof(Msg), "time_pps_getparams failed: %m");
+               oncore_log(instance, LOG_ERR, Msg);
                return (0);
        }
 
@@ -909,10 +912,12 @@ oncore_ppsapi(
 
                if (time_pps_kcbind(instance->pps_h, PPS_KC_HARDPPS, i,
                    PPS_TSFMT_TSPEC) < 0) {
-                       oncore_log(instance, LOG_ERR, "time_pps_kcbind failed: %m");
+                       snprintf(Msg, sizeof(Msg), "time_pps_kcbind failed: %m");
+                       oncore_log(instance, LOG_ERR, Msg);
                        oncore_log(instance, LOG_ERR, "HARDPPS failed, abort...");
                        return (0);
                }
+
                pps_enable = 1;
        }
        return(1);
@@ -1578,9 +1583,12 @@ oncore_get_timestamp(
        int     current_mode;
        pps_params_t current_params;
        struct timespec timeout;
+       struct peer *peer;
        pps_info_t pps_i;
        char    Msg[140];
 
+       peer = instance->peer;
+
 #if 1
        /* If we are in SiteSurvey mode, then we are in 3D mode, and we fall thru.
         * If we have Finished the SiteSurvey, then we fall thru for the 14/15
@@ -1588,18 +1596,22 @@ oncore_get_timestamp(
         * This gives good time, which gets better when the SS is done.
         */
 
-       if ((instance->site_survey == ONCORE_SS_DONE) && (instance->mode != MODE_0D))
+       if ((instance->site_survey == ONCORE_SS_DONE) && (instance->mode != MODE_0D)) {
 #else
        /* old check, only fall thru for SS_DONE and 0D mode, 2h45m wait for ticks */
 
-       if ((instance->site_survey != ONCORE_SS_DONE) || (instance->mode != MODE_0D))
+       if ((instance->site_survey != ONCORE_SS_DONE) || (instance->mode != MODE_0D)) {
 #endif
+               peer->flags &= ~FLAG_PPS;
                return;
+       }
 
        /* Don't do anything without an almanac to define the GPS->UTC delta */
 
-       if (instance->rsm.bad_almanac)
+       if (instance->rsm.bad_almanac) {
+               peer->flags &= ~FLAG_PPS;
                return;
+       }
 
        /* Once the Almanac is valid, the M12+T does not produce valid UTC
         * immediately.
@@ -1609,6 +1621,7 @@ oncore_get_timestamp(
 
        if (instance->count5) {
                instance->count5--;
+               peer->flags &= ~FLAG_PPS;
                return;
        }
 
@@ -1618,6 +1631,7 @@ oncore_get_timestamp(
        if (time_pps_fetch(instance->pps_h, PPS_TSFMT_TSPEC, &pps_i,
            &timeout) < 0) {
                oncore_log(instance, LOG_ERR, "time_pps_fetch failed");
+               peer->flags &= ~FLAG_PPS;
                return;
        }
 
@@ -1644,6 +1658,7 @@ oncore_get_timestamp(
 
                if (pps_i.assert_sequence == j) {
                        oncore_log(instance, LOG_NOTICE, "ONCORE: oncore_get_timestamp, error serial pps");
+                       peer->flags &= ~FLAG_PPS;
                        return;
                }
 
@@ -1671,6 +1686,7 @@ oncore_get_timestamp(
 
                if (pps_i.clear_sequence == j) {
                        oncore_log(instance, LOG_ERR, "oncore_get_timestamp, error serial pps");
+                       peer->flags &= ~FLAG_PPS;
                        return;
                }
                instance->ev_serial = pps_i.clear_sequence;
@@ -1729,12 +1745,16 @@ oncore_get_timestamp(
         */
 
        if (time_pps_getcap(instance->pps_h, &current_mode) < 0) {
-               oncore_log(instance, LOG_ERR, "time_pps_getcap failed: %m");
+               snprintf(Msg, sizeof(Msg), "time_pps_getcap failed: %m");
+               oncore_log(instance, LOG_ERR, Msg);
+               peer->flags &= ~FLAG_PPS;
                return;
        }
 
        if (time_pps_getparams(instance->pps_h, &current_params) < 0) {
-               oncore_log(instance, LOG_ERR, "time_pps_getparams failed: %m");
+               snprintf(Msg, sizeof(Msg), "time_pps_getparams failed: %m");
+               oncore_log(instance, LOG_ERR, Msg);
+               peer->flags &= ~FLAG_PPS;
                return;
        }
 
@@ -1844,6 +1864,7 @@ oncore_get_timestamp(
 
        if (!refclock_process(instance->pp)) {
                refclock_report(instance->peer, CEVNT_BADTIME);
+               peer->flags &= ~FLAG_PPS;
                return;
        }
 
@@ -1856,6 +1877,7 @@ oncore_get_timestamp(
                instance->pp->lastref = instance->pp->lastrec;
                refclock_receive(instance->peer);
        }
+       peer->flags |= FLAG_PPS;
 }
 
 
@@ -2491,6 +2513,7 @@ oncore_msg_Bl(
        } warn;
 
        day_now = day_lsf = 0;
+       cp = NULL;      /* keep gcc happy */
 
        chan = buf[4] & 0377;
        id   = buf[5] & 0377;