summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorPatrik Flykt <Patrik.Flykt@linux.intel.com>2014-06-26 16:18:43 +0300
committerTom Gundersen <teg@jklm.no>2014-06-29 15:18:21 +0200
commit68ceb9df6a39a7f86ffc3cf8266ca677a5d5271b (patch)
treee9cc615604eb921ce54bdf1bdcb9bf4a9a1d9f14 /src/libsystemd-network
parent7c16313f11e3953f3fe4dbf544f2d36f58d14138 (diff)
sd-dhcp-client/networkd: set lifetimes for IPv4 addresses
Note that /proc/sys/net/ipv4/ip_dynaddr needs to be non-zero. [tomegun: hook up DHCP renew events to increase the lifetime when necessary]
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c3
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 1603c41227..790728b40c 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -879,7 +879,8 @@ static int client_handle_ack(sd_dhcp_client *client, DHCPMessage *ack,
client->lease->subnet_mask != lease->subnet_mask ||
client->lease->router != lease->router) {
r = DHCP_EVENT_IP_CHANGE;
- }
+ } else
+ r = DHCP_EVENT_RENEW;
client->lease = sd_dhcp_lease_unref(client->lease);
}
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 3203b7a592..94ba283cf0 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -47,6 +47,15 @@ int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) {
return 0;
}
+int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime) {
+ assert_return(lease, -EINVAL);
+ assert_return(lease, -EINVAL);
+
+ *lifetime = lease->lifetime;
+
+ return 0;
+}
+
int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu) {
assert_return(lease, -EINVAL);
assert_return(mtu, -EINVAL);