Commit 1d17db44 authored by Francis Dupont's avatar Francis Dupont
Browse files

rename iaaddr structure & co

parent 9ac4206a
......@@ -1334,12 +1334,11 @@ typedef unsigned char option_mask [16];
/* these are referenced */
typedef struct hash_table ia_hash_t;
typedef struct hash_table iaaddr_hash_t;
typedef struct hash_table iasubopt_hash_t;
/* should be lease6 */
/* shared with iaprefix */
/* IAADDR/IAPREFIX lease */
struct iaaddr {
struct iasubopt {
int refcnt; /* reference count */
struct in6_addr addr; /* IPv6 address/prefix */
u_int8_t plen; /* iaprefix prefix length */
......@@ -1365,10 +1364,10 @@ struct ia_xx {
int refcnt; /* reference count */
struct data_string iaid_duid; /* from the client */
u_int16_t ia_type; /* IA_XX */
int num_iaaddr; /* number of IAADDR for this IA */
int max_iaaddr; /* space available for IAADDR */
int num_iasubopt; /* number of IAADDR/PREFIX */
int max_iasubopt; /* space available for IAADDR/PREFIX */
time_t cltt; /* client last transaction time */
struct iaaddr **iaaddr; /* pointers to the various IAADDRs */
struct iasubopt **iasubopt; /* pointers to the IAADDR/IAPREFIXs */
};
extern ia_hash_t *ia_na_active;
......@@ -1381,10 +1380,10 @@ struct ipv6_pool {
struct in6_addr start_addr; /* first IPv6 address */
int bits; /* number of bits, CIDR style */
int units; /* allocation unit in bits */
iaaddr_hash_t *addrs; /* non-free IAADDR */
int num_active; /* count of active IAADDR */
iasubopt_hash_t *leases; /* non-free leases */
int num_active; /* count of active leases */
isc_heap_t *active_timeouts; /* timeouts for active leases */
int num_inactive; /* count of inactive IAADDR */
int num_inactive; /* count of inactive leases */
isc_heap_t *inactive_timeouts; /* timeouts for expired or
released leases */
struct shared_network *shared_network; /* shared_network for
......@@ -1725,8 +1724,8 @@ void parse_server_duid_conf(struct parse *cfile);
/* ddns.c */
int ddns_updates(struct packet *, struct lease *, struct lease *,
struct iaaddr *, struct iaaddr *, struct option_state *);
int ddns_removals(struct lease *, struct iaaddr *);
struct iasubopt *, struct iasubopt *, struct option_state *);
int ddns_removals(struct lease *, struct iasubopt *);
/* parse.c */
void add_enumeration (struct enumeration *);
......@@ -3198,7 +3197,7 @@ isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *,
failover_message_t *);
isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
failover_message_t *);
void ia_remove_all_iaaddr(struct ia_xx *ia, const char *file, int line);
void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line);
void dhcp_failover_recover_done (void *);
void failover_print PROTO ((char *, unsigned *, unsigned, const char *));
void update_partner PROTO ((struct lease *));
......@@ -3227,14 +3226,16 @@ const char *binding_state_print (enum failover_state);
/* mdb6.c */
HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t);
HASH_FUNCTIONS_DECL(iaaddr, struct in6_addr *, struct iaaddr, iaaddr_hash_t);
HASH_FUNCTIONS_DECL(iasubopt, struct in6_addr *, struct iasubopt,
iasubopt_hash_t);
isc_result_t iaaddr_allocate(struct iaaddr **iaaddr,
const char *file, int line);
isc_result_t iaaddr_reference(struct iaaddr **iaaddr, struct iaaddr *src,
const char *file, int line);
isc_result_t iaaddr_dereference(struct iaaddr **iaaddr,
isc_result_t iasubopt_allocate(struct iasubopt **iasubopt,
const char *file, int line);
isc_result_t iasubopt_reference(struct iasubopt **iasubopt,
struct iasubopt *src,
const char *file, int line);
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt,
const char *file, int line);
isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid,
const char *duid, unsigned int duid_len,
......@@ -3246,10 +3247,10 @@ isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src,
const char *file, int line);
isc_result_t ia_dereference(struct ia_xx **ia,
const char *file, int line);
isc_result_t ia_add_iaaddr(struct ia_xx *ia, struct iaaddr *iaaddr,
const char *file, int line);
void ia_remove_iaaddr(struct ia_xx *ia, struct iaaddr *iaaddr,
const char *file, int line);
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
const char *file, int line);
void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
const char *file, int line);
isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b);
isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type,
......@@ -3262,25 +3263,25 @@ isc_result_t ipv6_pool_reference(struct ipv6_pool **pool,
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool,
const char *file, int line);
isc_result_t create_lease6(struct ipv6_pool *pool,
struct iaaddr **addr,
struct iasubopt **addr,
unsigned int *attempts,
const struct data_string *uid,
time_t soft_lifetime_end_time);
isc_result_t add_lease6(struct ipv6_pool *pool,
struct iaaddr *addr,
struct iasubopt *lease,
time_t valid_lifetime_end_time);
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iaaddr *addr);
isc_result_t expire_lease6(struct iaaddr **addr,
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
isc_result_t expire_lease6(struct iasubopt **leasep,
struct ipv6_pool *pool, time_t now);
isc_result_t release_lease6(struct ipv6_pool *pool, struct iaaddr *addr);
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iaaddr *addr);
isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
isc_boolean_t lease6_exists(const struct ipv6_pool *pool,
const struct in6_addr *addr);
isc_result_t mark_lease_unavailble(struct ipv6_pool *pool,
const struct in6_addr *addr);
isc_result_t create_prefix6(struct ipv6_pool *pool,
struct iaaddr **pref,
struct iasubopt **pref,
unsigned int *attempts,
const struct data_string *uid,
time_t soft_lifetime_end_time);
......
......@@ -4085,7 +4085,7 @@ parse_ia_na_declaration(struct parse *cfile) {
u_int32_t prefer;
u_int32_t valid;
TIME end_time;
struct iaaddr *iaaddr;
struct iasubopt *iaaddr;
struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding;
......@@ -4343,7 +4343,7 @@ parse_ia_na_declaration(struct parse *cfile) {
}
iaaddr = NULL;
if (iaaddr_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory.");
}
memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr));
......@@ -4360,7 +4360,7 @@ parse_ia_na_declaration(struct parse *cfile) {
}
/* add to our various structures */
ia_add_iaaddr(ia, iaaddr, MDL);
ia_add_iasubopt(ia, iaaddr, MDL);
ia_reference(&iaaddr->ia, ia, MDL);
pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_NA,
......@@ -4373,7 +4373,7 @@ parse_ia_na_declaration(struct parse *cfile) {
}
add_lease6(pool, iaaddr, end_time);
ipv6_pool_dereference(&pool, MDL);
iaaddr_dereference(&iaaddr, MDL);
iasubopt_dereference(&iaaddr, MDL);
}
/*
......@@ -4392,7 +4392,7 @@ parse_ia_na_declaration(struct parse *cfile) {
/*
* If we have addresses, add this, otherwise don't bother.
*/
if (ia->num_iaaddr > 0) {
if (ia->num_iasubopt > 0) {
ia_hash_add(ia_na_active,
(unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL);
......@@ -4418,7 +4418,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
u_int32_t prefer;
u_int32_t valid;
TIME end_time;
struct iaaddr *iaaddr;
struct iasubopt *iaaddr;
struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding;
......@@ -4676,7 +4676,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
}
iaaddr = NULL;
if (iaaddr_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory.");
}
memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr));
......@@ -4693,7 +4693,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
}
/* add to our various structures */
ia_add_iaaddr(ia, iaaddr, MDL);
ia_add_iasubopt(ia, iaaddr, MDL);
ia_reference(&iaaddr->ia, ia, MDL);
pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_TA,
......@@ -4706,7 +4706,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
}
add_lease6(pool, iaaddr, end_time);
ipv6_pool_dereference(&pool, MDL);
iaaddr_dereference(&iaaddr, MDL);
iasubopt_dereference(&iaaddr, MDL);
}
/*
......@@ -4725,7 +4725,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
/*
* If we have addresses, add this, otherwise don't bother.
*/
if (ia->num_iaaddr > 0) {
if (ia->num_iasubopt > 0) {
ia_hash_add(ia_ta_active,
(unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL);
......@@ -4752,7 +4752,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
u_int32_t prefer;
u_int32_t valid;
TIME end_time;
struct iaaddr *iapref;
struct iasubopt *iapref;
struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding;
......@@ -5010,7 +5010,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
}
iapref = NULL;
if (iaaddr_allocate(&iapref, MDL) != ISC_R_SUCCESS) {
if (iasubopt_allocate(&iapref, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory.");
}
memcpy(&iapref->addr, iaddr.iabuf, sizeof(iapref->addr));
......@@ -5027,7 +5027,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
}
/* add to our various structures */
ia_add_iaaddr(ia, iapref, MDL);
ia_add_iasubopt(ia, iapref, MDL);
ia_reference(&iapref->ia, ia, MDL);
pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_PD,
......@@ -5040,7 +5040,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
}
add_lease6(pool, iapref, end_time);
ipv6_pool_dereference(&pool, MDL);
iaaddr_dereference(&iapref, MDL);
iasubopt_dereference(&iapref, MDL);
}
/*
......@@ -5059,7 +5059,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
/*
* If we have prefixes, add this, otherwise don't bother.
*/
if (ia->num_iaaddr > 0) {
if (ia->num_iasubopt > 0) {
ia_hash_add(ia_pd_active,
(unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL);
......
......@@ -501,7 +501,7 @@ int write_group (group)
*/
int
write_ia(const struct ia_xx *ia) {
struct iaaddr *iaaddr;
struct iasubopt *iasubopt;
struct binding *bnd;
int i;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff.255.255.255.255")];
......@@ -557,46 +557,47 @@ write_ia(const struct ia_xx *ia) {
goto error_exit;
}
}
for (i=0; i<ia->num_iaaddr; i++) {
iaaddr = ia->iaaddr[i];
for (i=0; i<ia->num_iasubopt; i++) {
iasubopt = ia->iasubopt[i];
inet_ntop(AF_INET6, &iaaddr->addr, addr_buf, sizeof(addr_buf));
inet_ntop(AF_INET6, &iasubopt->addr,
addr_buf, sizeof(addr_buf));
if ((ia->ia_type != D6O_IA_PD) &&
(fprintf(db_file, " iaaddr %s {\n", addr_buf) < 0)) {
goto error_exit;
}
if ((ia->ia_type == D6O_IA_PD) &&
(fprintf(db_file, " iaprefix %s/%d {\n",
addr_buf, (int)iaaddr->plen) < 0)) {
addr_buf, (int)iasubopt->plen) < 0)) {
goto error_exit;
}
if ((iaaddr->state <= 0) || (iaaddr->state > FTS_LAST)) {
log_fatal("Unknown iaaddr state %d at %s:%d",
iaaddr->state, MDL);
if ((iasubopt->state <= 0) || (iasubopt->state > FTS_LAST)) {
log_fatal("Unknown iasubopt state %d at %s:%d",
iasubopt->state, MDL);
}
binding_state = binding_state_names[iaaddr->state-1];
binding_state = binding_state_names[iasubopt->state-1];
if (fprintf(db_file, " binding state %s;\n",
binding_state) < 0) {
goto error_exit;
}
if (fprintf(db_file, " preferred-life %u\n",
(unsigned)iaaddr->prefer) < 0) {
(unsigned)iasubopt->prefer) < 0) {
goto error_exit;
}
if (fprintf(db_file, " max-life %u\n",
(unsigned)iaaddr->valid) < 0) {
(unsigned)iasubopt->valid) < 0) {
goto error_exit;
}
/* Note that from here on out, the \n is prepended to the
* next write, rather than appended to the current write.
*/
if ((iaaddr->state == FTS_ACTIVE) ||
(iaaddr->state == FTS_ABANDONED) ||
(iaaddr->hard_lifetime_end_time != 0)) {
tval = print_time(iaaddr->hard_lifetime_end_time);
if ((iasubopt->state == FTS_ACTIVE) ||
(iasubopt->state == FTS_ABANDONED) ||
(iasubopt->hard_lifetime_end_time != 0)) {
tval = print_time(iasubopt->hard_lifetime_end_time);
} else {
tval = print_time(iaaddr->soft_lifetime_end_time);
tval = print_time(iasubopt->soft_lifetime_end_time);
}
if (tval == NULL) {
goto error_exit;
......@@ -608,8 +609,8 @@ write_ia(const struct ia_xx *ia) {
/* Write out any binding scopes: note that 'ends' above does
* not have \n on the end! We want that.
*/
if (iaaddr->scope != NULL)
bnd = iaaddr->scope->bindings;
if (iasubopt->scope != NULL)
bnd = iasubopt->scope->bindings;
else
bnd = NULL;
......
......@@ -213,7 +213,7 @@ static isc_result_t ddns_remove_ptr (struct data_string *ddns_rev_name)
*/
int
ddns_updates(struct packet *packet, struct lease *lease, struct lease *old,
struct iaaddr *lease6, struct iaaddr *old6,
struct iasubopt *lease6, struct iasubopt *old6,
struct option_state *options)
{
unsigned long ddns_ttl = DEFAULT_DDNS_TTL;
......@@ -801,7 +801,7 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old,
/* Remove relevant entries from DNS. */
int
ddns_removals(struct lease *lease, struct iaaddr *lease6)
ddns_removals(struct lease *lease, struct iasubopt *lease6)
{
struct data_string ddns_fwd_name;
struct data_string ddns_rev_name;
......
......@@ -862,7 +862,7 @@ process_lq_by_address(struct lq6_state *lq) {
struct ipv6_pool *pool = NULL;
struct data_string data;
struct in6_addr addr;
struct iaaddr *iaaddr = NULL;
struct iasubopt *iaaddr = NULL;
struct option_state *opt_state = NULL;
u_int32_t lifetime;
unsigned opt_cursor;
......@@ -909,8 +909,8 @@ process_lq_by_address(struct lq6_state *lq) {
ret_val = 1;
goto exit;
}
if (iaaddr_hash_lookup(&iaaddr, pool->addrs, &addr,
sizeof(addr), MDL) == 0) {
if (iasubopt_hash_lookup(&iaaddr, pool->leases, &addr,
sizeof(addr), MDL) == 0) {
ret_val = 1;
goto exit;
}
......@@ -993,7 +993,7 @@ process_lq_by_address(struct lq6_state *lq) {
if (pool != NULL)
ipv6_pool_dereference(&pool, MDL);
if (iaaddr != NULL)
iaaddr_dereference(&iaaddr, MDL);
iasubopt_dereference(&iaaddr, MDL);
if (opt_state != NULL)
option_state_dereference(&opt_state, MDL);
return ret_val;
......
......@@ -60,7 +60,7 @@ struct reply_state {
struct data_string fixed;
/* IAADDR/PREFIX level persistent state */
struct iaaddr *lease;
struct iasubopt *lease;
/*
* "t1", "t2", preferred, and valid lifetimes records for calculating
......@@ -118,7 +118,8 @@ static isc_result_t reply_process_is_addressed(struct reply_state *reply,
struct group *group);
static isc_result_t reply_process_send_addr(struct reply_state *reply,
struct iaddr *addr);
static struct iaaddr *lease_compare(struct iaaddr *alpha, struct iaaddr *beta);
static struct iasubopt *lease_compare(struct iasubopt *alpha,
struct iasubopt *beta);
static isc_result_t reply_process_ia_pd(struct reply_state *reply,
struct option_cache *ia_pd);
static isc_result_t reply_process_prefix(struct reply_state *reply,
......@@ -133,9 +134,9 @@ static isc_result_t reply_process_is_prefixed(struct reply_state *reply,
struct group *group);
static isc_result_t reply_process_send_prefix(struct reply_state *reply,
struct iaddrcidrnet *pref);
static struct iaaddr *prefix_compare(struct reply_state *reply,
struct iaaddr *alpha,
struct iaaddr *beta);
static struct iasubopt *prefix_compare(struct reply_state *reply,
struct iasubopt *alpha,
struct iasubopt *beta);
/*
* This function returns the time since DUID time start for the
......@@ -937,7 +938,7 @@ start_reply(struct packet *packet,
* requested_addr is the address the client wants
*/
static isc_result_t
try_client_v6_address(struct iaaddr **addr,
try_client_v6_address(struct iasubopt **addr,
struct ipv6_pool *pool,
const struct data_string *requested_addr)
{
......@@ -960,7 +961,7 @@ try_client_v6_address(struct iaaddr **addr,
return ISC_R_ADDRINUSE;
}
result = iaaddr_allocate(addr, MDL);
result = iasubopt_allocate(addr, MDL);
if (result != ISC_R_SUCCESS) {
return result;
}
......@@ -970,7 +971,7 @@ try_client_v6_address(struct iaaddr **addr,
/* Default is soft binding for 2 minutes. */
result = add_lease6(pool, *addr, cur_time + 120);
if (result != ISC_R_SUCCESS) {
iaaddr_dereference(addr, MDL);
iasubopt_dereference(addr, MDL);
}
return result;
}
......@@ -984,7 +985,7 @@ try_client_v6_address(struct iaaddr **addr,
* client_id is the DUID for the client
*/
static isc_result_t
pick_v6_address(struct iaaddr **addr, struct shared_network *shared_network,
pick_v6_address(struct iasubopt **addr, struct shared_network *shared_network,
const struct data_string *client_id)
{
struct ipv6_pool *p;
......@@ -1070,7 +1071,7 @@ pick_v6_address(struct iaaddr **addr, struct shared_network *shared_network,
* requested_pref is the address the client wants
*/
static isc_result_t
try_client_v6_prefix(struct iaaddr **pref,
try_client_v6_prefix(struct iasubopt **pref,
struct ipv6_pool *pool,
const struct data_string *requested_pref)
{
......@@ -1105,7 +1106,7 @@ try_client_v6_prefix(struct iaaddr **pref,
return ISC_R_ADDRINUSE;
}
result = iaaddr_allocate(pref, MDL);
result = iasubopt_allocate(pref, MDL);
if (result != ISC_R_SUCCESS) {
return result;
}
......@@ -1115,7 +1116,7 @@ try_client_v6_prefix(struct iaaddr **pref,
/* Default is soft binding for 2 minutes. */
result = add_lease6(pool, *pref, cur_time + 120);
if (result != ISC_R_SUCCESS) {
iaaddr_dereference(pref, MDL);
iasubopt_dereference(pref, MDL);
}
return result;
}
......@@ -1130,7 +1131,7 @@ try_client_v6_prefix(struct iaaddr **pref,
* client_id is the DUID for the client
*/
static isc_result_t
pick_v6_prefix(struct iaaddr **pref, int plen,
pick_v6_prefix(struct iasubopt **pref, int plen,
struct shared_network *shared_network,
const struct data_string *client_id)
{
......@@ -1778,13 +1779,13 @@ reply_process_ia_na(struct reply_state *reply, struct option_cache *ia) {
*/
if ((status != ISC_R_CANCELED) && !reply->static_lease &&
(reply->buf.reply.msg_type == DHCPV6_REPLY) &&
(reply->ia->num_iaaddr != 0)) {
struct iaaddr *tmp;
(reply->ia->num_iasubopt != 0)) {
struct iasubopt *tmp;
struct data_string *ia_id;
int i;
for (i = 0 ; i < reply->ia->num_iaaddr ; i++) {
tmp = reply->ia->iaaddr[i];
for (i = 0 ; i < reply->ia->num_iasubopt ; i++) {
tmp = reply->ia->iasubopt[i];
if (tmp->ia != NULL)
ia_dereference(&tmp->ia, MDL);
......@@ -1846,7 +1847,7 @@ reply_process_ia_na(struct reply_state *reply, struct option_cache *ia) {
if (reply->old_ia != NULL)
ia_dereference(&reply->old_ia, MDL);
if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL);
iasubopt_dereference(&reply->lease, MDL);
if (reply->fixed.data != NULL)
data_string_forget(&reply->fixed, MDL);
......@@ -2143,7 +2144,7 @@ reply_process_addr(struct reply_state *reply, struct option_cache *addr) {
if (data.data != NULL)
data_string_forget(&data, MDL);
if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL);
iasubopt_dereference(&reply->lease, MDL);
return status;
}
......@@ -2171,16 +2172,16 @@ address_is_owned(struct reply_state *reply, struct iaddr *addr) {
return ISC_FALSE;
}
if ((reply->old_ia == NULL) || (reply->old_ia->num_iaaddr == 0))
if ((reply->old_ia == NULL) || (reply->old_ia->num_iasubopt == 0))
return ISC_FALSE;
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) {
struct iaaddr *tmp;
for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
struct iasubopt *tmp;
tmp = reply->old_ia->iaaddr[i];
tmp = reply->old_ia->iasubopt[i];
if (memcmp(addr->iabuf, &tmp->addr, 16) == 0) {
iaaddr_reference(&reply->lease, tmp, MDL);
iasubopt_reference(&reply->lease, tmp, MDL);
return ISC_TRUE;
}
}
......@@ -2393,13 +2394,13 @@ reply_process_ia_ta(struct reply_state *reply, struct option_cache *ia) {
*/
if ((status != ISC_R_CANCELED) &&
(reply->buf.reply.msg_type == DHCPV6_REPLY) &&
(reply->ia->num_iaaddr != 0)) {
struct iaaddr *tmp;
(reply->ia->num_iasubopt != 0)) {
struct iasubopt *tmp;
struct data_string *ia_id;
int i;
for (i = 0 ; i < reply->ia->num_iaaddr ; i++) {
tmp = reply->ia->iaaddr[i];
for (i = 0 ; i < reply->ia->num_iasubopt ; i++) {
tmp = reply->ia->iasubopt[i];
if (tmp->ia != NULL)
ia_dereference(&tmp->ia, MDL);
......@@ -2463,7 +2464,7 @@ reply_process_ia_ta(struct reply_state *reply, struct option_cache *ia) {
if (reply->old_ia != NULL)
ia_dereference(&reply->old_ia, MDL);
if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL);
iasubopt_dereference(&reply->lease, MDL);
/*
* ISC_R_CANCELED is a status code used by the addr processing to
......@@ -2528,13 +2529,13 @@ find_client_temporaries(struct reply_state *reply) {
goto cleanup;
}
if (reply->lease != NULL) {
iaaddr_dereference(&reply->lease, MDL);
iasubopt_dereference(&reply->lease, MDL);
}
}
cleanup:
if (reply->lease != NULL) {
iaaddr_dereference(&reply->lease, MDL);
iasubopt_dereference(&reply->lease, MDL);
}
return status;
}
......@@ -2582,7 +2583,7 @@ static isc_result_t
find_client_address(struct reply_state *reply) {
struct iaddr send_addr;
isc_result_t status = ISC_R_NORESOURCES;
struct iaaddr *lease, *best_lease = NULL;
struct iasubopt *lease, *best_lease = NULL;
struct binding_scope **scope;
struct group *group;
int i;
......@@ -2605,8 +2606,8 @@ find_client_address(struct reply_state *reply) {
}
if (reply->old_ia != NULL) {
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) {
lease = reply->old_ia->iaaddr[i];
for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
lease = reply->old_ia->iasubopt[i];
best_lease = lease_compare(lease, best_lease);
}
......@@ -2619,7 +2620,7 @@ find_client_address(struct reply_state *reply) {
status = pick_v6_address(&reply->lease, reply->shared,
&reply->client_id);
} else if (best_lease != NULL) {
iaaddr_reference(&reply->lease, best_lease, MDL);
iasubopt_reference(&reply->lease, best_lease, MDL);
status = ISC_R_SUCCESS;
}
......@@ -2629,7 +2630,7 @@ find_client_address(struct reply_state *reply) {
log_error("Reclaiming abandoned addresses is not yet "
"supported. Treating this as an out of space "