diff --git a/include/openthread/icmp6.h b/include/openthread/icmp6.h index 32f8c6a1b..925871cda 100644 --- a/include/openthread/icmp6.h +++ b/include/openthread/icmp6.h @@ -144,6 +144,7 @@ typedef enum otIcmp6EchoMode OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY = 1, ///< ICMPv6 Echo processing enabled only for unicast requests only OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY = 2, ///< ICMPv6 Echo processing enabled only for multicast requests only OT_ICMP6_ECHO_HANDLER_ALL = 3, ///< ICMPv6 Echo processing enabled for unicast and multicast requests + OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY = 4, ///< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only } otIcmp6EchoMode; /** diff --git a/include/openthread/instance.h b/include/openthread/instance.h index c3538cdfa..a956397bb 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -53,7 +53,7 @@ extern "C" { * @note This number versions both OpenThread platform and user APIs. * */ -#define OPENTHREAD_API_VERSION (404) +#define OPENTHREAD_API_VERSION (405) /** * @addtogroup api-instance diff --git a/src/core/net/icmp6.cpp b/src/core/net/icmp6.cpp index 5bcea06c0..3dba7ca96 100644 --- a/src/core/net/icmp6.cpp +++ b/src/core/net/icmp6.cpp @@ -171,6 +171,9 @@ bool Icmp::ShouldHandleEchoRequest(const MessageInfo &aMessageInfo) case OT_ICMP6_ECHO_HANDLER_ALL: rval = true; break; + case OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: + rval = aMessageInfo.GetSockAddr().GetIid().IsLocator(); + break; } return rval; @@ -184,8 +187,7 @@ Error Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMess MessageInfo replyMessageInfo; uint16_t dataOffset; - // always handle Echo Request destined for RLOC or ALOC - VerifyOrExit(ShouldHandleEchoRequest(aMessageInfo) || aMessageInfo.GetSockAddr().GetIid().IsLocator()); + VerifyOrExit(ShouldHandleEchoRequest(aMessageInfo)); LogInfo("Received Echo Request"); diff --git a/src/lib/spinel/spinel.h b/src/lib/spinel/spinel.h index d91a039ac..c1865f373 100644 --- a/src/lib/spinel/spinel.h +++ b/src/lib/spinel/spinel.h @@ -607,6 +607,7 @@ typedef enum SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY = 1, SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2, SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL = 3, + SPINEL_IPV6_ICMP_PING_OFFLOAD_RLOC_ALOC_ONLY = 4, } spinel_ipv6_icmp_ping_offload_mode_t; typedef enum @@ -3457,6 +3458,7 @@ enum * SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY = 1 * SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2 * SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL = 3 + * SPINEL_IPV6_ICMP_PING_OFFLOAD_RLOC_ALOC_ONLY = 4 * * Default value is `NET_IPV6_ICMP_PING_OFFLOAD_DISABLED`. * diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index a1ad3adb3..96e362575 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -340,7 +340,7 @@ NcpBase::NcpBase(Instance *aInstance) #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE otUdpForwardSetForwarder(mInstance, &NcpBase::HandleUdpForwardStream, this); #endif - otIcmp6SetEchoMode(mInstance, OT_ICMP6_ECHO_HANDLER_DISABLED); + otIcmp6SetEchoMode(mInstance, OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY); #if OPENTHREAD_FTD otThreadRegisterNeighborTableCallback(mInstance, &NcpBase::HandleNeighborTableChanged); #if OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index aa87efa51..227ce61ce 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -2072,6 +2072,9 @@ template <> otError NcpBase::HandlePropertyGet otError NcpBase::HandlePropertySet