From: Patrik Flykt Date: Fri, 7 Sep 2018 20:37:56 +0000 (-0600) Subject: dhcp6-lease: Add function to fetch the IAID for the prefix X-Git-Tag: v240~700^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49228c7520b55edbeb6f8ccc469ae6309363d876;p=platform%2Fupstream%2Fsystemd.git dhcp6-lease: Add function to fetch the IAID for the prefix Add function to fetch the IAID for the delegated IA_PD prefix. In order to keep things simple in the implemntation, the same IAID is used with IA_NA addresses and IA_PD prefixes. But the DHCPv6 server can choose to return only IA_PD prefixes, and the client can nowadays omit requesting of IA_NA addresses. Since the function fetching said IAID from the lease looks only for IA_NA ones, it will return an empty IAID, which of course does not match the one set for prefixes. Fix this by adding a function returning the IAID for the prefix. --- diff --git a/src/libsystemd-network/dhcp6-lease-internal.h b/src/libsystemd-network/dhcp6-lease-internal.h index ff0b0f0..c05c32d 100644 --- a/src/libsystemd-network/dhcp6-lease-internal.h +++ b/src/libsystemd-network/dhcp6-lease-internal.h @@ -50,6 +50,7 @@ int dhcp6_lease_set_rapid_commit(sd_dhcp6_lease *lease); int dhcp6_lease_get_rapid_commit(sd_dhcp6_lease *lease, bool *rapid_commit); int dhcp6_lease_get_iaid(sd_dhcp6_lease *lease, be32_t *iaid); +int dhcp6_lease_get_pd_iaid(sd_dhcp6_lease *lease, be32_t *iaid); int dhcp6_lease_set_dns(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen); int dhcp6_lease_set_domains(sd_dhcp6_lease *lease, uint8_t *optval, diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index f857c79..a803097 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -955,7 +955,7 @@ static int client_parse_message( if (r < 0 && r != -ENOMSG) return r; - r = dhcp6_lease_get_iaid(lease, &iaid_lease); + r = dhcp6_lease_get_pd_iaid(lease, &iaid_lease); if (r < 0) return r; diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c index 5428313..971d963 100644 --- a/src/libsystemd-network/sd-dhcp6-lease.c +++ b/src/libsystemd-network/sd-dhcp6-lease.c @@ -136,6 +136,15 @@ int dhcp6_lease_get_iaid(sd_dhcp6_lease *lease, be32_t *iaid) { return 0; } +int dhcp6_lease_get_pd_iaid(sd_dhcp6_lease *lease, be32_t *iaid) { + assert_return(lease, -EINVAL); + assert_return(iaid, -EINVAL); + + *iaid = lease->pd.ia_pd.id; + + return 0; +} + int sd_dhcp6_lease_get_address(sd_dhcp6_lease *lease, struct in6_addr *addr, uint32_t *lifetime_preferred, uint32_t *lifetime_valid) {