-
Notifications
You must be signed in to change notification settings - Fork 813
Ntp: Add pool checkbox to timeserver configuration #7760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,17 +329,18 @@ function ntpd_configure_do($verbose = false) | |
|
||
$noselect = isset($config['ntpd']['noselect']) ? explode(' ', $config['ntpd']['noselect']) : []; | ||
$prefer = isset($config['ntpd']['prefer']) ? explode(' ', $config['ntpd']['prefer']) : []; | ||
$pool_server = isset($config['ntpd']['pool_server']) ? explode(' ', $config['ntpd']['pool_server']) : []; | ||
$iburst = isset($config['ntpd']['iburst']) ? explode(' ', $config['ntpd']['iburst']) : []; | ||
|
||
$ntpcfg .= "\n\n# Upstream Servers\n"; | ||
/* foreach through ntp servers and write out to ntpd.conf */ | ||
foreach (explode(' ', $config['system']['timeservers']) as $ts) { | ||
/* Determine if Network Time Server is from the NTP Pool or not */ | ||
if (preg_match("/\.pool\.ntp\.org$/", $ts)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daerSeebaer looking at this again what pool servers do not conform with this address? what servers are you using? Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The pool under pool.ntp.org is the capital P "NTP Pool". However, anyone that operates two or more ntp servers at different IP addresses can make them reachable under the same host name. Notable examples: As discussed above, in order to not affect existing setups the current idea is to handle any
I'm fully aware of this and changed the status of this PR to draft when #7841 was opened. I was hoping that the other PR would be merged first and I could then finalize my PR to reflect the |
||
$ntpcfg .= "pool {$ts}"; | ||
if (in_array($ts, $pool_server)) { | ||
$ntpcfg .= "pool"; | ||
} else { | ||
$ntpcfg .= "server {$ts}"; | ||
$ntpcfg .= "server"; | ||
} | ||
$ntpcfg .= " {$ts}"; | ||
if (in_array($ts, $iburst)) { | ||
$ntpcfg .= ' iburst'; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaning up the
timerserver
mess being anchored insystem
instead ofntpd
would be much more appealing, but it requires MVC code to make this work appealing and future-proof.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the whole structure of the data is mind boggling. You want to create a server entry and add all options like also
pool_server
as a property, but now you have all properties as global arrays that refer totimeservers
which isn't even anchored here. This also negatively impacts partial config imports as it is BTW.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the config is all over the place. I tried to "fit in" with the other options like
<prefer>
and just put the<pool_server>
next to them. For this PR that seemed like the best thing to do, since my goal was to introduce the ability for pool configurations, not to refactor the entire thing.Do you have alternative ideas where and how to store this data? One option that comes to mind would be to start the migration to a more sensible model and introduce a list of timeserver-tags that for now only contains a
<pool_server>[true|false]</pool_server>
, however the naming conventions for that structure should be agreed upon since they should last into the MVC age.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I use the os-chrony plugin as ntpd was unreliable I would prefer "Services - Network time" to become a plugin - so I can uninstall it. Same for Dnsmasq...