diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2014-06-19 15:39:45 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2014-06-19 15:44:44 +0300 |
commit | ea3b3a75abb3f8b853f7da454b9b8e258a120eea (patch) | |
tree | 82d44fc73fc8c36cced35de7e70d152a629fb8d0 /src/libsystemd-network/sd-dhcp6-client.c | |
parent | 631bbe71298ec892f77f44f94feb612646fe6853 (diff) |
sd-dhcp6-lease: Add functions for accessing lease and addresses
Add support functions for accessing the current client lease as well
as iterating over the addresses and get their preferred and valid
lifetimes.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-client.c')
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 431801d6f0..65679b7301 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -129,6 +129,18 @@ int sd_dhcp6_client_set_mac(sd_dhcp6_client *client, return 0; } +int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret) { + assert_return(client, -EINVAL); + assert_return(ret, -EINVAL); + + if (!client->lease) + return -ENOMSG; + + *ret = sd_dhcp6_lease_ref(client->lease); + + return 0; +} + static sd_dhcp6_client *client_notify(sd_dhcp6_client *client, int event) { if (client->cb) { client = sd_dhcp6_client_ref(client); |