Blob Blame History Raw
From 18647aa3d8f3ef8033cba55384d297d7ef8f3d9c Mon Sep 17 00:00:00 2001
From: juga0 <juga@riseup.net>
Date: Tue, 5 Sep 2017 10:26:32 +0000
Subject: [PATCH] networkd: send dhcp option NTP when UseNTP is true (#6726)

(cherry picked from commit ead36ce651955999e7cf1f6167aa0065f8cd5f3f)
---
 src/network/networkd-dhcp4.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 77771688e1..84a25b1a03 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -635,10 +635,11 @@ int dhcp4_configure(Link *link) {
                         return r;
         }
 
-        /* Always acquire the timezone and NTP */
-        r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NTP_SERVER);
-        if (r < 0)
-                return r;
+        if (link->network->dhcp_use_ntp) {
+                r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NTP_SERVER);
+                if (r < 0)
+                        return r;
+        }
 
         r = sd_dhcp_client_set_request_option(link->dhcp_client, SD_DHCP_OPTION_NEW_TZDB_TIMEZONE);
         if (r < 0)