summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-27 01:47:42 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-27 01:47:42 +0200
commit586ac6f711e2eccceb12421df22fca4f117226c4 (patch)
treef91fafc13b1d24970070192d89ff9691eddab9e5 /src/network/networkd-link.c
parent39745a5afb24ba0c877122aa1967d58f02c5435f (diff)
networkd: make DHCP lease timeouts configurable
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 09c27de22b..5b7ebfb79d 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -673,6 +673,22 @@ static int link_enter_set_addresses(Link *link) {
return r;
*/
+ if (link->network->dhcp_server_max_lease_time_usec > 0) {
+ r = sd_dhcp_server_set_max_lease_time(
+ link->dhcp_server,
+ DIV_ROUND_UP(link->network->dhcp_server_max_lease_time_usec, USEC_PER_SEC));
+ if (r < 0)
+ return r;
+ }
+
+ if (link->network->dhcp_server_default_lease_time_usec > 0) {
+ r = sd_dhcp_server_set_default_lease_time(
+ link->dhcp_server,
+ DIV_ROUND_UP(link->network->dhcp_server_default_lease_time_usec, USEC_PER_SEC));
+ if (r < 0)
+ return r;
+ }
+
if (link->network->dhcp_server_emit_timezone) {
_cleanup_free_ char *buffer = NULL;
const char *tz;