/*
- * Copyright (C) 2007-2013 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2007-2015 by Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
if (pool->ipv6_pond)
pool->ipv6_pond->num_active--;
+ if (lease->state == FTS_ABANDONED) {
+ pool->num_abandoned--;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned--;
+ }
+
iasubopt_hash_delete(pool->leases, &test_iasubopt->addr,
sizeof(test_iasubopt->addr), MDL);
ia_remove_iasubopt(old_ia, test_iasubopt, MDL);
pool->num_active--;
if (pool->ipv6_pond)
pool->ipv6_pond->num_active--;
+
+ if (test_iasubopt->state == FTS_ABANDONED) {
+ pool->num_abandoned--;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned--;
+ }
} else {
isc_heap_delete(pool->inactive_timeouts,
test_iasubopt->heap_index);
pool->num_active++;
if (pool->ipv6_pond)
pool->ipv6_pond->num_active++;
+
+ if (tmp_iasubopt->state == FTS_ABANDONED) {
+ pool->num_abandoned++;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned++;
+ }
}
} else {
lease->state = FTS_ACTIVE;
if (pool->ipv6_pond)
pool->ipv6_pond->num_active++;
+
}
return insert_result;
}
log_info("Reclaiming previously abandoned address %s",
inet_ntop(AF_INET6, &(lease->addr), tmp_addr,
sizeof(tmp_addr)));
+
+ pool->num_abandoned--;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned--;
+
return ISC_R_SUCCESS;
} else {
return move_lease_to_active(pool, lease);
pool->num_inactive++;
if (pool->ipv6_pond)
pool->ipv6_pond->num_active--;
+
+ if (lease->state == FTS_ABANDONED) {
+ pool->num_abandoned--;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned--;
+ }
}
return insert_result;
}
}
}
lease->state = FTS_ABANDONED;
+
+ pool->num_abandoned++;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_abandoned++;
+
lease->hard_lifetime_end_time = MAX_TIME;
isc_heap_decreased(pool->active_timeouts, lease->heap_index);
return ISC_R_SUCCESS;
return ISC_R_SUCCESS;
}
+/*
+ * Emits a log for each pond that has been flagged as being a "jumbo range"
+ * A pond is considered a "jumbo range" when the total number of elements
+ * exceeds the maximum value of POND_TRACK_MAX (currently maximum value
+ * that can be stored by ipv6_pond.num_total). Since we disable threshold
+ * logging for jumbo ranges, we need to report this to the user. This
+ * function allows us to report jumbo ponds after config parsing, so the
+ * logs can be seen both on the console (-T) and the log facility (i.e syslog).
+ *
+ * Note, threshold logging is done at the pond level, so we need emit a list
+ * of the addresses ranges of the pools in the pond affected.
+ */
+void
+report_jumbo_ranges() {
+ struct shared_network* s;
+ char log_buf[1084];
+
+ /* Loop thru all the networks looking for jumbo range ponds */
+ for (s = shared_networks; s; s = s -> next) {
+ struct ipv6_pond* pond = s->ipv6_pond;
+ while (pond) {
+ /* if its a jumbo and has pools(sanity check) */
+ if (pond->jumbo_range == 1 && (pond->ipv6_pools)) {
+ struct ipv6_pool* pool;
+ char *bufptr = log_buf;
+ size_t space_left = sizeof(log_buf) - 1;
+ int i = 0;
+ int used = 0;
+
+ /* Build list containing the start-address/CIDR
+ * of each pool */
+ *bufptr = '\0';
+ while ((pool = pond->ipv6_pools[i++]) &&
+ (space_left > (INET6_ADDRSTRLEN + 6))) {
+ /* more than one so add a comma */
+ if (i > 1) {
+ *bufptr++ = ',';
+ *bufptr++ = ' ';
+ *bufptr = '\0';
+ space_left -= 2;
+ }
+
+ /* add the address */
+ inet_ntop(AF_INET6, &pool->start_addr,
+ bufptr, INET6_ADDRSTRLEN);
+
+ used = strlen(bufptr);
+ bufptr += used;
+ space_left -= used;
+
+ /* add the CIDR */
+ sprintf (bufptr, "/%d",pool->bits);
+ used = strlen(bufptr);
+ bufptr += used;
+ space_left -= used;
+ *bufptr = '\0';
+ }
+
+ log_info("Threshold logging disabled for shared"
+ " subnet of ranges: %s", log_buf);
+ }
+ pond = pond->next;
+ }
+ }
+}
+
/* unittest moved to server/tests/mdb6_unittest.c */