ntp: fix adding noselect to selection options
If noselect is present in the configured options, don't assume it
cannot change and the effective options are equal. This fixes chronyc
selectopts +noselect command.
Fixes: 3877734814
("sources: add function to modify selection options")
This commit is contained in:
parent
b5cf861cd7
commit
7bc7d00297
2 changed files with 17 additions and 12 deletions
23
sources.c
23
sources.c
|
@ -587,18 +587,17 @@ update_sel_options(void)
|
||||||
for (i = 0; i < n_sources; i++) {
|
for (i = 0; i < n_sources; i++) {
|
||||||
options = sources[i]->conf_sel_options;
|
options = sources[i]->conf_sel_options;
|
||||||
|
|
||||||
if (options & SRC_SELECT_NOSELECT)
|
if (!(options & SRC_SELECT_NOSELECT)) {
|
||||||
continue;
|
switch (sources[i]->type) {
|
||||||
|
case SRC_NTP:
|
||||||
switch (sources[i]->type) {
|
options |= sources[i]->authenticated ? auth_ntp_options : unauth_ntp_options;
|
||||||
case SRC_NTP:
|
break;
|
||||||
options |= sources[i]->authenticated ? auth_ntp_options : unauth_ntp_options;
|
case SRC_REFCLOCK:
|
||||||
break;
|
options |= refclk_options;
|
||||||
case SRC_REFCLOCK:
|
break;
|
||||||
options |= refclk_options;
|
default:
|
||||||
break;
|
assert(0);
|
||||||
default:
|
}
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sources[i]->sel_options != options) {
|
if (sources[i]->sel_options != options) {
|
||||||
|
|
|
@ -350,6 +350,8 @@ minstratum 192.168.123.1 1
|
||||||
polltarget 192.168.123.1 10
|
polltarget 192.168.123.1 10
|
||||||
selectopts 192.168.123.1 +trust +prefer -require
|
selectopts 192.168.123.1 +trust +prefer -require
|
||||||
selectdata
|
selectdata
|
||||||
|
selectopts 192.168.123.1 +noselect -prefer -trust +require
|
||||||
|
selectdata
|
||||||
delete 192.168.123.1"
|
delete 192.168.123.1"
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
|
@ -372,6 +374,10 @@ check_chronyc_output "^200 OK
|
||||||
S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
||||||
=======================================================================
|
=======================================================================
|
||||||
M node1\.net1\.clk N \-PT\-\- \-PT\-\- 0 1\.0 \+0ns \+0ns \?
|
M node1\.net1\.clk N \-PT\-\- \-PT\-\- 0 1\.0 \+0ns \+0ns \?
|
||||||
|
200 OK
|
||||||
|
S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
||||||
|
=======================================================================
|
||||||
|
M node1\.net1\.clk N N\-\-R\- N\-\-R\- 0 1\.0 \+0ns \+0ns \?
|
||||||
200 OK$" || test_fail
|
200 OK$" || test_fail
|
||||||
|
|
||||||
chronyc_conf="
|
chronyc_conf="
|
||||||
|
|
Loading…
Reference in a new issue