summaryrefslogtreecommitdiffstats
path: root/src/timesync/timesyncd-manager.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* timesyncd: reorder structs instead of useless bitfieldsZbigniew Jędrzejewski-Szmek2024-02-201-2/+1
| | | | | | | | | Because of alignment, those bitfields were not doing anything useful, and were causing the generated code to be more complicated. But in this case, at least potentially there might be a number of copies of those structs (if we have a bunch of time servers configured), so let's actually implement the intended space savings by reording the fields to reduce the size of holes.
* timesyncd: make the transmit timestamp in requests fully randomDavid Venhoek2024-01-261-0/+1
| | | | | This improves security against off-path attackers, and avoids leaking the current system time.
* timesyncd: emit signal when timesyncd NTPServers property changesKingbom Dou2023-08-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit signal when timesyncd LinkNTPServers property changes Tested: ``` Monitoring bus message stream. ``` ``` > Type=signal Endian=l Flags=1 Version=1 Cookie=21 Timestamp="Fri 2023-05-19 07:50:47.427051 UT" Sender=:1.623 Path=/org/freedesktop/timesync1 Interface=org.freedesktop.DBus.Properties Memberd UniqueName=:1.623 MESSAGE "sa{sv}as" { STRING "org.freedesktop.timesync1.Manager"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "LinkNTPServers"; VARIANT "as" { ARRAY "s" { STRING "10.8.8.18"; STRING "10.8.8.19"; }; }; }; }; ARRAY "s" { }; }; ``` ``` > Type=signal Endian=l Flags=1 Version=1 Cookie=28 Timestamp="Fri 2023-05-19 07:53:22.609416 UT" Sender=:1.623 Path=/org/freedesktop/timesync1 Interface=org.freedesktop.DBus.Properties Memberd UniqueName=:1.623 MESSAGE "sa{sv}as" { STRING "org.freedesktop.timesync1.Manager"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "LinkNTPServers"; VARIANT "as" { ARRAY "s" { STRING "10.8.8.18"; STRING "10.8.8.20"; }; }; }; }; ARRAY "s" { }; }; ``` ``` > Type=signal Endian=l Flags=1 Version=1 Cookie=6 Timestamp="Fri 2023-05-19 08:12:26.964666 UTC" Sender=:1.627 Path=/org/freedesktop/timesync1 Interface=org.freedesktop.DBus.Properties Memberd UniqueName=:1.627 MESSAGE "sa{sv}as" { STRING "org.freedesktop.timesync1.Manager"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "LinkNTPServers"; VARIANT "as" { ARRAY "s" { STRING "10.8.8.18"; }; }; }; }; ARRAY "s" { }; }; ``` ``` > Type=signal Endian=l Flags=1 Version=1 Cookie=162 Timestamp="Mon 2023-07-10 09:06:18.865654 UTC" Sender=:1.1 Path=/org/freedesktop/timesync1 Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged UniqueName=:1.1 MESSAGE "sa{sv}as" { STRING "org.freedesktop.timesync1.Manager"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "RuntimeNTPServers"; VARIANT "as" { ARRAY "s" { STRING "10.2.16.10"; }; }; }; }; ARRAY "s" { }; }; ``` Signed-off-by: Kingbom Dou <doujinbao@bytedance.com>
* timesyncd: add RUNTIME serversDaniel Mack2022-04-091-0/+6
| | | | | | | | | | | This new server type can only be set at runtime through a D-Bus method and is exposed for reading through a D-Bus property. `CAP_NET_ADMIN` and a PolKit acknowledge is required for setting runtime servers. Entries submitted that way are used before system and link servers are being looked at.
* timesync: export manager_is_connected()Daniel Mack2022-04-091-0/+1
| | | | This function use useful from other files, so let's export it.
* timesyncd: generate a structure log message the first time we set the clock ↵Lennart Poettering2022-03-181-0/+3
| | | | | | | | | | correctly Usecase: later on we can use this to retroactively adjust log output in journalctl or similar on systems lacking an RTC: we just have to search for this sructured log message that indicates the first sync point and can then retroactively adjust the incorrect timestamps collected before that.
* timesyncd: rename bool 'good' → 'talking'Lennart Poettering2022-03-181-1/+1
| | | | | THe name is just too generic. Let's pick a name that makes clear that this is about successful communication.
* sd-event: add a single implementation of an event source that runs on clock ↵Lennart Poettering2022-03-181-1/+0
| | | | | | | | | | changes We basically had the same code in three places. Let's unify it in a common helper function. event_add_time_change() might be something we should add to the official sd-event API sooner or later, given its general usefulness.
* timesync: add option to periodically save timeDimitry Ishenko2021-08-091-2/+13
|
* timesync: rename variable to match config nameZbigniew Jędrzejewski-Szmek2021-02-251-1/+1
| | | | | PollIntervalMinSec and PollIntervalMaxSec use the same pattern, but RootDistanceMaxSec had switched orderd in the code.
* tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-1/+1
| | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* timesync: Make delaying attempts to contact servers configurableSusant Sahani2020-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` ❯ ssh sus@xx.xx.xx.xx Last login: Sat Nov 14 17:32:08 2020 from 10.104.45.138 17:36:19 up 0 min, 0 users, load average: 0.00, 0.00, 0.00 > systemd-analyze blame Bootup is not yet finished (org.freedesktop.systemd1.Manager.FinishTimestampMonotonic=0). Please try again later. Hint: Use 'systemctl list-jobs' to see active jobs > systemd-analyze blame 43.954s systemd-time-wait-sync.service 1.969s systemd-networkd-wait-online.service 1.559s cloud-init-local.service 1.039s cloud-init.service 414ms cloud-final.service 387ms dracut-initqueue.service 382ms initrd-switch-root.service 380ms cloud-config.service 198ms systemd-journal-flush.service 136ms systemd-udev-trigger.service 115ms initrd-parse-etc.service 97ms systemd-timesyncd.service 84ms systemd-journald.service ``` After made it configurable and set to 5s ``` ❯ ssh sus@xx.xx.xx.xx Last login: Sat Nov 14 18:41:42 2020 from 10.104.45.138 18:42:36 up 0 min, 0 users, load average: 0.16, 0.03, 0.01 > systemd-analyze blame 10.450s systemd-time-wait-sync.service 8.303s systemd-networkd-wait-online.service 1.621s cloud-init-local.service 1.068s cloud-init.service ```
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* timesync: increase retry interval more slowlyZbigniew Jędrzejewski-Szmek2020-07-301-0/+3
| | | | | | | | | | | The new retry intervals are [15, 20, 26, 34, 45, 60, 80, 106, 141, 188, 250, 333, 360, ...]. This should allow graceful response if a transient network failure is encountered. Growth is exponential, but with a small power and capped to a non-too-large value so that we resynchronize within a few minutes after network is restored. I made the minimum 15 s to make sure that we never send packets more often than that. Fixes #16492.
* tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2018-10-191-1/+1
|
* tree-wide: drop double newlineYu Watanabe2018-06-291-1/+0
|
* timesync: changes type of drift_freq to int64_tYu Watanabe2018-06-251-1/+1
| | | | | | | 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-201-3/+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
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | 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-141-1/+1
| | | | | | | | | | | 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-141-2/+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: save and expose NTP responce on busYu Watanabe2018-05-031-1/+9
|
* timesync: expose manager properties on busYu Watanabe2018-05-031-0/+2
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* timesync: make poll interval configurableYu Watanabe2017-11-071-0/+10
| | | | | | This adds PollIntervalMinSec= and PollIntervalMaxSec= to timesyncd.conf Closes #7262.
* timesync: add RootDistanceMaxSec= to timesyncd.conf (#7215)Yu Watanabe2017-11-051-0/+1
| | | Closes #7211.
* timesyncd: don't use compiled-in list if FallbackNTP has been configured ↵Michael Biebl2017-05-241-0/+2
| | | | | | | | | explicitly Parse the config files first and only apply the compiled-in list of fallback servers if no NTP server was configured via FallbackNTP. Closes: #5091
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: sort includes in *.hThomas Hindoe Paaboel Andersen2015-11-181-1/+2
| | | | | This is a continuation of the previous include sort patch, which only sorted for .c files.
* timesyncd: print an INFO log message when we successfully reached a time serverLennart Poettering2015-04-081-0/+1
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | 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.
* Revert "timesyncd: remove retry_timer logic which is covered by the server ↵Kay Sievers2014-09-021-0/+1
| | | | | | | | | | | timeout" This reverts commit 665c6a9eab46b0b253af6566ca9fc70c866b3fcd. 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.
* timesyncd: allow two missed replies before reselecting serverMiroslav Lichvar2014-09-021-0/+1
| | | | | | 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.
* timesyncd: remove retry_timer logic which is covered by the server timeoutKay Sievers2014-09-021-1/+0
|
* timesyncd: wait before reconnecting to first serverMiroslav Lichvar2014-09-021-0/+1
| | | | | | | | 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.
* timesyncd: beef up NTP server selection logic, and acquire NTP servers from DHCPLennart Poettering2014-08-121-5/+7
|
* timesyncd: split up into multiple source fileLennart Poettering2014-08-121-0/+101
The source file got much too large, hence split up the sources into multiple per-object files, similar in style to resolved.