Some fixes
This commit is contained in:
@@ -435,9 +435,8 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M
|
||||
//!NB: If there is information from peer - set lifetime as
|
||||
//we have got from PREQ, and set the rest lifetime of the
|
||||
//route if the information is correct
|
||||
uint32_t lifetime = preq.GetLifetime ();
|
||||
if(result.lifetime != Seconds (0.0))
|
||||
lifetime = result.lifetime.GetMicroSeconds () / 1024;
|
||||
uint32_t lifetime = result.lifetime.GetMicroSeconds () / 1024;
|
||||
NS_ASSERT(lifetime > 0);
|
||||
SendPrep (
|
||||
(*i)->GetDestinationAddress (),
|
||||
preq.GetOriginatorAddress (),
|
||||
@@ -488,7 +487,6 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M
|
||||
NS_LOG_DEBUG("I am "<<GetAddress ()<<", received prep from "<<prep.GetOriginatorAddress ()<<", receiver was:"<<from);
|
||||
HwmpRtable::LookupResult result = m_rtable->LookupReactive(prep.GetDestinationAddress());
|
||||
//Add a reactive path only if it is better than existing:
|
||||
m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from);
|
||||
if (
|
||||
((m_rtable->LookupReactive(prep.GetOriginatorAddress ())).retransmitter == Mac48Address::GetBroadcast ()) ||
|
||||
((m_rtable->LookupReactive(prep.GetOriginatorAddress ())).metric > prep.GetMetric ())
|
||||
@@ -501,6 +499,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M
|
||||
prep.GetMetric (),
|
||||
MicroSeconds(prep.GetLifetime () * 1024),
|
||||
prep.GetOriginatorSeqNumber ());
|
||||
m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from);
|
||||
if(result.retransmitter != Mac48Address::GetBroadcast ())
|
||||
m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter);
|
||||
ReactivePathResolved (prep.GetOriginatorAddress ());
|
||||
@@ -532,7 +531,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M
|
||||
//Forward PREP
|
||||
HwmpPluginMap::const_iterator prep_sender = m_interfaces.find (result.ifIndex);
|
||||
NS_ASSERT(prep_sender != m_interfaces.end ());
|
||||
prep_sender->second->SendPrep(prep, result.retransmitter);
|
||||
prep_sender->second->SendPrep (prep, result.retransmitter);
|
||||
}
|
||||
void
|
||||
HwmpProtocol::ReceivePerr (IePerr perr, Mac48Address from, uint32_t interface, Mac48Address fromMp)
|
||||
@@ -580,7 +579,7 @@ HwmpProtocol::SendPrep (
|
||||
prep.SetOriginatorSeqNumber (originatorDsn);
|
||||
HwmpPluginMap::const_iterator prep_sender = m_interfaces.find (interface);
|
||||
NS_ASSERT(prep_sender != m_interfaces.end ());
|
||||
prep_sender->second->SendPrep(prep, retransmitter);
|
||||
prep_sender->second->SendPrep (prep, retransmitter);
|
||||
//m_prepCallback (prep, retransmitter);
|
||||
|
||||
}
|
||||
|
||||
@@ -80,11 +80,7 @@ HwmpRtable::AddReactivePath (
|
||||
i->second.retransmitter = retransmitter;
|
||||
i->second.interface = interface;
|
||||
i->second.metric = metric;
|
||||
if (lifetime != Seconds (0))
|
||||
i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
|
||||
else
|
||||
// Information about peer does not have lifetime
|
||||
i->second.whenExpire = Seconds (0);
|
||||
i->second.whenExpire = Simulator::Now() + lifetime;
|
||||
i->second.seqnum = seqnum;
|
||||
}
|
||||
|
||||
@@ -101,7 +97,7 @@ HwmpRtable::AddProactivePath (
|
||||
m_root.root = root;
|
||||
m_root.retransmitter = retransmitter;
|
||||
m_root.metric = metric;
|
||||
m_root.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
|
||||
m_root.whenExpire = Simulator::Now() + lifetime;
|
||||
m_root.seqnum = seqnum;
|
||||
m_root.interface = interface;
|
||||
}
|
||||
@@ -171,10 +167,7 @@ HwmpRtable::LookupReactive (Mac48Address destination)
|
||||
NS_LOG_DEBUG ("Reactive route has expired, sorry.");
|
||||
return LookupResult();
|
||||
}
|
||||
Time lifetime = Seconds (0.0);
|
||||
if (i->second.whenExpire != Seconds (0))
|
||||
lifetime = i->second.whenExpire - Simulator::Now ();
|
||||
return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum);
|
||||
return LookupReactiveExpired (destination);
|
||||
}
|
||||
|
||||
HwmpRtable::LookupResult
|
||||
@@ -183,7 +176,12 @@ HwmpRtable::LookupReactiveExpired (Mac48Address destination)
|
||||
std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
|
||||
if (i == m_routes.end ())
|
||||
return LookupResult ();
|
||||
return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum);
|
||||
return LookupResult (
|
||||
i->second.retransmitter,
|
||||
i->second.interface,
|
||||
i->second.metric, i->second.seqnum,
|
||||
i->second.whenExpire - Simulator::Now ()
|
||||
);
|
||||
}
|
||||
|
||||
HwmpRtable::LookupResult
|
||||
@@ -200,7 +198,7 @@ HwmpRtable::LookupProactive ()
|
||||
HwmpRtable::LookupResult
|
||||
HwmpRtable::LookupProactiveExpired ()
|
||||
{
|
||||
return LookupResult(m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum);
|
||||
return LookupResult(m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum, m_root.whenExpire - Simulator::Now ());
|
||||
}
|
||||
|
||||
std::vector<IePerr::FailedDestination>
|
||||
|
||||
@@ -27,6 +27,9 @@ def build(bld):
|
||||
headers.module = 'dot11s'
|
||||
headers.source = [
|
||||
'peer-management-protocol.h',
|
||||
'ie-dot11s-beacon-timing.h',
|
||||
'ie-dot11s-peer-management.h',
|
||||
'ie-dot11s-perr.h',
|
||||
'hwmp-protocol.h',
|
||||
'dot11s-helper.h',
|
||||
'dot11s-mac-header.h',
|
||||
|
||||
Reference in New Issue
Block a user