Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • selsky/ntpsec
  • armbiant/gnome-ntpsec
  • smallm/ntpsec
  • devicenull/ntpsec
  • paelzer/ntpsec
  • mvangund/ntpsec
  • fe051/ntpsec
  • ollie314/ntpsec
  • rlaager/ntpsec
  • fhgwright/ntpsec
  • phirephly/ntpsec
  • Omnifarious/ntpsec
  • ghane/ntpsec
  • antranigv/ntpsec
  • pakarsolusitelematika/ntpsec
  • ianbruene/ntpsec
  • wingel/ntpsec
  • katyaBeck/ntpsec
  • akumiszcza/ntpsec
  • rouing/ntpsec
  • NTPsec/ntpsec
  • mlichvar/ntpsec
  • ktims/ntpsec
  • fararano.kevin/ntpsec
  • phillipcharleshart/ntpsec
  • SPACE001/ntpsec
  • thomasdstewart/ntpsec
  • testsleeek/ntpsec
  • NeatNerdPrime/ntpsec
  • marcinbrodowski35/ntpsec
  • AbbasDev/ntpsec
  • jurgen.xhelo/ntpsec
  • Wan10/ntpsec
  • BrnoPCmaniak/ntpsec
  • anastrophe/ntpsec
  • georgyo/ntpsec
  • mikie.simpson/ntpsec
  • OptimalRanging/ntpsec
  • toofishes/ntpsec
  • Jandrusk/ntpsec
  • sdwalker/ntpsec
  • mnordhoff/ntpsec
  • cjmayo/ntpsec
  • micromax/ntpsec
  • tychotithonus/ntpsec
  • ddrown/ntpsec
  • brendanbank/ntpsec
  • jh23453/ntpsec
  • samifarin/ntpsec
  • miller24joseph/ntpsec
  • AZDNice/ntpsec
  • lnceballos/ntpsec
  • gabriel-ku/ntpsec
  • psreport/ntpsec
  • thesamesam/ntpsec
  • alexk7/ntpsec
  • RRZEFox/ntpsec
  • m_by/ntpsec
  • jameshilliard/ntpsec
  • daemoneye/ntpsec
  • xgerault/ntpsec
  • permanent-vacations/ntpsec
  • o.zeynalpour/ntpsec
  • ravi.love.nippy/ntpsec
  • jhamlin96/ntpsec
  • abaehr/ntpsec
  • accidentallythecable-public/forks/ntpsec
  • james.jstroud/ntpsec
  • youwt19821020/ntpsec-no-root
  • jamesb_fe80/ntpsec
  • demsjf8/ntpsec
  • yegorich/ntpsec
  • 1963bib/ntpsec
  • armbiant/gnome-ntp
  • chucalu/ntpsec
  • folkertvanheusden/ntpsec
  • mktyler/ntpsec
  • 19bcs2794/ntpsec
  • LOCNNIL/ntpsec
  • lifeofguenter/ntpsec
  • trv-n/ntpsec-trimble-3
  • szepeviktor/ntpsec
  • lightswitch05/ntpsec
  • m_msft/ntpsec
84 results
Show changes
Commits on Source (6)
......@@ -12,6 +12,23 @@ on user-visible changes.
== Repository Head ==
Remove --build-epoch and replace it with arbitrary --build-desc text.
Passing '--build-desc=$(date -u +%Y-%m-%dT%H:%M:%Sz)' restores the previous
default extended version.
The build epoch has been replaced with a hardcoded timestamp which will be
manually updated every nine years or so (approx 512w). This makes the
binaries reproducible by default.
Compare versions of ntp.ntpc and libntpc printing a warning is
mismatched. Fix libntpc install path if using it.
Reduce maxclocks to 5 to reduce the NTP pool load.
Print LIBDIR during ./waf configure.
Documentation, new GPG key, and miscellaneous cleanups.
== 2020-10-06: 1.2.0 ==
The minor version bump is to indicate official official support of
......@@ -22,7 +39,7 @@ On this day in 1783, Benjamin Hanks received a patent for a
self-winding clock he planned to install in the Old Dutch Church in
Kingston, New York, supposedly making it the first public clock in
what became the New York City metropolitan area.
NTS-KE client now defaults to port 4460.
NTS-KE server now listens on port 4460.
......
......@@ -497,17 +497,13 @@ C was the minor. They also use release-candidate suffixes.
== Version string
We use the BUILD_EPOCH as described in packaging/packaging.adoc for
the timestamp (converted to RFC 3339 format) part of the version
string reported in ntpd and other binaries.
Release builds have version strings of the form:
<base version number> <BUILD_EPOCH in RFC 3339 format>
<base version number><trim()d --build-desc with a prepended space>
Development builds have version strings of the form:
<base version number>+ <BUILD_EPOCH in RFC 3339 format> (git rev <git shorthash>)
<base version number>+<commits since last tag>-g<git short hash><conditional '-dirty'> <trim()d --build-desc with a prepended space>
== Contribution workflow and conventions
......@@ -812,6 +808,6 @@ cat > ~/.gitconfig
^D
-------------------------------------------------------------
.
.
//end
......@@ -38,7 +38,7 @@ ntpcal_get_build_date(
struct calendar * jd
)
{
time_t epoch = (time_t)BUILD_EPOCH;
time_t epoch = (time_t)1577836800; // 2020 Jan 01 -> 1863820800 - 2029 Jan 23
struct tm epoch_tm;
ZERO(*jd);
......
......@@ -70,7 +70,7 @@ class Ntpq(cmd.Cmd):
# so I am leaving them, and possibly duplicating them.
self.rawmode = False # Flag which indicates raw mode output.
self.directmode = False # Flag for direct MRU output.
self.showhostnames = 1 # If & 1 false, display numeric IPs
self.showhostnames = 1 # If & 1, display names
self.showunits = False # If False, show old style float
self.auth_delay = 20 # delay time (default 20msec)
self.wideremote = False # show wide remote names?
......@@ -441,7 +441,7 @@ usage: timeout [ msec ]
value = queried[name][0]
rawvalue = queried[name][1]
if fmt in (NTP_ADD, NTP_ADP):
if self.showhostnames[0]:
if self.showhostnames & 1: # if & 1, display names
if self.debug:
self.say("DNS lookup begins...")
value = ntp.util.canonicalize_dns(
......
......@@ -1295,7 +1295,7 @@ def local_offset_multiplot(statlist):
plot = NTPViz.Common + '''\
set terminal %(terminal)s size %(size)s
set title "Multiplot Local Clock Offsets"
set ytics format "%1.2f μs" nomirror textcolor rgb "#0060ad"
set ytics format "%%1.2f μs" nomirror textcolor rgb "#0060ad"
set key bottom right box
plot \\
''' % out
......@@ -1311,7 +1311,7 @@ plot \\
for stats in statlist:
# speed up by only sending gnuplot the data it will actually use
# fields: time, offset
pt = NTPViz.plot_slice(stats.loopstats, 2)
pt = stats.plot_slice(stats.loopstats, 2)
plot_data += pt[0]
ret = {'html': '', 'stats': []}
......
......@@ -18,9 +18,9 @@ pool group of its own. This may change in the future.
Many tools (actually, almost everything except the core daemon itself)
have been moved from C to Python. This is an important step for
improving maintainability and reducing attack surface. However, we
know that some platforms cannot support Python or choose not to
include it in their core configuration.
improving maintainability and reducing the attack surface. However,
we know that some platforms cannot support Python or choose not
to include it in their core configuration.
For these platforms, we recommend using cx_Freeze to render the NTPsec
Python programs, and all their imported modules, into standalone files.
......@@ -35,7 +35,7 @@ can install it with pip like this:
```
pip install cx_Freeze
````
```
You may find that you also need to install the package 'patchelf'.
......@@ -58,54 +58,43 @@ binaries created by cx_freeze.
== Hacking Python shebangs
The shebang lines in our Python scripts point to "python". Part of
our standard tests check that you can change that to "python3" without
breaking anything.
We are aware that the Python 3 transition is well advanced. We are
also aware that PEP394 strongly urges all distributors to point
'python' at Python 2.
The shebang lines in our Python scripts point to the value of
--pyshebang (default "python"). Part of our standard development tests
check that you can change that to "python3" without breaking anything.
This leaves us with a choice to either (a) change the shebangs to
python3 ourselves, causing breakage to users stuck with Python 2
and installing from source, or (b) not change them, leaving it up
to distro maintainers to hack them in whatever way is appropriate for
their distro's Python policy.
We think the choice that minimizes overall pain, and directs it to
the party best able to cope, is clear. We choose (b).
We are aware that the Python 3 transition is well advanced. We are also
aware that PEP394 strongly urges all distributors to point 'python' at
Python 2.
== Cross-era interoperability in modular calendar arithmetic
The protocol necessarily uses time/date stamps of finite length in
order to fit into fixed-size fields; they happen to have a 136-year
cycle, but the problems this produces aren't dependent on the specific
cycle length. Thus, each instance of ntpd speaks time based on a
specific epoch (cycle start date). The epoch of era 0 was at the
beginning of 1900; the epoch of era 1 will be in 2036.
The protocol necessarily uses time/date stamps of finite length
to fit into fixed-size fields; they happen to have a 136-year cycle, but
the problems this produces aren't dependent on the specific cycle
length. Thus, each instance of ntpd speaks time based on a specific
epoch (cycle start date). The epoch of era 0 was at the beginning of
1900; the epoch of era 1 will be in 2036.
Two instances talking to each other have no way to know that they're
based in the same era. To mitigate this problem, each instance
has a pivot date and resolves incoming timestamps to the era that
minimizes distance between now and the timestamp. This procedure
is part of the core protocol specification.
An instance's pivot time is constructed from BUILD_EPOCH defined at
configure time in config.h. If BUILD_EPOCH is set to a known time
then the binaries are reproducible. By default the BUILD_EPOCH is the
time when the last './waf configure' was run. You can override the
BUILD_EPOCH with './waf configure --build-epoch' or using the SOURCE_DATE_EPOCH
environment variable.
based in the same era. To mitigate this problem, each instance has a
pivot date and resolves incoming timestamps to the era that minimizes
the distance between now and the timestamp. This procedure is part of the
core protocol specification.
An instance's pivot time is constructed from a hardcoded timestamp
in the source code. This is also used to disambiguate the current
GPS era. This number should be updated every nine years or so (approx
512w). This should make the binaries reproducible.
More information on reproducible builds is at:
https://reproducible-builds.org/[https://reproducible-builds.org/]
== Disambiguation of NMEA dates
Due to bad design of NMEA0183, the reporting protocol used by many GPS
sensors, the NMEA driver in NTPsec sometimes has to make an assumption
about what century it is. Choice of a base-century hits the same
issues; so here the year derived from the BUILD_EPOCH is also used. The
Due to the bad design of NMEA0183, the reporting protocol used by many GPS
sensors, the NMEA driver in NTPsec sometimes has to assume
what century it is. Choice of a base-century hits the same
issues, so here the year derived from a hardcoded timestamp. The
alternative - trusting the system clock to report the right century -
could produce very bad behavior near century boundaries, and also on
cold-start of systems without an RTC.
......
......@@ -44,9 +44,9 @@ def _dlo(paths):
try:
lib = ctypes.CDLL(ntpc_path, use_errno=True)
wrap_version = "@NTPSEC_VERSION_EXTENDED@"
clib_version = ctypes.c_char_p.in_dll(lib, 'version').value
clib_version = ntp.poly.polystr(ctypes.c_char_p.in_dll(lib, 'version').value)
if clib_version != wrap_version:
sys.stderr.write("ntp.ntpc wrong version %s !== %s" % (clib_version, wrap_version))
sys.stderr.write("ntp.ntpc wrong version '%s' != '%s'\n" % (clib_version, wrap_version))
return lib
except OSError:
pass
......
......@@ -1233,7 +1233,7 @@ class MRUSummary:
self.debug = debug
self.logfp = logfp
self.now = None
self.showhostnames = showhostnames # If not [0], display numeric IPs
self.showhostnames = showhostnames # if & 1, display names
self.wideremote = wideremote
header = " lstint avgint rstr r m v count score drop rport remote address"
......@@ -1269,7 +1269,7 @@ class MRUSummary:
rscode = '.'
(ip, port) = portsplit(entry.addr)
try:
if not self.showhostnames & 1:
if not self.showhostnames & 1: # if not & 1 display numeric IPs
dns = ip
else:
dns = canonicalize_dns(ip)
......
......@@ -67,8 +67,8 @@ ext, ffi, or none. defaults to ffi.""", nargs=1)
grp.add_option('--cflags', type='string', action="callback",
callback=callback_flags,
help="Users should use CFLAGS in their environment.")
grp.add_option('--build-epoch', type='int', default=None,
help="Force epoch, or use SOURCE_DATE_EPOCH in environment")
grp.add_option('--build-desc', type='string', default="",
help="Arbitrary text string to append to extended version.")
grp.add_option('--ldflags', type='string', action="callback",
callback=callback_flags,
help="Users should use LDFLAGS in their environment.")
......
from __future__ import print_function
from waflib.Logs import pprint
from pylib.poly import polystr
def test_write_log(ctx):
......@@ -16,9 +17,9 @@ def test_write_log(ctx):
fp.write("BINARY : %s\n" % binary)
fp.write("RETURN VALUE: %s\n" % retval)
fp.write("\n*** stdout ***\n")
fp.write(str(lines))
fp.write(polystr(lines))
fp.write("\n*** stderr ***\n")
fp.write(str(error))
fp.write(polystr(error))
fp.write("\n\n\n")
pprint("BLUE", "Wrote test log to: ", file_out)
......
......@@ -173,40 +173,23 @@ def configure(ctx):
if os.path.exists(".git"):
ctx.find_program("git", var="BIN_GIT", mandatory=False)
source_date_epoch = os.getenv('SOURCE_DATE_EPOCH', None)
if ctx.options.build_epoch is not None:
build_epoch = ctx.options.build_epoch
ctx.define("BUILD_EPOCH", build_epoch, comment="Using --build-epoch")
elif source_date_epoch:
if not source_date_epoch.isdigit():
ctx.fatal("ERROR: malformed SOURCE_DATE_EPOCH")
build_epoch = int(source_date_epoch)
ctx.define("BUILD_EPOCH", build_epoch,
comment="Using SOURCE_DATE_EPOCH")
elif ctx.env.BIN_GIT:
cmd = ctx.env.BIN_GIT + shlex.split("log -1 --pretty=%ct")
build_epoch = int(ctx.cmd_and_log(cmd).strip())
ctx.define("BUILD_EPOCH", build_epoch, comment="last git commit")
else:
build_epoch = int(time.time())
ctx.define("BUILD_EPOCH", build_epoch, comment="Using default")
build_epoch_formatted = datetime.utcfromtimestamp(build_epoch).strftime(
"%Y-%m-%dT%H:%M:%SZ")
build_desc = ctx.options.build_desc.strip()
if build_desc:
build_desc = ' ' + build_desc
if ctx.env.BIN_GIT:
cmd = ctx.env.BIN_GIT + shlex.split("describe --dirty")
git_short_hash = ctx.cmd_and_log(cmd).strip()
git_short_hash = '-'.join(git_short_hash.split('-')[1:])
ctx.env.NTPSEC_VERSION = "%s+" % ntpsec_release
ctx.env.NTPSEC_VERSION_EXTENDED = ("%s+%s %s" %
ctx.env.NTPSEC_VERSION_EXTENDED = ("%s+%s%s" %
(ntpsec_release,
git_short_hash,
build_epoch_formatted))
build_desc))
else:
ctx.env.NTPSEC_VERSION = "%s" % ntpsec_release
ctx.env.NTPSEC_VERSION_EXTENDED = ("%s %s" % (ntpsec_release,
build_epoch_formatted))
ctx.env.NTPSEC_VERSION_EXTENDED = ("%s%s" % (ntpsec_release,
build_desc))
ctx.define("NTPSEC_VERSION", ctx.env.NTPSEC_VERSION)
ctx.define("NTPSEC_VERSION_EXTENDED", ctx.env.NTPSEC_VERSION_EXTENDED)
......