--- a/src/devices/emu/emu-net-device.cc Fri May 29 13:33:20 2009 -0700
+++ b/src/devices/emu/emu-net-device.cc Fri May 29 06:40:34 2009 -0700
@@ -173,7 +173,9 @@
m_sock (-1),
m_readThread (0),
m_ifIndex (std::numeric_limits<uint32_t>::max ()), // absurdly large value
- m_sll_ifindex (-1)
+ m_sll_ifindex (-1),
+ m_isBroadcast (true),
+ m_isMulticast (false)
{
NS_LOG_FUNCTION (this);
Start (m_tStart);
@@ -293,7 +295,19 @@
{
NS_FATAL_ERROR ("EmuNetDevice::StartDevice(): " << m_deviceName << " is not in promiscuous mode");
}
-
+ if ((ifr.ifr_flags & IFF_BROADCAST) != IFF_BROADCAST)
+ {
+ // We default m_isBroadcast to true but turn it off here if not
+ // supported, because in the common case, overlying IP code will
+ // assert during configuration time if this is false, before this
+ // method has a chance to set it during runtime
+ m_isBroadcast = false;
+ }
+ if ((ifr.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST)
+ {
+ // This one is OK to enable at runtime
+ m_isMulticast = true;
+ }
//
// Now spin up a read thread to read packets.
//
@@ -918,7 +932,7 @@
bool
EmuNetDevice::IsBroadcast (void) const
{
- return true;
+ return m_isBroadcast;
}
Address
@@ -930,7 +944,7 @@
bool
EmuNetDevice::IsMulticast (void) const
{
- return false;
+ return m_isMulticast;
}
Address
--- a/src/devices/emu/emu-net-device.h Fri May 29 13:33:20 2009 -0700
+++ b/src/devices/emu/emu-net-device.h Fri May 29 06:40:34 2009 -0700
@@ -453,6 +453,18 @@
bool m_linkUp;
/**
+ * Flag indicating whether or not the underlying net device supports
+ * broadcast.
+ */
+ bool m_isBroadcast;
+
+ /**
+ * Flag indicating whether or not the underlying net device supports
+ * multicast.
+ */
+ bool m_isMulticast;
+
+ /**
* Callback to fire if the link changes state (up or down).
*/
Callback<void> m_linkChangeCallback;