--- a/examples/mesh/mesh.cc Tue Oct 27 13:56:38 2009 +0300
+++ b/examples/mesh/mesh.cc Tue Oct 27 18:43:45 2009 +0300
@@ -158,7 +158,16 @@
* mesh point device
*/
mesh = MeshHelper::Default ();
- mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
+ if (!Mac48Address (m_root.c_str ()).IsBroadcast ())
+ {
+ mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
+ }
+ else
+ {
+ //If root is not set, we do not use "Root" attribute, because it
+ //is specified only for 11s
+ mesh.SetStackInstaller (m_stack);
+ }
if (m_chan)
{
mesh.SetSpreadInterfaceChannels (MeshHelper::SPREAD_CHANNELS);
--- a/src/devices/mesh/flame/flame-protocol-mac.cc Tue Oct 27 13:56:38 2009 +0300
+++ b/src/devices/mesh/flame/flame-protocol-mac.cc Tue Oct 27 18:43:45 2009 +0300
@@ -31,6 +31,8 @@
}
FlameProtocolMac::~FlameProtocolMac ()
{
+ m_protocol = 0;
+ m_parent = 0;
}
void
FlameProtocolMac::SetParent (Ptr<MeshWifiInterfaceMac> parent)
--- a/src/devices/mesh/flame/flame-protocol.cc Tue Oct 27 13:56:38 2009 +0300
+++ b/src/devices/mesh/flame/flame-protocol.cc Tue Oct 27 18:43:45 2009 +0300
@@ -127,7 +127,7 @@
return tid;
}
FlameProtocol::FlameProtocol () :
- m_address (Mac48Address ()), m_broadcastInterval (Seconds (5)), m_lastBroadcast (Simulator::Now ()),
+ m_address (Mac48Address ()), m_broadcastInterval (Seconds (5)), m_lastBroadcast (Seconds (0)),
m_maxCost (32), m_myLastSeqno (1), m_rtable (CreateObject<FlameRtable> ())
{
}
@@ -137,6 +137,9 @@
void
FlameProtocol::DoDispose ()
{
+ m_interfaces.clear ();
+ m_rtable = 0;
+ m_mp = 0;
}
bool
FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
@@ -224,8 +227,12 @@
m_stats.totalDropped++;
return false;
}
+ tag.receiver = result.retransmitter;
}
- tag.receiver = result.retransmitter;
+ else
+ {
+ tag.receiver = Mac48Address::GetBroadcast ();
+ }
if (result.retransmitter == Mac48Address::GetBroadcast ())
{
m_stats.txBroadcast++;
@@ -262,19 +269,21 @@
}
FlameHeader flameHdr;
packet->RemoveHeader (flameHdr);
- if ((destination == GetAddress ()) && (m_lastBroadcast + m_broadcastInterval < Simulator::Now ()))
- {
- Ptr<Packet> packet = Create<Packet> ();
- m_mp->Send(packet, Mac48Address::GetBroadcast (), 0);
- m_lastBroadcast = Simulator::Now ();
- }
- NS_ASSERT (protocolType == FLAME_PROTOCOL);
- protocolType = flameHdr.GetProtocol ();
- if ((HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface))
- || packet->GetSize () == 0)
+ if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface))
{
return false;
}
+ // Start PATH_UPDATE procedure if destination is our own address and last broadcast was sent more
+ // than broadcast interval ago or was not sent at all
+ if ((destination == GetAddress ()) && ((m_lastBroadcast + m_broadcastInterval < Simulator::Now ())
+ || (m_lastBroadcast == Seconds (0))))
+ {
+ Ptr<Packet> packet = Create<Packet> ();
+ m_mp->Send (packet, Mac48Address::GetBroadcast (), 0);
+ m_lastBroadcast = Simulator::Now ();
+ }
+ NS_ASSERT (protocolType == FLAME_PROTOCOL);
+ protocolType = flameHdr.GetProtocol ();
return true;
}
bool