]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2271] Decode refclock types when built with --disable-all-clocks.
authorHarlan Stenn <stenn@ntp.org>
Sun, 9 Sep 2012 23:05:06 +0000 (19:05 -0400)
committerHarlan Stenn <stenn@ntp.org>
Sun, 9 Sep 2012 23:05:06 +0000 (19:05 -0400)
bk: 504d20a2NxRHMH4VTdnTO_0TKca3ew

ChangeLog
include/ntp_net.h
ntpd/ntp_peer.c

index 3ee2b8af96844237300c28aa133bf88a7c93be7f..a5c216d36de771e72d47eb8dcf1e5d72fb0a9d6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 2271] Decode refclock types when built with --disable-all-clocks.
 (4.2.7p304) 2012/09/06 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 2264] Cleanup SEL240X Refclock.
 * In refclock_wwv.c rename SECOND to WWV_SEC and MINUTE to WWV_MIN.
index df207eb6cdf81a891bf8411eb767f2e57c345590..0577402bfb2ceb76f8a4fbe297a324680e046fd6 100644 (file)
@@ -216,13 +216,9 @@ typedef union {
 #define        REFCLOCK_ADDR   0x7f7f0000      /* 127.127.0.0 */
 #define        REFCLOCK_MASK   0xffff0000      /* 255.255.0.0 */
 
-#ifdef REFCLOCK
 #define        ISREFCLOCKADR(srcadr)                                   \
        (IS_IPV4(srcadr) &&                                     \
         (SRCADR(srcadr) & REFCLOCK_MASK) == REFCLOCK_ADDR)
-#else
-#define ISREFCLOCKADR(srcadr)          (0)
-#endif
 
 /*
  * Macro for checking for invalid addresses.  This is really, really
index 8bfcd378e82c7fd70077c7fda90ee977cc581a6e..495ee30af1a173543f23ab4371f75282cd96f342 100644 (file)
@@ -905,9 +905,8 @@ newpeer(
        peer->timereachable = current_time;
        peer->timereceived = current_time;
 
-#ifdef REFCLOCK
        if (ISREFCLOCKADR(&peer->srcadr)) {
-
+#ifdef REFCLOCK
                /*
                 * We let the reference clock support do clock
                 * dependent initialization.  This includes setting
@@ -924,8 +923,14 @@ newpeer(
                        free_peer(peer, 0);
                        return NULL;
                }
+#else /* REFCLOCK */
+               msyslog(LOG_ERR, "refclock %s isn't supported. ntpd was compiled without refclock support.",
+                       stoa(&peer->srcadr));
+               set_peerdstadr(peer, NULL);
+               free_peer(peer, 0);
+               return NULL;
+#endif /* REFCLOCK */
        }
-#endif
 
        /*
         * Put the new peer in the hash tables.