108 unsigned char data[65536];
224 memset(&raw, 0,
sizeof(raw));
226 log_error(
"dhcpv4o6_handler: no memory buffer.");
229 raw.data = raw.buffer->data;
256 char pbuf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
260 memset(name, 0,
sizeof(name));
267 log_error(
"send_dhcpv4_response: can't find interface %s.",
288 log_info(
"send_dhcpv4_response(): sending %s on %s to %s port %d",
296 log_error(
"send_dhcpv4_response: send_packet6(): %m");
298 log_error(
"send_dhcpv4_response: send_packet6() "
299 "sent %d of %d bytes",
320 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
472 log_error(
"Invalid DUID type %d specified, "
482 if (
p->hw_address.hlen > 0) {
486 log_error(
"Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
507 p->hw_address.hbuf[0]);
510 p->hw_address.hbuf+1,
p->hw_address.hlen-1);
520 p->hw_address.hbuf[0]);
522 p->hw_address.hbuf+1,
p->hw_address.hlen-1);
583 "client identifier missing",
588 log_error(
"Error processing %s from %s; "
589 "unable to evaluate Client Identifier",
599 log_debug(
"Discarding %s from %s; packet sent unicast "
614 "server identifier found "
615 "(CLIENTID %s, SERVERID %s)",
624 "server identifier found "
669 memset(server_id, 0,
sizeof(*server_id));
676 "client identifier missing",
681 log_error(
"Error processing %s from %s; "
682 "unable to evaluate Client Identifier",
691 "server identifier missing (CLIENTID %s)",
700 log_error(
"Error processing %s from %s; "
701 "unable to evaluate Server Identifier (CLIENTID %s)",
710 "not our server identifier "
711 "(CLIENTID %s, SERVERID %s, server DUID %s)",
751 memset(server_id, 0,
sizeof(*server_id));
774 log_debug(
"Discarding %s from %s; packet sent unicast%s",
783 "IA_NA option present%s",
791 "IA_TA option present%s",
799 "IA_PD option present%s",
810 log_error(
"Error processing %s from %s; "
811 "unable to evaluate Server Identifier%s",
820 "not our server identifier "
821 "(SERVERID %s, server DUID %s)%s",
825 server_id->
data, 60),
868#if defined(RELAY_PORT)
924 "error evaluating raw option.");
928 log_error(
"get_encapsulated_IA_state: raw option too small.");
939 log_error(
"get_encapsulated_IA_state: no memory for options.");
947 log_error(
"get_encapsulated_IA_state: error parsing options.");
966 log_fatal(
"set_status_code: no memory for status code.");
968 d.data =
d.buffer->data;
973 d.buffer, (
unsigned char *)
d.data,
d.len,
975 log_error(
"set_status_code: error saving status code.");
998 if (
pond->jumbo_range == 1) {
1002 count =
pond->num_total;
1006 if ((
pond->shared_network !=
NULL) &&
1007 (
pond->shared_network->name !=
NULL)) {
1021 if (
pond->logged !=0) {
1023 pond->low_threshold = 0;
1025 log_error(
"Pool threshold reset - shared subnet: %s; "
1026 "address: %s; low threshold %llu/%llu.",
1030 (
long long unsigned)(
used),
1031 (
long long unsigned)(count));
1059 log_error(
"Pool threshold exceeded - shared subnet: %s; "
1060 "address: %s; high threshold %d%% %llu/%llu.",
1064 (
long long unsigned)(count));
1107 log_error(
"start_reply: no memory for option_state.");
1160 sizeof(
reply->transaction_id));
1175 if (server_id ==
NULL) {
1186 "error saving server identifier.");
1198 "client identifier.");
1214 NULL, (
unsigned char *)
"", 0,
1217 "error saving RECONF_ACCEPT option.");
1311 int jumbo_range = 0;
1313 reply->shared->name :
"(no name)");
1333 log_debug(
"Unable to pick client address: "
1334 "no IPv6 pools on this shared network");
1352 if (((
pond->prohibit_list !=
NULL) &&
1361 if (
pond->use_eui_64 &&
1373 if (
pond->use_eui_64) {
1376 &
reply->ia->iaid_duid,
1384 &
reply->ia->iaid_duid,
1396 if (
pond->ipv6_pools[
i]
1402 pond->last_ipv6_pool =
i;
1419 jumbo_range +=
pond->jumbo_range;
1420 total +=
pond->num_total;
1421 active +=
pond->num_active;
1422 abandoned +=
pond->num_abandoned;
1430 if (jumbo_range != 0) {
1431 log_debug(
"Unable to pick client address: "
1432 "no addresses available - shared network %s: "
1433 " 2^64-1 < total, %llu active, %llu abandoned",
1434 shared_name, (
long long unsigned)(active - abandoned),
1435 (
long long unsigned)(abandoned));
1437 log_debug(
"Unable to pick client address: "
1438 "no addresses available - shared network %s: "
1439 "%llu total, %llu active, %llu abandoned",
1441 (
long long unsigned)(active - abandoned),
1442 (
long long unsigned)(abandoned));
1576 log_debug(
"Unable to pick client prefix: "
1577 "no IPv6 pools on this shared network");
1581 if (
reply->preflen <= 0) {
1626 (
unsigned)(
reply->lease->plen));
1634 log_debug(
"Unable to pick client prefix: no prefixes available");
1670 if (((
pond->prohibit_list !=
NULL) &&
1681 &
reply->ia->iaid_duid,
1803 log_error(
"lease_to_client: error evaluating ORO.");
1825 reply.client_resources = 0;
1843 reply.client_resources = 0;
1864 reply.client_resources = 0;
1882 if ((
reply.ia_count == 0) && (
reply.pd_count == 0)) {
1883 if (
reply.packet->dhcpv6_msg_type !=
1893 reply.packet->options,
1899 for (
i =
reply.packet->class_count;
i > 0;
i--) {
1902 reply.packet->options,
1905 reply.packet->classes[
i - 1]->group,
1913 reply.packet->options,
2010 log_error(
"reply_process_ia_na: Reply too long for IA.");
2018 log_error(
"reply_process_ia_na: error evaluating ia");
2031 log_error(
"reply_process_ia_na: no memory for ia.");
2039 (
unsigned char *)
reply->ia->iaid_duid.data,
2058 log_error(
"reply_process_ia_na: unable to evaluate "
2064 if (
reply->fixed.len < 16) {
2065 log_error(
"reply_process_ia_na: invalid fixed address.");
2121 reply->client_valid =
reply->client_prefer = 0;
2150 switch (
reply->packet->dhcpv6_msg_type) {
2173 "memory for option state "
2180 "No addresses available "
2181 "for this interface.",
2183 log_error(
"reply_process_ia_na: Unable "
2184 "to set NoAddrsAvail status "
2210 if (
reply->resources_included)
2237 if (
reply->static_lease) {
2239 log_info(
"%s NA: address %s to client with duid %s iaid = %d "
2245 reply->client_id.data, 60),
2257 reply->packet->options,
2269 if (
reply->ia->num_iasubopt != 0) {
2274 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
2277 log_info(
"%s NA: address %s to client with duid %s "
2278 "iaid = %d valid for %u seconds",
2283 reply->client_id.data, 60),
2303 if ((
reply->ia->num_iasubopt != 0) &&
2310 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
2319 if (
tmp->on_star.on_commit !=
NULL) {
2322 reply->packet->options,
2325 tmp->on_star.on_commit,
2328 (&
tmp->on_star.on_commit,
MDL);
2331#if defined (NSUPDATE)
2339 reply->packet->options,
2366 (
unsigned char *)
ia_id->data,
2475 if ((
reply->cursor + 28) >
sizeof(
reply->buf)) {
2476 log_error(
"reply_process_addr: Out of room for address.");
2485 log_error(
"reply_process_addr: error evaluating IAADDR.");
2494 if ((
reply->client_valid == 0) ||
2498 if ((
reply->client_prefer == 0) ||
2535 && (
pool->ipv6_pond->use_eui_64) &&
2538 " not valid for EUI-64 pool",
2575 log_error(
"reply_process_addr: No memory for "
2576 "option state wipe.");
2583 "Address not for use on this "
2584 "link.",
reply->reply_ia)) {
2585 log_error(
"reply_process_addr: Failure "
2586 "setting status code.");
2606 log_error(
"It is impossible to lease a client that is "
2607 "not sending a solicit, request, renew, or "
2648 if (
reply->packet->dhcpv6_msg_type ==
2650 reply->send_prefer = 0;
2651 reply->send_valid = 0;
2672 log_error(
"reply_process_addr: No memory for "
2673 "option state wipe.");
2680 "Address not bound to this "
2681 "interface.",
reply->reply_ia)) {
2682 log_error(
"reply_process_addr: Unable to "
2683 "attach status code.");
2692 log_error(
"It is impossible to lease a client that is "
2693 "not sending a solicit, request, renew, or "
2700 if (
reply->static_lease) {
2710 scope = &
reply->lease->scope;
2711 group =
reply->lease->ipv6_pool->ipv6_pond->group;
2720 if (
reply->client_resources != 0) {
2733 reply->packet->options,
2737 log_error(
"reply_process_addr: unable to "
2738 "evaluate addrs-per-ia value.");
2751 if (
reply->client_resources >= limit)
2765 if (data.data !=
NULL)
2787 if (
reply->static_lease) {
2797 if ((
reply->old_ia ==
NULL) || (
reply->old_ia->num_iasubopt == 0))
2800 for (
i = 0 ;
i <
reply->old_ia->num_iasubopt ;
i++) {
2811 if (((
pond->prohibit_list !=
NULL) &&
2844 memset(&data, 0,
sizeof(data));
2849 log_error(
"reply_process_ia_ta: Reply too long for IA.");
2857 log_error(
"reply_process_ia_ta: error evaluating ia");
2868 log_error(
"reply_process_ia_ta: no memory for ia.");
2876 (
unsigned char *)
reply->ia->iaid_duid.data,
2918 reply->client_valid =
reply->client_prefer = 0;
2928 "evaluating IAADDR.");
2936 if ((
reply->client_valid == 0) ||
2940 if ((
reply->client_prefer == 0) ||
2953 &
reply->lease->scope,
2954 reply->lease->ipv6_pool->ipv6_pond->group);
2972 reply->client_resources = 0;
2982 if (
reply->client_resources != 0)
2986 switch (
reply->packet->dhcpv6_msg_type) {
3007 "memory for option state wipe.");
3013 "No addresses available "
3014 "for this interface.",
3016 log_error(
"reply_process_ia_ta: Unable "
3017 "to set NoAddrsAvail status code.");
3031 if (
reply->resources_included)
3056 if (
reply->ia->num_iasubopt != 0) {
3061 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
3064 log_info(
"%s TA: address %s to client with duid %s "
3065 "iaid = %d valid for %u seconds",
3070 reply->client_id.data, 60),
3084 if ((
reply->ia->num_iasubopt != 0) &&
3091 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
3099 if (
tmp->on_star.on_commit !=
NULL) {
3102 reply->packet->options,
3105 tmp->on_star.on_commit,
3108 (&
tmp->on_star.on_commit,
MDL);
3111#if defined (NSUPDATE)
3120 reply->packet->options,
3148 (
unsigned char *)
ia_id->data,
3224 (
lease->hard_lifetime_end_time == 0) ||
3237 if (
d1.len == 1 && (
d1.data[0] < 100)) {
3252 log_debug (
"reusing infinite lease for: %s%s",
3350 "age %ld secs < %d%%,"
3351 " sending shortened lifetimes -"
3352 " preferred: %u, valid %u",
3406 if (((
pond->prohibit_list !=
NULL) &&
3431 reply->lease->plen = 0;
3469 log_debug(
"Unable to get client addresses: "
3470 "no IPv6 pools on this shared network");
3482 if (((
pond->prohibit_list !=
NULL) &&
3501 log_debug(
"Unable to get a temporary address.");
3506 &
reply->lease->scope,
3556 for (
i = 0; ;
i++) {
3587 if (((
pond->prohibit_list !=
NULL) &&
3626 if (
reply->static_lease) {
3639 for (
i = 0 ;
i <
reply->old_ia->num_iasubopt ;
i++) {
3656 if (((
pond->prohibit_list !=
NULL) &&
3679 log_error(
"Best match for DUID %s is an abandoned address,"
3680 " This may be a result of multiple clients attempting"
3681 " to use this DUID",
3683 reply->client_id.data, 60));
3698 scope = &
reply->lease->scope;
3699 group =
reply->lease->ipv6_pool->ipv6_pond->group;
3729 memset(&data, 0,
sizeof(data));
3767 for (
i =
reply->packet->class_count;
i > 0;
i--) {
3769 reply->packet->options,
3770 reply->opt_state, scope,
3771 reply->packet->classes[
i - 1]->group,
3782 reply->packet->options,
3783 reply->opt_state, scope,
3788 if (
reply->client_valid == 0)
3797 reply->packet->options,
3801 log_error(
"reply_process_is_addressed: unable to "
3802 "evaluate default lease time");
3822 if (
reply->client_prefer == 0)
3827 if ((
reply->send_prefer >=
reply->send_valid) &&
3829 reply->send_prefer = (
reply->send_valid / 2) +
3830 (
reply->send_valid / 8);
3836 reply->packet->options,
3840 log_error(
"reply_process_is_addressed: unable to "
3841 "evaluate preferred lease time");
3869 reply->client_id->len);
3886 reply->lease->soft_lifetime_end_time =
3894 log_fatal(
"reply_process_is_addressed: Unable to "
3895 "attach lease to new IA: %s",
3913 for (
i =
reply->packet->class_count;
i > 0;
i--) {
3915 reply->packet->options,
3916 reply->reply_ia, scope,
3917 reply->packet->classes[
i - 1]->group,
3927 reply->packet->options,
3928 reply->reply_ia, scope,
3932 if (data.data !=
NULL)
3936 reply->client_resources++;
3952 log_error(
"reply_process_send_addr: out of memory"
3953 "allocating new IAADDR buffer.");
3966 log_error(
"reply_process_send_addr: unable "
3967 "to save IAADDR option");
3989 switch(
alpha->state) {
3991 switch(
beta->state) {
3996 if (
alpha->hard_lifetime_end_time <
3997 beta->hard_lifetime_end_time)
4012 switch (
beta->state) {
4018 if (
alpha->hard_lifetime_end_time <
4019 beta->hard_lifetime_end_time)
4021 else if ((
alpha->hard_lifetime_end_time ==
4022 beta->hard_lifetime_end_time) &&
4023 (
alpha->soft_lifetime_end_time <
4024 beta->soft_lifetime_end_time))
4038 switch (
beta->state) {
4045 if (
alpha->hard_lifetime_end_time <
4046 beta->hard_lifetime_end_time)
4060 log_fatal(
"Triple impossible condition at %s:%d.",
MDL);
4086 log_error(
"reply_process_ia_pd: Reply too long for IA.");
4094 log_error(
"reply_process_ia_pd: error evaluating ia");
4107 log_error(
"reply_process_ia_pd: no memory for ia.");
4115 (
unsigned char *)
reply->ia->iaid_duid.data,
4128 reply->static_prefixes = 0;
4134 reply->static_prefixes += 1;
4171 reply->client_valid =
reply->client_prefer = 0;
4172 reply->preflen = -1;
4201 switch (
reply->packet->dhcpv6_msg_type) {
4216 "memory for option state "
4223 "No prefixes available "
4224 "for this interface.",
4228 "NoPrefixAvail status "
4238 if (
reply->resources_included)
4265 if (
reply->static_prefixes != 0) {
4267 log_info(
"%s PD: address %s/%d to client with duid %s "
4272 reply->fixed_pref.bits,
4274 reply->client_id.data, 60),
4283 reply->packet->options,
4296 if (
reply->ia->num_iasubopt != 0) {
4301 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
4304 log_info(
"%s PD: address %s/%d to client with duid %s"
4305 " iaid = %d valid for %u seconds",
4311 reply->client_id.data, 60),
4329 (
reply->ia->num_iasubopt != 0)) {
4335 for (
i = 0 ;
i <
reply->ia->num_iasubopt ;
i++) {
4343 if (
tmp->on_star.on_commit !=
NULL) {
4346 reply->packet->options,
4349 tmp->on_star.on_commit,
4352 (&
tmp->on_star.on_commit,
MDL);
4374 (
unsigned char *)
ia_id->data,
4447static struct group *
4457 reply->fixed_pref.lo_addr,
MDL) != 0) {
4466 memset(&fixed_addr, 0,
sizeof(fixed_addr));
4468 if ((
reply->host->fixed_addr !=
NULL) &&
4472 if (fixed_addr.len >= 16) {
4506 memset(&data, 0,
sizeof(data));
4513 if ((
reply->cursor + 29) >
sizeof(
reply->buf)) {
4514 log_error(
"reply_process_prefix: Out of room for prefix.");
4523 log_error(
"reply_process_prefix: error evaluating IAPREFIX.");
4535 if ((
reply->client_valid == 0) ||
4539 if ((
reply->client_prefer == 0) ||
4549 if ((
iapref.data[8] == 0) &&
4560 if (
reply->preflen < 0) {
4585 if (
reply->packet->dhcpv6_msg_type ==
4587 reply->send_prefer = 0;
4588 reply->send_valid = 0;
4611 log_error(
"reply_process_prefix: No memory "
4612 "for option state wipe.");
4619 "Prefix not bound to this "
4620 "interface.",
reply->reply_ia)) {
4621 log_error(
"reply_process_prefix: Unable to "
4622 "attach status code.");
4631 log_error(
"It is impossible to lease a client that is "
4632 "not sending a solicit, request, renew, or "
4639 if (
reply->static_prefixes > 0) {
4654 scope = &
reply->lease->scope;
4655 group =
reply->lease->ipv6_pool->ipv6_pond->group;
4664 if (
reply->client_resources != 0) {
4677 reply->packet->options,
4681 log_error(
"reply_process_prefix: unable to "
4682 "evaluate prefs-per-ia value.");
4695 if (
reply->client_resources >= limit)
4709 if (data.data !=
NULL)
4732 if (
reply->static_prefixes > 0) {
4733 for (
l =
reply->host->fixed_prefix;
l !=
NULL;
l =
l->next) {
4734 if ((pref->
bits ==
l->cidrnet.bits) &&
4736 l->cidrnet.lo_addr.iabuf, 16) == 0))
4743 (
reply->old_ia->num_iasubopt == 0))
4746 for (
i = 0 ;
i <
reply->old_ia->num_iasubopt ;
i++) {
4751 if ((pref->
bits == (
int)
tmp->plen) &&
4758 if (((
pond->prohibit_list !=
NULL) &&
4813 log_error(
"reply_process_try_prefix: out of memory.");
4829 if (((
pond->prohibit_list !=
NULL) &&
4869 if (
reply->static_prefixes > 0) {
4875 for (
l =
reply->host->fixed_prefix;
l !=
NULL;
l =
l->next) {
4876 if (
l->cidrnet.bits ==
reply->preflen)
4884 l =
reply->host->fixed_prefix;
4900 for (
i = 0 ;
i <
reply->old_ia->num_iasubopt ;
i++) {
4904 prefix =
reply->old_ia->iasubopt[
i];
4922 if (((
pond->prohibit_list !=
NULL) &&
4959 log_error(
"Reclaiming abandoned prefixes is not yet "
4960 "supported. Treating this as an out of space "
4972 scope = &
reply->lease->scope;
4973 group =
reply->lease->ipv6_pool->ipv6_pond->group;
5004 memset(&data, 0,
sizeof(data));
5042 for (
i =
reply->packet->class_count;
i > 0;
i--) {
5044 reply->packet->options,
5045 reply->opt_state, scope,
5046 reply->packet->classes[
i - 1]->group,
5057 reply->packet->options,
5058 reply->opt_state, scope,
5063 if (
reply->client_valid == 0)
5072 reply->packet->options,
5076 log_error(
"reply_process_is_prefixed: unable to "
5077 "evaluate default prefix time");
5097 if (
reply->client_prefer == 0)
5102 if ((
reply->send_prefer >=
reply->send_valid) &&
5104 reply->send_prefer = (
reply->send_valid / 2) +
5105 (
reply->send_valid / 8);
5111 reply->packet->options,
5115 log_error(
"reply_process_is_prefixed: unable to "
5116 "evaluate preferred prefix time");
5146 reply->lease->soft_lifetime_end_time =
5154 log_fatal(
"reply_process_is_prefixed: Unable to "
5155 "attach prefix to new IA_PD: %s",
5173 for (
i =
reply->packet->class_count;
i > 0;
i--) {
5175 reply->packet->options,
5176 reply->reply_ia, scope,
5177 reply->packet->classes[
i - 1]->group,
5187 reply->packet->options,
5188 reply->reply_ia, scope,
5192 if (data.data !=
NULL)
5196 reply->client_resources++;
5213 log_error(
"reply_process_send_prefix: out of memory"
5214 "allocating new IAPREFIX buffer.");
5228 log_error(
"reply_process_send_prefix: unable "
5229 "to save IAPREFIX option");
5252 if (
reply->preflen >= 0) {
5261 switch(
alpha->state) {
5263 switch(
beta->state) {
5268 if (
alpha->hard_lifetime_end_time <
5269 beta->hard_lifetime_end_time)
5284 switch (
beta->state) {
5290 if (
alpha->hard_lifetime_end_time <
5291 beta->hard_lifetime_end_time)
5293 else if ((
alpha->hard_lifetime_end_time ==
5294 beta->hard_lifetime_end_time) &&
5295 (
alpha->soft_lifetime_end_time <
5296 beta->soft_lifetime_end_time))
5310 switch (
beta->state) {
5317 if (
alpha->hard_lifetime_end_time <
5318 beta->hard_lifetime_end_time)
5332 log_fatal(
"Triple impossible condition at %s:%d.",
MDL);
5438 tmp_addr.len =
sizeof(*first_link_addr);
5443 log_debug(
"No subnet found for link-address %s.",
5460 log_info(
"[L2 Relay] No link address in relay packet "
5461 "assuming L2 relay and using receiving "
5471 log_error(
"No interface and no link address "
5472 "can't determine pool");
5592 "error evaluating IAADDR.");
5650 "Some of the addresses are not on link.",
5656 "All addresses still on link.",
5764 log_error(
"Client %s reports address %s is "
5765 "already in use by another host!",
5789 log_info(
"Client %s declines address %s, which is not offered to it.",
5798 log_error(
"ia_na_nomatch_decline: out of memory "
5799 "allocating option_state.");
5813 "out of space for reply packet.");
5854 const char *packet_type,
5885 memset(&fixed_addr, 0,
sizeof(fixed_addr));
5899 sizeof(
reply->transaction_id));
5906 log_error(
"iterate_over_ia_na: no memory for option_state.");
5922 "error saving server identifier.");
5933 "error saving client identifier.");
5986 "error evaluating IAADDR.");
6007 while (host !=
NULL) {
6015 "evaluating host address.");
6018 if ((
iaaddr.len >= 16) &&
6036 log_fatal(
"iterate_over_ia_na: no memory for "
6042 (
unsigned char *)key.data,
6098 if (fixed_addr.buffer !=
NULL) {
6172 log_info(
"Client %s releases address %s",
6195 log_info(
"Client %s releases address %s, which is not leased to it.",
6204 log_error(
"ia_na_nomatch_release: out of memory "
6205 "allocating option_state.");
6210 "Release for non-leased address.",
6220 "out of space for reply packet.");
6263 log_info(
"Client %s releases prefix %s/%u",
6268 if (prefix !=
NULL) {
6288 log_info(
"Client %s releases prefix %s/%u, which is not leased to it.",
6299 log_error(
"ia_pd_nomatch_release: out of memory "
6300 "allocating option_state.");
6305 "Release for non-leased prefix.",
6315 "out of space for reply packet.");
6356 const char *packet_type,
6406 log_error(
"iterate_over_ia_pd: no memory for option_state.");
6443 "error evaluating IAPREFIX.");
6464 while (host !=
NULL) {
6471 if (plen !=
l->cidrnet.bits)
6474 l->cidrnet.lo_addr.iabuf,
6492 log_fatal(
"iterate_over_ia_pd: no memory for "
6498 (
unsigned char *)key.data,
6525 if ((host !=
NULL) || (prefix !=
NULL)) {
6534 if (prefix !=
NULL) {
6563 if (prefix !=
NULL) {
6679 unsigned char msg_type;
6683 char link_addr[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
6684 char peer_addr[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
6710 log_info(
"Relay-forward from %s with link address=%s and "
6711 "peer address=%s missing Relay Message option.",
6719 log_error(
"dhcpv6_forw_relay: error evaluating "
6720 "relayed message.");
6726 log_error(
"dhcpv6_forw_relay: encapsulated packet too short.");
6737 "no memory for encapsulated packet.");
6744 "no memory for encapsulated packet's options.");
6781 "unsupported %s message type.",
6788 log_error(
"dhcpv6_relay_forw: unsupported %s message type.",
6799 msg->transaction_id,
6834 sizeof(
reply->link_address));
6836 sizeof(
reply->peer_address));
6844 log_error(
"dhcpv6_relay_forw: no memory for option state.");
6858 log_error(
"dhcpv6_relay_forw: error evaluating "
6863 (
unsigned char *)
a_opt.data,
6866 log_error(
"dhcpv6_relay_forw: error saving "
6873#if defined(RELAY_PORT)
6884 log_error(
"dhcpv6_relay_forw: error evaluating "
6885 "Relay Source Port.");
6889 (
unsigned char *)
a_opt.data,
6892 log_error(
"dhcpv6_relay_forw: error saving "
6893 "Relay Source Port.");
6909 log_error(
"dhcpv6_relay_forw: error saving Relay MSG.");
6926 log_error(
"dhcpv6_relay_forw: error evaluating ERO.");
6948 "evaluating option %u.",
req);
6954 (
unsigned char *)
a_opt.data,
6958 log_error(
"dhcpv6_relay_forw: error saving "
7017 unsigned char msg_type;
7021 char link_addr[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
7022 char peer_addr[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
7048 log_info(
"Relay-forward from %s with link address=%s and "
7049 "peer address=%s missing Relay Message option.",
7056 log_error(
"dhcp4o6_relay_forw: error evaluating "
7057 "relayed message.");
7063 "encapsulated packet too short.");
7072 "no memory for encapsulated packet.");
7078 "no memory for encapsulated packet's options.");
7130 log_error(
"dhcp4o6_relay_forw: unexpected message of type %d.",
7157 sizeof(
reply->link_address));
7159 sizeof(
reply->peer_address));
7166 log_error(
"dhcp4o6_relay_forw: no memory for option state.");
7180 log_error(
"dhcp4o6_relay_forw: error evaluating "
7185 (
unsigned char *)
a_opt.data,
7188 log_error(
"dhcp4o6_relay_forw: error saving "
7195#if defined(RELAY_PORT)
7206 log_error(
"dhcpv4o6_relay_forw: error evaluating "
7207 "Relay Source Port.");
7211 (
unsigned char *)
a_opt.data,
7214 log_error(
"dhcpv4o6_relay_forw: error saving "
7215 "Relay Source Port.");
7231 log_error(
"dhcp4o6_relay_forw: error saving Relay MSG.");
7248 log_error(
"dhcp4o6_relay_forw: error evaluating ERO.");
7270 "evaluating option %u.",
req);
7276 (
unsigned char *)
a_opt.data,
7280 log_error(
"dhcp4o6_relay_forw: error saving "
7357 log_info(
"DHCPv4-query from %s missing DHCPv4 Message option.",
7364 log_error(
"dhcp4o6_dhcpv4_query: error evaluating "
7370 log_error(
"dhcp4o6_dhcpv4_query: DHCPv4 packet too short.");
7379 "no memory for encapsulated packet.");
7395 "discarding packet with bogus hlen.");
7401 log_error(
"dhcp4o6_dhcpv4_query: no memory for options.");
7464 log_error(
"dhcp4o6_dhcpv4_query: no memory for option state.");
7475 log_error(
"dhcp4o6_dhcpv4_query: error saving DHCPv4 MSG.");
7490 log_fatal(
"dhcp4o6_dhcpv4_query: no memory to store reply.");
7531 log_error(
"forw_dhcpv4_query: can't find initial message.");
7540 "no memory for encapsulating packet.");
7543 ds.data =
ds.buffer->data;
7560 log_error(
"forw_dhcpv4_query: send(): %m");
7570 log_debug(
"Discarding %s from %s; message type not handled by server",
7665 log_info(
"Discarding unknown DHCPv6 message type %d "
7687 "Unknown message type %d from %s port %d",
7760#if defined (REPLY_TO_SOURCE_PORT)
7771#if defined(RELAY_PORT)
7783 log_info(
"Sending %s to %s port %d",
7791 log_error(
"dhcpv6: send_packet6() sent %d of %d bytes",
7815 unsigned char msg_type;
7824 memset(name, 0,
sizeof(name));
7831 log_error(
"recv_dhcpv4_query: can't find interface %s.",
7848 "short packet from %s, len %d, dropped",
7858 log_error(
"recv_dhcpv4_query: no memory for packet.");
7863 log_error(
"recv_dhcpv4_query: no memory for options.");
7874 msg_type = raw->
data[36];
7919 log_error(
"recv_dhcpv4_query: unexpected message of type %d.",
7940 "Unknown message type %d from %s",
7980 len =
reply.len + 36;
7983 log_error(
"recv_dhcpv4_query: no memory.");
7987 ds.data =
ds.buffer->data;
8003 log_error(
"recv_dhcpv4_query: send(): %m");
8047 memset(&addr, 0,
sizeof(addr));
8052 if (addr.len < 16) {
8102 log_error(
"unicast_reject: could not locate client.");
8111 &
reply.buf.reply)) {
8114 "Unicast not allowed by server.",
8116 log_error(
"unicast_reject: Unable to set status code.");
8135 "No memory to store Reply.");
8183 "No memory for option state.");
8195 "cannot attribute packet to a network.");
8251 log_debug(
"share_network_from_request_addr: nothing to match");
8256 log_debug(
"shared_network_from_requested_addr:"
8262 log_debug(
"shared_network_from_requested_addr:"
8263 " found shared network %s for address %s.",
8264 ((*shared)->name ? (*shared)->name :
"unnamed"),
8327 log_error (
"get_first_ia_addr_val: invalid opt type %d",
8339 " couldn't unroll enclosing option");
8361 "error evaluating IA_XX option.");
8364 log_error(
"shared_network_from_requested_addr:"
8365 " invalid length %d, expected %d",
8424 reply->packet->options,
8436 reply->packet->options,
8471 reply->packet->options,
8511 ||
old_ia->num_iasubopt <= 0) {
8520 if (
lease->ipv6_pool->shared_network ==
reply->shared) {
8526 for (
i = 0;
i <
old_ia->num_iasubopt;
i++) {
8529 log_info(
"Client: %s roamed to new network,"
8530 " releasing lease: %s%s",
8532 reply->client_id.data, 60),
8577 reply->packet->options,
8588 reply->packet->options,
8608 iasub->static_lease = 1;
8611 log_fatal(
"Out of memory for binding scope.");
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
int option_state_allocate(struct option_state **ptr, const char *file, int line)
int option_state_dereference(struct option_state **ptr, const char *file, int line)
int packet_reference(struct packet **ptr, struct packet *bp, const char *file, int line)
int packet_dereference(struct packet **ptr, const char *file, int line)
int binding_scope_reference(struct binding_scope **ptr, struct binding_scope *bp, const char *file, int line)
int binding_scope_allocate(struct binding_scope **ptr, const char *file, int line)
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
int packet_allocate(struct packet **ptr, const char *file, int line)
void delete_option(struct universe *universe, struct option_state *options, int code)
int append_option_buffer(struct universe *universe, struct option_state *options, struct buffer *bp, unsigned char *buffer, unsigned length, unsigned code, int terminatep)
int parse_options(struct packet *packet)
int save_option_buffer(struct universe *universe, struct option_state *options, struct buffer *bp, unsigned char *buffer, unsigned length, unsigned code, int terminatep)
struct option_cache * lookup_option(struct universe *universe, struct option_state *options, unsigned code)
int get_option_int(int *result, struct universe *universe, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct option_state *options, struct binding_scope **scope, unsigned code, const char *file, int line)
int store_options6(char *buf, int buflen, struct option_state *opt_state, struct packet *packet, const int *required_opts, struct data_string *oro)
int packet6_len_okay(const char *packet, int len)
int parse_option_buffer(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *universe)
int validate_packet(struct packet *packet)
u_int32_t getUShort(const unsigned char *)
void putUShort(unsigned char *, u_int32_t)
u_int32_t getULong(const unsigned char *)
u_int32_t getUChar(const unsigned char *)
void putULong(unsigned char *, u_int32_t)
void bootp(struct packet *packet)
void dhcp(struct packet *packet)
int find_subnet(struct subnet **sp, struct iaddr addr, const char *file, int line)
#define IASUBOPT_NA_PREF_OFFSET
#define DHCPV6_RELAY_REPL
#define D6O_RELAY_SOURCE_PORT
#define IASUBOPT_PD_PREFLEN_OFFSET
#define DHCP4O6_QUERY_UNICAST
#define DHCPV6_RELAY_FORW
#define D6O_RECONF_ACCEPT
#define IASUBOPT_NA_VALID_OFFSET
#define REPLY_OPTIONS_INDEX
#define IASUBOPT_PD_PREF_OFFSET
#define DHCPV6_LEASEQUERY
#define DHCPV6_DHCPV4_QUERY
#define IASUBOPT_PD_PREFIX_OFFSET
#define IASUBOPT_NA_ADDR_OFFSET
#define DHCPV6_INFORMATION_REQUEST
#define STATUS_NoAddrsAvail
#define DHCPV6_RECONFIGURE
#define STATUS_UseMulticast
#define STATUS_NoPrefixAvail
#define IASUBOPT_PD_VALID_OFFSET
#define DHCPV6_DHCPV4_RESPONSE
#define DHCPV6_LEASEQUERY_REPLY
#define DHCP_FIXED_NON_UDP
#define DHO_DHCP_MESSAGE_TYPE
#define DHO_DHCP_RENEWAL_TIME
#define DHO_DHCP_REBINDING_TIME
#define SV_UPDATE_STATIC_LEASES
#define DEFAULT_DEFAULT_LEASE_TIME
const char * pin6_addr(const struct in6_addr *)
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
#define SV_DHCPV6_SET_TEE_TIMES
#define DEFAULT_CACHE_THRESHOLD
void dhcpv6_leasequery(struct data_string *, struct packet *)
#define FIND_POND6_PERCENT(count, percent)
isc_boolean_t ipv6_in_pool(const struct in6_addr *addr, const struct ipv6_pool *pool)
isc_result_t get_client_id(struct packet *, struct data_string *)
#define SV_LOG_THRESHOLD_LOW
isc_result_t iasubopt_reference(struct iasubopt **iasubopt, struct iasubopt *src, const char *file, int line)
isc_result_t generate_new_server_duid(void)
#define print_hex_3(len, data, limit)
int find_hosts6(struct host_decl **host, struct packet *packet, const struct data_string *client_id, char *file, int line)
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
isc_boolean_t lease6_usable(struct iasubopt *lease)
Check if address is available to a lease.
void set_server_duid(struct data_string *new_duid)
void copy_server_duid(struct data_string *ds, const char *file, int line)
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)
void schedule_lease_timeout(struct ipv6_pool *pool)
#define SV_LIMIT_PREFS_PER_IA
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)
int find_grouped_subnet(struct subnet **, struct shared_network *, struct iaddr, const char *, int)
void set_server_duid_type(int type)
#define SV_CACHE_THRESHOLD
void change_host_uid(struct host_decl *host, const char *data, int len)
int ddns_updates(struct packet *, struct lease *, struct lease *, struct iasubopt *, struct iasubopt *, struct option_state *)
int commit_leases_timed(void)
struct universe server_universe
isc_result_t set_server_duid_from_option(void)
isc_result_t ia_dereference(struct ia_xx **ia, const char *file, int line)
struct universe dhcp_universe
#define SV_LIMIT_ADDRS_PER_IA
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)
isc_boolean_t lease6_exists(const struct ipv6_pool *pool, const struct in6_addr *addr)
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)
int find_hosts_by_option(struct host_decl **, struct packet *, struct option_state *, const char *, int)
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
Renew a lease in the pool.
#define SV_LOG_THRESHOLD_HIGH
isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
#define print_hex_2(len, data, limit)
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *addr)
int write_ia(const struct ia_xx *)
ssize_t send_packet6(struct interface_info *, const unsigned char *, size_t, struct sockaddr_in6 *)
isc_boolean_t server_duid_isset(void)
void classify_client(struct packet *)
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line)
isc_boolean_t prefix6_exists(const struct ipv6_pool *pool, const struct in6_addr *pref, u_int8_t plen)
#define SV_PREFER_LIFETIME
isc_result_t add_lease6(struct ipv6_pool *pool, struct iasubopt *lease, time_t valid_lifetime_end_time)
int permitted(struct packet *, struct permit *)
void dhcpv6(struct packet *)
#define SV_DEFAULT_LEASE_TIME
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
#define print_hex_1(len, data, limit)
struct interface_info * interfaces
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)
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)
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits)
const char * piaddr(const struct iaddr addr)
int addr_eq(struct iaddr addr1, struct iaddr addr2)
struct iaddr subnet_number(struct iaddr addr, struct iaddr mask)
struct group * root_group
int log_error(const char *,...) __attribute__((__format__(__printf__
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
void log_fatal(const char *,...) __attribute__((__format__(__printf__
int int log_info(const char *,...) __attribute__((__format__(__printf__
#define DHCP_R_INVALIDARG
const unsigned char * data
unsigned char options[DHCP_MAX_OPTION_LEN]
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
unsigned char link_address[16]
unsigned char peer_address[16]
struct iaddrcidrnetlist * fixed_prefix
struct option_cache * fixed_addr
struct host_decl * n_ipaddr
struct iasubopt ** iasubopt
struct ipv6_pool * ipv6_pool
struct interface_info * next
struct shared_network * shared_network
isc_uint64_t low_threshold
struct ipv6_pond * ipv6_pond
struct shared_network * shared_network
struct lease_state * state
struct dhcp_ddns_cb * ddns_cb
struct binding_scope * scope
struct option_cache * next
struct in6_addr dhcpv6_link_address
struct packet * dhcpv6_container_packet
unsigned char dhcp4o6_flags[3]
unsigned char dhcpv6_msg_type
unsigned char dhcpv6_hop_count
struct interface_info * interface
isc_boolean_t relay_source_port
struct in6_addr dhcpv6_peer_address
struct option_state * options
unsigned char dhcpv6_transaction_id[3]
struct subnet * next_sibling
struct shared_network * shared_network
const int dhcpv6_type_name_max
const char * dhcpv6_type_names[]
struct universe dhcpv6_universe
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)
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)
int data_string_sprintfa(struct data_string *ds, const char *fmt,...)
struct binding_scope * global_scope