chiark / gitweb /
sd-dhcp-client: do not reset 'secs' when entering INIT-REBOOT
[elogind.git] / src / libsystemd-network / sd-dhcp-client.c
index 5d8efbbd3f7c16c33b93fdc1873ecb0ccf4633df..6e35ef403b81d7641b7c007f11fbea08eafbd302 100644 (file)
@@ -198,8 +198,6 @@ static int client_initialize(sd_dhcp_client *client) {
 
         client->attempt = 1;
 
-        client->start_time = 0;
-        client->secs = 0;
         client->state = DHCP_STATE_INIT;
         client->xid = 0;
 
@@ -592,10 +590,12 @@ static int client_start(sd_dhcp_client *client) {
                 client_stop(client, r);
                 return r;
         }
-
         client->fd = r;
-        client->start_time = now(CLOCK_MONOTONIC);
-        client->secs = 0;
+
+        if (client->state == DHCP_STATE_INIT) {
+                client->start_time = now(CLOCK_MONOTONIC);
+                client->secs = 0;
+        }
 
         log_dhcp_client(client, "STARTED");