Re: [chrony-dev] [PATCH] nm-dispatcher: handle NTP servers from DHCP |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] nm-dispatcher: handle NTP servers from DHCP
- From: Robert Fairley <rfairley@xxxxxxxxxx>
- Date: Tue, 26 May 2020 15:26:21 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590521201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R0681JLXolrZxfkn8nGUg5vvmJ3WQVML2PyJGPSrxwY=; b=aeQ2ynzT42VkY/UAFEAet5VDEpkxOIpwRBX3b7KqQFITAaNPbWn7L3zgn3I3mLn5PcG172 1RCcyzLjAcm+pWa9nL/n1ssmCtDn7UsUB6y5W9cWX7N7f8Qoj9AMHMXuPiSp2f25k27CFi lQgguIXrYbQBhZdXvjyvDcGEHaeg2/E=
On Mon, May 25, 2020 at 7:27 AM Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
> I'd rather avoid having any distribution-specific code in the
> examples. If there was a downstream change in one of the directories
> for instance, we would need to support different versions of the
> distribution.
>
> If you would like to submit the chrony-helper script, please remove
> the sysconfig/PEERNTP stuff. It can be put back in a downstream patch.
> The various locations in the script can be set to strings like
> @CHRONYC@, @CHRONYCONF@, @DHCP_SERVERS_FILES@ to indicate they need to
> be edited before use.
>
> Also, please rename the dhclient_servers_files variable to
> dhcp_servers_file and remove the add/remove-dhclient-servers commands.
>
> The NM dispatcher script should follow the same idea, e.g. the check
> of /sbin/dhclient should be in a downstream patch.
Thank you for the feedback and suggestions on the approach, makes sense
to keep the files as general examples without the distribution-specific
handling. I have updated the patch to include chrony.helper.in, following
these points. One part of the above description which I deviated from
while making the edits is the following:
- Use @DHCP_SERVERS_DIR@ instead of @DHCP_SERVERS_FILES@. In the
helper, dhcp_servers_files is a glob expression, but
dhcp_server_file in the NM dispatcher is variable based on the
${interface} argument. To avoid two different macros for these two
variables, and avoid passing in a variable reference "${interface}" as
part of a config string, I made only the directory configurable.
That way, both the helper and NM dispatcher can use one macro
@DHCP_SERVERS_DIR@.
I have updated https://src.fedoraproject.org/rpms/chrony/pull-request/3
with the downstream changes for adding back sysconfig, etc., which is
the `examples-use-sysconfig-detect-dhclient.patch` file. The other two
`.patch` files in that PR add in the upstream patches proposed in this
email.
So far, I have tested these changes by manually applying the files,
with the downstream patch for Fedora, in Fedora CoreOS (the F32-based
"next" stream) with and without dhclient present on the system, with
a DHCP server on the same network using the `ntp-servers` option. In
both cases NTP server config files are written to `/var/lib/dhclient`
or `/var/lib/chrony/servers`, and the NTP servers from the DHCP server
are listed with `chronyc sources`.