OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.28 / (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.27: +9 -1 lines
Diff to previous 1.27 (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.27 / (download) - annotate - [select for diffs], Sun Nov 19 10:41:25 2023 UTC (6 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.26: +2 -1 lines
Diff to previous 1.26 (colored)

util.c requires stdint.h for UINT32_MAX and friends.
OK tb@

Revision 1.26 / (download) - annotate - [select for diffs], Wed Nov 15 15:52:09 2023 UTC (6 months, 3 weeks ago) by otto
Branch: MAIN
Changes since 1.25: +5 -5 lines
Diff to previous 1.25 (colored)

Correct denominators when converting NTP fixed point values to double
and vice-versa; ok tb@

Revision 1.25 / (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_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, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.24: +10 -3 lines
Diff to previous 1.24 (colored)

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

Revision 1.24 / (download) - annotate - [select for diffs], Wed Mar 1 00:56:30 2017 UTC (7 years, 3 months ago) by gsoares
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, 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, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

*nargv[] holds an array of pointers, so it should be
terminated by a null pointer.

ok rzalamena@ reyk@

Revision 1.23 / (download) - annotate - [select for diffs], Mon Oct 3 12:30:43 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.22: +7 -2 lines
Diff to previous 1.22 (colored)

Fix a possible bug that will happen with dup2() when oldd == newd. In that
case the dup2() would fail silently and the descriptor would remain with
the CLOEXEC flag causing the exec*()d child process to have unexpected
behavior.

ok guenther@

Revision 1.22 / (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.21: +80 -1 lines
Diff to previous 1.21 (colored)

Teach ntpd(8) how to fork+exec.

ok reyk@, bcook@

Revision 1.21 / (download) - annotate - [select for diffs], Wed Sep 14 08:24:08 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.20: +4 -4 lines
Diff to previous 1.20 (colored)

Fix copyright disclaimer in util.c.

OK from the original author Alexander Guy

Revision 1.20 / (download) - annotate - [select for diffs], Sat Dec 19 13:58:08 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.19: +13 -1 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Sat Mar 28 03:49:01 2015 UTC (9 years, 2 months ago) by bcook
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.18: +6 -3 lines
Diff to previous 1.18 (colored)

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

Original fix from Romuald Delavergne. ok henning@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Feb 10 11:46:39 2015 UTC (9 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

spacing

Revision 1.17 / (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.16: +7 -1 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Sun Jan 4 01:11:24 2015 UTC (9 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Add a missing include for time.h to get the definitions of clock_gettime and strftime.

ok jsing@ phessler@ naddy@

Revision 1.15 / (download) - annotate - [select for diffs], Tue Oct 15 20:35:55 2013 UTC (10 years, 7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Remove stray (long) cast of value being assigned to tv_secs.

ok guenther@

Revision 1.14 / (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_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.13: +14 -1 lines
Diff to previous 1.13 (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.13 / (download) - annotate - [select for diffs], Tue Mar 27 18:22:02 2007 UTC (17 years, 2 months ago) by otto
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, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.12: +5 -1 lines
Diff to previous 1.12 (colored)

Normalize tv so that tv_usec is positive. The kernel also normalizes,
but this might increase portability since some other systems do not
grok negative tv_usec well. ok henning@

Revision 1.12 / (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.11: +12 -1 lines
Diff to previous 1.11 (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.11 / (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.10: +16 -1 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Wed Dec 8 15:47:38 2004 UTC (19 years, 6 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.9: +11 -11 lines
Diff to previous 1.9 (colored)

uniquely name members of s_fixedpt and l_fixedpt; henning@ ok

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

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

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

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

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jul 7 07:38:21 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

help the compiler a bit with a cast, spotted by theo

Revision 1.6 / (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.5: +2 -2 lines
Diff to previous 1.5 (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.5 / (download) - annotate - [select for diffs], Wed Jul 7 07:16:16 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Endian conversion mistakenly done before fraction math; ok henning@

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jul 5 19:53:21 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

use correct multiplier for us -> s conversion

Revision 1.3 / (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.2: +9 -1 lines
Diff to previous 1.2 (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.2 / (download) - annotate - [select for diffs], Sun Jul 4 18:07:15 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.1: +6 -9 lines
Diff to previous 1.1 (colored)

KNF

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jul 4 11:01:49 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN

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

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.