summaryrefslogtreecommitdiff
path: root/src/timesync/timesyncd.c
AgeCommit message (Collapse)Author
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
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-01-27timesyncd: set RLIMIT_NPROC to 2Lennart Poettering
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.
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
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-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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-08-21notify: send STOPPING=1 from our daemonsLennart Poettering
2014-08-12timesyncd: split up into multiple source fileLennart Poettering
The source file got much too large, hence split up the sources into multiple per-object files, similar in style to resolved.
2014-08-12timesyncd: move the generic sockaddr_equal() call to socket-util.hLennart Poettering
2014-08-11timesyncd: when we don't know anything about the network state, assume we ↵Lennart Poettering
are online This should provide better compatibility with systems that lack networkd
2014-08-11timesyncd: always use CLOCK_BOOTTIME if we canLennart Poettering
After all we want to compare a monotonically increasing clock with the remote clock, hence we shouldn't ignore system suspend periods.
2014-07-31Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek
$ 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-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
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-27core: only set the kernel's timezone when the RTC runs in local timeKay Sievers
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-17sd-network: fix parameter order for sd_network_monitor_new()Lennart Poettering
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-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
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-15Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek
2014-07-15timesyncd: add sockaddr_pretty wrapperZbigniew Jędrzejewski-Szmek
2014-07-15timesyncd: only listen to clock changes when connectedZbigniew Jędrzejewski-Szmek
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-15timesyncd: suppress resync at system time change when not connectedKay Sievers
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-07resolved: make use of union in_addr_union in resolved, tooLennart Poettering
2014-06-01timesyncd: split privilege dropping code out of timesyncd so that we can ↵Lennart Poettering
make use of it from other daemons too This is preparation to make networkd work as unpriviliged user.
2014-05-25timesysnc: reword network watching messages, and move resolver errors to debugKay Sievers
2014-05-24timesyncd: only update stamp file when we are synchronizedKay Sievers
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-22time-util: make sure USEC_PER_SEC and friends are actually of type usec_tLennart Poettering
2014-05-21timesyncd: use STR_IN_SET()Kay Sievers
2014-05-21timesyncd: fix english language typoLennart Poettering
2014-05-21timesyncd: save clock to disk everytime we get an NTP fix, and bump clock at ↵Lennart Poettering
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-19timesyncd: only attempt to connect when an address is configuredTom Gundersen
For now, we accept both link-local and routable addresses, maybe we want to restrict ourselves to routable addresses only.
2014-05-19fix spelling of privilegeNis Martensen
2014-05-18timesyncd: make use of floating event sources for signal handlingLennart Poettering
2014-05-18timesyncd: enable watchdog supportLennart Poettering
2014-05-18timesyncd: run timesyncd as unpriviliged user "systemd-timesync" (but still ↵Lennart Poettering
with CAP_SYS_TIME)
2014-05-16timesyncd: fix typo in commentKay Sievers
2014-05-15timesyncd: fix error path return valueKay Sievers
https://bugs.freedesktop.org/show_bug.cgi?id=78752
2014-05-08timesyncd: read global operational state from networkdTom Gundersen
2014-05-08timesyncd: only run when the system has a carrier on a network interfaceTom Gundersen
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-07timesyncd: shorten log messageKay Sievers
2014-05-06timesyncd: never accept NTP time from server that is older than systemd's ↵Lennart Poettering
release time
2014-05-06timesyncd: read server settings from a configuration fileLennart Poettering
Also, allow compiling in a default server list via a configure command line item.
2014-05-06timesyncd: when an NTP server doesn't respond, proceed with the nextLennart Poettering
2014-05-06list: make LIST_FIND_TAIL work for empty listsLennart Poettering
2014-05-06timesyncd: keep order of NTP serversLennart Poettering
2014-05-06timesyncd: make sure to reread /etc/resolv.conf when we try the next NTP serverLennart Poettering
2014-05-06timesyncd: accept NTP version 3 responsesKay Sievers
2014-05-06timesyncd: add a more servers by defaultLennart Poettering
2014-05-06timesyncd: also try next server when sendto() failsLennart Poettering
2014-05-06timesyncd: don't busy loop when we cannot connect to any serversLennart Poettering
2014-05-06timesyncd: properly handle multiple configured NTP servers and multiplei IP ↵Lennart Poettering
addresses per server name
2014-05-05timesyncd: lookup name server via sd-resolve, support IPv6, react to ↵Lennart Poettering
SIGINT/SITERM
2014-05-05timesync: use safe_close() where possibleLennart Poettering