summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp6-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-07-24 18:53:01 +0200
committerTom Gundersen <teg@jklm.no>2014-07-24 19:02:58 +0200
commitfa94c34b083b5b4019975624453e53d0cbad2a5d (patch)
tree8bd0d0486f7b9f3b0c36e9075bc3999ec7b28c09 /src/libsystemd-network/sd-dhcp6-client.c
parent77ff2de999b7ea6b1b4a3a218fbd9d62bb07cd54 (diff)
libsystemd-network: use CLOCK_BOOTTIME instead of CLOCK_MONOTONIC where possible
The timeouts in the networking library (DHCP lease timeouts and similar) should not be affected by suspend. In the cases where CLOCK_BOOTTIME is not implemented, it is still safe to fallback to CLOCK_MONOTONIC, as the consumers of the library (i.e., networkd) _should_ renew the leases when coming out of suspend.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 13bed67ad3..c6c82eb349 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -460,7 +460,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
client->retransmit_count++;
- r = sd_event_now(client->event, CLOCK_MONOTONIC, &time_now);
+ r = sd_event_now(client->event, clock_boottime_or_monotonic(), &time_now);
if (r < 0)
goto error;
@@ -484,7 +484,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
client->retransmit_time, 0));
r = sd_event_add_time(client->event, &client->timeout_resend,
- CLOCK_MONOTONIC,
+ clock_boottime_or_monotonic(),
time_now + client->retransmit_time,
10 * USEC_PER_MSEC, client_timeout_resend,
client);
@@ -503,7 +503,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
r = sd_event_add_time(client->event,
&client->timeout_resend_expire,
- CLOCK_MONOTONIC,
+ clock_boottime_or_monotonic(),
time_now + max_retransmit_duration,
USEC_PER_SEC,
client_timeout_resend_expire, client);
@@ -908,7 +908,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
case DHCP6_STATE_BOUND:
- r = sd_event_now(client->event, CLOCK_MONOTONIC, &time_now);
+ r = sd_event_now(client->event, clock_boottime_or_monotonic(), &time_now);
if (r < 0)
return r;
@@ -931,7 +931,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
r = sd_event_add_time(client->event,
&client->lease->ia.timeout_t1,
- CLOCK_MONOTONIC, time_now + timeout,
+ clock_boottime_or_monotonic(), time_now + timeout,
10 * USEC_PER_SEC, client_timeout_t1,
client);
if (r < 0)
@@ -951,7 +951,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
r = sd_event_add_time(client->event,
&client->lease->ia.timeout_t2,
- CLOCK_MONOTONIC, time_now + timeout,
+ clock_boottime_or_monotonic(), time_now + timeout,
10 * USEC_PER_SEC, client_timeout_t2,
client);
if (r < 0)
@@ -970,7 +970,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
client->transaction_id = random_u32() & htobe32(0x00ffffff);
r = sd_event_add_time(client->event, &client->timeout_resend,
- CLOCK_MONOTONIC, 0, 0, client_timeout_resend,
+ clock_boottime_or_monotonic(), 0, 0, client_timeout_resend,
client);
if (r < 0)
return r;