Fixed dublicates in broadcasts

This commit is contained in:
Kirill Andreev
2009-06-01 12:32:37 +04:00
parent b5797604c0
commit a688fb2751
3 changed files with 6 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ AirtimeLinkMetricCalculator::CalculateMetric(Mac48Address peerAddress, Ptr<MeshW
Ptr<Packet> test_frame = Create<Packet> (test_length);
uint32_t rate = station->GetDataMode(test_frame, test_length+header_length).GetDataRate ();
uint32_t payload_nanosec = (uint32_t) ((double) (test_length * 8) * 1e9 / ((double)rate));
uint32_t metric = (uint32_t) (((double) (payload_nanosec + overhead_nanosec)) / 102.4 * (station->GetAvgSlrc () + 1));
uint32_t metric = (uint32_t) (((double) (payload_nanosec + overhead_nanosec)) / 10240 * (station->GetAvgSlrc () + 1));
return metric;
}
} //namespace dot11s

View File

@@ -64,9 +64,11 @@ HwmpMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
m_stats.recvDataBytes += packet->GetSize ();
//TODO: address extension
Mac48Address destination;
Mac48Address source;
switch (meshHdr.GetAddressExt ())
{
case 0:
source = header.GetAddr3 ();
destination = header.GetAddr3 ();
break;
default:
@@ -82,7 +84,7 @@ HwmpMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
if(m_protocol->GetAddress() != destination)
packet->AddPacketTag(tag);
if (destination == Mac48Address::GetBroadcast ())
if(m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), header.GetAddr4 ()) )
if(m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), source))
return false;
}
if(header.IsAction())

View File

@@ -633,6 +633,8 @@ HwmpProtocol::SetNeighboursCallback(Callback<std::vector<Mac48Address>, uint32_t
bool
HwmpProtocol::DropDataFrame(uint32_t seqno, Mac48Address source)
{
if(source == GetAddress ())
return true;
std::map<Mac48Address, uint32_t,std::less<Mac48Address> >::const_iterator i = m_lastDataSeqno.find (source);
if (i == m_lastDataSeqno.end ())
m_lastDataSeqno[source] = seqno;