Fix Duplicate detection for ipv4 l3 multicast

This commit is contained in:
cbowers1020
2021-08-30 19:52:04 +00:00
committed by Tommaso Pecorella
parent d1636bbb52
commit b529897c6c
5 changed files with 16 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ Julien Boite (juboite@gmail.com)
Biljana Bojovic (bbojovic@cttc.es)
Elena Borovkova (borokovaes@iitp.ru)
Rahul Bothra (rrbothra@gmail.com)
Caleb Bowers (caleb.bowers@nel.navy.mil, cbowers1020@gmail.com)
Pavel Boyko (boyko@iitp.ru)
Matthew Bradbury (matt-bradbury@live.co.uk)
Dan Broyles (muxman@sbcglobal.net)

View File

@@ -73,6 +73,7 @@ us a note on ns-developers mailing list.</p>
<ul>
<li>Nix-Vector routing supports topologies with multiple WiFi networks using the same WiFi channel object.</li>
<li>ConfigStore does not save anymore OBSOLETE Attributes.</li>
<li>The <b>Ipv4L3Protocol</b> Duplicate detection now accounts for transmitted packets, so a transmitting multicast node will not forward its own packets.</li>
</ul>
<hr>

View File

@@ -38,6 +38,7 @@ New user-visible features
Bugs fixed
----------
- (internet) ipv4-l3-protocol.cc duplicate detection now accounts for sent packets, not just forwards.
Release 3.34
=============

View File

@@ -804,6 +804,10 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
NS_LOG_LOGIC ("Ipv4L3Protocol::Send case 1b: passed in with route and valid gateway");
int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
m_sendOutgoingTrace (ipHeader, packet, interface);
if (m_enableDpd && ipHeader.GetDestination ().IsMulticast ())
{
UpdateDuplicate (packet, ipHeader);
}
SendRealOut (route, packet->Copy (), ipHeader);
return;
}

View File

@@ -424,6 +424,11 @@ Ipv4DeduplicationTest::CheckPackets (const std::string &name)
std::map <std::string, uint32_t> packets = {
{"A", 14}, {"B", 16}, {"C", 16}, {"D", 16}, {"E", 4}
};
// a priori determined packet receptions based on
std:: map <std::string, uint32_t> packetsDuped = {
{"A", 0}, {"B", 1}, {"C", 1}, {"D", 1}, {"E", 1}
};
// a priori determined packet receptions based on initial TTL of 4, degenerate de-dup
// There are TTL (4) rounds of packets. Each round a node will register a
// received packet if another connected node transmits. A misses the 1st round
@@ -433,12 +438,10 @@ Ipv4DeduplicationTest::CheckPackets (const std::string &name)
{"A", 3}, {"B", 4}, {"C", 4}, {"D", 3}, {"E", 2}
};
NS_TEST_ASSERT_MSG_NE ((m_packetCountMap.find (name) == m_packetCountMap.end ()), true,
"No packets received for node " << name);
switch (m_mode)
{
case ENABLED:
NS_TEST_EXPECT_MSG_EQ (m_packetCountMap[name], 1, "Wrong number of packets received for node " << name);
NS_TEST_ASSERT_MSG_EQ (m_packetCountMap[name], packetsDuped[name], "Wrong number of packets received for node " << name);
break;
case DISABLED:
NS_TEST_EXPECT_MSG_EQ (m_packetCountMap[name], packets[name], "Wrong number of packets received for node " << name);
@@ -457,10 +460,10 @@ Ipv4DeduplicationTest::CheckDrops (const std::string &name)
{
case ENABLED:
// a priori determined packet drops based on initial TTL of 4, enabled de-dup;
// A hears from B & C
// A hears from B & C -- > 2 drops
// D hears from B, C, AND E
// B (C) hears from A, C (B), D, and A again
drops = {{"A", 1}, {"B", 3}, {"C", 3}, {"D", 2}, {"E", 0}};
// B (C) hears from A, C (B), D,
drops = {{"A", 2}, {"B", 2}, {"C", 2}, {"D", 2}, {"E", 0}};
break;
case DISABLED:
// a priori determined packet drops based on initial TTL of 4, disabled de-dup