summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp6-lease.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2015-01-20 19:35:56 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2015-01-27 09:35:24 +0200
commite7504d95479455be5cef120fc8e0a48fd74ad5ca (patch)
tree33d1addd0d885141868f9b05f1fc48e7e1d60e9a /src/libsystemd-network/sd-dhcp6-lease.c
parent2a481c84561d6c8ce37d75cc334f7c149ffb2bb9 (diff)
sd-dhcp6-lease: Revise address iteration functions
Revise the address iteration functions so that one helper function resets the iterator to the start of the address list while the second one fetches addresses one by one. The test case is also updated.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-lease.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-lease.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c
index 78e1589286..2442269a3f 100644
--- a/src/libsystemd-network/sd-dhcp6-lease.c
+++ b/src/libsystemd-network/sd-dhcp6-lease.c
@@ -146,10 +146,9 @@ int dhcp6_lease_get_iaid(sd_dhcp6_lease *lease, be32_t *iaid) {
return 0;
}
-int sd_dhcp6_lease_get_next_address(sd_dhcp6_lease *lease,
- struct in6_addr *addr,
- uint32_t *lifetime_preferred,
- uint32_t *lifetime_valid) {
+int sd_dhcp6_lease_get_address(sd_dhcp6_lease *lease, struct in6_addr *addr,
+ uint32_t *lifetime_preferred,
+ uint32_t *lifetime_valid) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
assert_return(lifetime_preferred, -EINVAL);
@@ -169,22 +168,9 @@ int sd_dhcp6_lease_get_next_address(sd_dhcp6_lease *lease,
return 0;
}
-int sd_dhcp6_lease_get_first_address(sd_dhcp6_lease *lease,
- struct in6_addr *addr,
- uint32_t *lifetime_preferred,
- uint32_t *lifetime_valid) {
- assert_return(lease, -EINVAL);
- assert_return(addr, -EINVAL);
- assert_return(lifetime_preferred, -EINVAL);
- assert_return(lifetime_valid, -EINVAL);
-
- if (!lease->ia.addresses)
- return -ENOMSG;
-
- lease->addr_iter = lease->ia.addresses;
-
- return sd_dhcp6_lease_get_next_address(lease, addr, lifetime_preferred,
- lifetime_valid);
+void sd_dhcp6_lease_reset_address_iter(sd_dhcp6_lease *lease) {
+ if (lease)
+ lease->addr_iter = lease->ia.addresses;
}
sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease) {