bug 274: bridge must detect compatibility of devices with bridging mode
This commit is contained in:
1 parent
52c546a29a
commit
83d5287e80
22 files changed
+552
-536
No files matched your search
@@ -314,7 +314,7 @@ public:
|
||||
/**
|
||||
* \return true if this interface supports a promiscuous mode, false otherwise.
|
||||
*/
|
||||
virtual bool SupportsPromiscuous (void) const = 0;
|
||||
virtual bool SupportsSendFrom (void) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -184,7 +184,7 @@ Node::RegisterProtocolHandler (ProtocolHandler handler,
|
||||
i != m_devices.end (); i++)
|
||||
{
|
||||
Ptr<NetDevice> dev = *i;
|
||||
if (dev->SupportsPromiscuous ())
|
||||
if (dev->SupportsSendFrom ())
|
||||
{
|
||||
dev->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
|
||||
}
|
||||
@@ -192,7 +192,7 @@ Node::RegisterProtocolHandler (ProtocolHandler handler,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (device->SupportsPromiscuous ())
|
||||
if (device->SupportsSendFrom ())
|
||||
{
|
||||
device->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
|
||||
}
|
||||
|
||||
@@ -51,15 +51,23 @@ SimpleNetDevice::Receive (Ptr<Packet> packet, uint16_t protocol,
|
||||
{
|
||||
packetType = NetDevice::PACKET_HOST;
|
||||
}
|
||||
else if (to == Mac48Address::GetBroadcast ())
|
||||
else if (to.IsBroadcast ())
|
||||
{
|
||||
packetType = NetDevice::PACKET_HOST;
|
||||
}
|
||||
else
|
||||
else if (to.IsMulticast ())
|
||||
{
|
||||
NS_FATAL_ERROR ("Weird packet destination " << to);
|
||||
packetType = NetDevice::PACKET_MULTICAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
packetType = NetDevice::PACKET_OTHERHOST;
|
||||
}
|
||||
m_rxCallback (this, packet, protocol, from);
|
||||
if (!m_promiscCallback.IsNull ())
|
||||
{
|
||||
m_promiscCallback (this, packet, protocol, from, to, packetType);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -203,13 +211,13 @@ SimpleNetDevice::DoDispose (void)
|
||||
void
|
||||
SimpleNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb)
|
||||
{
|
||||
NS_FATAL_ERROR ("Not supported");
|
||||
m_promiscCallback = cb;
|
||||
}
|
||||
|
||||
bool
|
||||
SimpleNetDevice::SupportsPromiscuous (void) const
|
||||
SimpleNetDevice::SupportsSendFrom (void) const
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -69,13 +69,14 @@ public:
|
||||
virtual bool NeedsArp (void) const;
|
||||
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
|
||||
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
|
||||
virtual bool SupportsPromiscuous (void) const;
|
||||
virtual bool SupportsSendFrom (void) const;
|
||||
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
private:
|
||||
Ptr<SimpleChannel> m_channel;
|
||||
NetDevice::ReceiveCallback m_rxCallback;
|
||||
NetDevice::PromiscReceiveCallback m_promiscCallback;
|
||||
Ptr<Node> m_node;
|
||||
uint16_t m_mtu;
|
||||
std::string m_name;
|
||||
|
||||
Reference in new issue
Block a user