diff --git a/source/6LoWPAN/Thread/thread_bootstrap.c b/source/6LoWPAN/Thread/thread_bootstrap.c index 5f4541278920..8bfaebc2fb2c 100644 --- a/source/6LoWPAN/Thread/thread_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_bootstrap.c @@ -86,7 +86,7 @@ #include "MPL/mpl.h" #include "MLE/mle.h" #include "MLE/mle_tlv.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "thread_config.h" #include "thread_meshcop_lib.h" #include "multicast_api.h" @@ -890,7 +890,7 @@ void thread_interface_init(protocol_interface_info_entry_t *cur) { thread_discovery_reset(cur->id); thread_routing_set_mesh_callbacks(cur); - thread_dhcp_client_init(cur->id); + dhcp_client_init(cur->id); thread_management_client_init(cur->id); thread_address_registration_init(); cur->mpl_seed_id_mode = MULTICAST_MPL_SEED_ID_MAC_SHORT; @@ -1837,7 +1837,7 @@ static void thread_dhcp_client_gua_error_cb(int8_t interface, uint8_t dhcp_addr[ tr_warn("Address Get fail: %s from: %s", trace_ipv6(prefix), trace_ipv6(dhcp_addr)); if (prefix && dhcp_addr) { tr_debug("Delete Current Server data"); - thread_dhcp_client_global_address_delete(interface, dhcp_addr, prefix); + dhcp_client_global_address_delete(interface, dhcp_addr, prefix); } } } @@ -2295,7 +2295,7 @@ void thread_bootstrap_stop(protocol_interface_info_entry_t *cur) thread_leader_service_leader_data_free(cur->thread_info); thread_bootstrap_all_nodes_multicast_unregister(cur); thread_data_base_init(cur->thread_info, cur->id); - thread_dhcp_client_delete(cur->id); + dhcp_client_delete(cur->id); thread_nd_service_delete(cur->id); thread_child_id_request_entry_clean(cur); thread_registered_mcast_addr_entry_clean(cur); @@ -2544,7 +2544,7 @@ int thread_bootstrap_network_data_process(protocol_interface_info_entry_t *cur, memcpy(&addr[8], ADDR_SHORT_ADR_SUFFIC, 6); common_write_16_bit(genericService.routerID, &addr[14]); tr_debug("Delete DHCPv6 given address"); - thread_dhcp_client_global_address_delete(cur->id, addr, prefixTlv.Prefix); + dhcp_client_global_address_delete(cur->id, addr, prefixTlv.Prefix); } } @@ -2840,8 +2840,8 @@ void thread_bootstrap_network_prefixes_process(protocol_interface_info_entry_t * if (!thread_dhcpv6_address_entry_available(curPrefix->servicesPrefix, &cur->ip_addresses)) { thread_addr_write_mesh_local_16(addr, curBorderRouter->routerID, cur->thread_info); /* Do not allow multiple DHCP solicits from one prefix => delete previous */ - thread_dhcp_client_global_address_delete(cur->id, NULL, curPrefix->servicesPrefix); - if (thread_dhcp_client_get_global_address(cur->id, addr, curPrefix->servicesPrefix, cur->mac, thread_dhcp_client_gua_error_cb) == 0) { + dhcp_client_global_address_delete(cur->id, NULL, curPrefix->servicesPrefix); + if (dhcp_client_get_global_address(cur->id, addr, curPrefix->servicesPrefix, cur->mac, thread_dhcp_client_gua_error_cb) == 0) { tr_debug("GP Address Requested"); } } diff --git a/source/6LoWPAN/Thread/thread_common.c b/source/6LoWPAN/Thread/thread_common.c index a02faa1891f2..637eef73bd27 100644 --- a/source/6LoWPAN/Thread/thread_common.c +++ b/source/6LoWPAN/Thread/thread_common.c @@ -46,7 +46,7 @@ #include "6LoWPAN/Thread/thread_beacon.h" #include "6LoWPAN/Thread/thread_leader_service.h" #include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/Thread/thread_discovery.h" #include "6LoWPAN/Thread/thread_bootstrap.h" #include "6LoWPAN/Thread/thread_router_bootstrap.h" diff --git a/source/6LoWPAN/Thread/thread_dhcpv6_client.c b/source/6LoWPAN/Thread/thread_dhcpv6_client.c deleted file mode 100644 index 2eec89060eff..000000000000 --- a/source/6LoWPAN/Thread/thread_dhcpv6_client.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2013-2018, Arm Limited and affiliates. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "nsconfig.h" -#ifdef HAVE_THREAD -#include -#include -#include -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "common_functions.h" - - -#include "dhcp_service_api.h" -#include "thread_dhcpv6_client.h" -#include "libDHCPv6/libDHCPv6.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" - -#define TRACE_GROUP "TDHP" - -typedef struct { - thread_dhcp_client_global_adress_cb *global_address_cb; - uint16_t service_instance; - uint8_t libDhcp_instance; - int8_t interface; -} thread_dhcp_client_class_t; - -thread_dhcp_client_class_t dhcp_client; - -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr); - - -void thread_dhcp_client_init(int8_t interface) -{ - // No support for multible thread instances yet. - dhcp_client.service_instance = dhcp_service_init(interface, DHCP_INSTANCE_CLIENT, NULL); - dhcp_client.interface = interface; - dhcp_client.libDhcp_instance = libdhcpv6_nonTemporal_entry_get_unique_instance_id(); - - return; -} - -void thread_dhcp_client_delete(int8_t interface) -{ - protocol_interface_info_entry_t *cur = NULL; - dhcpv6_client_server_data_t *srv_data_ptr; - - dhcp_service_delete(dhcp_client.service_instance); - - - cur = protocol_stack_interface_info_get_by_id(interface); - - if (!cur) { - return; - } - - do { - srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_instance(dhcp_client.libDhcp_instance); - if (srv_data_ptr != NULL) { - tr_debug("Free DHCPv6 Client\n"); - dhcp_service_req_remove(srv_data_ptr->transActionId);// remove all pending retransmissions - addr_delete(cur, srv_data_ptr->iaNontemporalAddress.addressPrefix); - libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); - } - } while (srv_data_ptr != NULL); - dhcp_client.service_instance = 0; - return; -} - - -void thread_dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) -{ - if (srv_data_ptr != NULL) { - - // error for Global address - if (dhcp_client.global_address_cb != NULL) { - dhcp_client.global_address_cb(dhcp_client.interface, srv_data_ptr->server_address, srv_data_ptr->iaNontemporalAddress.addressPrefix, false); - } - } -} - - -/* solication responce received for either global address or routter id assignment */ -int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - dhcp_ia_non_temporal_params_t dhcp_ia_non_temporal_params; - dhcp_link_options_params_t clientId; - dhcp_link_options_params_t serverId; - dhcp_link_options_params_t interfaceId; - dhcpv6_client_server_data_t *srv_data_ptr = NULL; - (void)instance_id; - - srv_data_ptr = ptr; - - if (srv_data_ptr == NULL) { - tr_error("server data not found"); - goto error_exit; - } - - // Validate message - if (msg_name != DHCPV6_REPLY_TYPE) { - tr_error("invalid response"); - goto error_exit; - } - - if (libdhcpv6_reply_message_option_validate(&clientId, &serverId, &dhcp_ia_non_temporal_params, msg_ptr, msg_len) != 0) { - tr_error("Sol Not include all Options"); - goto error_exit; - } - - if (libdhcpv6_nonTemporal_entry_get_by_iaid(dhcp_ia_non_temporal_params.iaId) != srv_data_ptr) { - /* Validate server data availability */ - tr_error("Valid instance not found"); - goto error_exit; - } - - if (srv_data_ptr->IAID != dhcp_ia_non_temporal_params.iaId) { - tr_error("Wrong IAID"); - goto error_exit; - } - - interfaceId.linkID = srv_data_ptr->clientId; - interfaceId.linkType = srv_data_ptr->clientLinkIdType; - if (libdhcpv6_compare_DUID(&interfaceId, &clientId) != 0) { - tr_error("Not Valid Client Id"); - goto error_exit; - } - - memcpy(srv_data_ptr->iaNontemporalAddress.addressPrefix, dhcp_ia_non_temporal_params.nonTemporalAddress, 16); - srv_data_ptr->iaNontemporalAddress.preferredTime = dhcp_ia_non_temporal_params.preferredValidLifeTime; - srv_data_ptr->iaNontemporalAddress.validLifetime = dhcp_ia_non_temporal_params.validLifeTime; - memcpy(srv_data_ptr->serverLinkId, serverId.linkID, 8); - srv_data_ptr->serverLinkType = serverId.linkType; - srv_data_ptr->serverLinkType = serverId.linkType; - srv_data_ptr->T0 = dhcp_ia_non_temporal_params.T0; - srv_data_ptr->T1 = dhcp_ia_non_temporal_params.T1; - srv_data_ptr->iaNonTemporalStructValid = true; - - thread_dhcpv6_client_set_address(dhcp_client.interface, srv_data_ptr); - - - if (dhcp_client.global_address_cb) { - dhcp_client.global_address_cb(dhcp_client.interface, srv_data_ptr->server_address, srv_data_ptr->iaNontemporalAddress.addressPrefix, true); - } - return RET_MSG_ACCEPTED; -error_exit: - thread_dhcpv6_client_send_error_cb(srv_data_ptr); - return RET_MSG_ACCEPTED; -} - -int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], uint8_t mac64[static 8], thread_dhcp_client_global_adress_cb *error_cb) -{ - dhcpv6_solication_base_packet_s solPacket = {0}; - dhcpv6_ia_non_temporal_address_s nonTemporalAddress = {0}; - uint8_t *payload_ptr; - uint32_t payload_len; - dhcpv6_client_server_data_t *srv_data_ptr; - - if (mac64 == NULL || prefix == NULL || dhcp_addr == NULL) { - tr_error("Invalid parameters"); - return -1; - } - - srv_data_ptr = libdhcvp6_nontemporalAddress_server_data_allocate(interface, dhcp_client.libDhcp_instance, mac64, DHCPV6_DUID_HARDWARE_EUI64_TYPE, prefix, dhcp_addr); - if (!srv_data_ptr) { - tr_error("OOM srv_data_ptr"); - return -1; - } - - payload_len = libdhcpv6_solication_message_length(DHCPV6_DUID_HARDWARE_EUI64_TYPE, true, 0); - payload_ptr = ns_dyn_mem_temporary_alloc(payload_len); - if (!payload_ptr) { - libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); - tr_error("OOM payload_ptr"); - return -1; - } - - dhcp_client.global_address_cb = error_cb; //TODO Only supporting one instance globaly if we need more for different instances needs code. - srv_data_ptr->GlobalAddress = true; - // Build solicit - solPacket.clientDUID.linkID = mac64; - solPacket.clientDUID.linkType = DHCPV6_DUID_HARDWARE_EUI64_TYPE; - solPacket.iaID = srv_data_ptr->IAID; - solPacket.messageType = DHCPV6_SOLICATION_TYPE; - solPacket.transActionId = libdhcpv6_txid_get(); - /*Non Temporal Address */ - nonTemporalAddress.requestedAddress = prefix; - libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &solPacket, &nonTemporalAddress, NULL); - - // send solicit - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client.service_instance, 0, srv_data_ptr , dhcp_addr, payload_ptr, payload_len, dhcp_solicit_resp_cb); - if (srv_data_ptr->transActionId == 0) { - ns_dyn_mem_free(payload_ptr); - libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); - return -1; - } - - return 0; -} - -void thread_dhcp_client_global_address_renew(int8_t interface) -{ - // only prepared for changes in thread specifications - (void)interface; - return; -} - -void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]) -{ - protocol_interface_info_entry_t *cur; - dhcpv6_client_server_data_t *srv_data_ptr; - (void) dhcp_addr; - - srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_prefix(interface, prefix); - cur = protocol_stack_interface_info_get_by_id(interface); - - do { - if (cur == NULL || srv_data_ptr == NULL) { - return; - } - dhcp_service_req_remove(srv_data_ptr->transActionId);// remove all pending retransmissions - tr_debug("Deleting address: %s", trace_ipv6(srv_data_ptr->iaNontemporalAddress.addressPrefix)); - - addr_delete(cur, srv_data_ptr->iaNontemporalAddress.addressPrefix); - - libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); - srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_prefix(interface, prefix); - } while (srv_data_ptr); - - return; -} - -void thread_dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, if_address_callback_t reason) -{ - dhcpv6_ia_non_temporal_address_s nonTemporalAddress = {0}; - dhcp_link_options_params_t serverLink; - uint8_t *payload_ptr; - uint32_t payload_len; - dhcpv6_client_server_data_t *srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_prefix(interface->id, addr->address); - - if (srv_data_ptr == NULL) { - tr_warn("Dhcp address lost"); - return ; - } - if (reason == ADDR_CALLBACK_INVALIDATED) { - dhcp_service_req_remove(srv_data_ptr->transActionId);//stop retransmissions of renew - libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); - tr_warn("Dhcp address lost"); - return; - } - - if (reason != ADDR_CALLBACK_TIMER) { - return; - } - - payload_len = libdhcpv6_address_request_message_len(srv_data_ptr->clientLinkIdType, srv_data_ptr->serverLinkType, 0); - payload_ptr = ns_dyn_mem_temporary_alloc(payload_len); - if (payload_ptr == NULL) { - addr->state_timer = 200; //Retry after 20 seconds - tr_error("Out of memory"); - return ; - } - dhcpv6_solication_base_packet_s packetReq = { - .messageType = DHCPV6_RENEW_TYPE, - .clientDUID.linkID = srv_data_ptr->clientId, - .clientDUID.linkType = srv_data_ptr->clientLinkIdType, - .requestedOptionCnt = 0, - .iaID = srv_data_ptr->IAID, - .timerT0 = srv_data_ptr->T0, - .timerT1 = srv_data_ptr->T1, - .requestedOptionList = NULL, - }; - - // Set Address information - nonTemporalAddress.requestedAddress = srv_data_ptr->iaNontemporalAddress.addressPrefix; - nonTemporalAddress.preferredLifeTime = srv_data_ptr->iaNontemporalAddress.preferredTime; - nonTemporalAddress.validLifeTime = srv_data_ptr->iaNontemporalAddress.validLifetime; - serverLink.linkID = srv_data_ptr->serverLinkId; - serverLink.linkType = srv_data_ptr->serverLinkType; - libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &packetReq, &nonTemporalAddress, &serverLink); - // send solicit - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client.service_instance, 0, srv_data_ptr, srv_data_ptr->server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb); - if (srv_data_ptr->transActionId == 0) { - ns_dyn_mem_free(payload_ptr); - addr->state_timer = 200; //Retry after 20 seconds - tr_error("DHCP renew send failed"); - } -} - -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr) -{ - protocol_interface_info_entry_t *cur = NULL; - if_address_entry_t *address_entry = NULL; - uint32_t renewTimer; - - cur = protocol_stack_interface_info_get_by_id(interface_id); - if (!cur) { - return; - } - renewTimer = libdhcpv6_renew_time_define(srv_data_ptr); - - address_entry = addr_get_entry(cur, srv_data_ptr->iaNontemporalAddress.addressPrefix); - if (address_entry == NULL) { - // create new - address_entry = addr_add(cur, srv_data_ptr->iaNontemporalAddress.addressPrefix, 64, ADDR_SOURCE_DHCP, srv_data_ptr->iaNontemporalAddress.validLifetime, srv_data_ptr->iaNontemporalAddress.preferredTime, false); - } else { - addr_set_valid_lifetime(cur, address_entry, srv_data_ptr->iaNontemporalAddress.validLifetime); - addr_set_preferred_lifetime(cur, address_entry, srv_data_ptr->iaNontemporalAddress.preferredTime); - } - - if (address_entry == NULL) { - tr_error("Address add failed"); - return; - } - if (renewTimer) { - // translate seconds to 100ms ticks - if (renewTimer < 0xffffffff / 10) { - renewTimer *= 10; - } else { - renewTimer = 0xfffffffe; - } - } - address_entry->state_timer = renewTimer; - address_entry->cb = thread_dhcpv6_renew; -} -#endif diff --git a/source/6LoWPAN/Thread/thread_dhcpv6_client.h b/source/6LoWPAN/Thread/thread_dhcpv6_client.h deleted file mode 100644 index cc97006e05a6..000000000000 --- a/source/6LoWPAN/Thread/thread_dhcpv6_client.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifndef SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_ -#define SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_ - -#include - -/* Thread DHCP client implementation. - * - * Responsibilities of this module are: - * - send router id address request and receive new router address and inform it to thread bootstrap. - * - handle Global address queries and refresh inside thread network. - * - */ - -/* Initialize dhcp thread dhcp client. - * - * This instance needs to bee initialized once for each thread network interface. - * if only one thread instance is supported this is needed to call only once. - * - * /param interface interface id of this thread instance. - * - */ - -void thread_dhcp_client_init(int8_t interface); - -/* Delete dhcp thread dhcp client. - * - * When this is called all addressed assigned by this module are removed from stack. - */ -void thread_dhcp_client_delete(int8_t interface); - -/* Global address handler. - * - * This module updates the addresses from dhcp server and sets them in stack. - * this module makes refresh of address when needed. - * - */ - - -/* give dhcp server and prefix for global address assignment - * - * /param interface interface where address is got - * /param dhcp_addr dhcp server ML16 address where address is registered. - * /param prefix dhcp server ML16 address where address is registered. - * /param mac64 64 bit mac address for identifieng client. - * /param error_cb error callback that is called if address cannot be created or becomes invalid. - * /param register_status true if address registered. - * - */ -typedef void (thread_dhcp_client_global_adress_cb)(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status); - -int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], uint8_t mac64[static 8], thread_dhcp_client_global_adress_cb *error_cb); - -/* Renew all leased adddresses might be used when short address changes - * - * /param interface interface where address is got - */ -void thread_dhcp_client_global_address_renew(int8_t interface); - -/* Delete address from device - * if prefix is NULL all are deleted - * - * /param interface interface where address is got - * /param prefix dhcp server ML16 address where address is registered. - * - */ -void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]); - -#endif /* SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_ */ diff --git a/source/6LoWPAN/Thread/thread_leader_service.c b/source/6LoWPAN/Thread/thread_leader_service.c index 714a209c9aa4..a244c9cedcf6 100644 --- a/source/6LoWPAN/Thread/thread_leader_service.c +++ b/source/6LoWPAN/Thread/thread_leader_service.c @@ -41,7 +41,7 @@ #include "6LoWPAN/Thread/thread_config.h" #include "6LoWPAN/Thread/thread_common.h" #include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/Thread/thread_discovery.h" #include "6LoWPAN/Thread/thread_joiner_application.h" #include "6LoWPAN/Thread/thread_network_data_lib.h" @@ -1301,7 +1301,7 @@ static int thread_leader_service_leader_init(protocol_interface_info_entry_t *cu thread_routing_free(&thread_info->routing); ipv6_route_table_remove_info(cur->id, ROUTE_THREAD, NULL); ipv6_route_table_remove_info(cur->id, ROUTE_THREAD_BORDER_ROUTER, NULL); - thread_dhcp_client_delete(cur->id); + dhcp_client_delete(cur->id); thread_nd_service_delete(cur->id); mpl_clear_realm_scope_seeds(cur); ipv6_neighbour_cache_flush(&cur->ipv6_neighbour_cache); diff --git a/source/6LoWPAN/Thread/thread_management_if.c b/source/6LoWPAN/Thread/thread_management_if.c index 767bb355389c..1d4a460004b5 100644 --- a/source/6LoWPAN/Thread/thread_management_if.c +++ b/source/6LoWPAN/Thread/thread_management_if.c @@ -50,7 +50,7 @@ #include "6LoWPAN/Thread/thread_leader_service.h" #include "6LoWPAN/Thread/thread_nd.h" #include "thread_diagnostic.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/Thread/thread_discovery.h" #include "6LoWPAN/Thread/thread_network_synch.h" #include "6LoWPAN/Thread/thread_management_internal.h" diff --git a/source/6LoWPAN/Thread/thread_network_data_storage.c b/source/6LoWPAN/Thread/thread_network_data_storage.c index 94fde76bc2a3..f1e5c54161d3 100755 --- a/source/6LoWPAN/Thread/thread_network_data_storage.c +++ b/source/6LoWPAN/Thread/thread_network_data_storage.c @@ -48,7 +48,7 @@ #include "6LoWPAN/Thread/thread_joiner_application.h" #include "6LoWPAN/Thread/thread_network_data_lib.h" #include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/MAC/mac_helper.h" #include "thread_management_if.h" #include "thread_meshcop_lib.h" @@ -930,7 +930,7 @@ static bool thread_server_data_clean_by_router_id(thread_network_data_cache_entr if (cur->P_dhcp) { tr_debug("Delete DHCPv6 given address"); - thread_dhcp_client_global_address_delete(curInterface->id, addr, prefixEntry->servicesPrefix); + dhcp_client_global_address_delete(curInterface->id, addr, prefixEntry->servicesPrefix); } if (cur->P_slaac) { diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.c b/source/6LoWPAN/Thread/thread_router_bootstrap.c index 4c061ce934d6..2d5726c84c23 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -78,7 +78,7 @@ #include "Service_Libs/nd_proxy/nd_proxy.h" #include "Service_Libs/mle_service/mle_service_api.h" #include "Service_Libs/blacklist/blacklist.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/MAC/mac_helper.h" #include "mac_api.h" #include "6LoWPAN/MAC/mac_data_poll.h" diff --git a/source/6LoWPAN/ws/ws_bbr_api.c b/source/6LoWPAN/ws/ws_bbr_api.c index ed7b31862491..d787c9ac9435 100644 --- a/source/6LoWPAN/ws/ws_bbr_api.c +++ b/source/6LoWPAN/ws/ws_bbr_api.c @@ -33,7 +33,6 @@ #include "Common_Protocols/icmpv6_radv.h" #include "net_rpl.h" #include "Service_Libs/nd_proxy/nd_proxy.h" - #include "6LoWPAN/ws/ws_bbr_api_internal.h" #define TRACE_GROUP "wsbs" diff --git a/source/DHCPv6_client/dhcpv6_client_service.c b/source/DHCPv6_client/dhcpv6_client_service.c index e22259b49950..33ad2fc23d96 100644 --- a/source/DHCPv6_client/dhcpv6_client_service.c +++ b/source/DHCPv6_client/dhcpv6_client_service.c @@ -45,7 +45,7 @@ void dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t void dhcp_client_init(int8_t interface) { - // No support for multible thread instances yet. + // No support for multible instances yet. dhcp_client.service_instance = dhcp_service_init(interface, DHCP_INSTANCE_CLIENT, NULL); dhcp_client.interface = interface; dhcp_client.libDhcp_instance = libdhcpv6_nonTemporal_entry_get_unique_instance_id(); @@ -149,7 +149,7 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin srv_data_ptr->T1 = dhcp_ia_non_temporal_params.T1; srv_data_ptr->iaNonTemporalStructValid = true; - thread_dhcpv6_client_set_address(dhcp_client.interface, srv_data_ptr); + dhcpv6_client_set_address(dhcp_client.interface, srv_data_ptr); if (dhcp_client.global_address_cb) { @@ -268,7 +268,7 @@ void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t payload_len = libdhcpv6_address_request_message_len(srv_data_ptr->clientLinkIdType, srv_data_ptr->serverLinkType, 0); payload_ptr = ns_dyn_mem_temporary_alloc(payload_len); if (payload_ptr == NULL) { - addr->state_timer = 200;//Retry after? should there be maximum 20 second retry + addr->state_timer = 200; //Retry after 20 seconds tr_error("Out of memory"); return ; } @@ -292,6 +292,11 @@ void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &packetReq, &nonTemporalAddress, &serverLink); // send solicit srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client.service_instance, 0, srv_data_ptr, srv_data_ptr->server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb); + if (srv_data_ptr->transActionId == 0) { + ns_dyn_mem_free(payload_ptr); + addr->state_timer = 200; //Retry after 20 seconds + tr_error("DHCP renew send failed"); + } } void dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr) diff --git a/sources.mk b/sources.mk index 589d668aa791..e634107d319b 100644 --- a/sources.mk +++ b/sources.mk @@ -139,7 +139,6 @@ SRCS += \ source/6LoWPAN/Thread/thread_bootstrap.c \ source/6LoWPAN/Thread/thread_host_bootstrap.c \ source/6LoWPAN/Thread/thread_router_bootstrap.c \ - source/6LoWPAN/Thread/thread_dhcpv6_client.c \ source/6LoWPAN/Thread/thread_discovery.c \ source/6LoWPAN/Thread/thread_commissioning_if.c \ source/6LoWPAN/Thread/thread_extension.c \ @@ -160,6 +159,7 @@ SRCS += \ source/6LoWPAN/Thread/thread_nvm_store.c \ source/6LoWPAN/Thread/thread_extension_bootstrap.c \ source/DHCPv6_Server/DHCPv6_Server_service.c \ + source/DHCPv6_client/dhcpv6_client_service.c \ source/libDHCPv6/dhcp_service_api.c \ source/libDHCPv6/libDHCPv6.c \ source/libDHCPv6/libDHCPv6_server.c \ diff --git a/test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c b/test/nanostack/unittest/stub/dhcpv6_client_stub.c similarity index 60% rename from test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c rename to test/nanostack/unittest/stub/dhcpv6_client_stub.c index b5999a0b5a7a..c5ebb9a12d7a 100644 --- a/test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c +++ b/test/nanostack/unittest/stub/dhcpv6_client_stub.c @@ -24,7 +24,7 @@ #include "dhcp_service_api.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "libDHCPv6/libDHCPv6.h" #include "NWK_INTERFACE/Include/protocol.h" #include "6LoWPAN/Thread/thread_common.h" @@ -32,27 +32,27 @@ typedef struct { - thread_dhcp_client_global_adress_cb *global_address_cb; + dhcp_client_global_adress_cb *global_address_cb; uint16_t service_instance; uint8_t libDhcp_instance; int8_t interface; -} thread_dhcp_client_class_t; +} dhcp_client_class_t; -thread_dhcp_client_class_t dhcp_client; +dhcp_client_class_t dhcp_client; extern uint8_t *dhcpv6_vendor_code_parse_thread_router_id(uint8_t *ptr, uint16_t data_length); -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr); +void dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr); -void thread_dhcp_client_init(int8_t interface) +void dhcp_client_init(int8_t interface) { } -void thread_dhcp_client_delete(int8_t interface) +void dhcp_client_delete(int8_t interface) { } -void thread_dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) +void dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) { } @@ -63,24 +63,24 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin return 0; } -int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[__static 16], uint8_t prefix[__static 16], uint8_t mac64[__static 8], thread_dhcp_client_global_adress_cb *error_cb) +int dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[__static 16], uint8_t prefix[__static 16], uint8_t mac64[__static 8], dhcp_client_global_adress_cb *error_cb) { return 0; } -void thread_dhcp_client_global_address_renew(int8_t interface) +void dhcp_client_global_address_renew(int8_t interface) { } -void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]) +void dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]) { } -void thread_dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, if_address_callback_t reason) +void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, if_address_callback_t reason) { } -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr) +void dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr) { } diff --git a/test/nanostack/unittest/stub/thread_bootstrap_stub.c b/test/nanostack/unittest/stub/thread_bootstrap_stub.c index d5726755c5c8..9b636ef7e57a 100644 --- a/test/nanostack/unittest/stub/thread_bootstrap_stub.c +++ b/test/nanostack/unittest/stub/thread_bootstrap_stub.c @@ -49,7 +49,7 @@ #include "Common_Protocols/icmpv6_radv.h" #include "MLE/mle.h" #include "dhcp_service_api.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" diff --git a/test/nanostack/unittest/stub/thread_common_stub.c b/test/nanostack/unittest/stub/thread_common_stub.c index e9324df06fab..905ddbe3203f 100644 --- a/test/nanostack/unittest/stub/thread_common_stub.c +++ b/test/nanostack/unittest/stub/thread_common_stub.c @@ -31,7 +31,7 @@ #include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h" #include "6LoWPAN/Thread/thread_common.h" #include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/Thread/thread_bootstrap.h" #include "6LoWPAN/Thread/thread_nd.h" #include "6LoWPAN/Thread/thread_network_data_lib.h" diff --git a/test/nanostack/unittest/stub/thread_management_if_stub.c b/test/nanostack/unittest/stub/thread_management_if_stub.c index 730c32804e89..533f7a309733 100644 --- a/test/nanostack/unittest/stub/thread_management_if_stub.c +++ b/test/nanostack/unittest/stub/thread_management_if_stub.c @@ -32,7 +32,7 @@ #include "6LoWPAN/Thread/thread_network_data_lib.h" #include "6LoWPAN/Thread/thread_network_data_storage.h" #include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/Thread/thread_management_internal.h" #include "6LoWPAN/Thread/thread_joiner_application.h" #include "MLE/mle.h" diff --git a/test/nanostack/unittest/stub/thread_network_data_storage_stub.c b/test/nanostack/unittest/stub/thread_network_data_storage_stub.c index f702e4e51097..bc6ef5a9a7e7 100644 --- a/test/nanostack/unittest/stub/thread_network_data_storage_stub.c +++ b/test/nanostack/unittest/stub/thread_network_data_storage_stub.c @@ -31,7 +31,7 @@ #include "6LoWPAN/Thread/thread_common.h" #include "6LoWPAN/Thread/thread_network_data_lib.h" #include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "libDHCPv6/libDHCPv6_server.h" #include "DHCPv6_Server/DHCPv6_server_service.h" diff --git a/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c b/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c index c4b7ea9f42cd..2747da7f797b 100644 --- a/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c +++ b/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c @@ -64,7 +64,7 @@ #include "Service_Libs/nd_proxy/nd_proxy.h" #include "Service_Libs/mle_service/mle_service_api.h" #include "Service_Libs/blacklist/blacklist.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "6LoWPAN/MAC/mac_helper.h" #include "mac_api.h" #include "6LoWPAN/MAC/mac_data_poll.h" diff --git a/test/nanostack/unittest/thread/thread/Makefile b/test/nanostack/unittest/thread/thread/Makefile index 17dfdf875fd7..a744db1671f9 100644 --- a/test/nanostack/unittest/thread/thread/Makefile +++ b/test/nanostack/unittest/thread/thread/Makefile @@ -37,7 +37,7 @@ TEST_SRC_FILES = main.cpp \ ../../stub/icmpv6_stub.c \ ../../stub/blacklist_stub.c \ ../../stub/protocol_ipv6_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ + ../../stub/dhcpv6_client_stub.c \ ../../stub/thread_management_client_stub.c \ ../../stub/thread_discovery_stub.c \ ../../stub/thread_management_server_stub.c \ diff --git a/test/nanostack/unittest/thread/thread_bootstrap/Makefile b/test/nanostack/unittest/thread/thread_bootstrap/Makefile index 915cbec987b2..f6f1b149dd44 100644 --- a/test/nanostack/unittest/thread/thread_bootstrap/Makefile +++ b/test/nanostack/unittest/thread/thread_bootstrap/Makefile @@ -29,7 +29,7 @@ TEST_SRC_FILES = \ ../../stub/thread_meshcop_lib_stub.c \ ../../stub/thread_management_api_stub.c \ ../../stub/event_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ + ../../stub/dhcpv6_client_stub.c \ ../../stub/thread_border_router_api_stub.c \ ../../stub/thread_border_router_api_internal_stub.c \ ../../stub/thread_common_stub.c \ diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/Makefile b/test/nanostack/unittest/thread/thread_lowpower_api/Makefile index b98327fccc80..f8c78631adf3 100644 --- a/test/nanostack/unittest/thread/thread_lowpower_api/Makefile +++ b/test/nanostack/unittest/thread/thread_lowpower_api/Makefile @@ -26,7 +26,7 @@ TEST_SRC_FILES = \ ../../stub/thread_meshcop_lib_stub.c \ ../../stub/thread_management_api_stub.c \ ../../stub/event_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ + ../../stub/dhcpv6_client_stub.c \ ../../stub/thread_border_router_api_stub.c \ ../../stub/thread_border_router_api_internal_stub.c \ ../../stub/thread_common_stub.c \ diff --git a/unittest/thread_dhcp/Test.c b/unittest/thread_dhcp/Test.c index 6b848f64ca30..4d3cbe894223 100644 --- a/unittest/thread_dhcp/Test.c +++ b/unittest/thread_dhcp/Test.c @@ -27,7 +27,7 @@ #include #include "unity.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "dhcp_service_api.h" #include "ns_trace.h" #include "nsdynmemLIB.h" @@ -171,13 +171,13 @@ void test_client_init(void) { TEST_DESCRIPTION("1 test service create and delete\n"); TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); - thread_dhcp_client_init(1); + dhcp_client_init(1); TEST_ASSERT_EQUAL_INT(2, lt_test_sockets_open()); - thread_dhcp_client_delete(1); + dhcp_client_delete(1); TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); - thread_dhcp_client_init(2); + dhcp_client_init(2); TEST_ASSERT_EQUAL_INT(2, lt_test_sockets_open()); - thread_dhcp_client_delete(2); + dhcp_client_delete(2); TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); } @@ -206,15 +206,15 @@ void test_client_get_global_address(void) TEST_DESCRIPTION("1 get Global address\n" "2 delete Global address manually\n" "3 delete service\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); + dhcp_client_init(1); + dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); lt_test_addr_add(gua_assigned_addr); - thread_dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand + dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand lt_test_addr_delete(gua_assigned_addr); - thread_dhcp_client_delete(1); + dhcp_client_delete(1); } void test_client_get_global_address_retry(void) @@ -224,8 +224,8 @@ void test_client_get_global_address_retry(void) "3 receive reply \n" "4 delete service\n" "5 service deletes allocated address\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); + dhcp_client_init(1); + dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); dhcp_service_timer_tick(10); @@ -235,7 +235,7 @@ void test_client_get_global_address_retry(void) lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); lt_test_addr_add(gua_assigned_addr); - thread_dhcp_client_delete(1); + dhcp_client_delete(1); lt_test_addr_delete(gua_assigned_addr); } @@ -245,8 +245,8 @@ void test_client_get_global_address_retry_no_response(void) TEST_DESCRIPTION("1 get Global address\n" "2 no response, make retransmissions\n" "3 delete service\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); + dhcp_client_init(1); + dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); dhcp_service_timer_tick(11); // Allow for max 1.1 initial randomisation @@ -266,7 +266,7 @@ void test_client_get_global_address_retry_no_response(void) dhcp_service_timer_tick(1982); lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - thread_dhcp_client_delete(1); + dhcp_client_delete(1); lt_test_addr_delete(non_assigned_gua);// TODO This is bug should fix add boolean when got address. } @@ -303,17 +303,17 @@ void test_client_global_address_renew(void) "5 recv renew\n" "6 delete address\n" "7 service delete\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); + dhcp_client_init(1); + dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); lt_test_addr_add(gua_assigned_addr); lt_timeout_address(1, gua_assigned_addr); lt_test_socket_sendto(2, gua_dhcp_addr, gua_renew_req, sizeof(gua_renew_req)); lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_renew_resp, sizeof(gua_renew_resp)); - thread_dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand + dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand lt_test_addr_delete(gua_assigned_addr); - thread_dhcp_client_delete(1); + dhcp_client_delete(1); } #undef T1 diff --git a/unittest/thread_dhcp/makefile b/unittest/thread_dhcp/makefile index aae131e99948..86f2967ea2c1 100644 --- a/unittest/thread_dhcp/makefile +++ b/unittest/thread_dhcp/makefile @@ -14,7 +14,7 @@ SRC_FILES += ../../../libService/source/libTrace/ns_trace.c SRC_FILES += ../../../libService/source/libip6string/ip6tos.c SRC_FILES += ../../../libService/source/libBits/common_functions.c ## nanostack files -TEST_SRC_FILES += ../../source/6LoWPAN/Thread/thread_dhcpv6_client.c +TEST_SRC_FILES += ../../source/DHCPv6_client/dhcpv6_client_service.c TEST_SRC_FILES += ../../source/libDHCPv6/dhcp_service_api.c TEST_SRC_FILES += ../../source/libDHCPv6/libDHCPv6.c diff --git a/unittest/thread_dhcp_servers/Test.c b/unittest/thread_dhcp_servers/Test.c index d6770483c3e7..e9f95485eb4c 100644 --- a/unittest/thread_dhcp_servers/Test.c +++ b/unittest/thread_dhcp_servers/Test.c @@ -27,7 +27,7 @@ #include #include "unity.h" -#include "thread_dhcpv6_client.h" +#include "DHCPv6_client/dhcpv6_client_api.h" #include "dhcp_service_api.h" #include "ns_trace.h" #include "nsdynmemLIB.h"