Fix receiving bug in BridgeNetDevice regarding packet for the node itself
A node containing a BridgeNetDevice has two interfaces, the bridge netdevice adopts one of the MAC addresses as its own address. Whenever a packet has to be sent by the node itself (as opposed to bridged), the packets are sent using that MAC address. The source MAC address used when transmitting in one real netdevice may end up being the MAC address of another real netdevice, and any eventual reply will arrive with a destination MAC address of that other netdevice. Therefore, when receiving packets of type PACKET_OTHERHOST we need to check for this condition, instead of always assuming the packet is to be forwarded.
This commit is contained in:
@@ -111,7 +111,14 @@ BridgeNetDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packe
|
||||
break;
|
||||
|
||||
case PACKET_OTHERHOST:
|
||||
ForwardUnicast (incomingPort, packet, protocol, src48, dst48);
|
||||
if (dst48 == m_address)
|
||||
{
|
||||
m_rxCallback (this, packet, protocol, src);
|
||||
}
|
||||
else
|
||||
{
|
||||
ForwardUnicast (incomingPort, packet, protocol, src48, dst48);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user