Blob Blame History Raw
From 08101c754aafab4d0f79367839bbd0d6012c31cf Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 2 Mar 2022 14:54:39 +0100
Subject: [PATCH 1/3] Chrony: add new directives and options (#745)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Support new configuration added in chrony 4.1 and 4.2.

Co-authored-by: Raphaƫl Pinson <github+aem1eeshi1@raphink.net>
(cherry picked from commit 5f3a566511626c35f69961598f1f332db01ed7a1)
---
 lenses/chrony.aug            | 11 ++++++++---
 lenses/tests/test_chrony.aug |  9 +++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lenses/chrony.aug b/lenses/chrony.aug
index 91c8ed51..d1c29531 100644
--- a/lenses/chrony.aug
+++ b/lenses/chrony.aug
@@ -57,8 +57,11 @@ module Chrony =
 (************************************************************************
  * Group: Create required expressions
  ************************************************************************)
+    (* Variable: hex *)
+    let hex = /[0-9a-fA-F]+/
+
     (* Variable: number *)
-    let number = integer | decimal | decimal . /[eE]/ . integer
+    let number = integer | decimal | decimal . /[eE]/ . integer | hex
 
     (* Variable: address_re *)
     let address_re = Rx.ip | Rx.hostname
@@ -79,6 +82,8 @@ module Chrony =
          Server/Peer/Pool options with values
     *)
     let cmd_options = "asymmetry"
+                    | "certset"
+                    | "extfield"
                     | "filter"
                     | "key"
                     | /maxdelay((dev)?ratio)?/
@@ -96,7 +101,7 @@ module Chrony =
          Server/Peer/Pool options without values
     *)
     let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer"
-                  |"require"|"trust"|"xleave"|"burst"|"nts"
+                  |"copy"|"require"|"trust"|"xleave"|"burst"|"nts"
 
     (* Variable: ntp_source
          Server/Peer/Pool key names
@@ -183,7 +188,7 @@ module Chrony =
                     | "nocerttimecheck" | "ntsdumpdir" | "ntsntpserver"
                     | "ntsport" | "ntsprocesses" | "ntsrefresh" | "ntsrotate"
                     | "ntsservercert" | "ntsserverkey" | "ntstrustedcerts"
-                    | "ntpsigndsocket" | "pidfile"
+                    | "ntpsigndsocket" | "pidfile" | "ptpport"
                     | "port" | "reselectdist" | "rtcautotrim" | "rtcdevice"
                     | "rtcfile" | "sched_priority" | "stratumweight" | "user"
 
diff --git a/lenses/tests/test_chrony.aug b/lenses/tests/test_chrony.aug
index 0c86cde7..691e63f7 100644
--- a/lenses/tests/test_chrony.aug
+++ b/lenses/tests/test_chrony.aug
@@ -17,8 +17,8 @@ module Test_Chrony =
 server ntp1.example.com
 server ntp2.example.com iburst
 server ntp3.example.com presend 2
-server ntp4.example.com offline polltarget 4
-server ntp5.example.com maxdelay 2 offline
+server ntp4.example.com offline polltarget 4 extfield F323 copy
+server ntp5.example.com maxdelay 2 offline certset 1
 server ntp6.example.com maxdelay 2 iburst presend 2 xleave offset 1e-4
 server ntp7.example.com iburst presend 2 offline prefer trust require
 server ntp8.example.com minsamples 8 maxsamples 16 version 3
@@ -88,6 +88,7 @@ ntsport 123
 ntsprocesses 2
 ntsrefresh 86400
 ntsrotate 86400
+ptpport 319
 "
 
   test Chrony.lns get exampleconf =
@@ -110,10 +111,13 @@ ntsrotate 86400
   { "server" = "ntp4.example.com"
     { "offline" }
     { "polltarget" = "4" }
+    { "extfield" = "F323" }
+    { "copy" }
   }
   { "server" = "ntp5.example.com"
     { "maxdelay" = "2" }
     { "offline" }
+    { "certset" = "1" }
   }
   { "server" = "ntp6.example.com"
     { "maxdelay" = "2" }
@@ -312,6 +316,7 @@ ntsrotate 86400
   { "ntsprocesses" = "2" }
   { "ntsrefresh" = "86400" }
   { "ntsrotate" = "86400" }
+  { "ptpport" = "319" }
 
 
 (* Local Variables: *)
-- 
2.31.1