2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 15:56:00 +00:00

rename iaaddr structure & co

This commit is contained in:
Francis Dupont
2008-03-31 13:49:45 +00:00
parent 9ac4206a63
commit 1d17db44a7
7 changed files with 430 additions and 424 deletions

View File

@@ -1334,12 +1334,11 @@ typedef unsigned char option_mask [16];
/* these are referenced */ /* these are referenced */
typedef struct hash_table ia_hash_t; typedef struct hash_table ia_hash_t;
typedef struct hash_table iaaddr_hash_t; typedef struct hash_table iasubopt_hash_t;
/* should be lease6 */ /* IAADDR/IAPREFIX lease */
/* shared with iaprefix */
struct iaaddr { struct iasubopt {
int refcnt; /* reference count */ int refcnt; /* reference count */
struct in6_addr addr; /* IPv6 address/prefix */ struct in6_addr addr; /* IPv6 address/prefix */
u_int8_t plen; /* iaprefix prefix length */ u_int8_t plen; /* iaprefix prefix length */
@@ -1365,10 +1364,10 @@ struct ia_xx {
int refcnt; /* reference count */ int refcnt; /* reference count */
struct data_string iaid_duid; /* from the client */ struct data_string iaid_duid; /* from the client */
u_int16_t ia_type; /* IA_XX */ u_int16_t ia_type; /* IA_XX */
int num_iaaddr; /* number of IAADDR for this IA */ int num_iasubopt; /* number of IAADDR/PREFIX */
int max_iaaddr; /* space available for IAADDR */ int max_iasubopt; /* space available for IAADDR/PREFIX */
time_t cltt; /* client last transaction time */ 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; extern ia_hash_t *ia_na_active;
@@ -1381,10 +1380,10 @@ struct ipv6_pool {
struct in6_addr start_addr; /* first IPv6 address */ struct in6_addr start_addr; /* first IPv6 address */
int bits; /* number of bits, CIDR style */ int bits; /* number of bits, CIDR style */
int units; /* allocation unit in bits */ int units; /* allocation unit in bits */
iaaddr_hash_t *addrs; /* non-free IAADDR */ iasubopt_hash_t *leases; /* non-free leases */
int num_active; /* count of active IAADDR */ int num_active; /* count of active leases */
isc_heap_t *active_timeouts; /* timeouts for 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 isc_heap_t *inactive_timeouts; /* timeouts for expired or
released leases */ released leases */
struct shared_network *shared_network; /* shared_network for struct shared_network *shared_network; /* shared_network for
@@ -1725,8 +1724,8 @@ void parse_server_duid_conf(struct parse *cfile);
/* ddns.c */ /* ddns.c */
int ddns_updates(struct packet *, struct lease *, struct lease *, int ddns_updates(struct packet *, struct lease *, struct lease *,
struct iaaddr *, struct iaaddr *, struct option_state *); struct iasubopt *, struct iasubopt *, struct option_state *);
int ddns_removals(struct lease *, struct iaaddr *); int ddns_removals(struct lease *, struct iasubopt *);
/* parse.c */ /* parse.c */
void add_enumeration (struct enumeration *); 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 *); failover_message_t *);
isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *, isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
failover_message_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 dhcp_failover_recover_done (void *);
void failover_print PROTO ((char *, unsigned *, unsigned, const char *)); void failover_print PROTO ((char *, unsigned *, unsigned, const char *));
void update_partner PROTO ((struct lease *)); void update_partner PROTO ((struct lease *));
@@ -3227,14 +3226,16 @@ const char *binding_state_print (enum failover_state);
/* mdb6.c */ /* mdb6.c */
HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t); 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, isc_result_t iasubopt_allocate(struct iasubopt **iasubopt,
const char *file, int line); const char *file, int line);
isc_result_t iaaddr_reference(struct iaaddr **iaaddr, struct iaaddr *src, isc_result_t iasubopt_reference(struct iasubopt **iasubopt,
const char *file, int line); struct iasubopt *src,
isc_result_t iaaddr_dereference(struct iaaddr **iaaddr,
const char *file, int line); 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, isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid,
const char *duid, unsigned int duid_len, 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); const char *file, int line);
isc_result_t ia_dereference(struct ia_xx **ia, isc_result_t ia_dereference(struct ia_xx **ia,
const char *file, int line); const char *file, int line);
isc_result_t ia_add_iaaddr(struct ia_xx *ia, struct iaaddr *iaaddr, isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
const char *file, int line); const char *file, int line);
void ia_remove_iaaddr(struct ia_xx *ia, struct iaaddr *iaaddr, void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
const char *file, int line); const char *file, int line);
isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b); 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, 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, isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool,
const char *file, int line); const char *file, int line);
isc_result_t create_lease6(struct ipv6_pool *pool, isc_result_t create_lease6(struct ipv6_pool *pool,
struct iaaddr **addr, struct iasubopt **addr,
unsigned int *attempts, unsigned int *attempts,
const struct data_string *uid, const struct data_string *uid,
time_t soft_lifetime_end_time); time_t soft_lifetime_end_time);
isc_result_t add_lease6(struct ipv6_pool *pool, isc_result_t add_lease6(struct ipv6_pool *pool,
struct iaaddr *addr, struct iasubopt *lease,
time_t valid_lifetime_end_time); time_t valid_lifetime_end_time);
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iaaddr *addr); isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
isc_result_t expire_lease6(struct iaaddr **addr, isc_result_t expire_lease6(struct iasubopt **leasep,
struct ipv6_pool *pool, time_t now); struct ipv6_pool *pool, time_t now);
isc_result_t release_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 iaaddr *addr); isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
isc_boolean_t lease6_exists(const struct ipv6_pool *pool, isc_boolean_t lease6_exists(const struct ipv6_pool *pool,
const struct in6_addr *addr); const struct in6_addr *addr);
isc_result_t mark_lease_unavailble(struct ipv6_pool *pool, isc_result_t mark_lease_unavailble(struct ipv6_pool *pool,
const struct in6_addr *addr); const struct in6_addr *addr);
isc_result_t create_prefix6(struct ipv6_pool *pool, isc_result_t create_prefix6(struct ipv6_pool *pool,
struct iaaddr **pref, struct iasubopt **pref,
unsigned int *attempts, unsigned int *attempts,
const struct data_string *uid, const struct data_string *uid,
time_t soft_lifetime_end_time); time_t soft_lifetime_end_time);

View File

@@ -4085,7 +4085,7 @@ parse_ia_na_declaration(struct parse *cfile) {
u_int32_t prefer; u_int32_t prefer;
u_int32_t valid; u_int32_t valid;
TIME end_time; TIME end_time;
struct iaaddr *iaaddr; struct iasubopt *iaaddr;
struct ipv6_pool *pool; struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding; isc_boolean_t newbinding;
@@ -4343,7 +4343,7 @@ parse_ia_na_declaration(struct parse *cfile) {
} }
iaaddr = NULL; iaaddr = NULL;
if (iaaddr_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory."); log_fatal("Out of memory.");
} }
memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr)); memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr));
@@ -4360,7 +4360,7 @@ parse_ia_na_declaration(struct parse *cfile) {
} }
/* add to our various structures */ /* add to our various structures */
ia_add_iaaddr(ia, iaaddr, MDL); ia_add_iasubopt(ia, iaaddr, MDL);
ia_reference(&iaaddr->ia, ia, MDL); ia_reference(&iaaddr->ia, ia, MDL);
pool = NULL; pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_NA, 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); add_lease6(pool, iaaddr, end_time);
ipv6_pool_dereference(&pool, MDL); 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 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, ia_hash_add(ia_na_active,
(unsigned char *)ia->iaid_duid.data, (unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL); ia->iaid_duid.len, ia, MDL);
@@ -4418,7 +4418,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
u_int32_t prefer; u_int32_t prefer;
u_int32_t valid; u_int32_t valid;
TIME end_time; TIME end_time;
struct iaaddr *iaaddr; struct iasubopt *iaaddr;
struct ipv6_pool *pool; struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding; isc_boolean_t newbinding;
@@ -4676,7 +4676,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
} }
iaaddr = NULL; iaaddr = NULL;
if (iaaddr_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory."); log_fatal("Out of memory.");
} }
memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr)); memcpy(&iaaddr->addr, iaddr.iabuf, sizeof(iaaddr->addr));
@@ -4693,7 +4693,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
} }
/* add to our various structures */ /* add to our various structures */
ia_add_iaaddr(ia, iaaddr, MDL); ia_add_iasubopt(ia, iaaddr, MDL);
ia_reference(&iaaddr->ia, ia, MDL); ia_reference(&iaaddr->ia, ia, MDL);
pool = NULL; pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_TA, 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); add_lease6(pool, iaaddr, end_time);
ipv6_pool_dereference(&pool, MDL); 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 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, ia_hash_add(ia_ta_active,
(unsigned char *)ia->iaid_duid.data, (unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL); ia->iaid_duid.len, ia, MDL);
@@ -4752,7 +4752,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
u_int32_t prefer; u_int32_t prefer;
u_int32_t valid; u_int32_t valid;
TIME end_time; TIME end_time;
struct iaaddr *iapref; struct iasubopt *iapref;
struct ipv6_pool *pool; struct ipv6_pool *pool;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
isc_boolean_t newbinding; isc_boolean_t newbinding;
@@ -5010,7 +5010,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
} }
iapref = NULL; iapref = NULL;
if (iaaddr_allocate(&iapref, MDL) != ISC_R_SUCCESS) { if (iasubopt_allocate(&iapref, MDL) != ISC_R_SUCCESS) {
log_fatal("Out of memory."); log_fatal("Out of memory.");
} }
memcpy(&iapref->addr, iaddr.iabuf, sizeof(iapref->addr)); memcpy(&iapref->addr, iaddr.iabuf, sizeof(iapref->addr));
@@ -5027,7 +5027,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
} }
/* add to our various structures */ /* add to our various structures */
ia_add_iaaddr(ia, iapref, MDL); ia_add_iasubopt(ia, iapref, MDL);
ia_reference(&iapref->ia, ia, MDL); ia_reference(&iapref->ia, ia, MDL);
pool = NULL; pool = NULL;
if (find_ipv6_pool(&pool, D6O_IA_PD, 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); add_lease6(pool, iapref, end_time);
ipv6_pool_dereference(&pool, MDL); 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 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, ia_hash_add(ia_pd_active,
(unsigned char *)ia->iaid_duid.data, (unsigned char *)ia->iaid_duid.data,
ia->iaid_duid.len, ia, MDL); ia->iaid_duid.len, ia, MDL);

View File

@@ -501,7 +501,7 @@ int write_group (group)
*/ */
int int
write_ia(const struct ia_xx *ia) { write_ia(const struct ia_xx *ia) {
struct iaaddr *iaaddr; struct iasubopt *iasubopt;
struct binding *bnd; struct binding *bnd;
int i; int i;
char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff.255.255.255.255")]; 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; goto error_exit;
} }
} }
for (i=0; i<ia->num_iaaddr; i++) { for (i=0; i<ia->num_iasubopt; i++) {
iaaddr = ia->iaaddr[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) && if ((ia->ia_type != D6O_IA_PD) &&
(fprintf(db_file, " iaaddr %s {\n", addr_buf) < 0)) { (fprintf(db_file, " iaaddr %s {\n", addr_buf) < 0)) {
goto error_exit; goto error_exit;
} }
if ((ia->ia_type == D6O_IA_PD) && if ((ia->ia_type == D6O_IA_PD) &&
(fprintf(db_file, " iaprefix %s/%d {\n", (fprintf(db_file, " iaprefix %s/%d {\n",
addr_buf, (int)iaaddr->plen) < 0)) { addr_buf, (int)iasubopt->plen) < 0)) {
goto error_exit; goto error_exit;
} }
if ((iaaddr->state <= 0) || (iaaddr->state > FTS_LAST)) { if ((iasubopt->state <= 0) || (iasubopt->state > FTS_LAST)) {
log_fatal("Unknown iaaddr state %d at %s:%d", log_fatal("Unknown iasubopt state %d at %s:%d",
iaaddr->state, MDL); 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", if (fprintf(db_file, " binding state %s;\n",
binding_state) < 0) { binding_state) < 0) {
goto error_exit; goto error_exit;
} }
if (fprintf(db_file, " preferred-life %u\n", if (fprintf(db_file, " preferred-life %u\n",
(unsigned)iaaddr->prefer) < 0) { (unsigned)iasubopt->prefer) < 0) {
goto error_exit; goto error_exit;
} }
if (fprintf(db_file, " max-life %u\n", if (fprintf(db_file, " max-life %u\n",
(unsigned)iaaddr->valid) < 0) { (unsigned)iasubopt->valid) < 0) {
goto error_exit; goto error_exit;
} }
/* Note that from here on out, the \n is prepended to the /* Note that from here on out, the \n is prepended to the
* next write, rather than appended to the current write. * next write, rather than appended to the current write.
*/ */
if ((iaaddr->state == FTS_ACTIVE) || if ((iasubopt->state == FTS_ACTIVE) ||
(iaaddr->state == FTS_ABANDONED) || (iasubopt->state == FTS_ABANDONED) ||
(iaaddr->hard_lifetime_end_time != 0)) { (iasubopt->hard_lifetime_end_time != 0)) {
tval = print_time(iaaddr->hard_lifetime_end_time); tval = print_time(iasubopt->hard_lifetime_end_time);
} else { } else {
tval = print_time(iaaddr->soft_lifetime_end_time); tval = print_time(iasubopt->soft_lifetime_end_time);
} }
if (tval == NULL) { if (tval == NULL) {
goto error_exit; goto error_exit;
@@ -608,8 +609,8 @@ write_ia(const struct ia_xx *ia) {
/* Write out any binding scopes: note that 'ends' above does /* Write out any binding scopes: note that 'ends' above does
* not have \n on the end! We want that. * not have \n on the end! We want that.
*/ */
if (iaaddr->scope != NULL) if (iasubopt->scope != NULL)
bnd = iaaddr->scope->bindings; bnd = iasubopt->scope->bindings;
else else
bnd = NULL; bnd = NULL;

View File

@@ -213,7 +213,7 @@ static isc_result_t ddns_remove_ptr (struct data_string *ddns_rev_name)
*/ */
int int
ddns_updates(struct packet *packet, struct lease *lease, struct lease *old, 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) struct option_state *options)
{ {
unsigned long ddns_ttl = DEFAULT_DDNS_TTL; 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. */ /* Remove relevant entries from DNS. */
int 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_fwd_name;
struct data_string ddns_rev_name; struct data_string ddns_rev_name;

View File

@@ -862,7 +862,7 @@ process_lq_by_address(struct lq6_state *lq) {
struct ipv6_pool *pool = NULL; struct ipv6_pool *pool = NULL;
struct data_string data; struct data_string data;
struct in6_addr addr; struct in6_addr addr;
struct iaaddr *iaaddr = NULL; struct iasubopt *iaaddr = NULL;
struct option_state *opt_state = NULL; struct option_state *opt_state = NULL;
u_int32_t lifetime; u_int32_t lifetime;
unsigned opt_cursor; unsigned opt_cursor;
@@ -909,8 +909,8 @@ process_lq_by_address(struct lq6_state *lq) {
ret_val = 1; ret_val = 1;
goto exit; goto exit;
} }
if (iaaddr_hash_lookup(&iaaddr, pool->addrs, &addr, if (iasubopt_hash_lookup(&iaaddr, pool->leases, &addr,
sizeof(addr), MDL) == 0) { sizeof(addr), MDL) == 0) {
ret_val = 1; ret_val = 1;
goto exit; goto exit;
} }
@@ -993,7 +993,7 @@ process_lq_by_address(struct lq6_state *lq) {
if (pool != NULL) if (pool != NULL)
ipv6_pool_dereference(&pool, MDL); ipv6_pool_dereference(&pool, MDL);
if (iaaddr != NULL) if (iaaddr != NULL)
iaaddr_dereference(&iaaddr, MDL); iasubopt_dereference(&iaaddr, MDL);
if (opt_state != NULL) if (opt_state != NULL)
option_state_dereference(&opt_state, MDL); option_state_dereference(&opt_state, MDL);
return ret_val; return ret_val;

View File

@@ -60,7 +60,7 @@ struct reply_state {
struct data_string fixed; struct data_string fixed;
/* IAADDR/PREFIX level persistent state */ /* IAADDR/PREFIX level persistent state */
struct iaaddr *lease; struct iasubopt *lease;
/* /*
* "t1", "t2", preferred, and valid lifetimes records for calculating * "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); struct group *group);
static isc_result_t reply_process_send_addr(struct reply_state *reply, static isc_result_t reply_process_send_addr(struct reply_state *reply,
struct iaddr *addr); 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, static isc_result_t reply_process_ia_pd(struct reply_state *reply,
struct option_cache *ia_pd); struct option_cache *ia_pd);
static isc_result_t reply_process_prefix(struct reply_state *reply, 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); struct group *group);
static isc_result_t reply_process_send_prefix(struct reply_state *reply, static isc_result_t reply_process_send_prefix(struct reply_state *reply,
struct iaddrcidrnet *pref); struct iaddrcidrnet *pref);
static struct iaaddr *prefix_compare(struct reply_state *reply, static struct iasubopt *prefix_compare(struct reply_state *reply,
struct iaaddr *alpha, struct iasubopt *alpha,
struct iaaddr *beta); struct iasubopt *beta);
/* /*
* This function returns the time since DUID time start for the * 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 * requested_addr is the address the client wants
*/ */
static isc_result_t static isc_result_t
try_client_v6_address(struct iaaddr **addr, try_client_v6_address(struct iasubopt **addr,
struct ipv6_pool *pool, struct ipv6_pool *pool,
const struct data_string *requested_addr) const struct data_string *requested_addr)
{ {
@@ -960,7 +961,7 @@ try_client_v6_address(struct iaaddr **addr,
return ISC_R_ADDRINUSE; return ISC_R_ADDRINUSE;
} }
result = iaaddr_allocate(addr, MDL); result = iasubopt_allocate(addr, MDL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return result; return result;
} }
@@ -970,7 +971,7 @@ try_client_v6_address(struct iaaddr **addr,
/* Default is soft binding for 2 minutes. */ /* Default is soft binding for 2 minutes. */
result = add_lease6(pool, *addr, cur_time + 120); result = add_lease6(pool, *addr, cur_time + 120);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
iaaddr_dereference(addr, MDL); iasubopt_dereference(addr, MDL);
} }
return result; return result;
} }
@@ -984,7 +985,7 @@ try_client_v6_address(struct iaaddr **addr,
* client_id is the DUID for the client * client_id is the DUID for the client
*/ */
static isc_result_t 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) const struct data_string *client_id)
{ {
struct ipv6_pool *p; 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 * requested_pref is the address the client wants
*/ */
static isc_result_t static isc_result_t
try_client_v6_prefix(struct iaaddr **pref, try_client_v6_prefix(struct iasubopt **pref,
struct ipv6_pool *pool, struct ipv6_pool *pool,
const struct data_string *requested_pref) const struct data_string *requested_pref)
{ {
@@ -1105,7 +1106,7 @@ try_client_v6_prefix(struct iaaddr **pref,
return ISC_R_ADDRINUSE; return ISC_R_ADDRINUSE;
} }
result = iaaddr_allocate(pref, MDL); result = iasubopt_allocate(pref, MDL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return result; return result;
} }
@@ -1115,7 +1116,7 @@ try_client_v6_prefix(struct iaaddr **pref,
/* Default is soft binding for 2 minutes. */ /* Default is soft binding for 2 minutes. */
result = add_lease6(pool, *pref, cur_time + 120); result = add_lease6(pool, *pref, cur_time + 120);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
iaaddr_dereference(pref, MDL); iasubopt_dereference(pref, MDL);
} }
return result; return result;
} }
@@ -1130,7 +1131,7 @@ try_client_v6_prefix(struct iaaddr **pref,
* client_id is the DUID for the client * client_id is the DUID for the client
*/ */
static isc_result_t 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, struct shared_network *shared_network,
const struct data_string *client_id) 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 && if ((status != ISC_R_CANCELED) && !reply->static_lease &&
(reply->buf.reply.msg_type == DHCPV6_REPLY) && (reply->buf.reply.msg_type == DHCPV6_REPLY) &&
(reply->ia->num_iaaddr != 0)) { (reply->ia->num_iasubopt != 0)) {
struct iaaddr *tmp; struct iasubopt *tmp;
struct data_string *ia_id; struct data_string *ia_id;
int i; int i;
for (i = 0 ; i < reply->ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->ia->num_iasubopt ; i++) {
tmp = reply->ia->iaaddr[i]; tmp = reply->ia->iasubopt[i];
if (tmp->ia != NULL) if (tmp->ia != NULL)
ia_dereference(&tmp->ia, MDL); 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) if (reply->old_ia != NULL)
ia_dereference(&reply->old_ia, MDL); ia_dereference(&reply->old_ia, MDL);
if (reply->lease != NULL) if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
if (reply->fixed.data != NULL) if (reply->fixed.data != NULL)
data_string_forget(&reply->fixed, MDL); 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) if (data.data != NULL)
data_string_forget(&data, MDL); data_string_forget(&data, MDL);
if (reply->lease != NULL) if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
return status; return status;
} }
@@ -2171,16 +2172,16 @@ address_is_owned(struct reply_state *reply, struct iaddr *addr) {
return ISC_FALSE; 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; return ISC_FALSE;
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
struct iaaddr *tmp; struct iasubopt *tmp;
tmp = reply->old_ia->iaaddr[i]; tmp = reply->old_ia->iasubopt[i];
if (memcmp(addr->iabuf, &tmp->addr, 16) == 0) { if (memcmp(addr->iabuf, &tmp->addr, 16) == 0) {
iaaddr_reference(&reply->lease, tmp, MDL); iasubopt_reference(&reply->lease, tmp, MDL);
return ISC_TRUE; return ISC_TRUE;
} }
} }
@@ -2393,13 +2394,13 @@ reply_process_ia_ta(struct reply_state *reply, struct option_cache *ia) {
*/ */
if ((status != ISC_R_CANCELED) && if ((status != ISC_R_CANCELED) &&
(reply->buf.reply.msg_type == DHCPV6_REPLY) && (reply->buf.reply.msg_type == DHCPV6_REPLY) &&
(reply->ia->num_iaaddr != 0)) { (reply->ia->num_iasubopt != 0)) {
struct iaaddr *tmp; struct iasubopt *tmp;
struct data_string *ia_id; struct data_string *ia_id;
int i; int i;
for (i = 0 ; i < reply->ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->ia->num_iasubopt ; i++) {
tmp = reply->ia->iaaddr[i]; tmp = reply->ia->iasubopt[i];
if (tmp->ia != NULL) if (tmp->ia != NULL)
ia_dereference(&tmp->ia, MDL); 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) if (reply->old_ia != NULL)
ia_dereference(&reply->old_ia, MDL); ia_dereference(&reply->old_ia, MDL);
if (reply->lease != NULL) 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 * 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; goto cleanup;
} }
if (reply->lease != NULL) { if (reply->lease != NULL) {
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
} }
} }
cleanup: cleanup:
if (reply->lease != NULL) { if (reply->lease != NULL) {
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
} }
return status; return status;
} }
@@ -2582,7 +2583,7 @@ static isc_result_t
find_client_address(struct reply_state *reply) { find_client_address(struct reply_state *reply) {
struct iaddr send_addr; struct iaddr send_addr;
isc_result_t status = ISC_R_NORESOURCES; isc_result_t status = ISC_R_NORESOURCES;
struct iaaddr *lease, *best_lease = NULL; struct iasubopt *lease, *best_lease = NULL;
struct binding_scope **scope; struct binding_scope **scope;
struct group *group; struct group *group;
int i; int i;
@@ -2605,8 +2606,8 @@ find_client_address(struct reply_state *reply) {
} }
if (reply->old_ia != NULL) { if (reply->old_ia != NULL) {
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
lease = reply->old_ia->iaaddr[i]; lease = reply->old_ia->iasubopt[i];
best_lease = lease_compare(lease, best_lease); 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, status = pick_v6_address(&reply->lease, reply->shared,
&reply->client_id); &reply->client_id);
} else if (best_lease != NULL) { } else if (best_lease != NULL) {
iaaddr_reference(&reply->lease, best_lease, MDL); iasubopt_reference(&reply->lease, best_lease, MDL);
status = ISC_R_SUCCESS; status = ISC_R_SUCCESS;
} }
@@ -2629,7 +2630,7 @@ find_client_address(struct reply_state *reply) {
log_error("Reclaiming abandoned addresses is not yet " log_error("Reclaiming abandoned addresses is not yet "
"supported. Treating this as an out of space " "supported. Treating this as an out of space "
"condition."); "condition.");
/* iaaddr_reference(&reply->lease, best_lease, MDL); */ /* iasubopt_reference(&reply->lease, best_lease, MDL); */
} }
/* Give up now if we didn't find a lease. */ /* Give up now if we didn't find a lease. */
@@ -2760,7 +2761,7 @@ reply_process_is_addressed(struct reply_state *reply,
/* Wait before renew! */ /* Wait before renew! */
} }
status = ia_add_iaaddr(reply->ia, reply->lease, MDL); status = ia_add_iasubopt(reply->ia, reply->lease, MDL);
if (status != ISC_R_SUCCESS) { if (status != ISC_R_SUCCESS) {
log_fatal("reply_process_is_addressed: Unable to " log_fatal("reply_process_is_addressed: Unable to "
"attach lease to new IA: %s", "attach lease to new IA: %s",
@@ -2831,8 +2832,8 @@ reply_process_send_addr(struct reply_state *reply, struct iaddr *addr) {
} }
/* Choose the better of two leases. */ /* Choose the better of two leases. */
static struct iaaddr * static struct iasubopt *
lease_compare(struct iaaddr *alpha, struct iaaddr *beta) { lease_compare(struct iasubopt *alpha, struct iasubopt *beta) {
if (alpha == NULL) if (alpha == NULL)
return beta; return beta;
if (beta == NULL) if (beta == NULL)
@@ -3159,13 +3160,13 @@ reply_process_ia_pd(struct reply_state *reply, struct option_cache *ia) {
*/ */
if ((status != ISC_R_CANCELED) && (reply->static_prefixes == 0) && if ((status != ISC_R_CANCELED) && (reply->static_prefixes == 0) &&
(reply->buf.reply.msg_type == DHCPV6_REPLY) && (reply->buf.reply.msg_type == DHCPV6_REPLY) &&
(reply->ia->num_iaaddr != 0)) { (reply->ia->num_iasubopt != 0)) {
struct iaaddr *tmp; struct iasubopt *tmp;
struct data_string *ia_id; struct data_string *ia_id;
int i; int i;
for (i = 0 ; i < reply->ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->ia->num_iasubopt ; i++) {
tmp = reply->ia->iaaddr[i]; tmp = reply->ia->iasubopt[i];
if (tmp->ia != NULL) if (tmp->ia != NULL)
ia_dereference(&tmp->ia, MDL); ia_dereference(&tmp->ia, MDL);
@@ -3211,7 +3212,7 @@ reply_process_ia_pd(struct reply_state *reply, struct option_cache *ia) {
if (reply->old_ia != NULL) if (reply->old_ia != NULL)
ia_dereference(&reply->old_ia, MDL); ia_dereference(&reply->old_ia, MDL);
if (reply->lease != NULL) if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
/* /*
* ISC_R_CANCELED is a status code used by the prefix processing to * ISC_R_CANCELED is a status code used by the prefix processing to
@@ -3439,7 +3440,7 @@ reply_process_prefix(struct reply_state *reply, struct option_cache *pref) {
if (data.data != NULL) if (data.data != NULL)
data_string_forget(&data, MDL); data_string_forget(&data, MDL);
if (reply->lease != NULL) if (reply->lease != NULL)
iaaddr_dereference(&reply->lease, MDL); iasubopt_dereference(&reply->lease, MDL);
return status; return status;
} }
@@ -3469,17 +3470,17 @@ prefix_is_owned(struct reply_state *reply, struct iaddrcidrnet *pref) {
} }
if ((reply->old_ia == NULL) || if ((reply->old_ia == NULL) ||
(reply->old_ia->num_iaaddr == 0)) (reply->old_ia->num_iasubopt == 0))
return ISC_FALSE; return ISC_FALSE;
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
struct iaaddr *tmp; struct iasubopt *tmp;
tmp = reply->old_ia->iaaddr[i]; tmp = reply->old_ia->iasubopt[i];
if ((pref->bits == (int) tmp->plen) && if ((pref->bits == (int) tmp->plen) &&
memcmp(pref->lo_addr.iabuf, &tmp->addr, 16) == 0) { memcmp(pref->lo_addr.iabuf, &tmp->addr, 16) == 0) {
iaaddr_reference(&reply->lease, tmp, MDL); iasubopt_reference(&reply->lease, tmp, MDL);
return ISC_TRUE; return ISC_TRUE;
} }
} }
@@ -3536,7 +3537,7 @@ static isc_result_t
find_client_prefix(struct reply_state *reply) { find_client_prefix(struct reply_state *reply) {
struct iaddrcidrnet send_pref; struct iaddrcidrnet send_pref;
isc_result_t status = ISC_R_NORESOURCES; isc_result_t status = ISC_R_NORESOURCES;
struct iaaddr *prefix, *best_prefix = NULL; struct iasubopt *prefix, *best_prefix = NULL;
struct binding_scope **scope; struct binding_scope **scope;
struct group *group; struct group *group;
int i; int i;
@@ -3571,8 +3572,8 @@ find_client_prefix(struct reply_state *reply) {
} }
if (reply->old_ia != NULL) { if (reply->old_ia != NULL) {
for (i = 0 ; i < reply->old_ia->num_iaaddr ; i++) { for (i = 0 ; i < reply->old_ia->num_iasubopt ; i++) {
prefix = reply->old_ia->iaaddr[i]; prefix = reply->old_ia->iasubopt[i];
best_prefix = prefix_compare(reply, prefix, best_prefix = prefix_compare(reply, prefix,
best_prefix); best_prefix);
@@ -3586,7 +3587,7 @@ find_client_prefix(struct reply_state *reply) {
status = pick_v6_prefix(&reply->lease, reply->preflen, status = pick_v6_prefix(&reply->lease, reply->preflen,
reply->shared, &reply->client_id); reply->shared, &reply->client_id);
} else if (best_prefix != NULL) { } else if (best_prefix != NULL) {
iaaddr_reference(&reply->lease, best_prefix, MDL); iasubopt_reference(&reply->lease, best_prefix, MDL);
status = ISC_R_SUCCESS; status = ISC_R_SUCCESS;
} }
@@ -3596,7 +3597,7 @@ find_client_prefix(struct reply_state *reply) {
log_error("Reclaiming abandoned prefixes is not yet " log_error("Reclaiming abandoned prefixes is not yet "
"supported. Treating this as an out of space " "supported. Treating this as an out of space "
"condition."); "condition.");
/* iaaddr_reference(&reply->lease, best_prefix, MDL); */ /* iasubopt_reference(&reply->lease, best_prefix, MDL); */
} }
/* Give up now if we didn't find a prefix. */ /* Give up now if we didn't find a prefix. */
@@ -3713,7 +3714,7 @@ reply_process_is_prefixed(struct reply_state *reply,
/* Wait before renew! */ /* Wait before renew! */
} }
status = ia_add_iaaddr(reply->ia, reply->lease, MDL); status = ia_add_iasubopt(reply->ia, reply->lease, MDL);
if (status != ISC_R_SUCCESS) { if (status != ISC_R_SUCCESS) {
log_fatal("reply_process_is_prefixed: Unable to " log_fatal("reply_process_is_prefixed: Unable to "
"attach prefix to new IA_PD: %s", "attach prefix to new IA_PD: %s",
@@ -3786,9 +3787,9 @@ reply_process_send_prefix(struct reply_state *reply,
} }
/* Choose the better of two prefixes. */ /* Choose the better of two prefixes. */
static struct iaaddr * static struct iasubopt *
prefix_compare(struct reply_state *reply, prefix_compare(struct reply_state *reply,
struct iaaddr *alpha, struct iaaddr *beta) { struct iasubopt *alpha, struct iasubopt *beta) {
if (alpha == NULL) if (alpha == NULL)
return beta; return beta;
if (beta == NULL) if (beta == NULL)
@@ -4273,7 +4274,7 @@ dhcpv6_rebind(struct data_string *reply, struct packet *packet) {
static void static void
ia_na_match_decline(const struct data_string *client_id, ia_na_match_decline(const struct data_string *client_id,
const struct data_string *iaaddr, const struct data_string *iaaddr,
struct iaaddr *lease) struct iasubopt *lease)
{ {
char tmp_addr[INET6_ADDRSTRLEN]; char tmp_addr[INET6_ADDRSTRLEN];
@@ -4387,7 +4388,7 @@ iterate_over_ia_na(struct data_string *reply_ret,
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
int reply_ofs = (int)((char *)reply->options - (char *)reply); int reply_ofs = (int)((char *)reply->options - (char *)reply);
char status_msg[32]; char status_msg[32];
struct iaaddr *lease; struct iasubopt *lease;
struct ia_xx *existing_ia_na; struct ia_xx *existing_ia_na;
int i; int i;
struct data_string key; struct data_string key;
@@ -4576,16 +4577,16 @@ iterate_over_ia_na(struct data_string *reply_ret,
/* /*
* Make sure this address is in the IA_NA. * Make sure this address is in the IA_NA.
*/ */
for (i=0; i<existing_ia_na->num_iaaddr; i++) { for (i=0; i<existing_ia_na->num_iasubopt; i++) {
struct iaaddr *tmp; struct iasubopt *tmp;
struct in6_addr *in6_addr; struct in6_addr *in6_addr;
tmp = existing_ia_na->iaaddr[i]; tmp = existing_ia_na->iasubopt[i];
in6_addr = &tmp->addr; in6_addr = &tmp->addr;
if (memcmp(in6_addr, if (memcmp(in6_addr,
iaaddr.data, 16) == 0) { iaaddr.data, 16) == 0) {
iaaddr_reference(&lease, iasubopt_reference(&lease,
tmp, MDL); tmp, MDL);
break; break;
} }
} }
@@ -4604,7 +4605,7 @@ iterate_over_ia_na(struct data_string *reply_ret,
} }
if (lease != NULL) { if (lease != NULL) {
iaaddr_dereference(&lease, MDL); iasubopt_dereference(&lease, MDL);
} }
data_string_forget(&iaaddr, MDL); data_string_forget(&iaaddr, MDL);
@@ -4625,7 +4626,7 @@ iterate_over_ia_na(struct data_string *reply_ret,
exit: exit:
if (lease != NULL) { if (lease != NULL) {
iaaddr_dereference(&lease, MDL); iasubopt_dereference(&lease, MDL);
} }
if (host_opt_state != NULL) { if (host_opt_state != NULL) {
option_state_dereference(&host_opt_state, MDL); option_state_dereference(&host_opt_state, MDL);
@@ -4692,7 +4693,7 @@ dhcpv6_decline(struct data_string *reply, struct packet *packet) {
static void static void
ia_na_match_release(const struct data_string *client_id, ia_na_match_release(const struct data_string *client_id,
const struct data_string *iaaddr, const struct data_string *iaaddr,
struct iaaddr *lease) struct iasubopt *lease)
{ {
char tmp_addr[INET6_ADDRSTRLEN]; char tmp_addr[INET6_ADDRSTRLEN];
@@ -4783,7 +4784,7 @@ exit:
static void static void
ia_pd_match_release(const struct data_string *client_id, ia_pd_match_release(const struct data_string *client_id,
const struct data_string *iapref, const struct data_string *iapref,
struct iaaddr *prefix) struct iasubopt *prefix)
{ {
char tmp_addr[INET6_ADDRSTRLEN]; char tmp_addr[INET6_ADDRSTRLEN];
@@ -4899,7 +4900,7 @@ iterate_over_ia_pd(struct data_string *reply_ret,
int iaprefix_is_found; int iaprefix_is_found;
char reply_data[65536]; char reply_data[65536];
int reply_ofs; int reply_ofs;
struct iaaddr *prefix; struct iasubopt *prefix;
struct ia_xx *existing_ia_pd; struct ia_xx *existing_ia_pd;
int i; int i;
struct data_string key; struct data_string key;
@@ -5044,19 +5045,19 @@ iterate_over_ia_pd(struct data_string *reply_ret,
* Make sure this prefix is in the IA_PD. * Make sure this prefix is in the IA_PD.
*/ */
for (i = 0; for (i = 0;
i < existing_ia_pd->num_iaaddr; i < existing_ia_pd->num_iasubopt;
i++) { i++) {
struct iaaddr *tmp; struct iasubopt *tmp;
u_int8_t plen; u_int8_t plen;
plen = getUChar(iaprefix.data + 8); plen = getUChar(iaprefix.data + 8);
tmp = existing_ia_pd->iaaddr[i]; tmp = existing_ia_pd->iasubopt[i];
if ((tmp->plen == plen) && if ((tmp->plen == plen) &&
(memcmp(&tmp->addr, (memcmp(&tmp->addr,
iaprefix.data + 9, iaprefix.data + 9,
16) == 0)) { 16) == 0)) {
iaaddr_reference(&prefix, iasubopt_reference(&prefix,
tmp, MDL); tmp, MDL);
break; break;
} }
} }
@@ -5075,7 +5076,7 @@ iterate_over_ia_pd(struct data_string *reply_ret,
} }
if (prefix != NULL) { if (prefix != NULL) {
iaaddr_dereference(&prefix, MDL); iasubopt_dereference(&prefix, MDL);
} }
data_string_forget(&iaprefix, MDL); data_string_forget(&iaprefix, MDL);
@@ -5104,7 +5105,7 @@ iterate_over_ia_pd(struct data_string *reply_ret,
exit: exit:
if (prefix != NULL) { if (prefix != NULL) {
iaaddr_dereference(&prefix, MDL); iasubopt_dereference(&prefix, MDL);
} }
if (host_opt_state != NULL) { if (host_opt_state != NULL) {
option_state_dereference(&host_opt_state, MDL); option_state_dereference(&host_opt_state, MDL);

File diff suppressed because it is too large Load Diff