Skip to content

Commit

Permalink
[netif] remove multicast promiscuous mode configuration
Browse files Browse the repository at this point in the history
Since 74c833b 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 <[email protected]>
  • Loading branch information
konradderda committed Jun 12, 2024
1 parent 32f462f commit 53b0359
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 139 deletions.
2 changes: 1 addition & 1 deletion include/openthread/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (420)
#define OPENTHREAD_API_VERSION (421)

/**
* @addtogroup api-instance
Expand Down
21 changes: 0 additions & 21 deletions include/openthread/ip6.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
28 changes: 0 additions & 28 deletions src/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1767,34 +1767,6 @@ ff32:40:fdde:ad00:beef:0:0:1
Done
```
### ipmaddr promiscuous
Get multicast promiscuous mode.
```bash
> ipmaddr promiscuous
Disabled
Done
```
### ipmaddr promiscuous enable
Enable multicast promiscuous mode.
```bash
> ipmaddr promiscuous enable
Done
```
### ipmaddr promiscuous disable
Disable multicast promiscuous mode.
```bash
> ipmaddr promiscuous disable
Done
```
### ipmaddr rlatn
Get the Realm-Local All Thread Nodes multicast address.
Expand Down
29 changes: 0 additions & 29 deletions src/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3365,35 +3365,6 @@ template <> otError Interpreter::Process<Cmd("ipmaddr")>(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
Expand Down
10 changes: 0 additions & 10 deletions src/core/api/ip6_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Addre
return AsCoreType(aInstance).Get<ThreadNetif>().UnsubscribeExternalMulticast(AsCoreType(aAddress));
}

bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<ThreadNetif>().IsMulticastPromiscuousEnabled();
}

void otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled)
{
AsCoreType(aInstance).Get<ThreadNetif>().SetMulticastPromiscuous(aEnabled);
}

void otIp6SetReceiveCallback(otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext)
{
AsCoreType(aInstance).Get<Ip6::Ip6>().SetReceiveDatagramCallback(aCallback, aCallbackContext);
Expand Down
4 changes: 0 additions & 4 deletions src/core/net/ip6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,6 @@ Error Ip6::HandleDatagram(OwnedPtr<Message> aMessagePtr, bool aIsReassembled)
{
receive = true;
}
else if (Get<ThreadNetif>().IsMulticastPromiscuousEnabled())
{
forwardHost = true;
}
}
else
{
Expand Down
1 change: 0 additions & 1 deletion src/core/net/netif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const otNetifMulticastAddress Netif::kLinkLocalAllRoutersMulticastAddress = {

Netif::Netif(Instance &aInstance)
: InstanceLocator(aInstance)
, mMulticastPromiscuous(false)
{
}

Expand Down
18 changes: 0 additions & 18 deletions src/core/net/netif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -702,7 +685,6 @@ class Netif : public InstanceLocator, private NonCopyable

LinkedList<UnicastAddress> mUnicastAddresses;
LinkedList<MulticastAddress> mMulticastAddresses;
bool mMulticastPromiscuous;

Callback<otIp6AddressCallback> mAddressCallback;

Expand Down
9 changes: 0 additions & 9 deletions tests/scripts/expect/cli-ipmaddr.exp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ send "ipmaddr del ff0e::1\n"
expect_line "Done"
send "ipmaddr del ff0e::1\n"
expect "Error 23: NotFound"
send "ipmaddr promiscuous enable\n"
expect_line "Done"
send "ipmaddr promiscuous\n"
expect "Enabled"
expect_line "Done"
send "ipmaddr promiscuous disable\n"
expect_line "Done"
send "ipmaddr promiscuous\n"
expect "Disabled"
expect_line "Done"
send "ipmaddr something_invalid\n"
expect "Error 35: InvalidCommand"
Expand Down
12 changes: 0 additions & 12 deletions tools/otci/otci/otci.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,18 +1946,6 @@ def has_ipmaddr(self, ip: Union[str, ipaddress.IPv6Address]):
"""Check if a IPv6 multicast address was subscribed by the Thread interface."""
return ip in self.get_ipmaddrs()

def get_ipmaddr_promiscuous(self) -> bool:
"""Get multicast promiscuous mode."""
return self.__parse_Enabled_or_Disabled(self.execute_command("ipmaddr promiscuous"))

def enable_ipmaddr_promiscuous(self):
"""Enable multicast promiscuous mode."""
self.execute_command('ipmaddr promiscuous enable')

def disable_ipmaddr_promiscuous(self):
"""Disable multicast promiscuous mode."""
self.execute_command('ipmaddr promiscuous disable')

def get_ipmaddr_llatn(self) -> Ip6Addr:
"""Get Link Local All Thread Nodes Multicast Address"""
return self.__parse_ip6addr(self.execute_command('ipmaddr llatn'))
Expand Down
6 changes: 0 additions & 6 deletions tools/otci/tests/test_otci.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ def _test_otci_single_node(self, leader):

logging.info("EID-to-RLOC cache: %r", leader.get_eidcache())

logging.info("ipmaddr promiscuous: %r", leader.get_ipmaddr_promiscuous())
leader.enable_ipmaddr_promiscuous()
self.assertTrue(leader.get_ipmaddr_promiscuous())
leader.disable_ipmaddr_promiscuous()
self.assertFalse(leader.get_ipmaddr_promiscuous())

logging.info("leader data: %r", leader.get_leader_data())
logging.info("leader neighbor list: %r", leader.get_neighbor_list())
logging.info("leader neighbor table: %r", leader.get_neighbor_table())
Expand Down

0 comments on commit 53b0359

Please sign in to comment.