From: Harlan Stenn Date: Sun, 9 Sep 2012 23:05:06 +0000 (-0400) Subject: [Bug 2271] Decode refclock types when built with --disable-all-clocks. X-Git-Tag: NTP_4_2_7P305~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23fc5eb2e1b57af118493236886e413c9d0d0ab5;p=thirdparty%2Fntp.git [Bug 2271] Decode refclock types when built with --disable-all-clocks. bk: 504d20a2NxRHMH4VTdnTO_0TKca3ew --- diff --git a/ChangeLog b/ChangeLog index 3ee2b8af9..a5c216d36 100644 --- 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 * [Bug 2264] Cleanup SEL240X Refclock. * In refclock_wwv.c rename SECOND to WWV_SEC and MINUTE to WWV_MIN. diff --git a/include/ntp_net.h b/include/ntp_net.h index df207eb6c..0577402bf 100644 --- a/include/ntp_net.h +++ b/include/ntp_net.h @@ -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 diff --git a/ntpd/ntp_peer.c b/ntpd/ntp_peer.c index 8bfcd378e..495ee30af 100644 --- a/ntpd/ntp_peer.c +++ b/ntpd/ntp_peer.c @@ -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.