Finally make tap bridge work with VMs (bug 569)

This commit is contained in:
Craig Dowell
2009-06-23 22:12:35 -07:00
parent c3b6466263
commit 6e8b7012e7
22 changed files with 116 additions and 121 deletions

View File

@@ -97,10 +97,16 @@ public:
*/
virtual Ptr<Channel> GetChannel (void) const = 0;
/**
* Set the address of this interface
*/
virtual void SetAddress (Address address) = 0;
/**
* \return the current Address of this interface.
*/
virtual Address GetAddress (void) const = 0;
/**
* \param mtu MTU value, in bytes, to set for the device
* \return whether the MTU value was within legal bounds

View File

@@ -192,23 +192,12 @@ Node::RegisterProtocolHandler (ProtocolHandler handler,
i != m_devices.end (); i++)
{
Ptr<NetDevice> dev = *i;
if (dev->SupportsSendFrom ())
{
dev->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
}
dev->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
}
}
else
{
if (device->SupportsSendFrom ())
{
device->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
}
else
{
NS_LOG_WARN ("Protocol handler request promiscuous mode for a specific netdevice,"
" but netdevice does not support promiscuous mode.");
}
device->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
}
}

View File

@@ -76,12 +76,6 @@ SimpleNetDevice::SetChannel (Ptr<SimpleChannel> channel)
m_channel->Add (this);
}
void
SimpleNetDevice::SetAddress (Mac48Address address)
{
m_address = address;
}
void
SimpleNetDevice::SetIfIndex(const uint32_t index)
{
@@ -97,9 +91,17 @@ SimpleNetDevice::GetChannel (void) const
{
return m_channel;
}
void
SimpleNetDevice::SetAddress (Address address)
{
m_address = Mac48Address::ConvertFrom(address);
}
Address
SimpleNetDevice::GetAddress (void) const
{
//
// Implicit conversion from Mac48Address to Address
//
return m_address;
}
bool

View File

@@ -43,12 +43,12 @@ public:
void Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from);
void SetChannel (Ptr<SimpleChannel> channel);
void SetAddress (Mac48Address address);
// inherited from NetDevice base class.
virtual void SetIfIndex(const uint32_t index);
virtual uint32_t GetIfIndex(void) const;
virtual Ptr<Channel> GetChannel (void) const;
virtual void SetAddress (Address address);
virtual Address GetAddress (void) const;
virtual bool SetMtu (const uint16_t mtu);
virtual uint16_t GetMtu (void) const;