summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
AgeCommit message (Collapse)Author
3 daysConvert simple stuff in usr.sbin over to new imsgbuf_init behaviourClaudio Jeker
OK tb@
3 daysUnify error reporting in various control programs.Claudio Jeker
Just use "read error" since the code also uses "write error" for the imsg_flush case. OK tb@
3 daysTry to handle the dumpster fire called constraint.c a bit better.Claudio Jeker
The imsg handling in here is not quite right. It works but more by luck. - use imsgbuf_read_one (similar code as found in a few other places) to read the one message we expect. - do not call imsgbuf_flush() without a child running to read the data. With large enough requests imsgbuf_flush() may be locked forever since there is no reader on the other side of the pipe. OK tb@
3 daysSimple bits of converting ntpd over to the new imsgbuf_read behaviour.Claudio Jeker
OK tb@
3 daysUse imsgbuf_queuelen() instead of accessing the w.queue member.Claudio Jeker
OK tb@
3 daysUse imsgbuf_clear() where appropriate instead of msgbuf_clear().Claudio Jeker
OK tb@
3 daysRename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flush toClaudio Jeker
imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush. This separates the imsgbuf API from the per-imsg API. OK tb@
3 daysConvert imsg_write() callers to the new simplified return logic.Claudio Jeker
OK tb@
3 daysIntroduce imsg_write() and use it instead of msgbuf_write().Claudio Jeker
imsg_write() is just a thin wrapper around msgbuf_write(). So this is mostly search and replace. OK tb@
3 daysUse imsg_flush() instead of implementing the same by hand.Claudio Jeker
OK tb@
11 daysTake into account how long the dns probe takes before decding toOtto Moerbeek
punt. A single res_query() call can return immediately (e.g. success or the nameservers are unreachable), or take quite some time, depending on how many nameservers are configured. So measure the actual time it takes and decide wat to do based on that. Early version from beck@; ok claudio@ deraadt@
2024-05-21remove prototypes with no matching function and externs with no varJonathan Gray
partly checked by millert@
2024-04-23correct indentation; no functional changeJonathan Gray
ok tb@
2024-02-21DNS resolution is best effort; if at this time IP addresses for tickersTheo de Raadt
cannot be resolved, don't spam syslog like crazy. Change the "DNS lookup tmpfail" message into a log_debug() ok millert
2024-02-08correct size in ipv6 address comparisonJonathan Gray
found by "'&a->sin6_addr' too small (16 vs 28)" smatch error ok jca@
2023-12-20introduce log_ntp_addr() and use it where applicable, avoids a nullOtto Moerbeek
pointer deref in constraint.c reported by bluhm@; ok millert@
2023-12-06Periodically reset constraint DNS info for constraints that failedOtto Moerbeek
to reply; ok florian@
2023-11-19util.c requires stdint.h for UINT32_MAX and friends.Claudio Jeker
OK tb@
2023-11-15Correct denominators when converting NTP fixed point values to doubleOtto Moerbeek
and vice-versa; ok tb@
2023-04-19remove duplicate includesJonathan Gray
2023-03-02improve the Nd lines such that the format is consistent for theJason McIntyre
various *d, *conf, *ctl files (where relevant) and simple; also makes "man -k routing" more useful; help from claudio and florian ok claudio florian millert
2022-11-27Once we are synced, we can validate the certificate in the standard way.Otto Moerbeek
ok tb@
2022-11-06typo: wlll -> willAntoine Jacoutot
2022-11-06Reintroduce snippet describing startup behaviour to where it belongs. ok jmc@Otto Moerbeek
2022-11-06remove the remnants of the old -s option, which was left stranded with poor,Jason McIntyre
innocent -n; noticed by indivc on misc@
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2022-03-24Plus a small leak found by jmatthew; ok millert@Otto Moerbeek
2022-01-07If no date could be parsed, bail out early and fix an error return thatOtto Moerbeek
leaked; ok florian@
2021-12-13including sys/cdefs.h manually started as a result of netbsd trying toTheo de Raadt
macro-build a replacement for sccsid, and was done without any concern for namespace damage. Unfortunately this practice started infecting other code as others were unaware they didn't need the file. ok millert guenther
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
2021-10-15Don't declare variables as "unsigned char *" that are passed toChristian Weisgerber
functions that take "char *" arguments. Where such chars are assigned to int or passed to ctype functions, explicitly cast them to unsigned char. For OpenBSD's clang, -Wpointer-sign has been disabled by default, but when the parse.y code was built elsewhere, the compiler would complain. With help from millert@ ok benno@ deraadt@
2021-07-16main proc doesn't speak with sockets during the main loop and setpriority plusRicardo Mestre
chroot (and privdrop) in the child procs at this point are all set and done so pledge("inet id") promises are not required anymore. analysis and OK @kn
2021-07-16/etc/ssl/cert.pem is loaded into mem with tls_load_file(3) on local functionRicardo Mestre
priv_constraint_child() which is called before we reach pledge(2), therefore we we don't need to unveil(2) that file nor having pledge("rpath") since it was only required to read that same file. OK kn@
2021-07-16Remove unneeded call to tls_init(3)kn
As per the manual and lib/libtls/tls.c revision 1.79 from 2018 "Automatically handle library initialisation for libtls." initialisation is handled automatically by other tls_*(3) functions. Remove the tls_init() call to not give the impression of it being needed. Feedback tb OK Tests mestre
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-04-21Improve ntpd offset handling. Call the index of the offset loopsAlexander Bluhm
"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@
2021-03-18Remove duplicate prototype.Alexander Bluhm
2021-03-18The ntpd client code corrects both T1 and T4 with the current offsetAlexander Bluhm
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@
2021-01-06double word fix; from sean daviesJason McIntyre
2020-09-11If we get messages but they are not ntp replies (e.g. caused byOtto Moerbeek
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@
2020-08-30If no replies are received for a while due to connectivity issuesOtto Moerbeek
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
2020-06-22When the main process exits, it closes the pipe so a read 0 occurs.Otto Moerbeek
Move log level to debug for that case and while there correct the string, we're reding, not writing.
2020-05-16list example files in FILES with a short description: generally, "ExampleJason McIntyre
configuration file.", but occasionally something else fit better; at the same time, try to make the format for FILES more consistent; original diff from clematis
2020-04-12If all addresses are numeric no use for dns probe; ok florian@ sthen@Otto Moerbeek
2020-04-11Zap double definition of conf and make ibuf_dns static to avoid doubleOtto Moerbeek
definition; from Michael Forney
2020-02-20Typo in log messageOtto Moerbeek
2020-02-12If constraints are configured but do not work for whatever reason ntpdOtto Moerbeek
does not work. Make that more clear in the log and ntpdctl -s status. report by and ok benno@
2020-02-12Standardize argument naming for "sourceaddr" and unify the wording a bit,Ingo Schwarze
similar to what deraadt@ recently did in other manual pages.
2020-02-10briefly mention /etc/examples/ in the FILES section of all theIngo Schwarze
manual pages that document the corresponding configuration files; OK jmc@, and general direction discussed with many
2020-01-30Properly determine era 0 or era 1, making it possible to move pastOtto Moerbeek
the ntp timestamp wrapping in 2036.