Skip to content

Commit

Permalink
Fix Duplicate detection for ipv4 l3 multicast
Browse files Browse the repository at this point in the history
  • Loading branch information
cbowers1020 authored and TommyPec committed Aug 30, 2021
1 parent d1636bb commit b529897
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Julien Boite ([email protected])
Biljana Bojovic ([email protected])
Elena Borovkova ([email protected])
Rahul Bothra ([email protected])
Caleb Bowers ([email protected], [email protected])
Pavel Boyko ([email protected])
Matthew Bradbury ([email protected])
Dan Broyles ([email protected])
Expand Down
1 change: 1 addition & 0 deletions CHANGES.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ <h2>Changed behavior:</h2>
<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>
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -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
=============
Expand Down
4 changes: 4 additions & 0 deletions src/internet/model/ipv4-l3-protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
15 changes: 9 additions & 6 deletions src/internet/test/ipv4-deduplication-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit b529897

Please sign in to comment.