From 2652a7e7a42aa53f5650043e5a5211a03c3beffa Mon Sep 17 00:00:00 2001 From: Konrad Derda Date: Tue, 4 Jun 2024 14:30:01 +0200 Subject: [PATCH] [netif] remove multicast promiscuous mode configuration Since 74c833b6236ac1dab3673fb8ebd705eca662d2b4 was introduced all IPv6 multicast packets are passed to the host. Previously used promiscuous mode configuration is now unused. This commit removes the dead code and corresponding elements as there is no use case for them at the moment (and they can confuse a user). Signed-off-by: Konrad Derda --- include/openthread/instance.h | 2 +- include/openthread/ip6.h | 21 --------------------- src/cli/cli.cpp | 29 ----------------------------- src/core/api/ip6_api.cpp | 10 ---------- src/core/net/ip6.cpp | 4 ---- src/core/net/netif.hpp | 17 ----------------- 6 files changed, 1 insertion(+), 82 deletions(-) diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 76f4fe1912fc..cf33632b0323 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 (417) +#define OPENTHREAD_API_VERSION (418) /** * @addtogroup api-instance diff --git a/include/openthread/ip6.h b/include/openthread/ip6.h index 2636702b4df6..4d1f3ce6021e 100644 --- a/include/openthread/ip6.h +++ b/include/openthread/ip6.h @@ -381,27 +381,6 @@ otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Addre */ const otNetifMulticastAddress *otIp6GetMulticastAddresses(otInstance *aInstance); -/** - * Checks if multicast promiscuous mode is enabled on the Thread interface. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * - * @sa otIp6SetMulticastPromiscuousEnabled - * - */ -bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance); - -/** - * Enables or disables multicast promiscuous mode on the Thread interface. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aEnabled TRUE to enable Multicast Promiscuous mode, FALSE otherwise. - * - * @sa otIp6IsMulticastPromiscuousEnabled - * - */ -void otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled); - /** * Allocate a new message buffer for sending an IPv6 message. * diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index d70978872bfc..ea02362bfbdc 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -3365,35 +3365,6 @@ template <> otError Interpreter::Process(Arg aArgs[]) SuccessOrExit(error = aArgs[1].ParseAsIp6Address(address)); error = otIp6UnsubscribeMulticastAddress(GetInstancePtr(), &address); } - /** - * @cli ipmaddr promiscuous - * @code - * ipmaddr promiscuous - * Disabled - * Done - * @endcode - * @par api_copy - * #otIp6IsMulticastPromiscuousEnabled - */ - else if (aArgs[0] == "promiscuous") - { - /** - * @cli ipmaddr promiscuous (enable,disable) - * @code - * ipmaddr promiscuous enable - * Done - * @endcode - * @code - * ipmaddr promiscuous disable - * Done - * @endcode - * @cparam ipmaddr promiscuous @ca{enable|disable} - * @par api_copy - * #otIp6SetMulticastPromiscuousEnabled - */ - error = - ProcessEnableDisable(aArgs + 1, otIp6IsMulticastPromiscuousEnabled, otIp6SetMulticastPromiscuousEnabled); - } /** * @cli ipmaddr llatn * @code diff --git a/src/core/api/ip6_api.cpp b/src/core/api/ip6_api.cpp index 5ca4f50d9f9c..29fee9da325c 100644 --- a/src/core/api/ip6_api.cpp +++ b/src/core/api/ip6_api.cpp @@ -105,16 +105,6 @@ otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Addre return AsCoreType(aInstance).Get().UnsubscribeExternalMulticast(AsCoreType(aAddress)); } -bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance) -{ - return AsCoreType(aInstance).Get().IsMulticastPromiscuousEnabled(); -} - -void otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled) -{ - AsCoreType(aInstance).Get().SetMulticastPromiscuous(aEnabled); -} - void otIp6SetReceiveCallback(otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext) { AsCoreType(aInstance).Get().SetReceiveDatagramCallback(aCallback, aCallbackContext); diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index 74d3e4fe60df..f8ec3821ad2a 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -1122,10 +1122,6 @@ Error Ip6::HandleDatagram(OwnedPtr aMessagePtr, bool aIsReassembled) { receive = true; } - else if (Get().IsMulticastPromiscuousEnabled()) - { - forwardHost = true; - } } else { diff --git a/src/core/net/netif.hpp b/src/core/net/netif.hpp index a736df8e4e55..d54d87a373ce 100644 --- a/src/core/net/netif.hpp +++ b/src/core/net/netif.hpp @@ -612,23 +612,6 @@ class Netif : public InstanceLocator, private NonCopyable */ void UnsubscribeAllExternalMulticastAddresses(void); - /** - * Checks if multicast promiscuous mode is enabled on the network interface. - * - * @retval TRUE If the multicast promiscuous mode is enabled. - * @retval FALSE If the multicast promiscuous mode is disabled. - * - */ - bool IsMulticastPromiscuousEnabled(void) const { return mMulticastPromiscuous; } - - /** - * Enables multicast promiscuous mode on the network interface. - * - * @param[in] aEnabled TRUE if Multicast Promiscuous mode is enabled, FALSE otherwise. - * - */ - void SetMulticastPromiscuous(bool aEnabled) { mMulticastPromiscuous = aEnabled; } - /** * Enables range-based `for` loop iteration over external multicast addresses on the Netif that matches * a given IPv6 address type filter.