OpenBSD CVS

CVS log for src/usr.sbin/ntpd/client.c


[BACK] Up to [local] / src / usr.sbin / ntpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.118 / (download) - annotate - [select for diffs], Wed Dec 20 15:36:36 2023 UTC (5 months, 2 weeks ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.117: +8 -11 lines
Diff to previous 1.117 (colored)

introduce log_ntp_addr() and use it where applicable, avoids a null
pointer deref in constraint.c reported by bluhm@; ok millert@

Revision 1.117 / (download) - annotate - [select for diffs], Thu Mar 24 07:37:19 2022 UTC (2 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.116: +23 -24 lines
Diff to previous 1.116 (colored)

Plus a small leak found by jmatthew; ok millert@

Revision 1.116 / (download) - annotate - [select for diffs], Wed Apr 21 09:38:11 2021 UTC (3 years, 1 month ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.115: +12 -17 lines
Diff to previous 1.115 (colored)

Improve ntpd offset handling.  Call the index of the offset loops
"shift" consistently.  Merge the two offset loops in client_update()
into one.  Use a simple assignment for the best value instead of
memcpy().  Use the same mechanism to loop over the offset array
everywhere to avoid an invalid best value.
tested by weerd@; OK claudio@

Revision 1.115 / (download) - annotate - [select for diffs], Thu Mar 18 11:06:41 2021 UTC (3 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.114: +6 -5 lines
Diff to previous 1.114 (colored)

The ntpd client code corrects both T1 and T4 with the current offset
returned by adjtime(2) from the kernel.  T1 is local time when the
NTP packet is sent and T4 when the response is received.  If between
these events a NTP reply from another server is received, it may
change the kernel offset with adjtime(2).  Then the calulation of
the client offset was done with different bases, the result was
wrong and the system time started moving around.
So instead of correcting T1 and T4 individually at different events,
correct their sum once.
Error handling was missing if there is no timestamp in the response.
As this should not happen in our kernel, fatal() is appropriate.
tested by weerd@; OK claudio@

Revision 1.114 / (download) - annotate - [select for diffs], Fri Sep 11 07:09:41 2020 UTC (3 years, 8 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.113: +29 -19 lines
Diff to previous 1.113 (colored)

If we get messages but they are not ntp replies (e.g. caused by
incoming icmp) do not register them as replies.  Also, fix a bug
introduced in the previous commit: first recompute scale, then
recompute interval, so that when the offset increases and thus the
scale is lowered both the poll interval and the check interval use
the same scale.
First issue spotted by naddy@ second one by and ok semarie@

Revision 1.113 / (download) - annotate - [select for diffs], Thu Jan 30 15:55:41 2020 UTC (4 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.112: +1 -17 lines
Diff to previous 1.112 (colored)

Properly determine era 0 or era 1, making it possible to move past
the ntp timestamp wrapping in 2036.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Nov 10 19:24:47 2019 UTC (4 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.111: +6 -6 lines
Diff to previous 1.111 (colored)

Introduce a "trusted" modifier, for peers that should be on a local net
used in situations where https constraints cannot be used and we still want
auto settime. Result of discussion with and ok deraadt@

Revision 1.111 / (download) - annotate - [select for diffs], Sun Nov 10 16:56:30 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (colored)

typo

Revision 1.110 / (download) - annotate - [select for diffs], Sun Jul 7 07:14:57 2019 UTC (4 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.109: +11 -4 lines
Diff to previous 1.109 (colored)

Sometimes ntp peers are unreliable (looking at you pool.ntp.org!)
and net config can change as well. So if a peer does not respond,
throw it out of the pool if it's a pool member and re-resolve to
find a replacement. Hold on to good peers so we end up with a good
set of peers. ok benno@

Revision 1.109 / (download) - annotate - [select for diffs], Thu Jun 20 07:28:18 2019 UTC (4 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.108: +4 -4 lines
Diff to previous 1.108 (colored)

Do a quick DNS probe to decide to stay in the forground and attempt
an (auto) settime or give up. 15s timeout is still in effect. ok florian@

Revision 1.108 / (download) - annotate - [select for diffs], Sun Jun 16 07:36:25 2019 UTC (4 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.107: +6 -3 lines
Diff to previous 1.107 (colored)

Be more aggressive retrying dns while in settime mode. The constraint
engine does not know if we're in startup mode, so use a small interval
the first few times there.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Jun 9 08:40:54 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.106: +53 -5 lines
Diff to previous 1.106 (colored)

Introducing autmatic settime mode: if some preconditions are met
(booting, constraint(s) defined) set the time but only if the clock
should be moved forward by more than a minute, based on ntp replies
that satisfied the constraints. Tested by many; ok deraadt@

Revision 1.106 / (download) - annotate - [select for diffs], Wed May 29 18:48:33 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.105: +7 -1 lines
Diff to previous 1.105 (colored)

If a DBS resolve was done with the Checking Disabled flag, re-resolve
with once the clock is synced. ok deraadt@ florian@

Revision 1.105 / (download) - annotate - [select for diffs], Tue May 30 23:30:48 2017 UTC (7 years ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.104: +13 -1 lines
Diff to previous 1.104 (colored)

add option "query from <ip>" to ntpd.conf, to specify a local IP
address for outgoing ntp queries.
From Job Snijders, thanks!
with feedback and ok henning@

Revision 1.104 / (download) - annotate - [select for diffs], Sat Sep 3 11:52:06 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.103: +4 -4 lines
Diff to previous 1.103 (colored)

Remove the oh so funny "LOSS OF MIND" from the diclaimer that was not
part of the original ISC license that we use in OpenBSD.  Done for
files were Henning is the original author.

OK henning@ deraadt@

Revision 1.103 / (download) - annotate - [select for diffs], Fri Oct 23 14:52:20 2015 UTC (8 years, 7 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.102: +3 -12 lines
Diff to previous 1.102 (colored)

Allowing upstream servers of ntp being in multiple routing tables is
non-sensical.  The dns lookups happened in the process routing table
(usually '0'), which is very likely to have different results from the
other routing domains.  If you do depend on having this behaviour,
you'll need to use pf to cross the rtable boundary.

"listen on * rtable X" is still supported.

Users of "server * rtable X" will need to switch to launching ntpd with
"route -T X exec /usr/sbin/ntpd"

OK deraadt@

Revision 1.102 / (download) - annotate - [select for diffs], Sat Jul 18 00:53:44 2015 UTC (8 years, 10 months ago) by bcook
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.101: +2 -2 lines
Diff to previous 1.101 (colored)

replace bzero with memset

ok phessler@ deraadt@

Revision 1.101 / (download) - annotate - [select for diffs], Sat Mar 28 03:49:01 2015 UTC (9 years, 2 months ago) by bcook
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Avoid overflow on 32-bit time_t systems converting timeval to NTP time.

Original fix from Romuald Delavergne. ok henning@

Revision 1.100 / (download) - annotate - [select for diffs], Thu Feb 12 01:54:57 2015 UTC (9 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)

Use ntpd's deferred DNS resolving for constraints as well.  This
allows to get constraint addresses even if network/DNS is not
available at startup (or system boot).

thumbs up & OK henning@

Revision 1.99 / (download) - annotate - [select for diffs], Tue Feb 10 06:40:08 2015 UTC (9 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.98: +10 -1 lines
Diff to previous 1.98 (colored)

Add support for "constraints": when configured, ntpd(8) will query the
time from HTTPS servers, by parsing the Date: header, and use the
median constraint time as a boundary to verify NTP responses.  This
adds some level of authentication and protection against MITM attacks
while preserving the accuracy of the NTP protocol; without relying on
authentication options for NTP that are basically unavailable at
present.  This is an initial implementation and the semantics will be
improved once it is in the tree.

Discussed with deraadt@ and henning@
OK henning@

Revision 1.98 / (download) - annotate - [select for diffs], Mon Jan 19 20:47:03 2015 UTC (9 years, 4 months ago) by bcook
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

Use initial assignment of action to check for errors.

This simplifies things and make action = -1 no longer a dead store.

Also, spell FALLTHROUGH consistently.

reported by fritjof@alokat.org

Revision 1.97 / (download) - annotate - [select for diffs], Fri Jan 9 23:44:07 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

return -1 on host() address parsing failure, not 1.

Match what parse.y expects it to return.

ok millert@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jan 9 07:35:37 2015 UTC (9 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

remove excessive/wrong use of sys/param.h
peanuts -- but all work has to start somewhere.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Jan 4 01:48:49 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.94: +3 -5 lines
Diff to previous 1.94 (colored)

use MAXIMUM as the canonical local MAX macro.

suggested by deraadt@ re: more general MIN/MAX cleanups

Revision 1.94 / (download) - annotate - [select for diffs], Sun Jan 4 01:19:46 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.93: +5 -3 lines
Diff to previous 1.93 (colored)

don't rely on sys/param.h having a MAX macro.

Switch to local definitions where MAX is needed.

discussed with deraadt@

Revision 1.93 / (download) - annotate - [select for diffs], Mon May 12 20:50:46 2014 UTC (10 years ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.92: +8 -8 lines
Diff to previous 1.92 (colored)

Fix format strings involving time_t arguments, fixes `ntpd -d' on sparc (and
probably more 32-bit platforms).

Problem noticed by tobiasu@; ok tobiasu@ dtucker@ sthen@ benno@

Revision 1.92 / (download) - annotate - [select for diffs], Mon Oct 21 08:48:22 2013 UTC (10 years, 7 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.91: +4 -7 lines
Diff to previous 1.91 (colored)

remove the IPv4-only check for rdomains, allows IPv6 to use them

OK claudio@ henning@

Revision 1.91 / (download) - annotate - [select for diffs], Fri Oct 4 14:28:16 2013 UTC (10 years, 8 months ago) by phessler
Branch: MAIN
Changes since 1.90: +3 -2 lines
Diff to previous 1.90 (colored)

Add ntpctl(8), which allows us to query the locally running ntpd(8) process

diff from Mike Miller <mmiller mgm51 com> (many thanks!)

OK phessler@, henning@, todd@

Revision 1.90 / (download) - annotate - [select for diffs], Tue Apr 30 11:42:56 2013 UTC (11 years, 1 month ago) by mglocker
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.89: +2 -3 lines
Diff to previous 1.89 (colored)

Remove unused function argument variables 'len' and 'auth' from
ntp_sendmsg().  They have been removed from the function body in the past
but not from the argument list.

From Maxime Villard

Revision 1.89 / (download) - annotate - [select for diffs], Wed Sep 21 15:41:30 2011 UTC (12 years, 8 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.88: +18 -3 lines
Diff to previous 1.88 (colored)

Add rdomain support to NTPd.

This basically adds the "rtable %d" keyword to "listen on", "server",
"servers" keywords, to specify which routing table to use.

OK henning@ claudio@ sthen@
manpage reviewed by jmc@

Revision 1.88 / (download) - annotate - [select for diffs], Wed Jun 24 17:34:32 2009 UTC (14 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

recvmsg ENOENT noncritical too

Revision 1.87 / (download) - annotate - [select for diffs], Wed Jun 17 11:52:54 2009 UTC (14 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.86: +3 -2 lines
Diff to previous 1.86 (colored)

ENOPROTOOPT is non-fatal on recvfrom, can apparently happen with ipvshit

Revision 1.86 / (download) - annotate - [select for diffs], Sun May 31 01:27:30 2009 UTC (15 years ago) by henning
Branch: MAIN
Changes since 1.85: +55 -8 lines
Diff to previous 1.85 (colored)

use the SCM_TIMESTAMP socket option to get the time we received the
reply instead of doing it in ntpd itself by getting the time we read
from the socket. based on a diff from mickey hacked in shape by me,
lots of testing and review from ckuethe and sthen, theo and claudio like it
too

Revision 1.85 / (download) - annotate - [select for diffs], Wed Apr 22 07:42:17 2009 UTC (15 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.84: +11 -1 lines
Diff to previous 1.84 (colored)

ignore replies with timestamps after 2030 to prevent time_t / tv_sec wraps
input & ok theo

Revision 1.84 / (download) - annotate - [select for diffs], Wed Mar 4 19:17:36 2009 UTC (15 years, 3 months ago) by stevesk
Branch: MAIN
Changes since 1.83: +2 -6 lines
Diff to previous 1.83 (colored)

I should know outside data must be vis(3)'d.
Don't log kiss code for now.

Revision 1.83 / (download) - annotate - [select for diffs], Wed Mar 4 18:49:07 2009 UTC (15 years, 3 months ago) by stevesk
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

received refid should not be converted to host byte order; ok henning@

Revision 1.82 / (download) - annotate - [select for diffs], Wed Mar 4 18:46:44 2009 UTC (15 years, 3 months ago) by stevesk
Branch: MAIN
Changes since 1.81: +19 -3 lines
Diff to previous 1.81 (colored)

log reason when not synced; ok henning@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Jun 10 03:51:53 2008 UTC (16 years ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.80: +14 -3 lines
Diff to previous 1.80 (colored)

For IPv6 addresses, return the first 32 bits of the MD5 hash of the
address as ref ID (RFC4330).  ok henning@

Revision 1.80 / (download) - annotate - [select for diffs], Tue Jun 10 03:46:09 2008 UTC (16 years ago) by naddy
Branch: MAIN
Changes since 1.79: +1 -2 lines
Diff to previous 1.79 (colored)

According to the latest SNTPv4 spec in RFC4330, secondary servers
return the address of the synchronization source as reference
identification.  Remove the obsolete special casing specified in RFC2030.
ok henning@

Revision 1.79 / (download) - annotate - [select for diffs], Mon Jan 28 11:45:59 2008 UTC (16 years, 4 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.78: +4 -1 lines
Diff to previous 1.78 (colored)

Reconnect a client socket after three consecutive send failures.
This allows recovery after an IP address change (e.g. on dialup links).
Also move the update of "nextaction" timeout below the deadline check.
OK henning@

Revision 1.78 / (download) - annotate - [select for diffs], Thu Dec 27 01:46:50 2007 UTC (16 years, 5 months ago) by stevesk
Branch: MAIN
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored)

some fatal() calls that should be fatalx(); ok henning@

Revision 1.77 / (download) - annotate - [select for diffs], Thu Nov 22 10:24:25 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.76: +5 -4 lines
Diff to previous 1.76 (colored)

be a bit less aggressive retrying; this keeps the message queue
empty while in the -s period, so the poll timeout actually times out
if there are no interfaces available. ok henning@

Revision 1.76 / (download) - annotate - [select for diffs], Tue May 1 07:40:45 2007 UTC (17 years, 1 month ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.75: +7 -3 lines
Diff to previous 1.75 (colored)

if resolving a name fails, be more aggressive retrying, but with care:
do not have more than one dns request outstanding per peer. resolves
slow recovery when resolving fails initially, without clogging the
pipe with lots of dns requests; tested by Jason George; ok deraadt@

Revision 1.75 / (download) - annotate - [select for diffs], Mon Apr 30 01:33:33 2007 UTC (17 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.74: +3 -3 lines
Diff to previous 1.74 (colored)

aggressive spelling fix, spotted by jbg

Revision 1.74 / (download) - annotate - [select for diffs], Fri Oct 27 12:22:41 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.73: +4 -4 lines
Diff to previous 1.73 (colored)

use clock_gettime(CLOCK_MONOTONIC, ..) to get a monotonically increasing
time, and make ntpd use that to send the next uery to an ntp peer and the
like. this has the advantage that changes to the clock do not interfere
with the intervals. for example, when we start on machines without an
RTC and the initial settime (-s) kicks in, intervals were strange.
idea from amandal@entrisphere.com, this implementation by me
tested ckuethe, phessler, mbalmer, ok mbalmer

Revision 1.73 / (download) - annotate - [select for diffs], Sat Oct 21 07:32:46 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.72: +5 -3 lines
Diff to previous 1.72 (colored)

in client_nextaddr, check fd != -1 before close, just nicer this way
From: amandal@entrisphere.com

Revision 1.72 / (download) - annotate - [select for diffs], Sat Oct 21 07:28:06 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.71: +2 -1 lines
Diff to previous 1.71 (colored)

when ntp_sendmsg fails, reset trustlevel to TRUSTLEVEL_PATHETIC
From: amandal@entrisphere.com

Revision 1.71 / (download) - annotate - [select for diffs], Sat Oct 21 07:18:57 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

EADDRNOTAVAIL after connect is one of the soft errors where we don't abort
too. from amandal@entrisphere.com

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jun 7 06:29:03 2006 UTC (18 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

Compensate old offsets with the amount of adjustment done, avoiding
overcompensating. From DragonFly, uses recent adjtime(2) changes,
so you'll need a recent kernel. ok henning@

Revision 1.69 / (download) - annotate - [select for diffs], Sun Jun 4 18:58:13 2006 UTC (18 years ago) by otto
Branch: MAIN
Changes since 1.68: +6 -7 lines
Diff to previous 1.68 (colored)

Only invalidate stored replies if an adjustment was really made.
ok henning@

Revision 1.68 / (download) - annotate - [select for diffs], Mon May 29 20:51:54 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
Changes since 1.67: +4 -3 lines
Diff to previous 1.67 (colored)

When ntpd backs off polling due to a negative delay, tell the user how long
it will wait until the next poll.
ok henning@

Revision 1.67 / (download) - annotate - [select for diffs], Thu May 25 19:25:46 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.66: +7 -1 lines
Diff to previous 1.66 (colored)

figure out the refid to send to NTP v3 clients early and store it
first bits from a way to long flight

Revision 1.66 / (download) - annotate - [select for diffs], Sat Sep 24 00:32:03 2005 UTC (18 years, 8 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

Log source address for 'malformed packet' errors.  ok henning@

Revision 1.65 / (download) - annotate - [select for diffs], Wed Aug 10 13:48:36 2005 UTC (18 years, 10 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

Propogate server's leap indicator flags to clients; ok henning@

Revision 1.64 / (download) - annotate - [select for diffs], Mon Jul 11 08:04:28 2005 UTC (18 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

Print actual error when in debug mode; ok henning@

Revision 1.63 / (download) - annotate - [select for diffs], Wed Jul 6 09:54:24 2005 UTC (18 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

add another non-fatal error for recvfrom; ok henning@

Revision 1.62 / (download) - annotate - [select for diffs], Tue Jul 5 10:09:12 2005 UTC (18 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (colored)

Save transmit time for each peer for later use as refid for SNTPv4
replies.  ok henning@

Revision 1.61 / (download) - annotate - [select for diffs], Sun Jun 19 16:42:57 2005 UTC (18 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.60: +7 -1 lines
Diff to previous 1.60 (colored)

use a little state engine to keep track of delayed dns lookups and such,
eases things
tested by Jason Ackley <jason@ackley.net> Matthias Kilian
<kili@outback.escape.de> Stephen Marley <stephen@marley.org.uk> sturm@
theo ok

Revision 1.60 / (download) - annotate - [select for diffs], Tue Apr 19 11:08:41 2005 UTC (19 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.59: +5 -5 lines
Diff to previous 1.59 (colored)

move the "reply from ... " log msg in -d mdoe uop a bit so it actually
comes before the "adjusting local clock by..." one, joerg

Revision 1.59 / (download) - annotate - [select for diffs], Mon Apr 18 11:06:35 2005 UTC (19 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.58: +9 -1 lines
Diff to previous 1.58 (colored)

prevent replies with negative delay from being used, could happen with -s
From: Joerg Sonnenberger <joerg@britannica.bec.de> of dragonfly

Revision 1.58 / (download) - annotate - [select for diffs], Tue Mar 8 12:31:40 2005 UTC (19 years, 3 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

let client_query return 0 if it requested dns resolution

Revision 1.57 / (download) - annotate - [select for diffs], Mon Feb 21 17:58:43 2005 UTC (19 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

fix an error message

Revision 1.56 / (download) - annotate - [select for diffs], Thu Feb 3 10:53:33 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
Changes since 1.55: +17 -3 lines
Diff to previous 1.55 (colored)

Implement simple duplicate suppression of peer errors; ok henning@

Revision 1.55 / (download) - annotate - [select for diffs], Fri Jan 28 12:37:20 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored)

Simplify interval scaling and randomize query intervals; ok henning@

Revision 1.54 / (download) - annotate - [select for diffs], Fri Jan 28 12:01:32 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
Changes since 1.53: +3 -2 lines
Diff to previous 1.53 (colored)

Make network unreachable errors non-fatal; ok henning@

Revision 1.53 / (download) - annotate - [select for diffs], Thu Jan 27 14:44:00 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
Changes since 1.52: +6 -22 lines
Diff to previous 1.52 (colored)

Scale query interval by the overall offset not per-peer offset, so we
don't query outliers more often than any other server.  ok henning@

Revision 1.52 / (download) - annotate - [select for diffs], Thu Jan 27 10:32:29 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
Changes since 1.51: +1 -3 lines
Diff to previous 1.51 (colored)

Delay before retrying a query on timeout; ok henning@

Revision 1.51 / (download) - annotate - [select for diffs], Wed Dec 15 12:29:25 2004 UTC (19 years, 5 months ago) by dtucker
Branch: MAIN
Changes since 1.50: +7 -2 lines
Diff to previous 1.50 (colored)

Poll unsynchronized servers at the maximum interval and log a message about
them when in debug mode; ok henning@

Revision 1.50 / (download) - annotate - [select for diffs], Wed Dec 15 12:24:21 2004 UTC (19 years, 5 months ago) by dtucker
Branch: MAIN
Changes since 1.49: +20 -19 lines
Diff to previous 1.49 (colored)

Factor out interval scaling code; ok henning@

Revision 1.49 / (download) - annotate - [select for diffs], Tue Dec 14 23:44:20 2004 UTC (19 years, 5 months ago) by dtucker
Branch: MAIN
Changes since 1.48: +4 -1 lines
Diff to previous 1.48 (colored)

If polling a server results in an error, drop that server to the maximum
poll interval;  ok henning@

Revision 1.48 / (download) - annotate - [select for diffs], Mon Dec 13 12:22:52 2004 UTC (19 years, 5 months ago) by dtucker
Branch: MAIN
Changes since 1.47: +5 -1 lines
Diff to previous 1.47 (colored)

Discard replies with alarm flag set or invalid stratum; ok henning@

Revision 1.47 / (download) - annotate - [select for diffs], Thu Dec 9 20:24:46 2004 UTC (19 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

define TRUSTLEVEL_MAX for the trustedlevel value of 10; henning@ ok

Revision 1.46 / (download) - annotate - [select for diffs], Wed Dec 8 15:47:38 2004 UTC (19 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.45: +5 -5 lines
Diff to previous 1.45 (colored)

uniquely name members of s_fixedpt and l_fixedpt; henning@ ok

Revision 1.45 / (download) - annotate - [select for diffs], Wed Nov 10 11:47:28 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.44: +4 -4 lines
Diff to previous 1.44 (colored)

ntp_adjtime() -> priv_adjtime()
ntp_settime() -> priv_settime()
ntp_host_dns() -> priv_host_dns()

Revision 1.44 / (download) - annotate - [select for diffs], Fri Nov 5 23:39:46 2004 UTC (19 years, 7 months ago) by dtucker
Branch: MAIN
Changes since 1.43: +4 -3 lines
Diff to previous 1.43 (colored)

Use SA_LEN() instead of ss.ss_len.  Evaluates to the same result but it's
easier on portable.  ok henning@

Revision 1.43 / (download) - annotate - [select for diffs], Fri Oct 22 21:17:37 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.42: +2 -1 lines
Diff to previous 1.42 (colored)

in server mode reply with stratum from the peer that we currently prefer
plus one

Revision 1.42 / (download) - annotate - [select for diffs], Fri Oct 15 01:58:04 2004 UTC (19 years, 7 months ago) by dtucker
Branch: MAIN
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)

Only set IPTOS_LOWDELAY on IPv4 interfaces; pointed out by phessler, ok henning

Revision 1.41 / (download) - annotate - [select for diffs], Thu Oct 14 09:35:48 2004 UTC (19 years, 7 months ago) by dtucker
Branch: MAIN
Changes since 1.40: +6 -1 lines
Diff to previous 1.40 (colored)

Have ntpd use IPTOS_LOWDELAY; ok henning@

Revision 1.40 / (download) - annotate - [select for diffs], Wed Oct 13 13:35:19 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

in struct ntp_msg, rename "distance" to "rootdelay" to closer match RFCs
and such

Revision 1.39 / (download) - annotate - [select for diffs], Wed Oct 13 13:19:44 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

thinko, htonl() -> ntohl(). as we don't use the value in question effect zero

Revision 1.38 / (download) - annotate - [select for diffs], Fri Oct 8 12:42:25 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

whitespace both in comment; from bernd

Revision 1.37 / (download) - annotate - [select for diffs], Tue Oct 5 11:23:28 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.36: +18 -16 lines
Diff to previous 1.36 (colored)

in client_addr_init() and client_nextaddr(), do not set up the socket and
connect it, instead leave it at -1.
in client_query, set up and connect the socket if it is -1.
and, the real reason for this change: handle connect failures gracefully
ok otto

Revision 1.36 / (download) - annotate - [select for diffs], Thu Sep 30 10:19:43 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

now that we connect() the client sockets we need to handle ECONNREFUSED as
non-fatal too, from camield@

Revision 1.35 / (download) - annotate - [select for diffs], Fri Sep 24 14:51:16 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.34: +18 -13 lines
Diff to previous 1.34 (colored)

connect() the client-side sockets. idea & test & ok camield@

Revision 1.34 / (download) - annotate - [select for diffs], Sat Sep 18 20:01:38 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.33: +4 -2 lines
Diff to previous 1.33 (colored)

add a new -s option, that tells ntpd to set the time using settimeofday()
once at startup. ntpd delays daemonizing until it has done the intial
time setting (or ran into the timeout) in this mode to make sure stuff started
later in rc is not subject to time jumps.
this eleminates the need to run rdate -n beforehands.
with some input from & ok ryan and bob, march music from mickey

Revision 1.33 / (download) - annotate - [select for diffs], Tue Sep 14 22:01:28 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (colored)

paranoia: reset query->fd to -1 after close, from canacar some time ago

Revision 1.32 / (download) - annotate - [select for diffs], Mon Aug 16 11:14:15 2004 UTC (19 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.31: +22 -9 lines
Diff to previous 1.31 (colored)

Be more careful setting next and deadline, they should not both be != 0
at the same time.
ok henning@

Revision 1.31 / (download) - annotate - [select for diffs], Fri Aug 13 12:26:13 2004 UTC (19 years, 10 months ago) by otto
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored)

Reset deadline on failed transmit. Avoids a spinning process if
all sends fail. ok henning@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Aug 12 16:33:59 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.29: +18 -15 lines
Diff to previous 1.29 (colored)

do not try to getaddrinfo() in the unprivileged process, send an imsg
asking the privileged one to do it. sends back an imsg with the
resulting addresses in a bunch of struct sockaddr_storage in the data
part.
this should fix all remaining issues with dns (non-)availability at
ntpd startup, be it due to named on localhost or something else.
tested by marco@ and Chris Paul <chris.paul@sentinare.com>

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jul 28 16:38:43 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.28: +17 -2 lines
Diff to previous 1.28 (colored)

when a dns lookup fails at parse time, do not abort but try again
to resolve the hostname every 60 seconds
fixes ntpd invocations before e. g. a dialup link is established and such.
as we want ntpd to be a "fire and forget" background daemon it should
cope with such situations.
tested by many

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jul 20 16:47:55 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

wrap the heads for the linked list of addresses into a new ntp_addr_wrap
which, besides the head pointer for the list of course, stores the original
address as specified (i. e. as hostname instead of resolved IPs) and flags
and such.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jul 18 13:26:53 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.26: +10 -3 lines
Diff to previous 1.26 (colored)

there are a few recvfrom(2) errors we do not want to panic on

Revision 1.26 / (download) - annotate - [select for diffs], Sun Jul 18 12:59:41 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.25: +11 -15 lines
Diff to previous 1.25 (colored)

query interval scaling, episode II
1) base the interval calculation on the offset from the last reply, not
   from the last peer update.
   Allows us to send more queries again faster when the local clock
   diverges too much
2) every time we form a peer update (for which we need 8 replies)
   check wether we have a ready peer update for all peers that are
   currently trusted, and if so, calculate the total offset and call
   adjtime().
   that means that adjtime is no longer called in fixed intervals
   but whenever we have enough data to reliably calculate the local
   clock offset.
   In practice, that means we call adjtime() less often, but with
   probably better data.
3) invalidate peer updates after beeing used. no point in re-using them
   - this resulted in calling adjtime() multiple times with the same
   offset, which doesn't make sense
tested by many

Revision 1.25 / (download) - annotate - [select for diffs], Wed Jul 14 20:16:31 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.24: +1 -2 lines
Diff to previous 1.24 (colored)

do not do the stratum guessing dance.
stratum is pretty much pointless anyway these days, and we certainly
do not want to send out illegal packets (stratum=0) until synced...

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jul 11 00:15:10 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.23: +10 -1 lines
Diff to previous 1.23 (colored)

Start collecting the remote server state along with the calculated
offsets, in preparation for having correct server statistics in
responses to client queries.  ok henning@

Revision 1.23 / (download) - annotate - [select for diffs], Sat Jul 10 19:16:06 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

missing {}

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 10 19:09:13 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.21: +5 -5 lines
Diff to previous 1.21 (colored)

check wether we have enough data to form a peer update on receiption
of each packet, not only after each 8th (where we have enough for sure)

Revision 1.21 / (download) - annotate - [select for diffs], Sat Jul 10 18:47:49 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

oups

Revision 1.20 / (download) - annotate - [select for diffs], Sat Jul 10 18:42:51 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.19: +70 -9 lines
Diff to previous 1.19 (colored)

scale query interval based on local clock offset. tested by many
not as efficient as I want it to be yet, but more is coming

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jul 9 15:02:15 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.18: +7 -3 lines
Diff to previous 1.18 (colored)

don't panic when sendto() fails; for the client part just re-schedule
noticed & fix tested by fries@

Revision 1.18 / (download) - annotate - [select for diffs], Fri Jul 9 10:53:33 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.17: +38 -18 lines
Diff to previous 1.17 (colored)

rework dns handling with all its cosequences...
we know have both a "server" and "servers" keyword. they differ when the
hostname resolves to more than one IP, server picks one and servers expands
to all.
that means no longer stuffing a sockaddr_storage into ntp_peer but a pointer
to a linked list of ntp_addr structs.
in the "servers" case the list of n addresses returned by host() is expanded
into n ntp_peer structs and thus n individual peers.
in the "server" case the whole list is attached to ntp_peer, and whenever we
do not receive a reply in time we traverse the list one further, so that
hosts with both AAAA and A records are first tried with the AAAA one but
we gracefully fall back to the A one.
semantics with theo; hacked up on the Montreal->Frankfurt flight.
again Air Canada surprised me, that older 767 hat pretty decent seats.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jul 8 01:20:21 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.16: +5 -1 lines
Diff to previous 1.16 (colored)

lof replies with log_debug so one gets increased verbosity when in
foreground/debug mode

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jul 7 08:07:02 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (colored)

RFC 2030 is incorrect with regards to the computation of the delay value
for NTP queries/replies.  RFC 1305 and some of Mills' other papers have
the correct formula.

ok henning@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 7 06:57:13 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.14: +1 -5 lines
Diff to previous 1.14 (colored)

don't log every single reply we receive and log local clock adjustemt nicer

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jul 7 06:51:16 2004 UTC (19 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

knf!

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jul 7 06:50:40 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.12: +2 -5 lines
Diff to previous 1.12 (colored)

if the cookie in the received packet doesn't match discard it silently;
the logging was useful for development but is a bad idea in production
use as a remote attacker could flood your logs

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jul 7 01:01:27 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.11: +20 -7 lines
Diff to previous 1.11 (colored)

keep a "trustlevel" per peer. loose credit for loosing a packet, loose
a lot of credit for not having supplied us with enough data within an
adjtime run interval, and get a little credit each time we get a good
reply packet. if a peer is below 20%, only send a packet occasionally to
see wether it is back. send out queries much more often between 20 and 80%
to (re-)sync quickly, and above 80% usethe regular interval.
do not use peers < 60% for calculating teh local clock offset.
designed with theo at the pho, alexander ok

Revision 1.11 / (download) - annotate - [select for diffs], Tue Jul 6 23:26:38 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.10: +8 -5 lines
Diff to previous 1.10 (colored)

Implement the clock filter as descirbed by David Mills:
form the last 8 replied received from a peer, find the one with the lowest
delay. Use that as the peer's update taken into account for calculating
the local clock's offset.
Invalidate that reply and all ones received earlier than it so that they do
not get used again.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jul 6 19:06:43 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.9: +3 -2 lines
Diff to previous 1.9 (colored)

when we received a apcket with incorrect cookie log from whom as well

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jul 6 18:45:29 2004 UTC (19 years, 11 months ago) by jason
Branch: MAIN
Changes since 1.8: +3 -2 lines
Diff to previous 1.8 (colored)

log host packet was received from (originally using a long convoluted
function until henning showed me the light... log_sockaddr... nifty);
this diff is from henning and should be henning ok =)

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 6 17:40:32 2004 UTC (19 years, 11 months ago) by naddy
Branch: MAIN
Changes since 1.7: +3 -1 lines
Diff to previous 1.7 (colored)

initialize the variables that track the offset array; ok henning@

Revision 1.7 / (download) - annotate - [select for diffs], Mon Jul 5 22:12:53 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.6: +10 -4 lines
Diff to previous 1.6 (colored)

keep last 8 offset,delay pairs - we'll need them for the clock filters later.
for now, average over those to adjust the local clock.

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jul 5 20:41:34 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

delay, not error

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jul 4 22:24:20 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

put interval defines in ntpd.h and name them consistently

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jul 4 19:52:24 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.3: +4 -7 lines
Diff to previous 1.3 (colored)

simplify slightly

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jul 4 11:01:49 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.2: +30 -8 lines
Diff to previous 1.2 (colored)

Compute the local clock offset from the server's response.
ok henning@

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jul 3 21:11:29 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

wrong struct calloc'ed; ok henning@

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jun 17 19:17:48 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN

provide most of the client functionality.
hook the descriptors into the main poll and such.
we're not doing anything with the reply we recive yet, tho.

mostly hacked on the Frankfurt->Montreal flight, as batteries and those
horrible air canada seats permitted...

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.