From: Harlan Stenn Date: Sat, 15 Dec 2018 13:25:25 +0000 (+0000) Subject: bug3527 fixes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d7cd8ca96467dda1838e89eb059c5734120bb92;p=thirdparty%2Fntp.git bug3527 fixes bk: 5c1500c5QLnqoQQT-5W9KHQoqOytzw --- diff --git a/ChangeLog b/ChangeLog index 87e695061..514585f03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ --- -* [Bug 3527] fudgeval2 anomaly in mode7 clock info packet - - Found by Gerry Garvey. Can't be fixed without causing serious interop - issues. Left a comment to fix this in protocol version 5. +* [Bug 3527 - Backward Incompatible] mode7 clockinfo fudgeval2 anomaly + packet , reported by GGarvey. + - --enable-bug3527-fix support by HStenn --- (4.2.8p12) 2018/08/14 Released by Harlan Stenn diff --git a/configure.ac b/configure.ac index 1f477c514..c2e5431d1 100644 --- a/configure.ac +++ b/configure.ac @@ -4194,6 +4194,24 @@ case "$ans" in esac +AC_MSG_CHECKING([if we want correct mode7 fudgetime2 behavior]) +AC_ARG_ENABLE( + [bug3527-fix], + [AS_HELP_STRING( + [--enable-bug3527-fix], + [+ provide correct mode7 fudgetime2 behavior] + )], + [ans=$enableval], + [ans=yes] +) +AC_MSG_RESULT([$ans]) +case "$ans" in + no) + AC_DEFINE([DISABLE_BUG3527_FIX], [1], + [use old autokey session key behavior?]) +esac + + AC_MSG_CHECKING([if we should use the IRIG sawtooth filter]) case "$host" in diff --git a/ntpd/ntp_request.c b/ntpd/ntp_request.c index 408a0f51d..53585088a 100644 --- a/ntpd/ntp_request.c +++ b/ntpd/ntp_request.c @@ -2536,12 +2536,15 @@ get_clock_info( DTOLFP(clock_stat.fudgetime2, <mp); HTONL_FP(<mp, &ic->fudgetime2); ic->fudgeval1 = htonl((u_int32)clock_stat.fudgeval1); - /* [Bug3527] ist still there: ic->fudgeval2 is effectively - * host order here, since clockstat.fudgeval2 is already - * in network byte order! Needs fixing the whole chain, - * possibly in NTP protocol v5... + /* [Bug3527] Backward Incompatible: ic->fudgeval2 is + * a string, instantiated via memcpy() so there is no + * endian issue to correct. */ +#ifdef DISABLE_BUG3527_FIX ic->fudgeval2 = htonl(clock_stat.fudgeval2); +#else + ic->fudgeval2 = clock_stat.fudgeval2; +#endif free_varlist(clock_stat.kv_list); diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c index 9c60c30a2..da2bdc86d 100644 --- a/ntpdc/ntpdc_ops.c +++ b/ntpdc/ntpdc_ops.c @@ -2713,12 +2713,17 @@ again: lfptoa(&ts, 6)); (void) fprintf(fp, "stratum: %ld\n", (u_long)ntohl(cl->fudgeval1)); - /* [Bug3527] ist still there: fudgeval2 is effectively - * host order here. Needs fixing the whole chain, - * possibly in NTP protocol v5... + /* [Bug3527] Backward Incompatible: cl->fudgeval2 is + * a string, instantiated via memcpy() so there is no + * endian issue to correct. */ +#ifdef DISABLE_BUG3527_FIX (void) fprintf(fp, "reference ID: %s\n", refid_string(ntohl(cl->fudgeval2), 0)); +#else + (void) fprintf(fp, "reference ID: %s\n", + refid_string(cl->fudgeval2, 0)); +#endif (void) fprintf(fp, "fudge flags: 0x%x\n", cl->flags);