OpenBSD CVS

CVS log for src/usr.sbin/ntpd/ntpd.h


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.154 / (download) - annotate - [select for diffs], Tue May 21 05:00:48 2024 UTC (2 weeks, 4 days ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.153: +1 -2 lines
Diff to previous 1.153 (colored)

remove prototypes with no matching function and externs with no var
partly checked by millert@

Revision 1.153 / (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
Changes since 1.152: +2 -1 lines
Diff to previous 1.152 (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.152 / (download) - annotate - [select for diffs], Sun Nov 27 13:19:00 2022 UTC (18 months, 1 week ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.151: +3 -2 lines
Diff to previous 1.151 (colored)

Once we are synced, we can validate the certificate in the standard way.
ok tb@

Revision 1.151 / (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_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.150: +2 -2 lines
Diff to previous 1.150 (colored)

Plus a small leak found by jmatthew; ok millert@

Revision 1.150 / (download) - annotate - [select for diffs], Sun Aug 30 16:21:29 2020 UTC (3 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.149: +3 -1 lines
Diff to previous 1.149 (colored)

If no replies are received for a while due to connectivity issues
go into unsynced mode. The existing code to check if we're unsycned
is only done on receiving an ntp packet which does not happen if
there are connectivity issues. Prodded by naddy@ ok @florian

Revision 1.149 / (download) - annotate - [select for diffs], Wed Feb 12 19:14:56 2020 UTC (4 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.148: +6 -5 lines
Diff to previous 1.148 (colored)

If constraints are configured but do not work for whatever reason ntpd
does not work. Make that more clear in the log and ntpdctl -s status.
report by and ok benno@

Revision 1.148 / (download) - annotate - [select for diffs], Mon Nov 11 06:32:52 2019 UTC (4 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.147: +4 -1 lines
Diff to previous 1.147 (colored)

Also implement "trusted" for sensors; do not do constraint validation
for these. ok deraadt@

Revision 1.147 / (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.146: +3 -1 lines
Diff to previous 1.146 (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.146 / (download) - annotate - [select for diffs], Tue Jul 16 14:15:40 2019 UTC (4 years, 10 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.145: +2 -1 lines
Diff to previous 1.145 (colored)

1) Re-resolve and re-get constraints once the clock is synced. Constraints
are relative to monotime; so they shift when time is being adjusted.
2) Fix a race between SIGCHLD delivery and reading the result imsg.
3) Some cleanup: use a number to distinguish pools internally

Revision 1.145 / (download) - annotate - [select for diffs], Thu Jun 27 15:18:42 2019 UTC (4 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.144: +2 -22 lines
Diff to previous 1.144 (colored)

Allow logging to both stderr and syslog; don't reset the log level if
the log destination changes. ok claudio@ benno@

Revision 1.144 / (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.143: +4 -3 lines
Diff to previous 1.143 (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.143 / (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.142: +5 -1 lines
Diff to previous 1.142 (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.142 / (download) - annotate - [select for diffs], Wed Jun 12 05:04:45 2019 UTC (4 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.141: +5 -3 lines
Diff to previous 1.141 (colored)

Fix init of syslog for childs and teach dns process about synced state.
ok benno@

Revision 1.141 / (download) - annotate - [select for diffs], Sun Jun 9 08:40:54 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.140: +8 -2 lines
Diff to previous 1.140 (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.140 / (download) - annotate - [select for diffs], Wed May 29 18:48:33 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.139: +2 -1 lines
Diff to previous 1.139 (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.139 / (download) - annotate - [select for diffs], Tue May 28 06:49:46 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.138: +2 -1 lines
Diff to previous 1.138 (colored)

A step in solving the bootstrap problem in a dnssec environement.
If the time is wrong, we cannot validate dnssec, leading to failed
DNS lookups, so we cannot adjust or set the time.  Work around this
by repeating a failed DNS lookup with a lookup with the DC (check
disabled) bit set. ok florian@

Revision 1.138 / (download) - annotate - [select for diffs], Mon Jan 14 16:30:21 2019 UTC (5 years, 4 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.137: +2 -1 lines
Diff to previous 1.137 (colored)

Prevent multiple ntpds from tripping over each other.
This brings over the logic from bgpd & ospfd.
Input & OK deraadt

Revision 1.137 / (download) - annotate - [select for diffs], Tue Nov 6 20:41:36 2018 UTC (5 years, 7 months ago) by jsing
Branch: MAIN
Changes since 1.136: +1 -2 lines
Diff to previous 1.136 (colored)

Use TLS_CA_CERT_FILE instead of a separate define.

ok beck@ bluhm@ tb@

Revision 1.136 / (download) - annotate - [select for diffs], Sat Aug 4 11:07:14 2018 UTC (5 years, 10 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.135: +1 -2 lines
Diff to previous 1.135 (colored)

Revert back previous commit, we have decided that socket files don't cause any
harm if not deleted after the daemon is shutdown and at the same time we also
tackle another attack surface by not allowing the program to create/delete
any more files (by removing "cpath" promise from pledge(2)).

Discussion initiated by a question from deraadt@ OK florian@

Revision 1.135 / (download) - annotate - [select for diffs], Tue May 30 23:30:48 2017 UTC (7 years ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.134: +5 -1 lines
Diff to previous 1.134 (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.134 / (download) - annotate - [select for diffs], Mon Jan 9 14:49:22 2017 UTC (7 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.133: +3 -2 lines
Diff to previous 1.133 (colored)

Stop accessing verbose and debug variables from log.c directly.

This replaces log_verbose() and "extern int verbose" with the two functions
log_setverbose() and log_getverbose().

Pointed out by benno@
OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)

Revision 1.133 / (download) - annotate - [select for diffs], Mon Sep 26 17:17:01 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.132: +5 -4 lines
Diff to previous 1.132 (colored)

Teach ntpd(8) constraint process to use exec*() instead of just forking,
with this change we get the pledge() ability back to the parent process.

some tweaks from and ok reyk@

Revision 1.132 / (download) - annotate - [select for diffs], Wed Sep 14 13:20:16 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.131: +10 -3 lines
Diff to previous 1.131 (colored)

Teach ntpd(8) how to fork+exec.

ok reyk@, bcook@

Revision 1.131 / (download) - annotate - [select for diffs], Sat Sep 3 11:52:06 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.130: +4 -4 lines
Diff to previous 1.130 (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.130 / (download) - annotate - [select for diffs], Sun Mar 27 11:16:12 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.129: +2 -7 lines
Diff to previous 1.129 (colored)

Rename session_socket_blockmode() to session_socket_nonblockmode(),
removing its second parameter and the enum() that provided the
values for said parameter.

The function was only called with the second parameter set to one
value (BM_NONBLOCKING) from the enum(). So just do the right thing.
Similar to changes made in smtpd.

While here remove the pointless third parameter from the fcntl(F_GETFL)
call.

No functional change.

ok guenther@ bcook@ deraadt@

Revision 1.129 / (download) - annotate - [select for diffs], Wed Jan 27 21:48:34 2016 UTC (8 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.128: +4 -1 lines
Diff to previous 1.128 (colored)

Don't attempt to kill() the constraint in the wrong process.  The
process management of the contraint processes has been moved from ntp
to the parent, for better privsep and pledge, but the ntp process
still attempted to kill the constraints on timeout directly.  Fix this
regression by introducing a new imsg from ntp to the parent and the
related logic to kill a constraint at the right place.

Reported & tested by bcook@
Ok bcook@

Revision 1.128 / (download) - annotate - [select for diffs], Wed Jan 27 21:36:25 2016 UTC (8 years, 4 months ago) by bcook
Branch: MAIN
Changes since 1.127: +3 -2 lines
Diff to previous 1.127 (colored)

update ntpd log initialization to work like relayd, fix debug log levels

ok reyk@

Revision 1.127 / (download) - annotate - [select for diffs], Sat Dec 19 20:44:35 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.126: +23 -3 lines
Diff to previous 1.126 (colored)

No need for an extra log.h

OK bcook@

Revision 1.126 / (download) - annotate - [select for diffs], Sat Dec 19 13:58:08 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.125: +2 -1 lines
Diff to previous 1.125 (colored)

Move log_sockaddr() to from log.c to util.c as it is a local addition
and actually not a "logging" function.  No functional change.

Revision 1.125 / (download) - annotate - [select for diffs], Tue Nov 24 01:03:25 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.124: +3 -2 lines
Diff to previous 1.124 (colored)

Cache values from getpwnam() done at initialization, which need to be
used by the constraint processes setup later (chroot, setuid...)
[late getpwnam discovered during a further audit]
ok millert

Revision 1.124 / (download) - annotate - [select for diffs], Fri Oct 30 17:59:56 2015 UTC (8 years, 7 months ago) by naddy
Branch: MAIN
Changes since 1.123: +1 -2 lines
Diff to previous 1.123 (colored)

drop unused define; ok reyk@

Revision 1.123 / (download) - annotate - [select for diffs], Fri Oct 23 14:52:20 2015 UTC (8 years, 7 months ago) by phessler
Branch: MAIN
Changes since 1.122: +1 -3 lines
Diff to previous 1.122 (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.122 / (download) - annotate - [select for diffs], Mon Oct 12 06:50:08 2015 UTC (8 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.121: +18 -5 lines
Diff to previous 1.121 (colored)

Move execution of the constraints from the ntp to the parent process.
This helps the ntp process to a) give a better pledge(2) and to b)
keep the promise of "saving the world again... on time" by removing
the delays that have been introduced by expensive constraint forks.
The new design offers better privsep but introduces a few more imsgs
and runs a little bit more code in the privileged parent.  The
privileged code is minimal, carefully checked, and does not attempt to
"parse" any contents; the forked constraints instantly drop all
privileges and pledge to "stdio inet".

OK beck@ deraadt@

Revision 1.121 / (download) - annotate - [select for diffs], Wed May 20 13:32:39 2015 UTC (9 years ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.120: +1 -3 lines
Diff to previous 1.120 (colored)

Remove hotplug(4) sensor support: the code has been disabled by
henning@ 9 years ago because of an issue with the /dev/hotplug device
- it does not support multiple readers opening it.  Nobody ever cared
enough to fix it so it is time to sent the dead code to the Attic.

OK henning@ (feeling sad about it), mpi@ and others

Revision 1.120 / (download) - annotate - [select for diffs], Sun May 17 18:31:32 2015 UTC (9 years ago) by reyk
Branch: MAIN
Changes since 1.119: +3 -1 lines
Diff to previous 1.119 (colored)

When resolving the "constraint" (singular), store all returned IP
addresses and try one after another until the connection succeeded -
based on the existing mechanism of "server".  "constraint" previously
only tried to connect to the first returned address, aborted and
skipped the constraint on failure.  In difference to "constraints"
(plural), it still only connects to one address at a time and not to
all of them at once.

Pointed out by rpe@
OK rpe@ deraadt@

Revision 1.119 / (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.118: +4 -2 lines
Diff to previous 1.118 (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.118 / (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.117: +47 -3 lines
Diff to previous 1.117 (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.117 / (download) - annotate - [select for diffs], Tue Jan 13 02:28:56 2015 UTC (9 years, 4 months ago) by bcook
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (colored)

fix some memory leaks in dns handling.

 - Nothing seems to free the result of host_dns(), so add host_dns_free() and
   call after each query.
 - If imsg_add() fails, it frees buf. Avoid subsequently dereferencing the
   freed buf in imsg_close().

ok millert@ deraadt@

Revision 1.116 / (download) - annotate - [select for diffs], Sat Jan 10 13:47:05 2015 UTC (9 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

don't check for a return value that host() doesn't return, so future
generations don't try to change any of the values and break the code.
ok deraadt

Revision 1.115 / (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.114: +4 -4 lines
Diff to previous 1.114 (colored)

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

Revision 1.114 / (download) - annotate - [select for diffs], Thu Jan 8 00:30:08 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.113: +2 -12 lines
Diff to previous 1.113 (colored)

sync log.c from smtpd.

Reduces the number of log.c snowflakes by a little, and gives ntpd a
variadic fatal() function to be used later.

ok deraadt@

Revision 1.113 / (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.112: +3 -1 lines
Diff to previous 1.112 (colored)

use MAXIMUM as the canonical local MAX macro.

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

Revision 1.112 / (download) - annotate - [select for diffs], Sun Jan 4 01:13:10 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.111: +1 -11 lines
Diff to previous 1.111 (colored)

removed unused libevent header and structures in ntpd.h

ok deraadt@ phessler@

Revision 1.111 / (download) - annotate - [select for diffs], Mon Nov 3 20:15:30 2014 UTC (9 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.110: +2 -1 lines
Diff to previous 1.110 (colored)

Convert the logic in yyerror().  Instead of creating a temporary
format string, create a temporary message.
OK claudio@

Revision 1.110 / (download) - annotate - [select for diffs], Sat Oct 25 03:23:49 2014 UTC (9 years, 7 months ago) by lteo
Branch: MAIN
Changes since 1.109: +1 -2 lines
Diff to previous 1.109 (colored)

Remove unnecessary netinet/in_systm.h include.

ok millert@

Revision 1.109 / (download) - annotate - [select for diffs], Wed Jan 22 02:55:15 2014 UTC (10 years, 4 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.108: +1 -2 lines
Diff to previous 1.108 (colored)

allow -s<abrev> in addition to -s <word> in ntpctl commandline, like
all the other tools do. changes option 'sensors' to 'Sensors'.
ok henning@, and grudgingly phessler@

Revision 1.108 / (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.107: +98 -3 lines
Diff to previous 1.107 (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.107 / (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.106: +2 -2 lines
Diff to previous 1.106 (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.106 / (download) - annotate - [select for diffs], Thu Sep 20 12:43:16 2012 UTC (11 years, 8 months ago) by patrick
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.105: +3 -1 lines
Diff to previous 1.105 (colored)

Allow ntpd.conf to assign a stratum to a sensor with the syntax stratum <level>.

OK markus@ henning@ phessler@ jmc@

Revision 1.105 / (download) - annotate - [select for diffs], Wed Sep 21 16:38:05 2011 UTC (12 years, 8 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.104: +11 -11 lines
Diff to previous 1.104 (colored)

fix the two most offensive indentation violations in here.

pointed out by sthen@

Revision 1.104 / (download) - annotate - [select for diffs], Wed Sep 21 15:41:30 2011 UTC (12 years, 8 months ago) by phessler
Branch: MAIN
Changes since 1.103: +5 -1 lines
Diff to previous 1.103 (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.103 / (download) - annotate - [select for diffs], Sat Jun 6 18:45:01 2009 UTC (15 years ago) by ckuethe
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.102: +3 -3 lines
Diff to previous 1.102 (colored)

Turns up the polling rate of sensors and makes ntpd calculate frequency
corrections more often. Due to physical effects crystal oscillators aren't
really stable beyond 1000s or so - at least not the kind found in pc's.
ok henning

Revision 1.102 / (download) - annotate - [select for diffs], Sat Jun 6 18:14:25 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.101: +2 -68 lines
Diff to previous 1.101 (colored)

make ntpd imsg-in-a-lib ready as well. extensive testing done, no
behavior change.
ok eric@

Revision 1.101 / (download) - annotate - [select for diffs], Thu Jun 4 23:39:46 2009 UTC (15 years ago) by ckuethe
Branch: MAIN
Changes since 1.100: +4 -2 lines
Diff to previous 1.100 (colored)

After calling adjfreq to correct the clock's rate, measure and fix the clock
offset. This avoids future frequency adjustments based on measurements of a
clock that was being adjusted. End result: more stable clock and better
frequency convergence.

Also, fix a mis-ordered structure member while I'm here.
ok henning

Revision 1.100 / (download) - annotate - [select for diffs], Wed May 13 15:08:10 2009 UTC (15 years ago) by stevesk
Branch: MAIN
Changes since 1.99: +5 -4 lines
Diff to previous 1.99 (colored)

when using a timedelta sensor for -s, if the sensor is invalid during
the first query we will never do the settime because
SENSOR_QUERY_INTERVAL (30s) is greater than SETTIME_TIMEOUT (15s).  so
during the settime period only, be more aggressive and use
SETTIME_TIMEOUT/3 for the query interval.

ok henning@

Revision 1.99 / (download) - annotate - [select for diffs], Wed Feb 11 01:00:10 2009 UTC (15 years, 3 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.98: +4 -4 lines
Diff to previous 1.98 (colored)

move prototypes that are really in ntp.c; ok henning@

Revision 1.98 / (download) - annotate - [select for diffs], Tue Feb 10 16:52:09 2009 UTC (15 years, 4 months ago) by stevesk
Branch: MAIN
Changes since 1.97: +2 -1 lines
Diff to previous 1.97 (colored)

log tiny frequency adjustments at debug only.
ok henning@, 'I think I agree' otto@

Revision 1.97 / (download) - annotate - [select for diffs], Fri Feb 6 21:48:00 2009 UTC (15 years, 4 months ago) by stevesk
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

rename a #define to be clearer; no binary change
ok henning@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Sep 12 10:46:09 2008 UTC (15 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.95: +4 -1 lines
Diff to previous 1.95 (colored)

move dns lookups to its own (privilege revoking, not chrooting) process.
reason: the parent process must never ever block, but the dns routines can.
last not least this fixes ntpd -s 'hanging' for a long time.
tested by a couple of people

Revision 1.95 / (download) - annotate - [select for diffs], Tue Jun 10 03:46:09 2008 UTC (16 years ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.94: +1 -2 lines
Diff to previous 1.94 (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.94 / (download) - annotate - [select for diffs], Mon Jun 9 18:30:48 2008 UTC (16 years ago) by deraadt
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

rename refstr to refid since it is an int32; ok henning

Revision 1.93 / (download) - annotate - [select for diffs], Mon Jun 9 16:37:35 2008 UTC (16 years ago) by ckuethe
Branch: MAIN
Changes since 1.92: +3 -1 lines
Diff to previous 1.92 (colored)

Allow outgoing replies from sensor-driven servers to have a
user-configurable reference ID, eg. "GPS" or "DCF"...
ok mbalmer

Revision 1.92 / (download) - annotate - [select for diffs], Fri May 16 06:13:25 2008 UTC (16 years ago) by ckuethe
Branch: MAIN
Changes since 1.91: +1 -2 lines
Diff to previous 1.91 (colored)

Allow ntpd to step the time at startup, now matter how large or small the
offset. The 180s limit doesn't help very much these days.
ok otto@ mbalmer@

Revision 1.91 / (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.90: +3 -1 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Sun Dec 23 18:39:50 2007 UTC (16 years, 5 months ago) by stevesk
Branch: MAIN
Changes since 1.89: +1 -4 lines
Diff to previous 1.89 (colored)

remove some unused #defines; ok henning@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Dec 22 18:26:21 2007 UTC (16 years, 5 months ago) by stevesk
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored)

just call getpwnam(NTPD_USER) once; ok henning@

Revision 1.88 / (download) - annotate - [select for diffs], Mon Oct 15 06:59:32 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.87: +2 -1 lines
Diff to previous 1.87 (colored)

Allow ntpd to report the status of peers and sensors to syslog. This
happens when a SIGINFO is received, or when the majority of peers or
sensors is bad. The latter with a maximum of once per 24 hour.
ok henning@ ckuethe@ mbalmer@

Revision 1.87 / (download) - annotate - [select for diffs], Thu Sep 13 14:34:36 2007 UTC (16 years, 8 months ago) by pyr
Branch: MAIN
Changes since 1.86: +2 -1 lines
Diff to previous 1.86 (colored)

Provide the -n switch like in the other imsg daemons for testing
the configuration file.
"yes please, ok" henning@

Revision 1.86 / (download) - annotate - [select for diffs], Wed Sep 12 21:08:46 2007 UTC (16 years, 8 months ago) by ckuethe
Branch: MAIN
Changes since 1.85: +3 -1 lines
Diff to previous 1.85 (colored)


Add a knob to compensate for a refclock that is early or late. Based on a
diff from Maurice Janssen. Manpage help from jmc and Maurice, other nits
from deraadt and otto.
ok deraadt, otto

Revision 1.85 / (download) - annotate - [select for diffs], Sat Aug 4 02:58:02 2007 UTC (16 years, 10 months ago) by ckuethe
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

This diff makes ntpd poll for sensors more aggressively when the use of
sensors is requested, but no sensors are found.
ok henning

Revision 1.84 / (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.83: +3 -3 lines
Diff to previous 1.83 (colored)

aggressive spelling fix, spotted by jbg

Revision 1.83 / (download) - annotate - [select for diffs], Fri Mar 23 14:22:40 2007 UTC (17 years, 2 months ago) by ckuethe
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

Increase sensor polling interval to 30s, just like ntp polls. This
improves sensor timekeeping significantly.

Before this patch my test system's frequency adjustment would range
between -350 and +250, with timedelta rarely getting close to 0. After,
frequency adjustmens is on the order of +/- 0.05ppm, with time +/- a
few microseconds away from 0

ok henning, mbalmer, otto

Revision 1.82 / (download) - annotate - [select for diffs], Thu Mar 1 17:50:42 2007 UTC (17 years, 3 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.81: +2 -2 lines
Diff to previous 1.81 (colored)

read buffer size must be >= max imsg size.
after release we should revisit this issue, we can probably safely shrink
the max imsg size.
Valentin Kozamernik in PR5401

Revision 1.81 / (download) - annotate - [select for diffs], Mon Jan 15 08:19:11 2007 UTC (17 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.80: +3 -2 lines
Diff to previous 1.80 (colored)

Although Unix compilers accept more than one definition of a global
symbol, follow the guidelines from K&R: only one definition of a
global symbol (and possibly more declarations).  Rename some vars
here and there to avoid shadowing. ok henning@

Revision 1.80 / (download) - annotate - [select for diffs], Sat Dec 23 17:49:53 2006 UTC (17 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

adapt to new two-level sensor sysctl framework; by Constantine A. Murenin

Revision 1.79 / (download) - annotate - [select for diffs], Mon Nov 20 20:58:47 2006 UTC (17 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.78: +2 -1 lines
Diff to previous 1.78 (colored)

with usig the meadian offset froma number of measurements the recording
of the last sensor update time got broken, doesn't show up with gps since
it updates often (more often than we read), but naddy ran into it with dcf.
record time of last sensor datum seperately. ok naddy balmer

Revision 1.78 / (download) - annotate - [select for diffs], Fri Oct 27 12:22:41 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.77: +2 -1 lines
Diff to previous 1.77 (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.77 / (download) - annotate - [select for diffs], Tue Oct 24 12:23:39 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.76: +6 -2 lines
Diff to previous 1.76 (colored)

timedelta sensors are usually updated very often, but we used to query
them only every 30 seconds. now query them every 5,and take the median
value from 7 queries as sensor value. this takes outliers out of the
equation and makes the overall result much better, especially for
sensors with heavy jitter (like nmea for now)

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jun 30 16:52:13 2006 UTC (17 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

spaces

Revision 1.75 / (download) - annotate - [select for diffs], Mon Jun 26 09:43:06 2006 UTC (17 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.74: +4 -3 lines
Diff to previous 1.74 (colored)

increase polling intervbal, but only after we are synced and have done
a few frequency adjustments. ok henning@

Revision 1.74 / (download) - annotate - [select for diffs], Thu Jun 22 11:11:25 2006 UTC (17 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.73: +2 -1 lines
Diff to previous 1.73 (colored)

Save the computed clock drift and use it on startup. ok deraadt@
henning@

Revision 1.73 / (download) - annotate - [select for diffs], Sun Jun 18 19:38:11 2006 UTC (17 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

tsk, tsk, tsk... the rule is simple: any define consisting of
more than one token MUST be put in parentheses!

Revision 1.72 / (download) - annotate - [select for diffs], Sat Jun 17 18:40:42 2006 UTC (17 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.71: +14 -2 lines
Diff to previous 1.71 (colored)

Import frequency conrrection code from dragonfly, whith some changes:
only do frequency compensation if the clock is synced, and a slightly
diffent way of computing the linear regression.
You'll need a recent kernel and libc to use this.
Testing by naddy@ and ckuethe@ and others, thanks!
ok henning@

Revision 1.71 / (download) - annotate - [select for diffs], Wed Jun 7 06:29:03 2006 UTC (18 years ago) by otto
Branch: MAIN
Changes since 1.70: +3 -1 lines
Diff to previous 1.70 (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.70 / (download) - annotate - [select for diffs], Sun Jun 4 18:58:13 2006 UTC (18 years ago) by otto
Branch: MAIN
Changes since 1.69: +2 -2 lines
Diff to previous 1.69 (colored)

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

Revision 1.69 / (download) - annotate - [select for diffs], Sun May 28 20:39:16 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.68: +4 -1 lines
Diff to previous 1.68 (colored)

allow for weight to be added to sensors or servers, so that one can
weight timedelta sensors higher than ntp peers, for example
ok deraadt mbalmer

Revision 1.68 / (download) - annotate - [select for diffs], Sun May 28 18:47:25 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.67: +2 -3 lines
Diff to previous 1.67 (colored)

let sensor_query handle removals itself

Revision 1.67 / (download) - annotate - [select for diffs], Sat May 27 22:22:47 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.66: +3 -3 lines
Diff to previous 1.66 (colored)

stop passing the config around all time, just store one copy

Revision 1.66 / (download) - annotate - [select for diffs], Sat May 27 21:27:34 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.65: +3 -1 lines
Diff to previous 1.65 (colored)

make ntpd listen on the hotplug socket and decode yadda yadda, because
new sensors showing up will be announced that way when slacking ml comes
back from food

Revision 1.65 / (download) - annotate - [select for diffs], Sat May 27 18:32:00 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.64: +1 -0 lines
Diff to previous 1.64 (colored)

scan for new timedelta sensors every five minutes for now, ok deraadt

Revision 1.64 / (download) - annotate - [select for diffs], Sat May 27 17:01:07 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.63: +19 -12 lines
Diff to previous 1.63 (colored)

config file bits for timedelta sensors, so one can specify which devices
to use. "sensors *" just uses all. untested due to lack of hardware.
hacked on the road somewhere between vancouver and calgary

Revision 1.63 / (download) - annotate - [select for diffs], Fri May 26 00:33:16 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.62: +19 -1 lines
Diff to previous 1.62 (colored)

add support for timedelta sensors, which pretty much means udcf(4) right
now. untested due to lack of hardware, and it wouldn't have worked in the
plane anyways. work in progress, currently picks up and uses all sensors
it finds, config file bits to be added soon. theo fine with this going in

Revision 1.62 / (download) - annotate - [select for diffs], Thu May 25 19:25:46 2006 UTC (18 years ago) by henning
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (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.61 / (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.60: +2 -2 lines
Diff to previous 1.60 (colored)

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

Revision 1.60 / (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.59: +2 -1 lines
Diff to previous 1.59 (colored)

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

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jul 15 03:37:15 2005 UTC (18 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

shrink read buffer size from 64k to 4k, this is not bgpd and we're dealing
with way less data

Revision 1.58 / (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.57: +2 -1 lines
Diff to previous 1.57 (colored)

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

Revision 1.57 / (download) - annotate - [select for diffs], Sun Jun 19 17:11:13 2005 UTC (18 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.56: +2 -1 lines
Diff to previous 1.56 (colored)

use a #define for the time to wait on -s and clarify a log msg

Revision 1.56 / (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.55: +4 -1 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Tue Apr 26 15:18:22 2005 UTC (19 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored)

unify shared code a bit again to make future syncs easier
From: Alexander von Gernler <grunk@pestilenz.org>

Revision 1.54 / (download) - annotate - [select for diffs], Wed Mar 23 10:42:04 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

wpos in struct buf_read and datalen in imsg_get should be size_t and not
ssize_t
From: Alexander von Gernler <grunk@pestilenz.org>

Revision 1.53 / (download) - annotate - [select for diffs], Thu Feb 3 10:53:33 2005 UTC (19 years, 4 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.52: +3 -1 lines
Diff to previous 1.52 (colored)

Implement simple duplicate suppression of peer errors; ok henning@

Revision 1.52 / (download) - annotate - [select for diffs], Wed Feb 2 18:57:09 2005 UTC (19 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.51: +6 -6 lines
Diff to previous 1.51 (colored)

buffer structs and API ssize_t -> size_t; from bgpd

Revision 1.51 / (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.50: +1 -2 lines
Diff to previous 1.50 (colored)

Simplify interval scaling and randomize query intervals; ok henning@

Revision 1.50 / (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.49: +6 -2 lines
Diff to previous 1.49 (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.49 / (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.48: +3 -1 lines
Diff to previous 1.48 (colored)

Delay before retrying a query on timeout; ok henning@

Revision 1.48 / (download) - annotate - [select for diffs], Thu Dec 16 00:38:59 2004 UTC (19 years, 5 months ago) by dtucker
Branch: MAIN
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored)

Limit the number of addresses used by the 'servers' directive to 8; 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 -1 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], Mon Dec 6 20:57:17 2004 UTC (19 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.45: +2 -1 lines
Diff to previous 1.45 (colored)

do not log tiny local clock drifts; w/ help from Joerg Sonnenberger <joerg@britannica.bec.de>; henning@ ok

Revision 1.45 / (download) - annotate - [select for diffs], Mon Dec 6 16:52:33 2004 UTC (19 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.44: +14 -14 lines
Diff to previous 1.44 (colored)

ensure the most excellent alignment in the structs; henning@ ok

Revision 1.44 / (download) - annotate - [select for diffs], Fri Nov 12 17:24:52 2004 UTC (19 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.43: +2 -1 lines
Diff to previous 1.43 (colored)

some missing includes, from Joerg Sonnenberger <joerg@britannica.bec.de>

Revision 1.43 / (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.42: +4 -4 lines
Diff to previous 1.42 (colored)

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

Revision 1.42 / (download) - annotate - [select for diffs], Wed Nov 10 11:27:54 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

const'ify conffile
From: Joerg Sonnenberger <joerg@britannica.bec.de>

Revision 1.41 / (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.40: +2 -1 lines
Diff to previous 1.40 (colored)

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

Revision 1.40 / (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.39: +3 -1 lines
Diff to previous 1.39 (colored)

Have ntpd use IPTOS_LOWDELAY; ok henning@

Revision 1.39 / (download) - annotate - [select for diffs], Sat Sep 18 20:27:57 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

don't call settimeofday() when the offset is smaller than 180 seconds,
adjtime() will fix that fast enough, from discussion in theo's living room
ok mcbride beck

Revision 1.38 / (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.37: +6 -3 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Sat Sep 18 07:33:14 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.36: +1 -3 lines
Diff to previous 1.36 (colored)

do not bother overallocating and shrinking the pfd and idx2peer arrays,
doesn't by us anything. discussed with ryan during dinner at original joe's

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

the "type" param to imsg_compose and imsg_create is really an
enum imsg_type and not an int

Revision 1.35 / (download) - annotate - [select for diffs], Wed Sep 15 19:21:25 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.34: +5 -5 lines
Diff to previous 1.34 (colored)

imsg framework cleanup:
-kill the _pid flavors of imsg_create and imsg_compose, and just add pid as
argument to those
-use imsg_create in imsg_compose instead of duplicating code
-check for datalen overflow

Revision 1.34 / (download) - annotate - [select for diffs], Wed Sep 15 00:18:12 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.33: +1 -2 lines
Diff to previous 1.33 (colored)

remove the unused variable/macro code, ok theo

Revision 1.33 / (download) - annotate - [select for diffs], Thu Aug 12 16:33:59 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.32: +5 -2 lines
Diff to previous 1.32 (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.32 / (download) - annotate - [select for diffs], Tue Aug 10 12:41:15 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.31: +4 -3 lines
Diff to previous 1.31 (colored)

move memory allocation for new peers into a new function, makes ID allocation
easier

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jul 29 11:01:48 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored)

keep an ID per server we talk to

Revision 1.30 / (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.29: +3 -2 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun Jul 25 18:27:58 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.28: +1 -2 lines
Diff to previous 1.28 (colored)

remove unused function

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: +8 -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 12:59:41 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.26: +3 -4 lines
Diff to previous 1.26 (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.26 / (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.25: +1 -2 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Tue Jul 13 19:41:26 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored)

Respond to client queries with better server statistics.  We now output
a close-to-reality stratum, a real reference time, and a leap indicator
that will indicate if the local clock isn't synchronized.

This also means that until the server feels it's synchronized, it will
tell the clients it isn't.  This is normal, and correct.

ok henning@

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: +18 -6 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 23:12:57 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.22: +8 -8 lines
Diff to previous 1.22 (colored)

KNF; ok henning@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 10 22:24:20 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.21: +3 -1 lines
Diff to previous 1.21 (colored)

short fixed point <-> double conversion routines; ok henning@

Revision 1.21 / (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.20: +6 -2 lines
Diff to previous 1.20 (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.20 / (download) - annotate - [select for diffs], Fri Jul 9 19:44:18 2004 UTC (19 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

make lint a wee bit happier

Revision 1.19 / (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.18: +4 -2 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Thu Jul 8 01:22:57 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

remove all handling of netmasks/prefix lengths - we don't need that in ntpd.
fixes the dns resolves to v4 and v6 addresses bug found by phessler
hacked on the Calgary->Montreal flight that proved that Air Canada _does_
have some modern aircrafts with good seats

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

* Convert to use the new double-based time handling functions.
* Respond to the query with a reasonable received time (which
  will help clients get better accuracy).
* Consolidate the server response code in preparation for a
  completely 'proper' response to the client.

tips and ok from henning@

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

do not listen anywhere by default.
listen on *
listens, well, everywhere.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 7 03:15:37 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.14: +8 -3 lines
Diff to previous 1.14 (colored)

swicth all the host_* functions to work on a newly invented
struct ntp_addr, which just wraps a sockaddr_storage and a next pointer,
so that host_dns can return more than one entry.
let host_dns do exactly that, return a list of all IPs for that hostname
adjust all callers in the grammar to cope with that

Revision 1.14 / (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.13: +12 -4 lines
Diff to previous 1.13 (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.13 / (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.12: +11 -4 lines
Diff to previous 1.12 (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.12 / (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.11: +8 -5 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Mon Jul 5 20:41:35 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

delay, not error

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jul 5 07:46:16 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.9: +5 -2 lines
Diff to previous 1.9 (colored)

calculate the median offset from all servers we sync to and call
adjtime() when necessary to keep the local clock in sync
yes, that means ntpd syncs the local clock now.

Revision 1.9 / (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.8: +6 -3 lines
Diff to previous 1.8 (colored)

put interval defines in ntpd.h and name them consistently

Revision 1.8 / (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.7: +8 -1 lines
Diff to previous 1.7 (colored)

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

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 18 04:51:31 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.6: +5 -3 lines
Diff to previous 1.6 (colored)

size struct pollfd and idx2peer dynamically instead of imposing an arbitary
limit on OPEN_MAX, modeled after bgpd

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jun 17 19:17:48 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.5: +23 -1 lines
Diff to previous 1.5 (colored)

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...

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jun 5 12:29:15 2004 UTC (20 years ago) by alexander
Branch: MAIN
Changes since 1.4: +11 -1 lines
Diff to previous 1.4 (colored)

Move prototype definitions.  Add multi-include protection to header.

ok henning@

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jun 2 10:08:59 2004 UTC (20 years ago) by henning
Branch: MAIN
Changes since 1.3: +3 -1 lines
Diff to previous 1.3 (colored)

prepare for client functionality

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jun 1 21:58:09 2004 UTC (20 years ago) by henning
Branch: MAIN
Changes since 1.2: +13 -1 lines
Diff to previous 1.2 (colored)

first cut at config file parser
for now, one can set the addresses to listen on

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 1 16:27:09 2004 UTC (20 years ago) by henning
Branch: MAIN
Changes since 1.1: +12 -2 lines
Diff to previous 1.1 (colored)

allow ntpd to listen on nearly arbitary number of sockets (OPEN_MAX - 1 atm).
default to one IPv4 wildcard and one IPv6 wildcard one.

Revision 1.1 / (download) - annotate - [select for diffs], Mon May 31 13:46:16 2004 UTC (20 years ago) by henning
Branch: MAIN

initial cut at ntpd.
it is just capable of answering (s)ntp4 requests with the local time
for now.
imsg/buffer and logging framework from bgpd, ntp protocol hackery
with Alexander Guy

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.