summaryrefslogtreecommitdiff
path: root/src/timesync
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: make sure our control buffers are properly alignedLennart Poettering2020-05-071-4/+1
| | | | | | | | | | | | | We always need to make them unions with a "struct cmsghdr" in them, so that things properly aligned. Otherwise we might end up at an unaligned address and the counting goes all wrong, possibly making the kernel refuse our buffers. Also, let's make sure we initialize the control buffers to zero when sending, but leave them uninitialized when reading. Both the alignment and the initialization thing is mentioned in the cmsg(3) man page.
* tree-wide: use recvmsg_safe() at various placesLennart Poettering2020-04-231-5/+4
| | | | | | | | | | | | | | | | | Let's be extra careful whenever we return from recvmsg() and see MSG_CTRUNC set. This generally means we ran into a programming error, as we didn't size the control buffer large enough. It's an error condition we should at least log about, or propagate up. Hence do that. This is particularly important when receiving fds, since for those the control data can be of any size. In particular on stream sockets that's nasty, because if we miss an fd because of control data truncation we cannot recover, we might not even realize that we are one off. (Also, when failing early, if there's any chance the socket might be AF_UNIX let's close all received fds, all the time. We got this right most of the time, but there were a few cases missing. God, UNIX is hard to use)
* tree-wide: implement new log control API dbus interface in all our daemonsLennart Poettering2020-04-211-0/+5
|
* tree-wide: fix spelling of lookup and setup verbsZbigniew Jędrzejewski-Szmek2020-03-031-1/+1
| | | | "set up" and "look up" are the verbs, "setup" and "lookup" are the nouns.
* timesyncd: log louder when we refuse a server due to root distanceLennart Poettering2020-01-211-1/+1
| | | | | | | This is something people should know about, since it's caused by misconfiguration. Fixes: #13912
* tree-wide: drop socket.h when socket-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop time.h when time-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop missing.hYu Watanabe2019-10-311-1/+0
|
* Updated log message when the timesync happens for the first time (#13624)cbzxt2019-09-261-3/+3
|
* Drop RATELIMIT macrosZbigniew Jędrzejewski-Szmek2019-09-201-1/+1
| | | | | Using plain structure initialization is both shorter _and_ more clearer. We get type safety for free.
* timesyncd: add ntp-units.d/ entry for timesyncZbigniew Jędrzejewski-Szmek2019-07-222-0/+3
| | | | | | | Priority is 80. At least in Fedora, chrony uses 50, and ntpd 60. timesyncd has lower priority, because if people install those other packages, it's most likely on purpose. timesyncd is always installed and provides less functionality.
* Merge pull request #12420 from mrc0mmand/coccinelle-tweaksLennart Poettering2019-04-301-1/+1
|\ | | | | Coccinelle improvements
| * tree-wide: drop !! casts to booleansFrantisek Sumsal2019-04-281-1/+1
| | | | | | | | Done by coccinelle/bool-cast.cocci
* | codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|/
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-272-0/+4
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* timesyncd: Improve sync log message. Fixes #11548.Niklas Hambüchen2019-01-241-2/+3
| | | | | This makes it clear that the user should not expect more log messages each time the time is synchronised.
* tree-wide: make sure to flush/close all bus connections when our daemons exitLennart Poettering2019-01-171-1/+1
| | | | | | | Let's make sure everything is written out ebfore we exit, so that no messages keep our bus connections referenced. Fixes: #11462
* timesyncd,resolved,machinectl: drop calls to sd_event_get_exit_code()Zbigniew Jędrzejewski-Szmek2019-01-081-3/+1
| | | | | | | | In all three cases, sd_event_loop() will return the exit code anyway. If sd_event_loop() returns negative, failure is logged and results in an immediate return. Otherwise, we don't care if sd_event_loop() returns 0 or positive, because the return value feeds into DEFINE_MAIN_FUNCTION(), which doesn't make the distinction.
* timesync: fix serialization of IP addressLennart Poettering2018-12-181-1/+5
| | | | Fixes: #11169
* timesync: use typesafe resolve_getaddrinfo()Yu Watanabe2018-12-171-3/+3
|
* timesync: define main through macroYu Watanabe2018-12-081-39/+27
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-4/+3
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2018-10-192-2/+2
|
* tree-wide: use setsockopt_int() moreYu Watanabe2018-10-191-2/+1
|
* tree-wide: introduce setsockopt_int() helper and make use of it everywhereLennart Poettering2018-10-181-2/+2
| | | | | | As suggested by @heftig: https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
* tree-wide: add a single version of "static const int one = 1"Lennart Poettering2018-10-151-2/+1
| | | | | | | | | | All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
* timesyncd: no need to reload dbus nowZbigniew Jędrzejewski-Szmek2018-09-201-1/+1
|
* tests: use a helper function to parse environment and open loggingZbigniew Jędrzejewski-Szmek2018-09-141-2/+2
| | | | | The advantages are that we save a few lines, and that we can override logging using environment variables in more test executables.
* user-util: rework get_user_creds()Lennart Poettering2018-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Let's fold get_user_creds_clean() into get_user_creds(), and introduce a flags argument for it to select "clean" behaviour. This flags parameter also learns to other new flags: - USER_CREDS_SYNTHESIZE_FALLBACK: in this mode the user records for root/nobody are only synthesized as fallback. Normally, the synthesized records take precedence over what is in the user database. With this flag set this is reversed, and the user database takes precedence, and the synthesized records are only used if they are missing there. This flag should be set in cases where doing NSS is deemed safe, and where there's interest in knowing the correct shell, for example if the admin changed root's shell to zsh or suchlike. - USER_CREDS_ALLOW_MISSING: if set, and a UID/GID is specified by numeric value, and there's no user/group record for it accept it anyway. This allows us to fix #9767 This then also ports all users to set the most appropriate flags. Fixes: #9767 [zj: remove one isempty() call]
* timesync: voidify sd_event_add_signal() and sd_event_set_watchdog()Yu Watanabe2018-07-201-3/+3
|
* tree-wide: drop double newlineYu Watanabe2018-06-293-3/+0
|
* timesync: update log messageYu Watanabe2018-06-251-1/+1
| | | | Fixes #9388.
* timesync: changes type of drift_freq to int64_tYu Watanabe2018-06-252-2/+2
| | | | | | | drift_freq is used for storing timex.freq, and is a 64bit integer. To support x32 ABI, this changes the type of drift_freq to int64_t. Fixes #9387.
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-207-21/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-142-5/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* Merge pull request #9274 from poettering/comment-header-cleanupZbigniew Jędrzejewski-Szmek2018-06-149-25/+9
|\ | | | | drop "this file is part of systemd" and lennart's copyright from header
| * tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-149-9/+9
| | | | | | | | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
| * tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-146-6/+6
| | | | | | | | | | | | | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
| * tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-148-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* | timesync: ignore any errors related to timestamp fileYu Watanabe2018-06-141-13/+21
|/
* timesync: add more log messages in manager_network_read_link_servers()Yu Watanabe2018-06-131-3/+11
|
* timesync: check validity of NTP server name or addressYu Watanabe2018-06-133-3/+22
|
* time-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client ↵Lennart Poettering2018-06-061-10/+2
| | | | | | code We now use pretty much the same code at three places, let's unify that.
* Merge pull request #9040 from yuwata/resolved-networkd-use-dynamic-userLennart Poettering2018-05-231-95/+1
|\ | | | | Set DynamicUser= to resolved and networkd
| * timesync,shared: move logic requesting bus name to sharedYu Watanabe2018-05-221-95/+1
| | | | | | | | | | Preparation for setting DynamicUser= to other services which request bus names.
* | tree-wide: port over all code to the new CONFIG_PARSER_PROTOTYPE() macroLennart Poettering2018-05-221-1/+1
|/ | | | | | | | | | | This makes most header files easier to look at. Also Emacs gets really slow when browsing through large sections of overly long prototypes, which is much improved by this macro. We should probably not do something similar with too many other cases, as macros like this might help readability for some, but make it worse for others. But I think given the complexity of this specific prototype and how often we use it, it's worth doing.
* Merge pull request #8981 from keszybz/ratelimit-and-dbusLennart Poettering2018-05-181-1/+1
|\ | | | | Ratelimit renaming and dbus error message fix
| * Rename ratelimit_test to ratelimit_belowZbigniew Jędrzejewski-Szmek2018-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When I see "test", I have to think three times what the return value means. With "below" this is immediately clear. ratelimit_below(&limit) sounds almost like English and is imho immediately obvious. (I also considered ratelimit_ok, but this strongly implies that being under the limit is somehow better. Most of the times this is true, but then we use the ratelimit to detect triple-c-a-d, and "ok" doesn't fit so well there.) C.f. a1bcaa07.
* | timesync: use NULL instead of empty stringYu Watanabe2018-05-151-1/+1
|/