diff --git a/docs/man/statime.toml.5.md b/docs/man/statime.toml.5.md index 2e152c20b..e431f5fbb 100644 --- a/docs/man/statime.toml.5.md +++ b/docs/man/statime.toml.5.md @@ -32,6 +32,9 @@ will be indicated by each configuration setting shown. `sdo-id` = *u12* (**0**) : The "source domain identity" of this PTP instance. Together with the `domain` it identifies a domain. +`slave-only` = *bool* (**false**) +: Forbids this instance to ever become a master on any port. + `priority1` = *priority* (**128**) : A tie breaker for the best master clock algorithm in the range `0..256`. `0` being the highest priority and `255` the lowest. diff --git a/docs/precompiled/man/statime.8 b/docs/precompiled/man/statime.8 index 0d4f6de81..c42fb78da 100644 --- a/docs/precompiled/man/statime.8 +++ b/docs/precompiled/man/statime.8 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.5 +.\" Automatically generated by Pandoc 3.4 .\" .TH "STATIME" "8" "" "statime 0.2.2" "statime" .SH NAME diff --git a/docs/precompiled/man/statime.toml.5 b/docs/precompiled/man/statime.toml.5 index bfa9240e6..6f8549527 100644 --- a/docs/precompiled/man/statime.toml.5 +++ b/docs/precompiled/man/statime.toml.5 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.5 +.\" Automatically generated by Pandoc 3.4 .\" .TH "STATIME.TOML" "5" "" "statime 0.2.2" "statime" .SH NAME @@ -33,6 +33,9 @@ domain. The \[lq]source domain identity\[rq] of this PTP instance. Together with the \f[CR]domain\f[R] it identifies a domain. .TP +\f[CR]slave\-only\f[R] = \f[I]bool\f[R] (\f[B]false\f[R]) +Forbids this instance to ever become a master on any port. +.TP \f[CR]priority1\f[R] = \f[I]priority\f[R] (\f[B]128\f[R]) A tie breaker for the best master clock algorithm in the range \f[CR]0..256\f[R]. diff --git a/statime-linux/src/config/mod.rs b/statime-linux/src/config/mod.rs index 95b0edff6..a7bd7c921 100644 --- a/statime-linux/src/config/mod.rs +++ b/statime-linux/src/config/mod.rs @@ -24,6 +24,8 @@ pub struct Config { pub sdo_id: u16, #[serde(default = "default_domain")] pub domain: u8, + #[serde(default = "default_slave_only")] + pub slave_only: bool, #[serde(default, deserialize_with = "deserialize_clock_identity")] pub identity: Option, #[serde(default = "default_priority1")] @@ -205,6 +207,10 @@ fn default_sdo_id() -> u16 { 0x000 } +fn default_slave_only() -> bool { + false +} + fn default_announce_interval() -> i8 { 1 } @@ -302,6 +308,7 @@ interface = "enp0s31f6" loglevel: LogLevel::Info, sdo_id: 0x000, domain: 0, + slave_only: false, identity: None, priority1: 128, priority2: 128, diff --git a/statime-linux/src/main.rs b/statime-linux/src/main.rs index dbce7992c..268ba8809 100644 --- a/statime-linux/src/main.rs +++ b/statime-linux/src/main.rs @@ -268,7 +268,7 @@ async fn actual_main() { priority_1: config.priority1, priority_2: config.priority2, domain_number: config.domain, - slave_only: false, + slave_only: config.slave_only, sdo_id: SdoId::try_from(config.sdo_id).expect("sdo-id should be between 0 and 4095"), path_trace: config.path_trace, };