mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 02:19:52 +00:00
[config] dhcp6 client (#4020)
This commit is contained in:
+2
-3
@@ -63,13 +63,13 @@ python --version || die
|
||||
-DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1"
|
||||
-DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1"
|
||||
|
||||
scan-build ./configure \
|
||||
--enable-builtin-mbedtls=no \
|
||||
--enable-cert-log \
|
||||
--enable-cli \
|
||||
--enable-dhcp6-client \
|
||||
--enable-dhcp6-server \
|
||||
--enable-diag \
|
||||
--enable-dns-client \
|
||||
@@ -98,7 +98,6 @@ python --version || die
|
||||
--enable-builtin-mbedtls=no \
|
||||
--enable-cert-log \
|
||||
--enable-cli \
|
||||
--enable-dhcp6-client \
|
||||
--enable-dhcp6-server \
|
||||
--enable-diag \
|
||||
--enable-dns-client \
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ ifeq ($(TARGET_PRODUCT),generic)
|
||||
OPENTHREAD_COMMON_FLAGS += \
|
||||
-DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 \
|
||||
-DOPENTHREAD_ENABLE_DHCP6_CLIENT=1 \
|
||||
-DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \
|
||||
-DOPENTHREAD_ENABLE_DHCP6_SERVER=1 \
|
||||
-DOPENTHREAD_ENABLE_DNS_CLIENT=1 \
|
||||
-DOPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC=1 \
|
||||
|
||||
@@ -34,7 +34,6 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--enable-address-sanitizer \
|
||||
--enable-cert-log \
|
||||
--enable-cli \
|
||||
--enable-dhcp6-client \
|
||||
--enable-dhcp6-server \
|
||||
--enable-diag \
|
||||
--enable-dns-client \
|
||||
|
||||
@@ -1143,36 +1143,6 @@ AC_SUBST(OPENTHREAD_NCP_SPINEL_ENCRYPTER_LIBS)
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER],[${OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER}],[Define to 1 if using NCP Spinel Encrypter])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER], [test "${OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER}" = "1"])
|
||||
|
||||
#
|
||||
# DHCPv6 Client
|
||||
#
|
||||
|
||||
AC_ARG_ENABLE(dhcp6_client,
|
||||
[AS_HELP_STRING([--enable-dhcp6-client],[Enable DHCPv6 client support @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
|
||||
no|yes)
|
||||
enable_dhcp6_client=${enableval}
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${enable_dhcp6_client} for --enable-dhcp6-client])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_dhcp6_client=no])
|
||||
|
||||
if test "$enable_dhcp6_client" = "yes"; then
|
||||
OPENTHREAD_ENABLE_DHCP6_CLIENT=1
|
||||
else
|
||||
OPENTHREAD_ENABLE_DHCP6_CLIENT=0
|
||||
fi
|
||||
|
||||
AC_SUBST(OPENTHREAD_ENABLE_DHCP6_CLIENT)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_DHCP6_CLIENT], [test "${enable_dhcp6_client}" = "yes"])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_DHCP6_CLIENT],[${OPENTHREAD_ENABLE_DHCP6_CLIENT}],[Define to 1 if you want to enable DHCPv6 Client])
|
||||
|
||||
#
|
||||
# DHCPv6 Server
|
||||
#
|
||||
@@ -1788,7 +1758,6 @@ AC_MSG_NOTICE([
|
||||
OpenThread Factory Diagnostics support : ${enable_diag}
|
||||
OpenThread Legacy network support : ${enable_legacy}
|
||||
OpenThread DHCPv6 Server support : ${enable_dhcp6_server}
|
||||
OpenThread DHCPv6 Client support : ${enable_dhcp6_client}
|
||||
OpenThread DNS Client support : ${enable_dns_client}
|
||||
OpenThread SNTP Client support : ${enable_sntp_client}
|
||||
OpenThread Raw Link-Layer support : ${enable_raw_link_api}
|
||||
|
||||
@@ -107,7 +107,7 @@ configure_OPTIONS += --enable-debug --disable-optimization
|
||||
endif
|
||||
|
||||
ifeq ($(DHCP6_CLIENT),1)
|
||||
configure_OPTIONS += --enable-dhcp6-client
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(DHCP6_SERVER),1)
|
||||
|
||||
@@ -325,6 +325,7 @@ HEADERS_COMMON = \
|
||||
config/child_supervision.h \
|
||||
config/coap.h \
|
||||
config/commissioner.h \
|
||||
config/dhcp6_client.h \
|
||||
config/openthread-core-config-check.h \
|
||||
config/openthread-core-default-config.h \
|
||||
crypto/aes_ccm.hpp \
|
||||
|
||||
@@ -598,7 +598,7 @@ template <> inline NetworkDiagnostic::NetworkDiagnostic &Instance::Get(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
template <> inline Dhcp6::Dhcp6Client &Instance::Get(void)
|
||||
{
|
||||
return mThreadNetif.mDhcp6Client;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes compile-time configurations for DHCPv6 Client.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DHCP6_CLIENT_H_
|
||||
#define CONFIG_DHCP6_CLIENT_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
*
|
||||
* Define to 1 to enable DHCPv6 Client support.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DHCP6_CLIENT_NUM_PREFIXES
|
||||
*
|
||||
* The number of dhcp prefixes.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_NUM_PREFIXES
|
||||
#define OPENTHREAD_CONFIG_DHCP6_CLIENT_NUM_PREFIXES 4
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_DHCP6_CLIENT_H_
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "net/dhcp6.hpp"
|
||||
#include "thread/thread_netif.hpp"
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
|
||||
using ot::Encoding::BigEndian::HostSwap16;
|
||||
|
||||
@@ -593,4 +593,4 @@ exit:
|
||||
} // namespace Dhcp6
|
||||
} // namespace ot
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
uint8_t mTransactionId[kTransactionIdSize];
|
||||
uint32_t mStartTime;
|
||||
|
||||
IdentityAssociation mIdentityAssociations[OPENTHREAD_CONFIG_NUM_DHCP_PREFIXES];
|
||||
IdentityAssociation mIdentityAssociations[OPENTHREAD_CONFIG_DHCP6_CLIENT_NUM_PREFIXES];
|
||||
IdentityAssociation *mIdentityAssociationCurrent;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "config/child_supervision.h"
|
||||
#include "config/coap.h"
|
||||
#include "config/commissioner.h"
|
||||
#include "config/dhcp6_client.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \
|
||||
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
@@ -396,7 +396,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
|
||||
SuccessOrExit(error = MeshCoP::GetBorderAgentRloc(Get<ThreadNetif>(), mMeshDest));
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
else if (aloc16 <= Mle::kAloc16DhcpAgentEnd)
|
||||
{
|
||||
uint16_t agentRloc16;
|
||||
@@ -419,7 +419,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
else if ((aloc16 >= Mle::kAloc16ServiceStart) && (aloc16 <= Mle::kAloc16ServiceEnd))
|
||||
{
|
||||
|
||||
@@ -1559,9 +1559,9 @@ void Mle::HandleStateChanged(otChangedFlags aFlags)
|
||||
Get<Dhcp6::Dhcp6Server>().UpdateService();
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
Get<Dhcp6::Dhcp6Client>().UpdateAddresses();
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
}
|
||||
|
||||
if (aFlags & (OT_CHANGED_THREAD_ROLE | OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER))
|
||||
|
||||
@@ -163,7 +163,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
otError LeaderBase::GetRlocByContextId(uint8_t aContextId, uint16_t &aRloc16)
|
||||
{
|
||||
otError error = OT_ERROR_NOT_FOUND;
|
||||
@@ -188,7 +188,7 @@ otError LeaderBase::GetRlocByContextId(uint8_t aContextId, uint16_t &aRloc16)
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
|
||||
bool LeaderBase::IsOnMesh(const Ip6::Address &aAddress)
|
||||
{
|
||||
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
*/
|
||||
otError SetCommissioningData(const uint8_t *aValue, uint8_t aValueLength);
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
/**
|
||||
* This method gets the Rloc of Dhcp Agent of specified contextId.
|
||||
*
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
*
|
||||
*/
|
||||
otError GetRlocByContextId(uint8_t aContextId, uint16_t &aRloc16);
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
|
||||
protected:
|
||||
uint8_t mStableVersion;
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace ot {
|
||||
ThreadNetif::ThreadNetif(Instance &aInstance)
|
||||
: Netif(aInstance)
|
||||
, mCoap(aInstance)
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
, mDhcp6Client(aInstance)
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
, mDhcp6Server(aInstance)
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
@@ -164,9 +164,9 @@ private:
|
||||
static otError TmfFilter(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, void *aContext);
|
||||
|
||||
Coap::Coap mCoap;
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
Dhcp6::Dhcp6Client mDhcp6Client;
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
#endif // OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
Dhcp6::Dhcp6Server mDhcp6Server;
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
Reference in New Issue
Block a user