2020-10-14 20:49:42 +00:00
|
|
|
From: Robert Fairley <rfairley@redhat.com>
|
|
|
|
Date: Wed, 17 Jun 2020 10:14:19 -0400
|
2021-05-26 13:46:14 +00:00
|
|
|
Subject: [PATCH] examples/nm-dispatcher.dhcp: use sysconfig
|
2020-10-14 20:49:42 +00:00
|
|
|
|
|
|
|
Use the PEERNTP and NTPSERVERARGS environment variables from
|
2021-05-26 13:46:14 +00:00
|
|
|
/etc/sysconfig/network{-scripts}.
|
2021-02-05 17:55:55 +00:00
|
|
|
|
|
|
|
Co-Authored-By: Christian Glombek <cglombek@redhat.com>
|
2020-10-14 20:49:42 +00:00
|
|
|
|
|
|
|
diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp
|
2021-02-05 17:55:55 +00:00
|
|
|
index 6ea4c37..a6ad35a 100644
|
2020-10-14 20:49:42 +00:00
|
|
|
--- a/examples/chrony.nm-dispatcher.dhcp
|
|
|
|
+++ b/examples/chrony.nm-dispatcher.dhcp
|
2022-03-22 13:31:29 +00:00
|
|
|
@@ -8,15 +8,23 @@ export LC_ALL=C
|
|
|
|
interface=$1
|
|
|
|
action=$2
|
2020-10-14 20:49:42 +00:00
|
|
|
|
2022-03-22 13:31:29 +00:00
|
|
|
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
|
|
|
|
+[ -f /etc/sysconfig/network-scripts/ifcfg-"${interface}" ] && \
|
|
|
|
+ . /etc/sysconfig/network-scripts/ifcfg-"${interface}"
|
|
|
|
+
|
2021-02-05 17:55:55 +00:00
|
|
|
chronyc=/usr/bin/chronyc
|
2022-03-22 13:31:29 +00:00
|
|
|
-server_options=iburst
|
2021-02-05 17:55:55 +00:00
|
|
|
-server_dir=/var/run/chrony-dhcp
|
2022-03-22 13:31:29 +00:00
|
|
|
+server_options=${NTPSERVERARGS:-iburst}
|
2021-02-05 17:55:55 +00:00
|
|
|
+server_dir=/run/chrony-dhcp
|
|
|
|
|
|
|
|
dhcp_server_file=$server_dir/$interface.sources
|
2022-03-22 13:31:29 +00:00
|
|
|
dhcp_ntp_servers="$DHCP4_NTP_SERVERS $DHCP6_DHCP6_NTP_SERVERS"
|
2020-10-14 20:49:42 +00:00
|
|
|
|
|
|
|
add_servers_from_dhcp() {
|
|
|
|
rm -f "$dhcp_server_file"
|
|
|
|
+
|
|
|
|
+ # Don't add NTP servers if PEERNTP=no specified; return early.
|
|
|
|
+ [ "$PEERNTP" = "no" ] && return
|
|
|
|
+
|
2022-03-22 13:31:29 +00:00
|
|
|
for server in $dhcp_ntp_servers; do
|
|
|
|
# Check for invalid characters (from the DHCPv6 NTP FQDN suboption)
|
|
|
|
len1=$(printf '%s' "$server" | wc -c)
|