Fixed seqno overflow

This commit is contained in:
Kirill Andreev
2009-08-04 14:57:35 +04:00
parent e69fddf279
commit ca157f44e6
2 changed files with 6 additions and 6 deletions

View File

@@ -389,7 +389,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M
}
else
{
if (i->second > preq.GetOriginatorSeqNumber ())
if ((int32_t)(i->second - preq.GetOriginatorSeqNumber ()) > 0)
{
return;
}
@@ -507,7 +507,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M
//we have got from PREQ, and set the rest lifetime of the
//route if the information is correct
uint32_t lifetime = result.lifetime.GetMicroSeconds () / 1024;
if ((lifetime > 0) && (result.seqnum >= (*i)->GetDestSeqNumber ()))
if ((lifetime > 0) && ((int32_t)(result.seqnum - (*i)->GetDestSeqNumber ()) >= 0))
{
SendPrep (
(*i)->GetDestinationAddress (),
@@ -555,7 +555,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M
}
else
{
if (i->second > prep.GetOriginatorSeqNumber ())
if ((int32_t)(i->second - prep.GetOriginatorSeqNumber ()) > 0)
{
return;
}
@@ -634,7 +634,7 @@ HwmpProtocol::ReceivePerr (std::vector<IePerr::FailedDestination> destinations,
if (!(
(result.retransmitter != from) ||
(result.ifIndex != interface) ||
(result.seqnum > destinations[i].seqnum)
((int32_t)(result.seqnum - destinations[i].seqnum) > 0)
))
{
retval.push_back (destinations[i]);
@@ -732,7 +732,7 @@ HwmpProtocol::DropDataFrame (uint32_t seqno, Mac48Address source)
}
else
{
if (i->second >= seqno)
if ((int32_t)(i->second - seqno) >= 0)
{
return true;
}

View File

@@ -328,7 +328,7 @@ FlameProtocol::HandleDataFrame (uint16_t seqno, Mac48Address source, const Flame
return true;
}
FlameRtable::LookupResult result = m_rtable->Lookup (source);
if ((result.retransmitter != Mac48Address::GetBroadcast ()) && (result.seqnum >= seqno))
if ((result.retransmitter != Mac48Address::GetBroadcast ()) && ((int16_t)(result.seqnum - seqno) >= 0))
{
return true;
}