170 #include <sys/types.h>
172 #include <netinet/in.h>
200 iasubopt_allocate(struct iasubopt **iasubopt, const
char *
file,
int line) {
201 struct iasubopt *tmp;
203 if (iasubopt == NULL) {
204 log_error(
"%s(%d): NULL pointer reference", file, line);
207 if (*iasubopt != NULL) {
208 log_error(
"%s(%d): non-NULL pointer", file, line);
212 tmp =
dmalloc(
sizeof(*tmp), file, line);
214 return ISC_R_NOMEMORY;
236 if (iasubopt == NULL) {
237 log_error(
"%s(%d): NULL pointer reference", file, line);
240 if (*iasubopt != NULL) {
241 log_error(
"%s(%d): non-NULL pointer", file, line);
245 log_error(
"%s(%d): NULL pointer reference", file, line);
262 struct iasubopt *tmp;
264 if ((iasubopt == NULL) || (*iasubopt == NULL)) {
265 log_error(
"%s(%d): NULL pointer", file, line);
274 log_error(
"%s(%d): negative refcnt", file, line);
278 if (tmp->
ia != NULL) {
284 if (tmp->
scope != NULL) {
301 dfree(tmp, file, line);
312 const char *duid,
unsigned int duid_len,
315 memset(key, 0,
sizeof(*key));
316 key->
len = duid_len +
sizeof(iaid);
318 return ISC_R_NOMEMORY;
321 memcpy((
char *)key->
data, &iaid,
sizeof(iaid));
322 memcpy((
char *)key->
data +
sizeof(iaid), duid, duid_len);
340 const char *duid,
unsigned int duid_len,
345 log_error(
"%s(%d): NULL pointer reference", file, line);
349 log_error(
"%s(%d): non-NULL pointer", file, line);
353 tmp =
dmalloc(
sizeof(*tmp), file, line);
355 return ISC_R_NOMEMORY;
360 dfree(tmp, file, line);
361 return ISC_R_NOMEMORY;
380 log_error(
"%s(%d): NULL pointer reference", file, line);
384 log_error(
"%s(%d): non-NULL pointer", file, line);
388 log_error(
"%s(%d): NULL pointer reference", file, line);
407 if ((ia == NULL) || (*ia == NULL)) {
408 log_error(
"%s(%d): NULL pointer", file, line);
417 log_error(
"%s(%d): negative refcnt", file, line);
429 dfree(tmp, file, line);
442 struct iasubopt **
new;
453 new =
dmalloc(max *
sizeof(
struct iasubopt *), file, line);
455 return ISC_R_NOMEMORY;
479 if (ia == NULL || iasubopt == NULL)
497 log_error(
"%s(%d): IAADDR/PREFIX not in IA", file, line);
569 sizeof(
struct in6_addr)) == 0) {
590 lease_older(
void *a,
void *b) {
608 active_changed(
void *
iasubopt,
unsigned int new_heap_index) {
609 ((
struct iasubopt *)iasubopt)->active_index = new_heap_index;
613 inactive_changed(
void *
iasubopt,
unsigned int new_heap_index) {
614 ((
struct iasubopt *)iasubopt)->inactive_index = new_heap_index;
641 const struct in6_addr *start_addr,
int bits,
642 int units,
const char *
file,
int line) {
646 log_error(
"%s(%d): NULL pointer reference", file, line);
650 log_error(
"%s(%d): non-NULL pointer", file, line);
654 tmp =
dmalloc(
sizeof(*tmp), file, line);
656 return ISC_R_NOMEMORY;
665 dfree(tmp, file, line);
666 return ISC_R_NOMEMORY;
670 iasubopt_free_hash_table(&(tmp->
leases), file, line);
671 dfree(tmp, file, line);
672 return ISC_R_NOMEMORY;
677 iasubopt_free_hash_table(&(tmp->
leases), file, line);
678 dfree(tmp, file, line);
679 return ISC_R_NOMEMORY;
709 log_error(
"%s(%d): NULL pointer reference", file, line);
713 log_error(
"%s(%d): non-NULL pointer", file, line);
717 log_error(
"%s(%d): NULL pointer reference", file, line);
739 dereference_hash_entry(
const void *name,
unsigned len,
void *value) {
751 dereference_heap_entry(
void *value,
void *dummy) {
780 if ((pool == NULL) || (*pool == NULL)) {
781 log_error(
"%s(%d): NULL pointer", file, line);
790 log_error(
"%s(%d): negative refcnt", file, line);
794 iasubopt_hash_foreach(tmp->
leases, dereference_hash_entry);
795 iasubopt_free_hash_table(&(tmp->
leases), file, line);
797 dereference_heap_entry, NULL);
800 dereference_heap_entry, NULL);
802 dfree(tmp, file, line);
813 build_address6(
struct in6_addr *
addr,
814 const struct in6_addr *net_start_addr,
int net_bits,
828 isc_md5_update(&ctx, input->
data, input->
len);
829 isc_md5_final(&ctx, (
unsigned char *)addr);
835 net_str = (
const char *)net_start_addr;
836 net_bytes = net_bits / 8;
837 for (i = 0; i < net_bytes; i++) {
840 switch (net_bits % 8) {
841 case 1: str[i] = (str[i] & 0x7F) | (net_str[i] & 0x80);
break;
842 case 2: str[i] = (str[i] & 0x3F) | (net_str[i] & 0xC0);
break;
843 case 3: str[i] = (str[i] & 0x1F) | (net_str[i] & 0xE0);
break;
844 case 4: str[i] = (str[i] & 0x0F) | (net_str[i] & 0xF0);
break;
845 case 5: str[i] = (str[i] & 0x07) | (net_str[i] & 0xF8);
break;
846 case 6: str[i] = (str[i] & 0x03) | (net_str[i] & 0xFC);
break;
847 case 7: str[i] = (str[i] & 0x01) | (net_str[i] & 0xFE);
break;
861 valid_eui_64_duid(
const struct data_string* uid,
int offset) {
863 const unsigned char* duid = uid->
data + offset;
864 return (((duid[0] == 0x00 && duid[1] == 0x03) &&
865 (duid[2] == 0x00 && duid[3] == 0x1b)));
876 build_address6_eui_64(
struct in6_addr *addr,
877 const struct in6_addr *net_start_addr,
int net_bits,
878 const struct data_string *iaid_duid,
int duid_beg) {
880 if (net_bits != 64) {
881 log_error(
"build_address_eui_64: network is not 64 bits");
882 return (ISC_R_FAILURE);
885 if (valid_eui_64_duid(iaid_duid, duid_beg)) {
886 const unsigned char *duid = iaid_duid->
data + duid_beg;
889 memcpy(addr->s6_addr, net_start_addr->s6_addr, 8);
892 memcpy(addr->s6_addr + 8, duid + 4, 8);
899 addr->s6_addr[8] |= 0x02;
903 log_error(
"build_address_eui_64: iaid_duid not a valid EUI-64: %s",
905 return (ISC_R_FAILURE);
910 int duid_beg,
struct in6_addr* ia_addr) {
911 struct in6_addr test_addr;
917 if (!valid_eui_64_duid(uid, duid_beg)) {
924 memset (&test_addr, 0,
sizeof(test_addr));
928 return (!memcmp(ia_addr, &test_addr,
sizeof(test_addr)));
938 build_temporary6(
struct in6_addr *addr,
939 const struct in6_addr *net_start_addr,
int net_bits,
941 static u_int32_t history[2];
942 static u_int32_t counter = 0;
944 unsigned char md[16];
951 isc_random_get(&history[0]);
952 isc_random_get(&history[1]);
959 isc_md5_update(&ctx, (
unsigned char *)&history[0], 8UL);
960 isc_md5_update(&ctx, input->
data, input->
len);
961 isc_md5_final(&ctx, md);
966 if (net_bits == 64) {
967 memcpy(&addr->s6_addr[0], &net_start_addr->s6_addr[0], 8);
968 memcpy(&addr->s6_addr[8], md, 8);
969 addr->s6_addr[8] &= ~0x02;
980 net_str = (
const char *)net_start_addr;
981 net_bytes = net_bits / 8;
982 for (i = 0; i < net_bytes; i++) {
985 memcpy(str + net_bytes, md, 16 - net_bytes);
986 switch (net_bits % 8) {
987 case 1: str[i] = (str[i] & 0x7F) | (net_str[i] & 0x80);
break;
988 case 2: str[i] = (str[i] & 0x3F) | (net_str[i] & 0xC0);
break;
989 case 3: str[i] = (str[i] & 0x1F) | (net_str[i] & 0xE0);
break;
990 case 4: str[i] = (str[i] & 0x0F) | (net_str[i] & 0xF0);
break;
991 case 5: str[i] = (str[i] & 0x07) | (net_str[i] & 0xF8);
break;
992 case 6: str[i] = (str[i] & 0x03) | (net_str[i] & 0xFC);
break;
993 case 7: str[i] = (str[i] & 0x01) | (net_str[i] & 0xFE);
break;
1001 memcpy((
unsigned char *)&history[0], md + 8, 8);
1006 static struct in6_addr rtany;
1008 static struct in6_addr resany;
1033 unsigned int *attempts,
1034 const struct data_string *uid, time_t soft_lifetime_end_time) {
1036 struct in6_addr tmp;
1040 isc_result_t result;
1041 isc_boolean_t reserved_iid;
1042 static isc_boolean_t init_resiid = ISC_FALSE;
1048 memset(&rtany, 0, 16);
1049 memset(&resany, 0, 8);
1050 resany.s6_addr[8] = 0xfd;
1051 memset(&resany.s6_addr[9], 0xff, 6);
1052 init_resiid = ISC_TRUE;
1058 memset(&ds, 0,
sizeof(ds));
1066 if (++(*attempts) > 100) {
1068 return ISC_R_NORESOURCES;
1087 log_error(
"create_lease6: prefix pool.");
1090 log_error(
"create_lease6: untyped pool.");
1097 reserved_iid = ISC_FALSE;
1098 if (memcmp(&tmp.s6_addr[8], &rtany.s6_addr[8], 8) == 0) {
1099 reserved_iid = ISC_TRUE;
1101 if (!reserved_iid &&
1102 (memcmp(&tmp.s6_addr[8], &resany.s6_addr[8], 7) == 0) &&
1103 ((tmp.s6_addr[15] & 0x80) == 0x80)) {
1104 reserved_iid = ISC_TRUE;
1111 if (!reserved_iid &&
1112 (iasubopt_hash_lookup(&test_iaaddr, pool->
leases,
1113 &tmp,
sizeof(tmp),
MDL) == 0)) {
1116 if (test_iaaddr != NULL)
1122 memset(&new_ds, 0,
sizeof(new_ds));
1123 new_ds.
len = ds.
len +
sizeof(tmp);
1126 return ISC_R_NOMEMORY;
1143 result = iasubopt_allocate(&iaaddr,
MDL);
1148 memcpy(&iaaddr->
addr, &tmp,
sizeof(iaaddr->
addr));
1153 result =
add_lease6(pool, iaaddr, soft_lifetime_end_time);
1176 struct in6_addr tmp;
1179 isc_result_t result;
1180 static isc_boolean_t init_resiid = ISC_FALSE;
1184 memset(&rtany, 0, 16);
1185 memset(&resany, 0, 8);
1186 resany.s6_addr[8] = 0xfd;
1187 memset(&resany.s6_addr[9], 0xff, 6);
1188 init_resiid = ISC_TRUE;
1193 log_error(
"create_lease6_eui_64: pool type is not IA_NA.");
1200 log_error(
"create_lease6_eui_64: build_address6_eui_64 failed");
1201 return (ISC_R_FAILURE);
1205 if ((memcmp(&tmp.s6_addr[8], &rtany.s6_addr[8], 8) == 0) ||
1206 ((memcmp(&tmp.s6_addr[8], &resany.s6_addr[8], 7) == 0) &&
1207 ((tmp.s6_addr[15] & 0x80) == 0x80))) {
1209 "address conflicts with reserved IID");
1210 return (ISC_R_FAILURE);
1215 if (iasubopt_hash_lookup(&test_iaaddr, pool->
leases,
1216 &tmp,
sizeof(tmp),
MDL) != 0) {
1220 if (!test_iaaddr->
ia) {
1222 "address %s is assigned to static lease",
1227 ours = ((found->
len == uid->
len) &&
1230 "address %s belongs to %s",
1238 return (ISC_R_FAILURE);
1244 result = iasubopt_allocate(&iaaddr,
MDL);
1246 log_error(
"create_lease6_eui_64: could not allocate iasubop");
1250 memcpy(&iaaddr->
addr, &tmp,
sizeof(iaaddr->
addr));
1253 result =
add_lease6(pool, iaaddr, soft_lifetime_end_time);
1309 struct iasubopt *test_iasubopt, *tmp_iasubopt;
1310 struct ia_xx *old_ia;
1313 test_iasubopt = NULL;
1320 if (iasubopt_hash_lookup(&test_iasubopt, pool->
leases,
1326 if (test_iasubopt->
ia == NULL) {
1362 status = ISC_R_FAILURE;
1380 iasubopt_hash_delete(pool->
leases, &test_iasubopt->
addr,
1381 sizeof(test_iasubopt->
addr),
MDL);
1384 ia_hash_delete(ia_table,
1394 tmp_iasubopt = test_iasubopt;
1415 time_t valid_lifetime_end_time) {
1416 isc_result_t insert_result;
1421 if (lease->
state == 0)
1430 test_iasubopt = NULL;
1431 if (iasubopt_hash_lookup(&test_iasubopt, pool->
leases,
1458 iasubopt_hash_delete(pool->
leases, &test_iasubopt->
addr,
1459 sizeof(test_iasubopt->
addr),
MDL);
1469 tmp_iasubopt = test_iasubopt;
1477 tmp_iasubopt = NULL;
1482 iasubopt_hash_add(pool->
leases, &tmp_iasubopt->
addr,
1483 sizeof(tmp_iasubopt->
addr), lease,
MDL);
1506 iasubopt_hash_delete(pool->
leases, &lease->
addr,
1509 return insert_result;
1528 if (iasubopt_hash_lookup(&test_iaaddr, pool->
leases,
1529 (
void *)addr,
sizeof(*addr),
MDL)) {
1554 isc_boolean_t status = ISC_TRUE;
1558 (
void *)&lease->
addr,
1560 if (test_iaaddr != lease) {
1574 isc_result_t insert_result;
1578 iasubopt_hash_add(pool->
leases, &lease->
addr,
1579 sizeof(lease->
addr), lease,
MDL);
1589 return insert_result;
1638 char tmp_addr[INET6_ADDRSTRLEN];
1641 log_info(
"Reclaiming previously abandoned address %s",
1642 inet_ntop(AF_INET6, &(lease->
addr), tmp_addr,
1651 return move_lease_to_active(pool, lease);
1661 isc_result_t insert_result;
1697 #if defined (NSUPDATE)
1707 if (lease->
scope != NULL) {
1711 iasubopt_hash_delete(pool->
leases,
1726 return insert_result;
1742 isc_result_t result;
1744 if (leasep == NULL) {
1748 if (*leasep != NULL) {
1757 result = move_lease_to_inactive(pool, tmp,
1775 isc_result_t result;
1779 result = move_lease_to_active(pool, lease);
1801 return move_lease_to_inactive(pool, lease,
FTS_RELEASED);
1813 const struct in6_addr *net_start_pref,
1814 int pool_bits,
int pref_bits,
1820 const char *net_str;
1828 isc_md5_update(&ctx, input->
data, input->
len);
1829 isc_md5_final(&ctx, (
unsigned char *)pref);
1835 net_str = (
const char *)net_start_pref;
1836 net_bytes = pool_bits / 8;
1837 for (i = 0; i < net_bytes; i++) {
1838 str[i] = net_str[i];
1841 switch (pool_bits % 8) {
1842 case 1: str[i] = (str[i] & 0x7F) | (net_str[i] & 0x80);
break;
1843 case 2: str[i] = (str[i] & 0x3F) | (net_str[i] & 0xC0);
break;
1844 case 3: str[i] = (str[i] & 0x1F) | (net_str[i] & 0xE0);
break;
1845 case 4: str[i] = (str[i] & 0x0F) | (net_str[i] & 0xF0);
break;
1846 case 5: str[i] = (str[i] & 0x07) | (net_str[i] & 0xF8);
break;
1847 case 6: str[i] = (str[i] & 0x03) | (net_str[i] & 0xFC);
break;
1848 case 7: str[i] = (str[i] & 0x01) | (net_str[i] & 0xFE);
break;
1853 net_bytes = pref_bits / 8;
1854 for (i=net_bytes+1; i<16; i++) {
1858 switch (pref_bits % 8) {
1859 case 0: str[i] &= 0;
break;
1860 case 1: str[i] &= 0x80;
break;
1861 case 2: str[i] &= 0xC0;
break;
1862 case 3: str[i] &= 0xE0;
break;
1863 case 4: str[i] &= 0xF0;
break;
1864 case 5: str[i] &= 0xF8;
break;
1865 case 6: str[i] &= 0xFC;
break;
1866 case 7: str[i] &= 0xFE;
break;
1893 unsigned int *attempts,
1895 time_t soft_lifetime_end_time) {
1897 struct in6_addr tmp;
1901 isc_result_t result;
1906 memset(&ds, 0,
sizeof(ds));
1914 if (++(*attempts) > 10) {
1916 return ISC_R_NORESOURCES;
1929 if (iasubopt_hash_lookup(&test_iapref, pool->
leases,
1930 &tmp,
sizeof(tmp),
MDL) == 0) {
1938 memset(&new_ds, 0,
sizeof(new_ds));
1939 new_ds.
len = ds.
len +
sizeof(tmp);
1942 return ISC_R_NOMEMORY;
1959 result = iasubopt_allocate(&iapref,
MDL);
1964 memcpy(&iapref->
addr, &tmp,
sizeof(iapref->
addr));
1969 result =
add_lease6(pool, iapref, soft_lifetime_end_time);
1982 const struct in6_addr *pref, u_int8_t
plen) {
1985 if ((
int)plen != pool->
units)
1989 if (iasubopt_hash_lookup(&test_iapref, pool->
leases,
1990 (
void *)pref,
sizeof(*pref),
MDL)) {
2006 isc_result_t result;
2008 dummy_iasubopt = NULL;
2009 result = iasubopt_allocate(&dummy_iasubopt,
MDL);
2012 iasubopt_hash_add(pool->
leases, &dummy_iasubopt->
addr,
2013 sizeof(*addr), dummy_iasubopt,
MDL);
2026 if (new_pools == NULL) {
2027 return ISC_R_NOMEMORY;
2030 if (num_pools > 0) {
2031 memcpy(new_pools,
pools,
2032 sizeof(
struct ipv6_pool *) * num_pools);
2037 pools[num_pools] = NULL;
2044 cleanup_old_expired(
struct ipv6_pool *pool) {
2047 struct ia_xx *ia_active;
2048 unsigned char *tmpd;
2067 if (tmp->
ia != NULL) {
2082 (ia_active == ia)) {
2090 (ia_active == ia)) {
2098 (ia_active == ia)) {
2109 lease_timeout_support(
void *vpool) {
2131 if (lease == NULL) {
2150 cleanup_old_expired(pool);
2166 time_t next_timeout;
2188 if (timeout < next_timeout) {
2189 next_timeout = timeout;
2194 tv.tv_sec = next_timeout;
2209 for (i=0; i<num_pools; i++) {
2224 ipv6_network_portion(
struct in6_addr *result,
2225 const struct in6_addr *addr,
int bits) {
2226 unsigned char *addrp;
2232 static const unsigned char bitmasks[] = {
2233 0x00, 0xFE, 0xFC, 0xF8,
2234 0xF0, 0xE0, 0xC0, 0x80,
2240 if ((bits < 0) || (bits > 128)) {
2241 log_fatal(
"ipv6_network_portion: bits %d not between 0 and 128",
2249 addrp = ((
unsigned char *)result) + 15;
2254 mask_bits = 128 - bits;
2255 bytes = mask_bits / 8;
2256 extra_bits = mask_bits % 8;
2258 for (i=0; i<bytes; i++) {
2263 *addrp &= bitmasks[extra_bits];
2272 struct in6_addr tmp;
2274 ipv6_network_portion(&tmp, addr, pool->
bits);
2275 if (memcmp(&tmp, &pool->
start_addr,
sizeof(tmp)) == 0) {
2290 const struct in6_addr *addr) {
2297 if (*pool != NULL) {
2302 for (i=0; i<num_pools; i++) {
2303 if (
pools[i]->pool_type != type)
2318 change_leases(
struct ia_xx *ia,
2319 isc_result_t (*change_func)(
struct ipv6_pool *,
2321 isc_result_t retval;
2322 isc_result_t renew_retval;
2324 struct in6_addr *
addr;
2333 renew_retval = change_func(pool, ia->
iasubopt[i]);
2335 retval = renew_retval;
2374 static int write_error;
2377 write_ia_leases(
const void *name,
unsigned len,
void *value) {
2410 log_info(
"Wrote %d NA, %d TA, %d PD leases to lease file.",
2417 mark_hosts_unavailable_support(
const void *name,
unsigned len,
void *value) {
2420 struct in6_addr addr;
2439 "error evaluating host address.");
2444 "host address is not 128 bits.");
2474 mark_phosts_unavailable_support(
const void *name,
unsigned len,
void *value) {
2477 struct in6_addr pref;
2530 while (ip != NULL) {
2572 log_error(
"%s(%d): NULL pointer reference", file, line);
2575 if (*pond != NULL) {
2576 log_error(
"%s(%d): non-NULL pointer", file, line);
2580 tmp =
dmalloc(
sizeof(*tmp), file, line);
2582 return ISC_R_NOMEMORY;
2614 log_error(
"%s(%d): NULL pointer reference", file, line);
2617 if (*pond != NULL) {
2618 log_error(
"%s(%d): non-NULL pointer", file, line);
2622 log_error(
"%s(%d): NULL pointer reference", file, line);
2654 if ((pond == NULL) || (*pond == NULL)) {
2655 log_error(
"%s(%d): NULL pointer", file, line);
2664 log_error(
"%s(%d): negative refcnt", file, line);
2668 dfree(tmp, file, line);
2688 int invalid_cnt = 0;
2701 if (pond->use_eui_64) {
2706 if (p->
bits != 64) {
2707 log_error(
"Pool %s/%d cannot use EUI-64,"
2712 log_debug(
"Pool: %s/%d - will use EUI-64",
2720 return (invalid_cnt);
2741 int invalid_cnt = 0;
2750 invalid_cnt += set_eui_64(pond);
2755 char *bufptr = log_buf;
2756 size_t space_left =
sizeof(log_buf) - 1;
2764 (space_left > (INET6_ADDRSTRLEN + 6))) {
2775 bufptr, INET6_ADDRSTRLEN);
2777 used = strlen(bufptr);
2782 sprintf (bufptr,
"/%d",pool->
bits);
2783 used = strlen(bufptr);
2789 log_info(
"Threshold logging disabled for shared"
2790 " subnet of ranges: %s", log_buf);
2799 log_fatal (
"%d pool(s) are invalid for EUI-64 use",
2826 static int log_once = 0;
2828 if (htype & 0xFF00) {
2830 log_error(
"Attention: At least one client advertises a "
2831 "hardware type of %d, which exceeds the software "
2832 "limitation of 255.", htype);
2876 if (packet->
haddr) {
2879 log_debug(
"find_hosts_by_haddr6: using packet->haddr,"
2880 " type: %d, len: %d", htype, hlen);
2903 memset(&rel_addr, 0,
sizeof(rel_addr));
2908 "Error evaluating option cache");
2916 hlen = rel_addr.
len - 2;
2922 "using relayed haddr"
2923 " type: %d, len: %d", htype, hlen);
2945 const unsigned char *chaddr;
2951 if (client_id->
len < 4)
2965 if (client_id->
len > 8) {
2966 hlen = client_id->
len - 8;
2967 chaddr = client_id->
data + 8;
2976 hlen = client_id->
len - 4;
2977 chaddr = client_id->
data + 4;
struct iaddrcidrnet cidrnet
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
Renew a lease in the pool.
int find_hosts_by_haddr6(struct host_decl **hp, struct packet *packet, struct option_state *opt_state, const char *file, int line)
Look for hosts by MAC address if it's available.
void mark_hosts_unavailable(void)
isc_result_t mark_lease_unavailable(struct ipv6_pool *pool, const struct in6_addr *addr)
struct binding_scope * global_scope
isc_result_t add_lease6(struct ipv6_pool *pool, struct iasubopt *lease, time_t valid_lifetime_end_time)
isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid, const char *duid, unsigned int duid_len, const char *file, int line)
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
struct shared_network * shared_networks
isc_result_t ia_dereference(struct ia_xx **ia, const char *file, int line)
struct universe server_universe
int execute_statements(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct executable_statement *statements, struct on_star *on_star)
struct ipv6_pond * ipv6_pond
isc_boolean_t lease6_usable(struct iasubopt *lease)
Check if address is available to a lease.
int find_hosts_by_option(struct host_decl **, struct packet *, struct option_state *, const char *, int)
#define print_hex_1(len, data, limit)
dhcp_context_t dhcp_gbl_ctx
#define HASH_FUNCTIONS(name, bufarg, type, hashtype, ref, deref, hasher)
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
void build_prefix6(struct in6_addr *pref, const struct in6_addr *net_start_pref, int pool_bits, int pref_bits, const struct data_string *input)
struct executable_statement * on_release
#define D6O_CLIENT_LINKLAYER_ADDR
void data_string_forget(struct data_string *data, const char *file, int line)
isc_result_t ipv6_pond_reference(struct ipv6_pond **pond, struct ipv6_pond *src, const char *file, int line)
reference an IPv6 pond structure.
struct in6_addr start_addr
struct option_cache * fixed_addr
int find_hosts_by_duid_chaddr(struct host_decl **host, const struct data_string *client_id)
int log_error(const char *,...) __attribute__((__format__(__printf__
int binding_scope_dereference(struct binding_scope **ptr, const char *file, int line)
struct binding_scope * scope
struct ipv6_pond * ipv6_pond
void add_timeout(struct timeval *when, void(*)(void *) where, void *what, tvref_t ref, tvunref_t unref)
int find_hosts_by_haddr(struct host_decl **, int, const unsigned char *, unsigned, const char *, int)
log_fatal("no memory for uname information.")
#define EXPIRED_IPV6_CLEANUP_TIME
isc_result_t isc_heap_create(isc_heapcompare_t compare, isc_heapindex_t index, unsigned int size_increment, isc_heap_t **heapp)
Create a new heap. The heap is implemented using a space-efficient storage method. When the heap elements are deleted space is not freed but will be reused when new elements are inserted.
isc_result_t decline_leases(struct ia_xx *ia)
void mark_interfaces_unavailable(void)
struct option_state * options
isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b)
isc_boolean_t lease6_exists(const struct ipv6_pool *pool, const struct in6_addr *addr)
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
int find_hosts6(struct host_decl **host, struct packet *packet, const struct data_string *client_id, char *file, int line)
isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *start_addr, int bits, int units, const char *file, int line)
Create a new IPv6 lease pool structure.
void isc_heap_decreased(isc_heap_t *heap, unsigned int index)
Indicates to the heap that an element's priority has decreased. This function MUST be called whenever...
void execute_statements_in_scope(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct group *group, struct group *limiting_group, struct on_star *on_star)
isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
void schedule_lease_timeout(struct ipv6_pool *pool)
int option_state_allocate(struct option_state **ptr, const char *file, int line)
time_t hard_lifetime_end_time
int evaluate_option_cache(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
host_hash_t * host_name_hash
void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line)
void mark_phosts_unavailable(void)
isc_result_t cleanup_lease6(ia_hash_t *ia_table, struct ipv6_pool *pool, struct iasubopt *lease, struct ia_xx *ia)
Cleans up leases when reading from a lease file.
unsigned do_string_hash(const void *, unsigned, unsigned)
struct ipv6_pool * ipv6_pool
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
if(parse_ip_addr(cfile,&match->addr))
isc_result_t renew_leases(struct ia_xx *ia)
int write_server_duid(void)
struct iaddrcidrnetlist * next
struct data_string iaid_duid
void(* tvref_t)(void *, void *, const char *, int)
u_int32_t getUShort(const unsigned char *)
isc_result_t add_ipv6_pool(struct ipv6_pool *pool)
void isc_heap_foreach(isc_heap_t *heap, isc_heapaction_t action, void *uap)
Iterate over the heap, calling an action for each element. The order of iteration is not sorted...
isc_result_t create_lease6(struct ipv6_pool *pool, struct iasubopt **addr, unsigned int *attempts, const struct data_string *uid, time_t soft_lifetime_end_time)
struct option_cache * lookup_option(struct universe *universe, struct option_state *options, unsigned code)
int int log_info(const char *,...) __attribute__((__format__(__printf__
struct ipv6_pool ** ipv6_pools
const char * pin6_addr(const struct in6_addr *)
void * dmalloc(size_t, const char *, int)
struct interface_info * interfaces
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool, const char *file, int line)
de-reference an IPv6 pool structure.
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *addr)
int find_hosts_by_uid(struct host_decl **, const unsigned char *, unsigned, const char *, int)
isc_boolean_t ipv6_in_pool(const struct in6_addr *addr, const struct ipv6_pool *pool)
void(* tvunref_t)(void *, const char *, int)
#define DEFAULT_HASH_SIZE
void isc_heap_destroy(isc_heap_t **heapp)
Destroys a heap.
isc_result_t release_leases(struct ia_xx *ia)
struct iaddrcidrnetlist * fixed_prefix
int option_state_dereference(struct option_state **ptr, const char *file, int line)
isc_result_t ddns_removals(struct lease *, struct iasubopt *, struct dhcp_ddns_cb *, isc_boolean_t)
int commit_leases_timed(void)
isc_result_t ipv6_pond_allocate(struct ipv6_pond **pond, const char *file, int line)
Create a new IPv6 pond structure.
void isc_heap_increased(isc_heap_t *heap, unsigned int index)
Indicates to the heap that an element's priority has increased. This function MUST be called whenever...
void isc_heap_delete(isc_heap_t *heap, unsigned int index)
Deletes an element from a heap, by element index.
int hash_foreach(struct hash_table *, hash_foreach_func)
struct interface_info * next
struct universe dhcpv6_universe
isc_boolean_t prefix6_exists(const struct ipv6_pool *pool, const struct in6_addr *pref, u_int8_t plen)
int evaluate_boolean_option_cache(int *ignorep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
isc_heap_t * inactive_timeouts
void schedule_all_ipv6_lease_timeouts()
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line)
isc_uint64_t num_abandoned
void report_jumbo_ranges()
isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid, const char *duid, unsigned int duid_len, const char *file, int line)
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
isc_uint64_t num_abandoned
isc_heap_t * active_timeouts
isc_result_t ipv6_pond_dereference(struct ipv6_pond **pond, const char *file, int line)
de-reference an IPv6 pond structure.
time_t soft_lifetime_end_time
u_int8_t hbuf[HARDWARE_ADDR_LEN+1]
#define HARDWARE_ADDR_LEN
void * isc_heap_element(isc_heap_t *heap, unsigned int index)
Returns the element for a specific element index.
struct ipv6_pool ** pools
struct iasubopt ** iasubopt
int write_ia(const struct ia_xx *)
struct executable_statement * on_expiry
struct shared_network * next
isc_result_t create_prefix6(struct ipv6_pool *pool, struct iasubopt **pref, unsigned int *attempts, const struct data_string *uid, time_t soft_lifetime_end_time)
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
struct executable_statement * on_commit
const unsigned char * data
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
isc_result_t ipv6_pool_reference(struct ipv6_pool **pool, struct ipv6_pool *src, const char *file, int line)
reference an IPv6 pool structure.
isc_result_t isc_heap_insert(isc_heap_t *heap, void *elt)
Inserts a new element into a heap.
int htype_bounds_check(uint16_t htype)
void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
isc_result_t expire_lease6(struct iasubopt **leasep, struct ipv6_pool *pool, time_t now)
struct packet * dhcpv6_container_packet
struct in6_addr * v6addresses
isc_result_t iasubopt_reference(struct iasubopt **iasubopt, struct iasubopt *src, const char *file, int line)