]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Merge shiny.ad.hartbrothers.com:C:/ntp/ntp-stable-1725
authorDave Hart <hart@ntp.org>
Mon, 15 Nov 2010 23:13:44 +0000 (23:13 +0000)
committerDave Hart <hart@ntp.org>
Mon, 15 Nov 2010 23:13:44 +0000 (23:13 +0000)
into  shiny.ad.hartbrothers.com:C:/ntp/ntp-dev-1725

bk: 4ce1bea8io2y4Fc_osjw_R_eYrPq2Q

1  2 
ChangeLog
include/ntp.h
include/ntpd.h
ntpd/ntp_config.c
ntpd/ntp_io.c
ntpd/ntp_peer.c
ntpd/ntp_request.c
ports/winnt/ntpd/ntp_iocompletionport.c
ports/winnt/ntpd/ntservice.c

diff --cc ChangeLog
index 94e380efef13d8a3fb78d1e2333b5b2f707c41e8,fefef43822d2690750e5a26551c7434c7c3211bf..a33c7220bc51e1a4d7d1aae4638490c477079c43
+++ b/ChangeLog
++* [Bug 1725] from 4.2.6p3-RC11: ntpd sends multicast from only one
++  address.
 +* [Bug 1727] ntp-keygen PLEN, ILEN undeclared --without-crypto.
++* from 4.2.6p3-RC11: Remove log_msg() and debug_msg() from sntp in favor
++  of msyslog().
 +(4.2.7p81) 2010/11/14 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1681] from 4.2.6p3-RC10: More sntp logging cleanup.
 +* [Bug 1683] from 4.2.6p3-RC10: Non-localhost on loopback exempted from
 +  nic rules.
 +* [Bug 1719] Cleanup for ntp-keygen and fix -V crash, from Dave Mills.
 +(4.2.7p80) 2010/11/10 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1574] from 4.2.6p3-RC9: sntp doesn't set tv_usec correctly.
 +* [Bug 1681] from 4.2.6p3-RC9: sntp logging cleanup.
 +* [Bug 1683] from 4.2.6p3-RC9: Interface binding does not seem to work
 +  as intended.
 +* [Bug 1708] make check fails with googletest 1.4.0.
 +* [Bug 1709] from 4.2.6p3-RC9: ntpdate ignores replies with equal
 +  receive and transmit timestamps.
 +* [Bug 1715] sntp utilitiesTest.IPv6Address failed.
 +* [Bug 1718] Improve gtest checks in configure.ac.
 +(4.2.7p79) 2010/11/07 Released by Harlan Stenn <stenn@ntp.org>
 +* Correct frequency estimate with no drift file, from David Mills.
 +(4.2.7p78) 2010/11/04 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1697] filegen implementation should be improved.
 +* Refactor calendar functions in terms of new common code.
 +* Documentation updates from Dave Mills.
 +(4.2.7p77) 2010/11/03 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1692] packageinfo.sh needs to be "sourced" using ./ .
 +* [Bug 1695] ntpdate takes longer than necessary.
 +(4.2.7p76) 2010/11/02 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1690] Unit tests fails to build on some systems.
 +* [Bug 1691] Use first NMEA sentence each second.
 +* Put the sntp tests under sntp/ .
 +* ... and only build/run them if we have gtest.
 +* Documentation updates from Dave Mills.
 +(4.2.7p75) 2010/10/30 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +* Include Linus Karlsson's GSoC 2010 testing code.
 +(4.2.7p74) 2010/10/29 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1685] from 4.2.6p3-RC8: NMEA driver mode byte confusion.
 +* from 4.2.6p3-RC8: First cut at using scripts/checkChangeLog.
 +* Documentation updates from Dave Mills.
 +(4.2.7p73) 2010/10/27 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1680] Fix alignment of clock_select() arrays.
 +* refinements to new startup behavior from David Mills.
 +* For the bootstrap script, touch .html files last.
 +* Add 'make check' test case that would have caught [Bug 1678].
 +(4.2.7p72) 2010/10/26 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1679] Fix test for -lsocket.
 +* Clean up missing ;; entries in configure.ac.
 +(4.2.7p71) 2010/10/25 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1676] from 4.2.6p3-RC7: NMEA: $GPGLL did not work after fix
 +  for Bug 1571.
 +* [Bug 1678] "restrict source" treated as "restrict default".
 +* from 4.2.6p3-RC7: Added scripts/checkChangeLog.
 +(4.2.7p70) 2010/10/24 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1571] from 4.2.6p3-RC6: NMEA does not relate data to PPS edge.
 +* [Bug 1572] from 4.2.p63-RC6: NMEA time adjustment for GPZDG buggy.
 +* [Bug 1675] from 4.2.6p3-RC6: Prohibit includefile remote config.
 +* Enable generating ntpd/ntp_keyword.h after keyword-gen.c changes on
 +  Windows as well as POSIX platforms.
 +* Fix from Dave Mills for a rare singularity in clock_combine().
 +(4.2.7p69) 2010/10/23 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1671] Automatic delay calibration is sometimes inaccurate.
 +(4.2.7p68) 2010/10/22 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1669] from 4.2.6p3-RC5: NTP fails to compile on IBM AIX 5.3.
 +* [Bug 1670] Fix peer->bias and broadcastdelay.
 +* Documentation updates from Dave Mills.
 +* Documentation EOL cleanup.
 +(4.2.7p67) 2010/10/21 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1649] from 4.2.6p3-RC5: Require NMEA checksum if $GPRMC or
 +  previously seen.
 +(4.2.7p66) 2010/10/19 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1277] Provide and use O(1) FIFOs, esp. in the config tree code.
 +* Remove unused 'bias' configuration keyword.
 +(4.2.7p65) 2010/10/16 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1584] from 4.2.6p3-RC4: wrong SNMP type for precision,
 +  resolution.
 +* Remove 'calldelay' and 'sign' remnants from parser, ntp_config.c.
 +(4.2.7p64) 2010/10/15 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1584] from 4.2.6p3-RC3: ntpsnmpd OID must be mib-2.197.
 +* [Bug 1659] from 4.2.6p3-RC4: Need CLOCK_TRUETIME not CLOCK_TRUE.
 +* [Bug 1663] ntpdsim should not open net sockets.
 +* [Bug 1665] from 4.2.6p3-RC4: is_anycast() u_int32_t should be u_int32.
 +* from 4.2.6p3: ntpsnmpd, libntpq warning cleanup.
 +* Remove 'calldelay' and 'sign' keywords (Dave Mills).
 +* Documentation updates from Dave Mills.
 +(4.2.7p63) 2010/10/13 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1080] from 4.2.6p3-RC3: ntpd on ipv6 routers very chatty.
 +* Documentation nit cleanup.
 +* Documentation updates from Dave Mills.
 +(4.2.7p62) 2010/10/12 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 750] from 4.2.6p3-RC3: Non-existing device causes coredump with 
 +  RIPE-NCC driver.
 +* [Bug 1567] from 4.2.6p3-RC3: Support Arbiter 1093C Satellite Clock on
 +  Windows.
 +* [Bug 1581] from 4.2.6p3-RC3: printf format string mismatch leftover.
 +* [Bug 1659] from 4.2.6p3-RC3: Support Truetime Satellite Clocks on
 +  Windows. 
 +* [Bug 1660] from 4.2.6p3-RC3: On some systems, test is in /usr/bin, not
 +  /bin. 
 +* [Bug 1661] from 4.2.6p3-RC3: Re-indent refclock_ripencc.c.
 +* Lose peer_count from ntp_peer.c and ntp_proto.c (Dave Mills).
 +* Documentation updates from Dave Mills.
 +(4.2.7p61) 2010/10/06 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation and code cleanup from Dave Mills. No more NTP_MAXASSOC.
 +(4.2.7p60) 2010/10/04 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +(4.2.7p59) 2010/10/02 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +* Variable name cleanup from Dave Mills.
 +* [Bug 1657] darwin needs res_9_init, not res_init.
 +(4.2.7p58) 2010/09/30 Released by Harlan Stenn <stenn@ntp.org>
 +* Clock select bugfix from Dave Mills.
 +* [Bug 1554] peer may stay selected as system peer after becoming
 +  unreachable.
 +* [Bug 1644] from 4.2.6p3-RC3: cvo.sh should use lsb_release to identify
 +  linux distros.
 +* [Bug 1646] ntpd crashes with relative path to logfile.
 +(4.2.7p57) 2010/09/27 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +(4.2.7p56) 2010/09/25 Released by Harlan Stenn <stenn@ntp.org>
 +* Clock combining algorithm improvements from Dave Mills.
 +* Documentation updates from Dave Mills.
 +* [Bug 1642] ntpdsim can't find simulate block in config file.
 +* [Bug 1643] from 4.2.6p3-RC3: Range-check the decoding of the RIPE-NCC
 +  status codes.
 +(4.2.7p55) 2010/09/22 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +* [Bug 1636] from 4.2.6p3-RC2: segfault after denied remote config.
 +(4.2.7p54) 2010/09/21 Released by Harlan Stenn <stenn@ntp.org>
 +* More Initial convergence improvements from Dave Mills.
 +* Documentation updates from Dave Mills.
 +* [Bug 1635] from 4.2.6p3-RC2: "filegen ... enable" is not default.
 +(4.2.7p53) 2010/09/20 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +* More Initial convergence improvements from Dave Mills.
 +(4.2.7p52) 2010/09/19 Released by Harlan Stenn <stenn@ntp.org>
 +* Initial convergence improvements from Dave Mills.
 +(4.2.7p51) 2010/09/18 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1344] from 4.2.6p3-RC1: ntpd on Windows exits without logging
 +  cause.
 +* [Bug 1629] 4.2.7p50 configure.ac changes invalidate config.cache.
 +* [Bug 1630] 4.2.7p50 cannot bootstrap on Autoconf 2.61.
 +(4.2.7p50) 2010/09/16 Released by Harlan Stenn <stenn@ntp.org>
 +* Cleanup NTP_LIB_M.
 +* [Bug 1628] Clean up -lxnet/-lsocket usage for (open)solaris.
 +(4.2.7p49) 2010/09/13 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +(4.2.7p48) 2010/09/12 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +(4.2.7p47) 2010/09/11 Released by Harlan Stenn <stenn@ntp.org>
 +* Documentation updates from Dave Mills.
 +* [Bug 1588] finish configure --disable-autokey implementation.
 +* [Bug 1616] refclock_acts.c: if (pp->leap == 2) is always false.
 +* [Bug 1620] [Backward Incompatible] "discard minimum" value should be in
 +  seconds, not log2 seconds.
 +(4.2.7p46) 2010/09/10 Released by Harlan Stenn <stenn@ntp.org>
 +* Use AC_SEARCH_LIBS instead of AC_CHECK_LIB for NTP_LIB_M.
 +(4.2.7p45) 2010/09/05 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1578] Consistently use -lm when needed.
 +(4.2.7p44) 2010/08/27 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1573] from 4.2.6p3-beta1: Miscalculation of offset in sntp.
 +(4.2.7p43) 2010/08/26 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1602] Refactor some of the sntp/ directory to facililtate testing.
 +(4.2.7p42) 2010/08/18 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1593] ntpd abort in free() with logconfig syntax error.
 +* [Bug 1595] from 4.2.6p3-beta1: empty last line in key file causes
 +  duplicate key to be added
 +* [Bug 1597] from 4.2.6p3-beta1: packet processing ignores RATE KoD packets,
 +  Because of a bug in string comparison.
 +(4.2.7p41) 2010/07/28 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1581] from 4.2.6p3-beta1: ntp_intres.c size_t printf format
 +  string mismatch.
 +* [Bug 1586] ntpd 4.2.7p40 doesn't write to syslog after fork on QNX.
 +* Avoid race with parallel builds using same source directory in
 +  scripts/genver by using build directory for temporary files.
 +* orphanwait documentation updates.
 +(4.2.7p40) 2010/07/12 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1395] ease ntpdate elimination with ntpd -w/--wait-sync
 +* [Bug 1396] allow servers on ntpd command line like ntpdate
 +(4.2.7p39) 2010/07/09 Released by Harlan Stenn <stenn@ntp.org>
 +* Fix typo in driver28.html.
 +* [Bug 1581] from 4.2.6p2: size_t printf format string mismatches, IRIG
 +  string buffers undersized.  Mostly backported from earlier ntp-dev
 +  fixes by Juergen Perlinger.
 +(4.2.7p38) 2010/06/20 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1570] backported to 4.2.6p2-RC7.
 +* [Bug 1575] from 4.2.6p2-RC7: use 'snprintf' with LIB_BUFLENGTH in
 +  inttoa.c, tvtoa.c and utvtoa.c
 +* [Bug 1576] backported to 4.2.6p2-RC7.
 +* Typo fix in a comment in ntp_proto.c.
 +(4.2.7p37) 2010/06/19 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1576] sys/sysctl.h depends on sys/param.h on OpenBSD.
 +(4.2.7p36) 2010/06/15 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1560] Initial support for orphanwait, from Dave Mills.
 +* clock_filter()/reachability fixes from Dave Mills.
 +(4.2.7p35) 2010/06/12 Released by Harlan Stenn <stenn@ntp.org>
 +* Rewrite of multiprecision macros in 'ntp_fp.h' from J. Perlinger
 +  <perlinger@ntp.org>
 +* [Bug 715] from 4.2.6p2-RC6: libisc Linux IPv6 interface iteration
 +  drops multicast flags.
 +(4.2.7p34) 2010/06/05 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1570] serial clock drivers get outdated input from kernel tty
 +  line buffer after startup
 +(4.2.7p33) 2010/06/04 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1561] from 4.2.6p2-RC5: ntpq, ntpdc "passwd" prompts for MD5
 +  password w/SHA1.
 +* [Bug 1565] from 4.2.6p2-RC5: sntp/crypto.c compile fails on MacOS over
 +  vsnprintf().
 +* from 4.2.6p2-RC5: Windows port: do not exit in
 +  ntp_timestamp_from_counter() without first logging the reason.
 +(4.2.7p32) 2010/05/19 Released by Harlan Stenn <stenn@ntp.org>
 +* Copyright file cleanup from Dave Mills.
 +* [Bug 1555] from 4.2.6p2-RC4: sntp illegal C (mixed code and
 +  declarations).
 +* [Bug 1558] pool prototype associations have 0.0.0.0 for remote addr.
 +* configure.ac: add --disable-autokey, #define AUTOKEY to enable future
 +  support for building without Autokey, but with OpenSSL for its digest
 +  algorithms (hash functions).  Code must be modified to use #ifdef
 +  AUTOKEY instead of #ifdef OPENSSL where appropriate to complete this.
 +* include/ntp_crypto.h: make assumption AUTOKEY implies OPENSSL explicit.
 +(4.2.7p31) 2010/05/11 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1325] from 4.2.6p2-RC3: unreachable code sntp recv_bcst_data().
 +* [Bug 1459] from 4.2.6p2-RC3: sntp MD5 authentication does not work
 +  with ntpd.
 +* [Bug 1552] from 4.2.6p2-RC3: update and complete broadcast and crypto
 +  features in sntp.
 +* [Bug 1553] from 4.2.6p2-RC3: sntp/configure.ac OpenSSL support.
 +* from 4.2.6p2-RC3: Escape unprintable characters in a refid in ntpq -p
 +  billboard.
 +* from 4.2.6p2-RC3: Simplify hash client code by providing OpenSSL
 +  EVP_*() API when built without OpenSSL.  (already in 4.2.7)
 +* from 4.2.6p2-RC3: Do not depend on ASCII in sntp.
 +(4.2.7p30) 2010/05/06 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1526] ntpd DNS pipe read EINTR with no network at startup.
 +* Update the ChangeLog entries when merging items from -stable.
 +(4.2.7p29) 2010/05/04 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1542] ntpd mrulist response may have incorrect last.older.
 +* [Bug 1543] ntpq mrulist must refresh nonce when retrying.
 +* [Bug 1544] ntpq mrulist sscanf timestamp format mismatch on 64-bit.
 +* Windows compiling hints/winnt.html update from G. Sunil Tej.
 +(4.2.7p28) 2010/05/03 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1512] from 4.2.6p2-RC3: ntpsnmpd should connect to net-snmpd
 +  via a unix-domain socket by default.
 +  Provide a command-line 'socket name' option.
 +* [Bug 1538] from 4.2.6p2-RC3: update refclock_nmea.c's call to
 +  getprotobyname().
 +* [Bug 1541] from 4.2.6p2-RC3: Fix wrong keyword for "maxclock".
 +(4.2.7p27) 2010/04/27 Released by Harlan Stenn <stenn@ntp.org>
 +(4.2.7p26) 2010/04/24 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1465] from 4.2.6p2-RC2: Make sure time from TS2100 is not
 +  invalid (backport from -dev).
 +* [Bug 1528] from 4.2.6p2-RC2: Fix EDITLINE_LIBS link order for ntpq
 +  and ntpdc.
 +* [Bug 1531] Require nonce with mrulist requests.
 +* [Bug 1532] Remove ntpd support for ntpdc's monlist in favor of ntpq's
 +  mrulist.
 +* [Bug 1534] from 4.2.6p2-RC2: conflicts with VC++ 2010 errno.h.
 +* [Bug 1535] from 4.2.6p2-RC2: "restrict -4 default" and "restrict
 +  -6 default" ignored.
 +(4.2.7p25) 2010/04/20 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1528] from 4.2.6p2-RC2: Remove --with-arlib from br-flock.
 +* [Bug 1503] [Bug 1504] [Bug 1518] [Bug 1522] from 4.2.6p2-RC2:
 +  all of which were fixed in 4.2.7 previously. 
 +(4.2.7p24) 2010/04/13 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1390] Control PPS on the Oncore M12.
 +* [Bug 1518] Windows ntpd should lock to one processor more
 +  conservatively.
 +* [Bug 1520] '%u' formats for size_t gives warnings with 64-bit builds.
 +* [Bug 1522] Enable range syntax "trustedkey (301 ... 399)".
 +* Documentation updates for 4.2.7p22 changes and additions, updating
 +  ntpdc.html, ntpq.html, accopt.html, confopt.html, manyopt.html,
 +  miscopt.html, and miscopt.txt.
 +* accopt.html: non-ntpport doc changes from Dave Mills.
 +* Modify full MRU list preemption when full to match "discard monitor"
 +  documentation, by removing exception for count == 1.
 +(4.2.7p23) 2010/04/04 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1516] unpeer by IP address fails, DNS name works.
 +* [Bug 1517] ntpq and ntpdc should verify reverse DNS before use.
 +  ntpq and ntpdc now use the following format for showing purported
 +  DNS names from IP address "reverse" DNS lookups when the DNS name
 +  does not exist or does not include the original IP address among
 +  the results: "192.168.1.2 (fake.dns.local)".
 +(4.2.7p22) 2010/04/02 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1432] Don't set inheritable flag for linux capabilities.
 +* [Bug 1465] Make sure time from TS2100 is not invalid.
 +* [Bug 1483] AI_NUMERICSERV undefined in 4.2.7p20.
 +* [Bug 1497] fudge is broken by getnetnum() change.
 +* [Bug 1503] Auto-enabling of monitor for "restrict ... limited" wrong.
 +* [Bug 1504] ntpdate tickles ntpd "discard minimum 1" rate limit if
 +  "restrict ... limited" is used.
 +* ntpdate: stop querying source after KoD packet response, log it.
 +* ntpdate: rate limit each server to 2s between packets.
 +* From J. N. Perlinger: avoid pointer wraparound warnings in dolfptoa(),
 +  printf format mismatches with 64-bit size_t.
 +* Broadcast client (ephemeral) associations should be demobilized only
 +  if they are not heard from for 10 consecutive polls, regardless of
 +  surviving the clock selection.  Fix from David Mills.
 +* Add "ntpq -c ifstats" similar to "ntpdc -c ifstats".
 +* Add "ntpq -c sysstats" similar to "ntpdc -c sysstats".
 +* Add "ntpq -c monstats" to show monlist knobs and stats.
 +* Add "ntpq -c mrulist" similar to "ntpdc -c monlist" but not
 +  limited to 600 rows, and with filtering and sorting options:
 +  ntpq -c "mrulist mincount=2 laddr=192.168.1.2 sort=-avgint"
 +  ntpq -c "mrulist sort=addr"
 +  ntpq -c "mrulist mincount=2 sort=count"
 +  ntpq -c "mrulist sort=-lstint"
 +* Modify internal representation of MRU list to use l_fp fixed-point
 +  NTP timestamps instead of seconds since startup.  This increases the
 +  resolution and substantially improves accuracy of sorts involving
 +  timestamps, at the cost of flushing all MRU entries when the clock is
 +  stepped, to ensure the timestamps can be compared with the current
 +  get_systime() results.
 +* Add ntp.conf "mru" directive to configure MRU parameters, such as
 +  "mru mindepth 600 maxage 64 maxdepth 5000 maxmem 1024" or
 +  "mru initalloc 0 initmem 16 incalloc 99 incmem 4".  Several pairs are
 +  equivalent with one in units of MRU entries and its twin in units of
 +  kilobytes of memory, so the last one used in ntp.conf controls:
 +  maxdepth/maxmem, initalloc/initmem, incalloc/incmem.  With the above
 +  values, ntpd will preallocate 16kB worth of MRU entries, allocating
 +  4kB worth each time more are needed, with a hard limit of 1MB of MRU
 +  entries.  Until there are more than 600 entries none would be reused.
 +  Then only entries for addresses last seen 64 seconds or longer ago are
 +  reused.
 +* Limit "ntpdc -c monlist" response in ntpd to 600 entries, the previous
 +  overall limit on the MRU list depth which was driven by the monlist
 +  implementation limit of one request with a single multipacket
 +  response.
 +* New "pool" directive implementation modeled on manycastclient.
 +* Do not abort on non-ASCII characters in ntp.conf, ignore them.
 +* ntpq: increase response reassembly limit from 24 to 32 packets, add
 +  discussion in comment regarding results with even larger MAXFRAGS.
 +* ntpq: handle "passwd MYPASSWORD" (without prompting) as with ntpdc.
 +* ntpdc: do not examine argument to "passwd" if not supplied.
 +* configure: remove check for pointer type used with qsort(), we
 +  require ANSI C which mandates void *.
 +* Reset sys_kodsent to 0 in proto_clr_stats().
 +* Add sptoa()/sockporttoa() similar to stoa()/socktoa() adding :port.
 +* Use memcpy() instead of memmove() when buffers can not overlap.
 +* Remove sockaddr_storage from our sockaddr_u union of sockaddr,
 +  sockaddr_in, and sockaddr_in6, shaving about 100 bytes from its size
 +  and substantially decreasing MRU entry memory consumption.
 +* Extend ntpq readvar (alias rv) to allow fetching up to three named
 +  variables in one operation:  ntpq -c "rv 0 version offset frequency".
 +* ntpq: use srchost variable to show .POOL. prototype associations'
 +  hostname instead of address 0.0.0.0.
 +* "restrict source ..." configures override restrictions for time
 +  sources, allows tight default restrictions to be used with the pool
 +  directive (where server addresses are not known in advance).
 +* Ignore "preempt" modifier on manycastclient and pool prototype
 +  associations.  The resulting associations are preemptible, but the
 +  prototype must not be.
 +* Maintain and use linked list of associations (struct peer) in ntpd,
 +  avoiding walking 128 hash table entries to iterate over peers.
 +* Remove more workarounds unneeded since we require ISO C90 AKA ANSI C:
 +  - remove fallback implementations for memmove(), memset, strstr().
 +  - do not test for atexit() or memcpy().
 +* Collapse a bunch of code duplication in ntpd/ntp_restrict.c added with
 +  support for IPv6.
 +* Correct some corner case failures in automatically enabling the MRU
 +  list if any "restrict ... limited" is in effect, and in disabling MRU
 +  maintenance. (ntp_monitor.c, ntp_restrict.c)
 +* Reverse the internal sort order of the address restriction lists, but
 +  preserve the same behavior.  This allows removal of special-case code
 +  related to the default restrictions and more straightforward lookups
 +  of restrictions for a given address (now, stop on first match).
 +* Move ntp_restrict.c MRU doubly-linked list maintenance code into
 +  ntp_lists.h macros, allowing more duplicated source excision.
 +* Repair ntpdate.c to no longer test HAVE_TIMER_SETTIME.
 +* Do not reference peer_node/unpeer_node after freeing when built with
 +  --disable-saveconfig and using DNS.
 +(4.2.7p21) 2010/03/31 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1514] from 4.2.6p1-RC6: Typo in ntp_proto.c: fabs(foo < .4)
 +  should be fabs(foo) < .4.
 +* [Bug 1464] from 4.2.6p1-RC6: synchronization source wrong for
 +  refclocks ARCRON_MSF (27) and SHM (28).
 +* From 4.2.6p1-RC6: Correct Windows port's refclock_open() to
 +  return 0 on failure not -1.
 +* From 4.2.6p1-RC6: Correct CHU, dumbclock, and WWVB drivers to
 +  check for 0 returned from refclock_open() on failure.
 +* From 4.2.6p1-RC6: Correct "SIMUL=4 ./flock-build -1" to
 +  prioritize -1/--one.
 +* [Bug 1306] constant conditionals in audio_gain().
 +(4.2.7p20) 2010/02/13 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1483] hostname in ntp.conf "restrict" parameter rejected.
 +* Use all addresses for each restrict by hostname.
 +* Use async DNS to resolve trap directive hostnames.
 +(4.2.7p19) 2010/02/09 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1338] Update the association type codes in ntpq.html.
 +* [Bug 1478] from 4.2.6p1-RC5: linking fails: EVP_MD_pkey_type.
 +* [Bug 1479] from 4.2.6p1-RC5: not finding readline headers.
 +* [Bug 1484] from 4.2.6p1-RC5: ushort is not defined in QNX6.
 +(4.2.7p18) 2010/02/07 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1480] from 4.2.6p1-RC5: snprintf() cleanup caused 
 +  unterminated refclock IDs.
 +* Stop using getaddrinfo() to convert numeric address strings to on-wire
 +  addresses in favor of is_ip_address() alone.
 +(4.2.7p17) 2010/02/05 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1477] from 4.2.6p1-RC5: First non-gmake make in clone
 +  w/VPATH can't make COPYRIGHT.
 +* Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings.
 +* Broaden ylwrap workaround VPATH_HACK to all non-GNU make.
 +(4.2.7p16) 2010/02/04 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1474] from 4.2.6p1-RC4: ntp_keygen LCRYPTO after libntp.a.
 +* Include 4.2.6p1-RC4: Remove arlib.
 +(4.2.7p15) 2010/02/03 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1455] from 4.2.6p1: ntpd does not try /etc/ntp.audio.
 +* Include 4.2.6p1: Convert many sprintf() calls to snprintf(), also
 +  strcpy(), strcat().
 +* Include 4.2.6p1: Fix widely cut-n-pasted bug in refclock shutdown
 +  after failed start.
 +* Include 4.2.6p1: Remove some dead code checking for emalloc()
 +  returning NULL.
 +(4.2.7p14) 2010/02/02 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1338] ntpq displays incorrect association type codes.
 +* [Bug 1469] u_int32, int32 changes broke HP-UX 10.20 build.
 +* [Bug 1470] from 4.2.6p1: "make distdir" compiles keyword-gen.
 +* [Bug 1471] CID 120 CID 121 CID 122 is_ip_address() uninit family.
 +* [Bug 1472] CID 116 CID 117 minor warnings in new DNS code.
 +* [Bug 1473] from 4.2.6p1: "make distcheck" version.m4 error.
 +(4.2.7p13) 2010/01/31 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1467] from 4.2.6p1: Fix bogus rebuild of sntp/sntp.html.
 +(4.2.7p12) 2010/01/30 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1468] 'make install' broken for root on default NFS mount.
 +(4.2.7p11) 2010/01/28 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 47] Debugging and logging do not work after a fork.
 +* [Bug 1010] getaddrinfo() could block and thus should not be called by
 +  the main thread/process.
 +* New async DNS resolver in ntpd allows nonblocking queries anytime,
 +  instead of only once at startup.
 +(4.2.7p10) 2010/01/24 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1140] from 4.2.6p1-RC5: Clean up debug.html, decode.html,
 +  and ntpq.html.
 +* Include 4.2.6p1-RC3: Use TZ=UTC instead of TZ= when calling date in
 +  scripts/mkver.in .
 +* [Bug 1448] from 4.2.6p1-RC3: Some macros not correctly conditionally
 +  or absolutely defined on Windows.
 +* [Bug 1449] from 4.2.6p1-RC3: ntpsim.h in ntp_config.c should be used
 +  conditionally.
 +* [Bug 1450] from 4.2.6p1-RC3: Option to exclude warnings not
 +  unconditionally defined on Windows.
 +(4.2.7p9) 2010/01/13 Released by Harlan Stenn <stenn@ntp.org>
 +(4.2.7p8) 2010/01/12 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 702] ntpd service logic should use libopts to examine cmdline.
 +* [Bug 1451] from 4.2.6p1-RC3: sntp leaks KoD entry updating.
 +* [Bug 1453] from 4.2.6p1-RC3: Use $CC in config.cache filename.
 +(4.2.7p7) 2009/12/30 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 620] ntpdc getresponse() esize != *rsize s/b size != *rsize.
 +* [Bug 1446] 4.2.7p6 requires autogen, missing ntpd.1, *.texi, *.menu.
 +(4.2.7p6) 2009/12/28 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1443] Remove unnecessary dependencies on ntp_io.h
 +* [Bug 1442] Move Windows functions into libntp files
 +* [Bug 1127] from 4.2.6p1-RC3: Check the return of X590_verify().
 +* [Bug 1439] from 4.2.6p1-RC3: .texi gen after binary is linked.
 +* [Bug 1440] from 4.2.6p1-RC3: Update configure.ac to support kfreebsd.
 +* [Bug 1445] from 4.2.6p1-RC3: IRIX does not have -lcap or support
 +  linux capabilities.
 +(4.2.7p5) 2009/12/25 Released by Harlan Stenn <stenn@ntp.org>
 +* Include 4.2.6p1-RC2
 +(4.2.7p4) 2009/12/24 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1429] ntpd -4 option does not reliably force IPv4 resolution.
 +* [Bug 1431] System headers must come before ntp headers in ntp_intres.c .
 +(4.2.7p3) 2009/12/22 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1426] scripts/VersionName needs . on the search path.
 +* [Bug 1427] quote missing in ./build - shows up on NetBSD.
 +* [Bug 1428] Use AC_HEADER_RESOLV to fix breaks from resolv.h
 +(4.2.7p2) 2009/12/20 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1419] ntpdate, ntpdc, sntp, ntpd ignore configure --bindir.
 +* [Bug 1421] add util/tg2, a clone of tg that works on Linux, NetBSD, and
 +  FreeBSD
 +(4.2.7p1) 2009/12/15 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1348] ntpd Windows port should wait for sendto() completion.
 +* [Bug 1413] test OpenSSL headers regarding -Wno-strict-prototypes.
 +* [Bug 1418] building ntpd/ntpdc/ntpq statically with ssl fails.
 +(4.2.7p0) 2009/12/13 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1412] m4/os_cflags.m4 caches results that depend on $CC.
 +* [Bug 1414] Enable "make distcheck" success with BSD make.
 +(4.2.7) 2009/12/09 Released by Harlan Stenn <stenn@ntp.org>
 +* [Bug 1407] configure.ac: recent GNU Make -v does not include "version".
+ ---
+ * [Bug 1725] ntpd sends multicast from only one address.
+ * Remove log_msg() and debug_msg() from sntp in favor of msyslog().
  ---
  (4.2.6p3-RC10) 2010/11/14 Released by Harlan Stenn <stenn@ntp.org>
  
diff --cc include/ntp.h
Simple merge
diff --cc include/ntpd.h
index a33b3e69dadfbcfd290ef309b779c366c919ced4,7342889992a36912021a775f1866e426f86c8bb7..f2ddbc68d545c3f4c689a514f0d7134d500c6a54
@@@ -118,12 -74,13 +118,12 @@@ typedef struct interface_info 
  
  typedef void  (*interface_receiver_t) (void *, interface_info_t *);
  
 -extern  int   disable_dynamic_updates;
 -
  extern        void    interface_enumerate     (interface_receiver_t, void *);
- extern struct interface *getinterface (sockaddr_u *, int);
- extern struct interface *findinterface        (sockaddr_u *);
- extern struct interface *findbcastinter       (sockaddr_u *);
- extern        void    enable_broadcast        (struct interface *, sockaddr_u *);
- extern        void    enable_multicast_if     (struct interface *, sockaddr_u *);
++extern        endpt * getinterface            (sockaddr_u *, u_int32);
+ extern        endpt * findinterface           (sockaddr_u *);
+ extern        endpt * findbcastinter          (sockaddr_u *);
+ extern        void    enable_broadcast        (endpt *, sockaddr_u *);
+ extern        void    enable_multicast_if     (endpt *, sockaddr_u *);
  extern        void    interface_update        (interface_receiver_t, void *);
  
  extern        void    init_io         (void);
@@@ -382,15 -324,18 +382,15 @@@ extern volatile u_long handler_calls;   /
  extern volatile u_long handler_pkts;  /* number of pkts received by handler */
  extern u_long io_timereset;           /* time counters were reset */
  
 -/*
 - * Interface stuff
 - */
 +/* ntp_io.c */
 +extern  int   disable_dynamic_updates;
 +extern fd_set activefds;
 +extern int    maxactivefd;
 +extern u_int  sys_ifnum;              /* next .ifnum to assign */
- extern struct interface *any_interface;       /* default ipv4 interface */
- extern struct interface *any6_interface;/* default ipv6 interface */
- extern struct interface *loopback_interface; /* loopback interface */
+ extern endpt *        any_interface;          /* IPv4 wildcard */
+ extern endpt *        any6_interface;         /* IPv6 wildcard */
+ extern endpt *        loopback_interface;     /* IPv4 loopback for refclocks */
 -
 -/*
 - * File descriptor masks etc. for call to select
 - */
 -extern fd_set activefds;
 -extern int    maxactivefd;
 +extern struct interface *inter_list;  /* linked list */
  
  /* ntp_loopfilter.c */
  extern double drift_comp;             /* clock frequency (s/s) */
index 1551fe876988e48d2d238028f2b4a9df58784ce6,613578faf1441a533145d9139dbb1a08b2ef37cc..e4a285eccd84f31197954d0b2a0355df1ac58b45
@@@ -1699,44 -1666,43 +1699,44 @@@ create_sim_node
   * ------------------------------------------
   */
  
 +#ifndef SIM
  static void
  config_other_modes(
 -      struct config_tree *ptree
 +      config_tree *   ptree
        )
  {
 -      sockaddr_u addr_sock;
 -      struct address_node *addr_node;
 +      sockaddr_u      addr_sock;
 +      address_node *  addr_node;
  
        if (ptree->broadcastclient)
 -              proto_config(PROTO_BROADCLIENT, ptree->broadcastclient, 0., NULL);
 -
 -      /* Configure the many-cast servers */
 -      addr_node = queue_head(ptree->manycastserver);
 -      if (addr_node != NULL) {
 -              do {
 -                      ZERO_SOCK(&addr_sock);
 -                      AF(&addr_sock) = (u_short)addr_node->type;
 -
 -                      if (getnetnum(addr_node->address, &addr_sock, 1, t_UNK)  == 1)
 -                              proto_config(PROTO_MULTICAST_ADD, 0, 0., &addr_sock);
 +              proto_config(PROTO_BROADCLIENT, ptree->broadcastclient,
 +                           0., NULL);
  
 -                      addr_node = next_node(addr_node);
 -              } while (addr_node != NULL);
 -              sys_manycastserver = 1;
 +      addr_node = HEAD_PFIFO(ptree->manycastserver);
 +      while (addr_node != NULL) {
-               memset(&addr_sock, 0, sizeof(addr_sock));
++              ZERO_SOCK(&addr_sock);
 +              AF(&addr_sock) = addr_node->type;
 +              if (1 == getnetnum(addr_node->address, &addr_sock, 1,
 +                                 t_UNK)) {
 +                      proto_config(PROTO_MULTICAST_ADD,
 +                                   0, 0., &addr_sock);
 +                      sys_manycastserver = 1;
 +              }
 +              addr_node = addr_node->link;
        }
  
        /* Configure the multicast clients */
 -      addr_node = queue_head(ptree->multicastclient);
 +      addr_node = HEAD_PFIFO(ptree->multicastclient);
        if (addr_node != NULL) {
                do {
-                       memset(&addr_sock, 0, sizeof(addr_sock));
+                       ZERO_SOCK(&addr_sock);
 -                      AF(&addr_sock) = (u_short)addr_node->type;
 -
 -                      if (getnetnum(addr_node->address, &addr_sock, 1, t_UNK)  == 1)
 -                              proto_config(PROTO_MULTICAST_ADD, 0, 0., &addr_sock);
 -
 -                      addr_node = next_node(addr_node);
 +                      AF(&addr_sock) = addr_node->type;
 +                      if (1 == getnetnum(addr_node->address,
 +                                         &addr_sock, 1, t_UNK)) {
 +                              proto_config(PROTO_MULTICAST_ADD, 0, 0.,
 +                                           &addr_sock);
 +                      }
 +                      addr_node = addr_node->link;
                } while (addr_node != NULL);
                proto_config(PROTO_MULTICAST_ADD, 1, 0., NULL);
        }
diff --cc ntpd/ntp_io.c
index 7a0e402dda5efbe2aff58defbc5a2de10fd780ab,b8c153fa7011f8fd52e2b45c84eb1a51be8a3645..0a07bf9f257435bb1dc4db0ff53c9628078d41a9
@@@ -142,12 -142,11 +142,12 @@@ u_long io_timereset;            /* time counters 
  /*
   * Interface stuff
   */
struct interface *any_interface;      /* default ipv4 interface */
struct interface *any6_interface;     /* default ipv6 interface */
struct interface *loopback_interface; /* loopback ipv4 interface */
endpt *       any_interface;          /* wildcard ipv4 interface */
endpt *       any6_interface;         /* wildcard ipv6 interface */
endpt *       loopback_interface;     /* loopback ipv4 interface */
  
  isc_boolean_t broadcast_client_enabled;       /* is broadcast client enabled */
 +u_int sys_ifnum;                      /* next .ifnum to assign */
  int ninterfaces;                      /* Total number of interfaces */
  
  int disable_dynamic_updates;          /* scan interfaces once only */
@@@ -187,12 -179,14 +187,13 @@@ static void     maintain_activefds(int fd, 
   */
  static  u_short               sys_interphase = 0;
  
- static struct interface *new_interface        (struct interface *);
- static void           add_interface   (struct interface *);
- static int            update_interfaces(u_short, interface_receiver_t, void *);
- static void           remove_interface(struct interface *);
- static struct interface *create_interface(u_short, struct interface *);
+ static endpt *        new_interface(endpt *);
+ static void   add_interface(endpt *);
+ static int    update_interfaces(u_short, interface_receiver_t,
+                                 void *);
+ static void   remove_interface(endpt *);
+ static endpt *        create_interface(u_short, endpt *);
  
 -static int    move_fd                 (SOCKET);
  static int    is_wildcard_addr        (const sockaddr_u *);
  
  /*
@@@ -951,14 -875,94 +952,92 @@@ delete_interface
   */
  static void
  add_interface(
-       struct interface *iface
+       endpt * ep
        )
  {
 -      /*
 -       * Calculate the address hash
 -       */
+       endpt **        pmclisthead;
+       endpt *         scan;
+       endpt *         scan_next;
+       endpt *         unlinked;
+       sockaddr_u *    addr;
+       int             ep_linklocal;
+       int             scan_linklocal;
-       iface->addr_refid = addr2refid(&iface->sin);
 +      /* Calculate the refid */
 -
 -      LINK_SLIST(ep_list, ep, elink);
+       ep->addr_refid = addr2refid(&ep->sin);
-       LINK_TAIL_SLIST(inter_list, iface, link, struct interface);
 +      /* link at tail so ntpdc -c ifstats index increases each row */
++      LINK_TAIL_SLIST(ep_list, ep, elink, endpt);
        ninterfaces++;
+       /* the rest is for enabled multicast-capable addresses only */
+       if (ep->ignore_packets || !(INT_MULTICAST & ep->flags))
+               return;
+       pmclisthead = (AF_INET == ep->family)
+                        ? &mc4_list
+                        : &mc6_list;
+ #ifdef INCLUDE_IPV6_MULTICAST_SUPPORT
+       addr = &ep->sin;
+       ep_linklocal = (AF_INET6 == ep->family &&
+               IN6_IS_ADDR_MC_LINKLOCAL(PSOCK_ADDR6(addr)));
+ #else
+       ep_linklocal = FALSE;
+ #endif
+       /*
+        * If we have multiple local addresses on the same
+        * network interface, and some are link-local, do not
+        * multicast out from the link-local addresses by
+        * default, to avoid duplicate manycastclient
+        * associations between v6 peers using link-local and
+        * global addresses.  link-local can still be forced
+        * using "nic ignore myv6globalprefix::/64".
+        */
+       for (scan = *pmclisthead;
+            scan != NULL && (AF_INET6 == ep->family);
+            scan = scan_next) {
+               scan_next = scan->mclink;
+               if (strcmp(ep->name, scan->name))
+                       continue;
+               addr = &scan->sin;
+               scan_linklocal =
+                       IN6_IS_ADDR_MC_LINKLOCAL(PSOCK_ADDR6(addr));
+               if (ep_linklocal && !scan_linklocal) {
+                       DPRINTF(4, ("did not add %s to %s of IPv6 multicast-capable list which already has %s\n",
+                               stoa(&ep->sin),
+                               (ep_linklocal)
+                                   ? "tail"
+                                   : "head",
+                               stoa(&scan->sin)));
+                       return;
+               }
+               if (scan_linklocal && !ep_linklocal) {
+                       UNLINK_SLIST(unlinked, *pmclisthead,
+                                    scan, mclink, endpt);
+                       DPRINTF(4, ("%s %s from IPv6 multicast-capable list to add %s\n",
+                               (unlinked != scan)
+                                   ? "Failed to remove"
+                                   : "removed",
+                               stoa(&scan->sin), stoa(&ep->sin)));
+               }
+       }
+       /*
+        * Add link/site local at the tail of the multicast-
+        * capable unicast interfaces list, so that ntpd will
+        * send from global addresses before link-/site-local
+        * ones.
+        */
+       if (ep_linklocal)
+               LINK_TAIL_SLIST(*pmclisthead, ep, mclink, endpt);
+       else
+               LINK_SLIST(*pmclisthead, ep, mclink);
+       DPRINTF(4, ("added %s to %s of IPv%s multicast-capable unicast local address list\n",
+               stoa(&ep->sin),
+               (ep_linklocal)
+                   ? "tail"
+                   : "head",
+               (AF_INET == ep->family)
+                   ? "4"
+                   : "6"));
  }
  
  
@@@ -1006,12 -1019,12 +1094,12 @@@ remove_interface
        }
  
        ninterfaces--;
-       mon_clearinterface(iface);
+       ntp_monclearinterface(ep);
  
        /* remove restrict interface entry */
-       SET_HOSTMASK(&resmask, AF(&iface->sin));
-       hack_restrict(RESTRICT_REMOVEIF, &iface->sin, &resmask,
+       SET_HOSTMASK(&resmask, AF(&ep->sin));
+       hack_restrict(RESTRICT_REMOVEIF, &ep->sin, &resmask,
 -                    RESM_NTPONLY | RESM_INTERFACE, RES_IGNORE);
 +                    RESM_NTPONLY | RESM_INTERFACE, RES_IGNORE, 0);
  }
  
  
@@@ -3659,7 -3671,7 +3743,7 @@@ findlocalinterface
   * multiple feasible local addresses, regardless of the order ntpd
   * enumerated them.
   */
- struct interface *
 -static endpt *
++endpt *
  findclosestinterface(
        sockaddr_u *    addr,
        int             flags
@@@ -3793,13 -3805,13 +3877,13 @@@ cmp_addr_distance
   * fetch an interface structure the matches the
   * address and has the given flags NOT set
   */
- struct interface *
 -static endpt *
++endpt *
  getinterface(
        sockaddr_u *    addr, 
-       int             flags
+       u_int32         flags
        )
  {
-       struct interface *iface;
+       endpt *iface;
        
        iface = find_addr_in_list(addr);
  
diff --cc ntpd/ntp_peer.c
index a95c2326c3fd49492649e8200076d200e871efb1,0e8f97d17d19a5ebe60ebb5a4bd548ef45636f2a..66ab0cf7b85da10c34da40917a24a5a294f981ce
  #include "ntp_stdlib.h"
  #include "ntp_control.h"
  #include <ntp_random.h>
 -#ifdef OPENSSL
 -#include "openssl/rand.h"
 -#endif /* OPENSSL */
  
+ #ifdef SYS_WINNT
+ int accept_wildcard_if_for_winnt;
+ #else
+ const int accept_wildcard_if_for_winnt = FALSE;
+ #endif
  /*
   *                  Table of valid association combinations
   *                  ---------------------------------------
@@@ -610,12 -550,14 +616,14 @@@ set_peerdstadr
   */
  static void
  peer_refresh_interface(
 -      struct peer *peer
 +      struct peer *p
        )
  {
-       struct interface *niface, *piface;
+       endpt * niface;
+       endpt * piface;
  
-       niface = select_peerinterface(p, &p->srcadr, NULL);
+       niface = select_peerinterface(peer, &peer->srcadr, NULL,
+                                     peer->cast_flags);
  
        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: ",
@@@ -682,15 -634,19 +693,18 @@@ refresh_all_peerinterfaces(void
  /*
   * find an interface suitable for the src address
   */
- static struct interface *
+ static endpt *
  select_peerinterface(
-       struct peer *           peer,
-       sockaddr_u *            srcadr,
-       struct interface *      dstadr
+       struct peer *   peer,
+       sockaddr_u *    srcadr,
 -      endpt *         dstadr,
 -      u_char          cast_flags
++      endpt *         dstadr
        )
  {
-       struct interface *interface;
-   
+       endpt *ep;
+       endpt *wild;
+       wild = ANY_INTERFACE_CHOOSE(srcadr);
        /*
         * Initialize the peer structure and dance the interface jig.
         * Reference clocks step the loopback waltz, the others
         * This might happen in some systems and would preclude proper
         * operation with public key cryptography.
         */
-       if (ISREFCLOCKADR(srcadr))
-               interface = loopback_interface;
-       else if ((MDF_BCLNT | MDF_MCAST | MDF_BCAST | MDF_ACAST) &
-                peer->cast_flags) {
-               interface = findbcastinter(srcadr);
-               if (interface != NULL)
-                       DPRINTF(4, ("Found *-cast interface %s for %s\n",
-                               stoa(&(interface)->sin), stoa(srcadr)));
+       if (ISREFCLOCKADR(srcadr)) {
+               ep = loopback_interface;
 -      } else if (cast_flags & 
++      } else if (peer->cast_flags & 
+                  (MDF_BCLNT | MDF_ACAST | MDF_MCAST | MDF_BCAST)) {
+               ep = findbcastinter(srcadr);
+               if (ep != NULL)
+                       DPRINTF(4, ("Found *-cast interface %s for address %s\n",
+                               stoa(&ep->sin), stoa(srcadr)));
                else
-                       DPRINTF(4, ("No *-cast interface found for %s\n",
-                              stoa(srcadr)));
-               /*
-                * If it was a multicast packet,
-                * findbcastinter() may not find it, so try a
-                * little harder.
-                */
-               if (interface == ANY_INTERFACE_CHOOSE(srcadr))
-                       interface = findinterface(srcadr);
-       }
-       else if (dstadr != NULL && dstadr !=
-           ANY_INTERFACE_CHOOSE(srcadr))
-               interface = dstadr;
-       else
-               interface = findinterface(srcadr);
+                       DPRINTF(4, ("No *-cast local address found for address %s\n",
+                               stoa(srcadr)));
+       } else {
+               ep = dstadr;
+               if (NULL == ep)
+                       ep = wild;
+       } 
+       /*
+        * If it is a multicast address, findbcastinter() may not find
+        * it.  For unicast, we get to find the interface when dstadr is
+        * given to us as the wildcard (ANY_INTERFACE_CHOOSE).  Either
+        * way, try a little harder.
+        */
+       if (wild == ep)
+               ep = findinterface(srcadr);
        /*
         * we do not bind to the wildcard interfaces for output 
         * as our (network) source address would be undefined and
         * crypto will not work without knowing the own transmit address
         */
-       if (interface != NULL && interface->flags & INT_WILDCARD)
- #ifdef SYS_WINNT
-               if ( !accept_wildcard_if_for_winnt )  
- #endif
-                       interface = NULL;
+       if (ep != NULL && INT_WILDCARD & ep->flags)
+               if (!accept_wildcard_if_for_winnt)  
+                       ep = NULL;
  
-       return interface;
+       return ep;
  }
  
 +
  /*
   * newpeer - initialize a new peer association
   */
Simple merge
index 26b2364bcd494883103376e43809a23651ab8fb7,1a99b24781d1932ac5384b4a937577260afc42ac..d98225ceabbf3b3f6c9a03da4d5b300cfcdd60c0
@@@ -778,68 -830,90 +778,69 @@@ OnWriteComplete(ULONG_PTR i, IoCompleti
  
  
  /*
 - * mimic sendto() interface
 + * io_completion_port_sendto() -- sendto() replacement for Windows
 + *
-  * Returns 0 after successful send.
++ * Returns len after successful send.
 + * Returns -1 for any error, with the error code available via
 + *    msyslog() %m, or GetLastError().
   */
- int   
+ int
  io_completion_port_sendto(
-       struct interface *inter,        
-       struct pkt *pkt,        
-       int len, 
-       sockaddr_u* dest
+       int             fd,
+       void  *         pkt,
+       size_t          len,
+       sockaddr_u *    dest
        )
  {
 -      WSABUF                  wsabuf;
 -      transmitbuf_t *         buff;
 -      DWORD                   Result;
 -      int                     errval;
 -      int                     AddrLen;
 -      IoCompletionInfo *      lpo;
 -      DWORD                   Flags;
 -
 -      Result = ERROR_SUCCESS;
 -      lpo = (IoCompletionInfo *)GetHeapAlloc("io_completion_port_sendto");
 -      if (lpo == NULL) {
 -              SetLastError(ERROR_OUTOFMEMORY);
 -              return -1;
 -      }
 -
 -      if (len <= sizeof(buff->pkt)) {
 -              buff = get_trans_buf();
 -
 -              if (buff == NULL) {
 -                      msyslog(LOG_ERR, "No more transmit buffers left - data discarded");
 -                      FreeHeap(lpo, "io_completion_port_sendto");
 -                      SetLastError(ERROR_OUTOFMEMORY);
 -                      return -1;
 -              }
 -
 -              memcpy(&buff->pkt, pkt, len);
 -              wsabuf.buf = buff->pkt;
 -              wsabuf.len = len;
 -
 -              AddrLen = SOCKLEN(dest);
 -              lpo->request_type = SOCK_SEND;
 -              lpo->trans_buf = buff;
 -              Flags = 0;
 +      static u_long time_next_ifscan_after_error;
 +      WSABUF wsabuf;
 +      DWORD octets_sent;
 +      DWORD Result;
 +      int errval;
 +      int AddrLen;
  
 -              Result = WSASendTo(fd, &wsabuf, 1, NULL, Flags,
 -                                 &dest->sa, AddrLen,
 -                                 (LPOVERLAPPED)lpo, NULL);
 -              if (Result == SOCKET_ERROR) {
 -                      errval = WSAGetLastError();
 -                      switch (errval) {
 +      wsabuf.buf = (void *)pkt;
 +      wsabuf.len = len;
 +      AddrLen = SOCKLEN(dest);
 +      octets_sent = 0;
  
-       Result = WSASendTo(inter->fd, &wsabuf, 1, &octets_sent, 0,
 -                      case NO_ERROR :
 -                      case WSA_IO_PENDING :
 -                              Result = ERROR_SUCCESS;
 -                              break ;
++      Result = WSASendTo(fd, &wsabuf, 1, &octets_sent, 0,
 +                         &dest->sa, AddrLen, NULL, NULL);
  
 +      if (SOCKET_ERROR == Result) {
 +              errval = GetLastError();
 +              if (ERROR_UNEXP_NET_ERR == errval) {
                        /*
 -                       * Something bad happened
 +                       * We get this error when trying to send if the
 +                       * network interface is gone or has lost link.
 +                       * Rescan interfaces to catch on sooner, but no
 +                       * more often than once per minute.  Once ntpd
 +                       * is able to detect changes without polling
 +                       * this should be unneccessary
                         */
 -                      default :
 -                              msyslog(LOG_ERR,
 -                                      "WSASendTo(%s) error %d: %s",
 -                                      stoa(dest), errval, strerror(errval));
 -                              free_trans_buf(buff);
 -                              lpo->trans_buf = NULL;
 -                              FreeHeap(lpo, "io_completion_port_sendto");
 -                              break;
 +                      if (time_next_ifscan_after_error < current_time) {
 +                              time_next_ifscan_after_error = current_time + 60;
 +                              timer_interfacetimeout(current_time);
                        }
-               } else
 +                      DPRINTF(4, ("sendto unexpected network error, interface may be down\n"));
 -#ifdef DEBUG
 -              if (debug > 3)
 -                      printf("WSASendTo - %d bytes to %s : %d\n", len, stoa(dest), Result);
 -#endif
 -              if (ERROR_SUCCESS == Result)
 -                      return len;
 -              SetLastError(Result);
++              } else {
 +                      msyslog(LOG_ERR, "WSASendTo(%s) error %m",
 +                              stoa(dest));
+               }
 +              SetLastError(errval);
                return -1;
 -      } else {
 -#ifdef DEBUG
 -              if (debug) printf("Packet too large: %d Bytes\n", len);
 -#endif
 -              SetLastError(ERROR_INSUFFICIENT_BUFFER);
 +      }
 +
 +      if (len != (int)octets_sent) {
 +              msyslog(LOG_ERR, "WSASendTo(%s) sent %u of %d octets",
 +                      stoa(dest), octets_sent, len);
 +              SetLastError(ERROR_BAD_LENGTH);
                return -1;
        }
-       return 0;
 +
 +      DPRINTF(4, ("sendto %s %d octets\n", stoa(dest), len));
 +
++      return len;
  }
  
  
@@@ -850,9 -924,10 +851,10 @@@ in
  async_write(
        int fd,
        const void *data,
-       unsigned int count)
+       unsigned int count
+       )
  {
 -      transmitbuf_t *buff;
 +      void *buff;
        IoCompletionInfo *lpo;
        DWORD BytesWritten;
  
index 906e8825380138d0d3fab78e304bab516988b611,d1f621c5b29b1e5a197d1fa21cd8befa53f83adb..e438ef48ef3cf79a26729e70da1b8e9543b88d92
@@@ -100,20 -95,32 +100,20 @@@ int main
        /* Under original Windows NT we must not discard the wildcard */
        /* socket to workaround a bug in NT's getsockname(). */
        if (isc_win32os_majorversion() <= 4)
-               accept_wildcard_if_for_winnt = 1;
+               accept_wildcard_if_for_winnt = TRUE;
  
 -      /*
 -       * This is a hack in the Windows port of ntpd.  Before the
 -       * portable ntpd libopts processing of the command line, we
 -       * need to know if we're "daemonizing" (attempting to start as
 -       * a service).  There is undoubtedly a better way.  Legitimate
 -       * option combinations are broken by this code , such as:
 -       *   ntpd -nc debug.conf
 -       */
 -      while (argv[i]) {
 -              if (!_strnicmp(argv[i], "-d", 2)
 -                  || !strcmp(argv[i], "--debug_level")
 -                  || !strcmp(argv[i], "--set-debug_level")
 -                  || !strcmp(argv[i], "-q")
 -                  || !strcmp(argv[i], "--quit")
 -                  || !strcmp(argv[i], "-?")
 -                  || !strcmp(argv[i], "--help")
 -                  || !_strnicmp(argv[i], "-n", 2)
 -                  || !strcmp(argv[i], "--nofork")
 -                  || !strcmp(argv[i], "--saveconfigquit")) {
 -                      foreground = TRUE;
 -                      break;
 -              }
 -              i++;
 -      }
 +      argc_after_opts = argc;
 +      argv_after_opts = argv;
 +      parse_cmdline_opts(&argc_after_opts, &argv_after_opts);
 +
 +      if (HAVE_OPT(QUIT)
 +          || HAVE_OPT(SAVECONFIGQUIT)
 +          || HAVE_OPT(HELP)
 +#ifdef DEBUG
 +          || DESC(DEBUG_LEVEL).optOccCt != 0
 +#endif
 +          || HAVE_OPT(NOFORK))
 +              foreground = TRUE;
  
        if (foreground)                 /* run in console window */
                rc = ntpdmain(argc, argv);