Commit graph

221 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 37efbbd821 meson: reindent all files with 8 spaces
The indentation for emacs'es meson-mode is added .dir-locals.

All files are reindented automatically, using the lasest meson-mode from git.
Indentation should now be fairly consistent.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 5c23128dab meson: build systemd using meson
It's crucial that we can build systemd using VS2010!

... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.

This is not complete, I'm throwing it out here for your amusement and critique.

- rules for sd-boot are missing. Those might be quite complicated.

- rules for tests are missing too. Those are probably quite simple and
  repetitive, but there's lots of them.

- it's likely that I didn't get all the conditions right, I only tested "full"
  compilation where most deps are provided and nothing is disabled.

- busname.target and all .busname units are skipped on purpose.

  Otherwise, installation into $DESTDIR has the same list of files and the
  autoconf install, except for .la files.

It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.

meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.

The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.

v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments

v3:
- drop required:true and fix progs/prog typo

v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute

v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components

v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
  hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.

v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
  ("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
  split-usr==true.

v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it

v9:
- indentation

v10:
- fix check for qrencode and libaudit

v11:
- unify handling of executable paths, provide options for all progs

  This makes the meson build behave slightly differently than the
  autoconf-based one, because we always first try to find the executable in the
  filesystem, and fall back to the default. I think different handling of
  loadkeys, setfont, and telinit was just a historical accident.

  In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
  In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
  but in Debian, those directories are not included in the path.

  C.f. https://github.com/mesonbuild/meson/issues/1576.

- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-23 21:47:26 -04:00
Yu Watanabe da4128543f tree-wide: fix wrong indent (#5757)
Fixes wrong indent introduced by the commit 43688c49d1.
2017-04-19 08:48:29 +02:00
Mike Gilbert c9f7b4d356 build-sys: add check for gperf lookup function signature (#5055)
gperf-3.1 generates lookup functions that take a size_t length
parameter instead of unsigned int. Test for this at configure time.

Fixes: https://github.com/systemd/systemd/issues/5039
2017-01-10 08:39:05 +01:00
akochetkov 5f36e3d303 timesyncd: clear ADJ_MAXERROR to keep STA_UNSYNC cleared after jump adjust (#4626)
NTP use jump adjust if system has incorrect time read from RTC during boot.
It is desireble to update RTC time as soon as NTP set correct system time.
Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
update finised. In that case RTC time wouldn't be updated within long time.
The commit makes RTC updates stable.

When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
in kernel. Sometimes the kernel is able to update RTC withing 1 second,
but sometimes it falied.
2016-11-11 18:50:46 +01:00
Zbigniew Jędrzejewski-Szmek 70887c5f29 tree-wide: add PRI_[NU]SEC, and use time format strings more 2016-11-07 22:49:09 -05:00
Zbigniew Jędrzejewski-Szmek 6b430fdb7c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
Zbigniew Jędrzejewski-Szmek 43688c49d1 tree-wide: rename config_parse_many to …_nulstr
In preparation for adding a version which takes a strv.
2016-09-16 10:32:03 -04:00
Martin Pitt 6369641d6f clock-util: make clock_is_localtime() testable and add initial tests
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's
NULL. This makes the function testable.

Add test-clock: initial test cases for some scenarios, using a temporary file.
This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime)
file.
2016-02-26 11:28:49 +01:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Zbigniew Jędrzejewski-Szmek baa33e79e3 timesyncd: use (void) to mark ignored value
CID #1325772.
2016-01-20 18:55:56 -05:00
Thomas Hindoe Paaboel Andersen 71d35b6b55 tree-wide: sort includes in *.h
This is a continuation of the previous include sort patch, which
only sorted for .c files.
2015-11-18 23:09:02 +01:00
Lennart Poettering 75eb615480 defs: rework CONF_DIRS_NULSTR() macro
The macro is generically useful for putting together search paths, hence
let's make it truly generic, by dropping the implicit ".d" appending it
does, and leave that to the caller. Also rename it from
CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about
dirs that way, but any kind of file system path.

Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to
_CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that
it's internal.
2015-11-10 17:31:31 +01:00
Michal Schmidt 6ff6f4d851 timesync: return negative errno from manager_adjust_clock() on error 2015-11-05 13:44:14 +01:00
Lennart Poettering a0f29c767a util-lib: move CONF_DIRS_NULSTR definition to def.h
After all, this is not some compiler or C magic, but something very
specific to how systemd works, hence let's move it into def.h, and out
of macro.h
2015-11-03 17:45:11 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 430f0182b7 src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → capability-util.[ch]
The files are named too generically, so that they might conflict with
the upstream project headers. Hence, let's add a "-util" suffix, to
clarify that this are just our utility headers and not any official
upstream headers.
2015-10-27 13:25:57 +01:00
Lennart Poettering f4f15635ec util-lib: move a number of fs operations into fs-util.[ch] 2015-10-27 13:25:56 +01:00
Susant Sahani 2e3c585472 timesysnd: port to extract_first_word 2015-10-27 09:12:04 +05:30
Lennart Poettering b1d4f8e154 util-lib: split out user/group/uid/gid calls into user-util.[ch] 2015-10-26 01:24:38 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering ac5b0c13d8 tree-wide: add more void casts for various syscall invocations 2015-10-19 23:07:18 +02:00
Lennart Poettering 12ca818ffd tree-wide: clean up log_syntax() usage
- Rely everywhere that we use abs() on the error code passed in anyway,
  thus don't need to explicitly negate what we pass in

- Never attach synthetic error number information to log messages. Only
  log about errors we *receive* with the error number we got there,
  don't log any synthetic error, that don#t even propagate, but just eat
  up.

- Be more careful with attaching exactly the error we get, instead of
  errno or unrelated errors randomly.

- Fix one occasion where the error number and line number got swapped.

- Make sure we never tape over OOM issues, or inability to resolve
  specifiers
2015-09-30 22:26:16 +02:00
Lennart Poettering aa36007ca1 timesyncd: fix how we print a PID 2015-09-11 18:31:49 +02:00
Kay Sievers b506d3141b timesyncd: remove RLIMIT_NPROC
NSS plugins might create additional threads. Remove the limit, we cannot
really make any assumptions here.
2015-07-31 15:33:49 +02:00
Kay Sievers 2c8849add4 build-sys: add all source files and no built files to the tar ball
This fully synchronizes the content of a "make dist" and a "git archive"
tar ball.

  http://lists.freedesktop.org/archives/systemd-devel/2015-June/033214.html
2015-06-23 12:43:15 +02:00
Lennart Poettering 72c0a2c255 everywhere: port everything to sigprocmask_many() and friends
This ports a lot of manual code over to sigprocmask_many() and friends.

Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.

Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly.
2015-06-15 20:13:23 +02:00
Lennart Poettering 2a1288ff89 util: introduce CMSG_FOREACH() macro and make use of it everywhere
It's only marginally shorter then the usual for() loop, but certainly
more readable.
2015-06-10 19:29:47 +02:00
Lennart Poettering 24882e06c1 util: split out signal-util.[ch] from util.[ch]
No functional changes.
2015-05-29 20:14:11 +02:00
Lennart Poettering 481b3f9e99 timesyncd: print an INFO log message when we successfully reached a time server 2015-04-08 20:14:04 +02:00
Shawn Landden 3b1c524154 add REMOTE_ADDR and REMOTE_PORT for Accept=yes 2015-03-10 09:00:27 -04:00
Zbigniew Jędrzejewski-Szmek e93549ef29 Do not advertise .d snippets over main config file
For daemons which have a main configuration file, there's
little reason for the administrator to use configuration snippets.
They are useful for packagers which need to override settings, but
we shouldn't advertise that as the main way of configuring those
services.

https://bugs.freedesktop.org/show_bug.cgi?id=89397
2015-03-03 19:10:21 -05:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Cristian Rodríguez 625b3b71c1 timesync: Use UINT64_C for OFFSET_1900_1970
So it matches what the comment says in both 32 and 64 bit systems.
2015-02-16 18:43:47 +01:00
Lennart Poettering a38d99451f Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"
This reverts commit d6d810fbf8.

It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw
sockets.
2015-02-12 11:45:39 +01:00
Cristian Rodríguez d6d810fbf8 tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC 2015-02-10 21:20:16 +01:00
Lennart Poettering 7e3254b3ba timesyncd: downgrade more log messages from LOG_INFO to LOG_DEBUG
https://bugs.freedesktop.org/show_bug.cgi?id=87505

Let's make timesyncd less chatty.
2015-02-04 17:06:39 +01:00
Lennart Poettering 7b5b3fc3ac timesyncd: reduce log chattiness a bit
Let's downgrade the statistics output from LOG_INFO to LOG_DEBUG.

https://bugs.freedesktop.org/show_bug.cgi?id=88926
2015-02-04 14:46:40 +01:00
Lennart Poettering 7e26029ff3 timesyncd: set RLIMIT_NPROC to 2
This way timesyncd cannot be used to fork().

Note that it generally is not safe to use RLIMIT_NPROC, since it breaks
running the same daemon in multiple containers if they do not use user
namespacing. However, timesyncd is excepted from running in a container
anyway, hence it is safe in this case.
2015-01-27 02:33:46 +01:00
Topi Miettinen 43fcd650e5 timesyncd: consider too long packets as invalid
If the received NTP message from server didn't fit to our buffer, either
it is doing something nasty or we don't know the protocol. Consider the
packet as invalid.

(David: add parantheses around conditional)
2015-01-18 21:42:00 +01:00
Cristian Rodríguez fa66b606b1 timesync: remove square(), use pow instead
In any case, the compiler generates the same code inline and never
actually calls the library function.
2014-12-25 10:55:41 -05:00
Lennart Poettering f89c4e15c9 timesyncd: minor simplification 2014-11-30 22:58:55 +01:00
Josh Triplett be795898c0 timesyncd: Support timesyncd.conf.d directories in the usual search paths 2014-11-29 13:55:32 -05:00
Michal Schmidt 4a62c710b6 treewide: another round of simplifications
Using the same scripts as in f647962d64 "treewide: yet more log_*_errno
+ return simplifications".
2014-11-28 19:57:32 +01:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt f647962d64 treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
 'local $/;
  local $_=<>;
  s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
  print;'
 $f
done

And a couple of manual whitespace fixups.
2014-11-28 18:56:16 +01:00
Michal Schmidt ff49bc3212 treewide: drop unnecessary trailing \n in log_*() calls 2014-11-28 14:26:31 +01:00
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Sean Young 7b6288914b timesyncd: do not keep listening socket open forever
This also makes the source port less predicatable.
2014-11-27 00:24:52 -05:00
Lennart Poettering 69f0081748 timesyncd: the IP_TOS sockopt is really just an optimization, we shouldn't fail if we can't set it
This partially undos 2f905e821e
2014-10-24 18:32:30 +02:00
Ronny Chevalier e4746b5738 util: avoid duplication of TIME_T_MAX 2014-10-21 00:38:30 +02:00
Tom Gundersen 2f905e821e timesyncd: check return of setting IP_TOS
Fonud by Coverity. Fixes CID #1237534.
2014-09-18 23:37:07 +02:00
Kay Sievers ab4df227d4 Revert "timesyncd: remove retry_timer logic which is covered by the server timeout"
This reverts commit 665c6a9eab.

On Tue, Sep 2, 2014 at 3:17 PM, Miroslav Lichvar <mlichvar@redhat.com> wrote:
>
> With the other patch allowing missed replies included it's now getting
> stuck as there is no timer to send the 2nd and 3rd request.
2014-09-02 15:29:15 +02:00
Kay Sievers 80cd2606b9 timesyncd: don't reset polling interval when reselecting server
Original patch from: Miroslav Lichvar <mlichvar@redhat.com>
2014-09-02 14:33:59 +02:00
Miroslav Lichvar e8206972be timesyncd: allow two missed replies before reselecting server
After receiving a reply from the server, allow two missed replies before
switching to another server to avoid unnecessary clock hopping when
packets are getting lost in the network.
2014-09-02 14:29:51 +02:00
Kay Sievers 665c6a9eab timesyncd: remove retry_timer logic which is covered by the server timeout 2014-09-02 14:27:34 +02:00
Miroslav Lichvar 63463bf091 timesyncd: wait before reconnecting to first server
When all servers are exhausted, wait for one poll interval before trying
to connect again to the first server in the list. Also, keep increasing
the polling interval to make sure a client not getting any valid replies
will not send requests to any server more frequently than is allowed by
the maximum polling interval.
2014-09-02 13:34:16 +02:00
Steven Noonan 20f8d3cf1b timesyncd-manager: don't clear current_server_name if ServerAddress is NULL
https://bugs.freedesktop.org/show_bug.cgi?id=83091

[zj: add comment]
2014-08-30 21:18:57 -04:00
Miroslav Lichvar 3af0442c52 timesyncd: check root distance
NTPv4 servers don't reply with unsynchronized status when they lost
synchronization, they only keep increasing the root dispersion and it's
up to the client to decide at which point they no longer consider it
synchronized.

Ignore replies with root distance over 5 seconds.
2014-08-29 18:13:05 +02:00
Miroslav Lichvar 487a36821e timesyncd: get kernel timestamp in nanoseconds 2014-08-29 18:13:04 +02:00
Miroslav Lichvar 73c76e6330 timesyncd: fix calculation of transmit time
The kernel timestamp (recv_time) is made earlier than current time
(now_ts), use the timestamp captured before sending packet directly.
2014-08-29 18:13:02 +02:00
Miroslav Lichvar 07610e108e timesyncd: check if stratum is valid 2014-08-29 18:13:00 +02:00
Lennart Poettering af4ec4309e notify: send STOPPING=1 from our daemons 2014-08-21 17:24:21 +02:00
Lennart Poettering c572db3ccf timesyncd: don't trip up if networkd isn't running and can't tell us any NTP servers 2014-08-13 21:07:07 +02:00
Lennart Poettering 874ff7bf4d timesyncd: beef up NTP server selection logic, and acquire NTP servers from DHCP 2014-08-12 19:48:24 +02:00
Lennart Poettering 84e51726a3 timesyncd: split up into multiple source file
The source file got much too large, hence split up the sources into
multiple per-object files, similar in style to resolved.
2014-08-12 16:58:56 +02:00
Lennart Poettering f01e5736f1 timesyncd: move the generic sockaddr_equal() call to socket-util.h 2014-08-12 14:54:32 +02:00
Lennart Poettering cedc8c44d4 timesyncd: when we don't know anything about the network state, assume we are online
This should provide better compatibility with systems that lack networkd
2014-08-11 22:04:37 +02:00
Lennart Poettering 6a5c7b7e41 timesyncd: always use CLOCK_BOOTTIME if we can
After all we want to compare a monotonically increasing clock with the
remote clock, hence we shouldn't ignore system suspend periods.
2014-08-11 15:06:22 +02:00
Zbigniew Jędrzejewski-Szmek b2fadec604 Properly report invalid quoted strings
$ systemd-analyze verify trailing-g.service
[./trailing-g.service:2] Trailing garbage, ignoring.
trailing-g.service lacks ExecStart setting. Refusing.
Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument.
Failed to create trailing-g.service/start: Invalid argument
2014-07-31 08:56:03 -04:00
Zbigniew Jędrzejewski-Szmek a2a5291b3f Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.

Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.

_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.

Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.

mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS  $RootDir $MountPoint
mbiebl_> which is pretty weird
2014-07-31 04:00:31 -04:00
Kay Sievers c264aeab4b core: only set the kernel's timezone when the RTC runs in local time
We can not reliably manage any notion of local time. Every daylight
saving time change or time zone change by traveling will make the
time jump, and the local time might jump backwards which creates
unsolvable problems with file timestamps.

We will no longer tell the kernel our local time zone and leave
everything set to UTC. This will effectively turn FAT timestamps
into UTC timestamps.

If and only if the machine is configured to read the RTC in local
time mode, the kernel's time zone will be configured, but
systemd-timesysnc will disable the kernel's system time to RTC
syncing. In this mode, the RTC will not be managed, and external
tools like Windows bootups are expected to manage the RTC's time.

https://bugs.freedesktop.org/show_bug.cgi?id=81538
2014-07-27 10:44:31 +02:00
Lennart Poettering 0014a4ad50 sd-network: fix parameter order for sd_network_monitor_new()
Constructors should return the object they created as first parameter,
except when they are generated as a child/member object of some other
object in which case that should be first.
2014-07-17 01:41:52 +02:00
Zbigniew Jędrzejewski-Szmek 36f822c4bd Let config_parse open file where applicable
Special care is needed so that we get an error message if the
file failed to parse, but not when it is missing. To avoid duplicating
the same error check in every caller, add an additional 'warn' boolean
to tell config_parse whether a message should be issued.
This makes things both shorter and more robust wrt. to error reporting.
2014-07-16 18:47:20 -04:00
Zbigniew Jędrzejewski-Szmek e9f3d2d508 Constify ConfigTableItem tables 2014-07-15 22:34:40 -04:00
Zbigniew Jędrzejewski-Szmek ae2db4e7e8 timesyncd: add sockaddr_pretty wrapper 2014-07-15 09:53:18 -04:00
Zbigniew Jędrzejewski-Szmek c566ee3253 timesyncd: only listen to clock changes when connected
This reverts previous commit and applies a different fix.

manager_clock_watch() callback calls manager_send_request() to kick
off a resync. We can only do that when we're actually connected to
something. It is not useful to setup the callback from manager_new().

Now the callback will be dropped in manager_connect() and requested
in manager_begin().

https://bugs.freedesktop.org/show_bug.cgi?id=80932
2014-07-15 09:52:19 -04:00
Kay Sievers afc7b1b9c1 timesyncd: suppress resync at system time change when not connected
Jul 04 17:46:03 orchid systemd[1]: Starting Network Time Synchronization...
Jul 04 17:46:03 orchid systemd[1]: Started Network Time Synchronization.
Jul 04 17:46:22 orchid systemd-timesyncd[301]: System time changed. Resyncing.
Jul 04 17:46:22 orchid systemd-timesyncd[301]: Assertion 'm->current_server_name'

https://bugs.freedesktop.org/show_bug.cgi?id=80932
2014-07-15 02:24:35 +02:00
Lennart Poettering c92e531c82 resolved: make use of union in_addr_union in resolved, too 2014-07-07 23:11:48 +02:00
Lennart Poettering 966bff2660 timesyncd: split privilege dropping code out of timesyncd so that we can make use of it from other daemons too
This is preparation to make networkd work as unpriviliged user.
2014-06-01 08:49:33 +02:00
Kay Sievers 4d40d39cdf timesysnc: reword network watching messages, and move resolver errors to debug 2014-05-25 13:46:43 +08:00
Kay Sievers d636d37679 timesyncd: only update stamp file when we are synchronized
Create initial stamp file with compiled-in time to prevent bootups
with clocks in the future from storing invalid timestamps.

At shutdown, only update the timestamp if we got an authoritative
time to store.
2014-05-24 08:04:56 +08:00
Lennart Poettering 609e002e78 time-util: make sure USEC_PER_SEC and friends are actually of type usec_t 2014-05-22 11:44:03 +09:00
Kay Sievers a6cb8f870d timesyncd: use STR_IN_SET() 2014-05-21 10:36:02 +09:00
Lennart Poettering a57a27b2ef timesyncd: fix english language typo 2014-05-21 09:36:49 +09:00
Lennart Poettering ece6e766cf timesyncd: save clock to disk everytime we get an NTP fix, and bump clock at boot using this
This is useful to make sure the system clock stays monotonic even on
systems that lack an RTC.

Also, why we are at it, also use the systemd release time for bumping
the clock, since it's a slightly less bad than starting with jan 1st,
1970.

This also moves timesyncd into the early bootphase, in order to make
sure this initial bump is guaranteed to have finished by the time we
start real daemons which might write to the file systemd and thus
shouldn't leave 1970's timestamps all over the place...
2014-05-21 00:23:39 +09:00
Tom Gundersen e56f363803 timesyncd: only attempt to connect when an address is configured
For now, we accept both link-local and routable addresses, maybe we want to
restrict ourselves to routable addresses only.
2014-05-19 20:54:42 +02:00
Nis Martensen f1721625e7 fix spelling of privilege 2014-05-19 00:40:44 +09:00
Lennart Poettering f864fd1b4b timesyncd: make use of floating event sources for signal handling 2014-05-18 20:52:49 +09:00
Lennart Poettering 9f7115498b timesyncd: enable watchdog support 2014-05-18 20:52:49 +09:00
Lennart Poettering a349eb10d3 timesyncd: run timesyncd as unpriviliged user "systemd-timesync" (but still with CAP_SYS_TIME) 2014-05-18 20:52:49 +09:00
Kay Sievers 15a224e06c timesyncd: fix typo in comment 2014-05-16 04:00:59 +02:00
Kay Sievers 59a9fce47b timesyncd: fix error path return value
https://bugs.freedesktop.org/show_bug.cgi?id=78752
2014-05-15 20:50:02 +02:00
Tom Gundersen 9b3310b066 timesyncd: read global operational state from networkd 2014-05-08 17:32:32 +02:00
Tom Gundersen e0e5ce237b timesyncd: only run when the system has a carrier on a network interface
As the operational state detection in sd-network is still too primitive, timesyncd
will likely try to connect a bit early, so the first attempt will fail.
2014-05-08 15:28:19 +02:00
Kay Sievers 089377209f timesyncd: shorten log message 2014-05-07 14:45:32 +02:00
Lennart Poettering 7b8b9686e0 timesyncd: hook up systemd-timesyncd with systemd-timedated
Later on we will probably remove support for controlling any other NTP
implementations but systemd-timesyncd, but for now, let's keep things
generic
2014-05-06 18:20:49 +02:00
Lennart Poettering 661278ee29 timesyncd: never accept NTP time from server that is older than systemd's release time 2014-05-06 18:08:04 +02:00
Lennart Poettering e8af69739a timesyncd: read server settings from a configuration file
Also, allow compiling in a default server list via a configure command
line item.
2014-05-06 17:02:11 +02:00
Lennart Poettering 16c058ba01 timesyncd: when an NTP server doesn't respond, proceed with the next 2014-05-06 16:15:02 +02:00
Lennart Poettering 376cd3b89c list: make LIST_FIND_TAIL work for empty lists 2014-05-06 13:07:15 +02:00
Lennart Poettering 600809211e timesyncd: keep order of NTP servers 2014-05-06 12:34:37 +02:00
Lennart Poettering 05f7fc0fe3 timesyncd: make sure to reread /etc/resolv.conf when we try the next NTP server 2014-05-06 12:34:37 +02:00
Kay Sievers 136aa3b444 timesyncd: accept NTP version 3 responses 2014-05-06 12:29:20 +02:00
Lennart Poettering 881c74201d timesyncd: add a more servers by default 2014-05-06 01:37:29 +02:00
Lennart Poettering becad8f1ed timesyncd: also try next server when sendto() fails 2014-05-06 01:37:13 +02:00
Lennart Poettering 7a183c4c73 timesyncd: don't busy loop when we cannot connect to any servers 2014-05-06 01:29:47 +02:00
Lennart Poettering 678522cff0 timesyncd: properly handle multiple configured NTP servers and multiplei IP addresses per server name 2014-05-06 01:17:35 +02:00
Lennart Poettering 856a5a7d76 timesyncd: lookup name server via sd-resolve, support IPv6, react to SIGINT/SITERM 2014-05-05 23:53:17 +02:00
Lennart Poettering 7ed0dd4be6 timesync: use safe_close() where possible 2014-05-05 21:47:38 +02:00
Lennart Poettering 5f8cfaee52 timesync: always initialize structs when declaring them as far as possible with contsant values 2014-05-05 21:47:09 +02:00
Kay Sievers ee03381e21 timesyncd: log drift value as signed 2014-05-05 14:21:40 +02:00
Kay Sievers ef6191945e timesyncd: log drift correction 2014-05-03 15:09:33 +02:00
Kay Sievers d67006fe53 timesyncd: use nanosecond mode 2014-04-30 17:25:46 +02:00
Kay Sievers 81c36b3f28 timesyncd: remove debug code 2014-04-30 09:37:59 +02:00
Kay Sievers ba9f11dc98 timesyncd: limit debug values to milliseconds 2014-04-29 23:48:23 +02:00
Kay Sievers 39594d49cf timesyncd: update log message 2014-04-29 10:16:07 +02:00
Kay Sievers a91df40e69 timesyncd: add unit and man page 2014-04-29 09:51:53 +02:00
Kay Sievers 687ed1237b rename timedate-sntp to timesync 2014-04-28 17:08:52 +02:00