internet: (fixes #2614) RIP header version mismatch

This commit is contained in:
Tommaso Pecorella
2017-01-06 14:30:46 +01:00
parent 6af76ae23e
commit 9c09190deb
3 changed files with 30 additions and 15 deletions

View File

@@ -58,6 +58,7 @@ Bugs fixed
- Bug 2584 - MacLow triggers StartNext even if there is no TXOP
- Bug 2591 - 802.11e Block Ack mechanism cannot be enabled on HT/VHT stations
- Bug 2594 - vht-wifi-network provides very low throughtput at MCS 6, 160 MHz, SGI
- Bug 2614 - RIP header version should be set to 2
Known issues
------------

View File

@@ -19,6 +19,7 @@
*/
#include "rip-header.h"
#include "ns3/log.h"
namespace ns3 {
@@ -149,8 +150,9 @@ std::ostream & operator << (std::ostream & os, const RipRte & h)
/*
* RipHeader
*/
NS_OBJECT_ENSURE_REGISTERED (RipHeader)
;
NS_LOG_COMPONENT_DEFINE ("RipHeader");
NS_OBJECT_ENSURE_REGISTERED (RipHeader);
RipHeader::RipHeader ()
: m_command (0)
@@ -193,7 +195,7 @@ void RipHeader::Serialize (Buffer::Iterator start) const
Buffer::Iterator i = start;
i.WriteU8 (uint8_t (m_command));
i.WriteU8 (1);
i.WriteU8 (2);
i.WriteU16 (0);
for (std::list<RipRte>::const_iterator iter = m_rteList.begin ();
@@ -219,11 +221,17 @@ uint32_t RipHeader::Deserialize (Buffer::Iterator start)
return 0;
}
temp = i.ReadU8 ();
NS_ASSERT_MSG (temp == 1, "RIP received a message with mismatch version, aborting.");
if (i.ReadU8 () != 2)
{
NS_LOG_LOGIC ("RIP received a message with mismatch version, ignoring.");
return 0;
}
uint16_t temp16 = i.ReadU16 ();
NS_ASSERT_MSG (temp16 == 0, "RIP received a message with invalid filled flags, aborting.");
if (i.ReadU16 () != 0)
{
NS_LOG_LOGIC ("RIP received a message with invalid filled flags, ignoring.");
return 0;
}
uint8_t rteNumber = i.GetRemainingSize ()/20;
for (uint8_t n=0; n<rteNumber; n++)

View File

@@ -19,14 +19,14 @@
*/
#include "ripng-header.h"
#include "ns3/log.h"
namespace ns3 {
/*
* RipNgRte
*/
NS_OBJECT_ENSURE_REGISTERED (RipNgRte)
;
NS_OBJECT_ENSURE_REGISTERED (RipNgRte);
RipNgRte::RipNgRte ()
: m_prefix ("::"), m_tag (0), m_prefixLen (0), m_metric (16)
@@ -132,8 +132,8 @@ std::ostream & operator << (std::ostream & os, const RipNgRte & h)
/*
* RipNgHeader
*/
NS_OBJECT_ENSURE_REGISTERED (RipNgHeader)
;
NS_LOG_COMPONENT_DEFINE ("RipNgHeader");
NS_OBJECT_ENSURE_REGISTERED (RipNgHeader);
RipNgHeader::RipNgHeader ()
: m_command (0)
@@ -202,11 +202,17 @@ uint32_t RipNgHeader::Deserialize (Buffer::Iterator start)
return 0;
}
temp = i.ReadU8 ();
NS_ASSERT_MSG (temp == 1, "RipNG received a message with mismatch version, aborting.");
if (i.ReadU8 () != 1)
{
NS_LOG_LOGIC ("RIP received a message with mismatch version, ignoring.");
return 0;
}
uint16_t temp16 = i.ReadU16 ();
NS_ASSERT_MSG (temp16 == 0, "RipNG received a message with invalid filled flags, aborting.");
if (i.ReadU16 () != 0)
{
NS_LOG_LOGIC ("RIP received a message with invalid filled flags, ignoring.");
return 0;
}
uint8_t rteNumber = i.GetRemainingSize ()/20;
for (uint8_t n=0; n<rteNumber; n++)