[ip6] simplify Ip6::HandleDatagram() - remove netif local var (#8035)

This commit updates `Ip6::HandleDatagram()` and removes the local
`netif` variable and directly uses `ThreadNetif` instead. Note that
the input parameter `aNetif` is either `nullptr` or points to
`ThreadNetif`, and in both cases the local variable `netif` will be
set to point to `ThreadNetif`.
This commit is contained in:
Abtin Keshavarzian
2022-08-17 14:32:18 -07:00
committed by Jonathan Hui
parent 2d4896f675
commit 061d22ba8e
+3 -8
View File
@@ -1154,8 +1154,6 @@ start:
// determine destination of packet
if (header.GetDestination().IsMulticast())
{
Netif *netif;
if (aNetif != nullptr)
{
#if OPENTHREAD_FTD
@@ -1165,23 +1163,20 @@ start:
forwardThread = true;
}
#endif
netif = aNetif;
}
else
{
forwardThread = true;
netif = &Get<ThreadNetif>();
}
forwardHost = header.GetDestination().IsMulticastLargerThanRealmLocal();
if ((aNetif != nullptr || aMessage.GetMulticastLoop()) && netif->IsMulticastSubscribed(header.GetDestination()))
if ((aNetif != nullptr || aMessage.GetMulticastLoop()) &&
Get<ThreadNetif>().IsMulticastSubscribed(header.GetDestination()))
{
receive = true;
}
else if (netif->IsMulticastPromiscuousEnabled())
else if (Get<ThreadNetif>().IsMulticastPromiscuousEnabled())
{
forwardHost = true;
}