mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +00:00
IP: Add API to subscribe/unsubscribe to multicast addresses. (#899)
* IP: Add API to subscribe/unsubscribe to multicast addresses. * CLI: Add commands to handle multicast addresses.
This commit is contained in:
committed by
Jonathan Hui
parent
30c9dfc0bc
commit
bb97cbee17
+14
-2
@@ -645,6 +645,7 @@ ThreadError Ip6::HandleDatagram(Message &message, Netif *netif, int8_t interface
|
||||
bool receive = false;
|
||||
bool forward = false;
|
||||
bool tunnel = false;
|
||||
bool multicastPromiscuous = false;
|
||||
uint8_t nextHeader;
|
||||
uint8_t hopLimit;
|
||||
|
||||
@@ -677,9 +678,16 @@ ThreadError Ip6::HandleDatagram(Message &message, Netif *netif, int8_t interface
|
||||
// determine destination of packet
|
||||
if (header.GetDestination().IsMulticast())
|
||||
{
|
||||
if (netif != NULL && netif->IsMulticastSubscribed(header.GetDestination()))
|
||||
if (netif != NULL)
|
||||
{
|
||||
receive = true;
|
||||
if (netif->IsMulticastSubscribed(header.GetDestination()))
|
||||
{
|
||||
receive = true;
|
||||
}
|
||||
else if (netif->IsMulticastPromiscuousModeEnabled())
|
||||
{
|
||||
multicastPromiscuous = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (netif == NULL)
|
||||
@@ -739,6 +747,10 @@ ThreadError Ip6::HandleDatagram(Message &message, Netif *netif, int8_t interface
|
||||
|
||||
SuccessOrExit(error = HandlePayload(message, messageInfo, nextHeader));
|
||||
}
|
||||
else if (multicastPromiscuous)
|
||||
{
|
||||
ProcessReceiveCallback(message, messageInfo, nextHeader);
|
||||
}
|
||||
|
||||
if (forward)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user