summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp6-lease.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-lease.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-lease.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c
index cbda7d8c84..17a4b64063 100644
--- a/src/libsystemd-network/sd-dhcp6-lease.c
+++ b/src/libsystemd-network/sd-dhcp6-lease.c
@@ -33,6 +33,28 @@ int dhcp6_lease_clear_timers(DHCP6IA *ia) {
return 0;
}
+int dhcp6_lease_ia_rebind_expire(const DHCP6IA *ia, uint32_t *expire) {
+ DHCP6Address *addr;
+ uint32_t valid = 0, t;
+
+ assert_return(ia, -EINVAL);
+ assert_return(expire, -EINVAL);
+
+ LIST_FOREACH(addresses, addr, ia->addresses) {
+ t = be32toh(addr->lifetime_valid);
+ if (valid < t)
+ valid = t;
+ }
+
+ t = be32toh(ia->lifetime_t2);
+ if (t > valid)
+ return -EINVAL;
+
+ *expire = valid - t;
+
+ return 0;
+}
+
DHCP6IA *dhcp6_lease_free_ia(DHCP6IA *ia) {
DHCP6Address *address;