From 26eb6ea30de77451438283ddaaecfe19ea9f9c3d Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Sat, 5 Apr 2025 17:39:51 +0200 Subject: [PATCH] internet: fix ARP cache entries handling --- src/internet/model/arp-cache.h | 3 --- src/internet/model/arp-l3-protocol.cc | 22 ++++++++++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/internet/model/arp-cache.h b/src/internet/model/arp-cache.h index e78d903b7..f3a186991 100644 --- a/src/internet/model/arp-cache.h +++ b/src/internet/model/arp-cache.h @@ -278,8 +278,6 @@ class ArpCache : public Object */ void UpdateSeen(); -<<<<<<< HEAD -======= /** * @brief Print this ARP entry to the given output stream * @@ -293,7 +291,6 @@ class ArpCache : public Object */ Time GetTimeout() const; ->>>>>>> 04b17e847 (internet: add functions to print an ArpCache::Entry) private: /** * @brief ARP cache entry states diff --git a/src/internet/model/arp-l3-protocol.cc b/src/internet/model/arp-l3-protocol.cc index 0cbcb9d65..46539e479 100644 --- a/src/internet/model/arp-l3-protocol.cc +++ b/src/internet/model/arp-l3-protocol.cc @@ -309,10 +309,23 @@ ArpL3Protocol::Lookup(Ptr packet, cache, destination); } + else if (entry->IsWaitReply()) + { + NS_LOG_LOGIC("node=" << m_node->GetId() << ", entry for " << destination + << " waiting for a reply -- adding the packet to the queue"); + if (!entry->UpdateWaitReply(ArpCache::Ipv4PayloadHeaderPair(packet, ipHeader))) + { + // add the Ipv4 header for tracing purposes + packet->AddHeader(ipHeader); + m_dropTrace(packet); + } + return false; + } else { - NS_FATAL_ERROR("Test for possibly unreachable code-- please file a bug report, " - "with a test case, if this is ever hit"); + NS_FATAL_ERROR("Test for possibly unreachable code -- please file a bug report, " + "with a test case - " + << *entry); } } else @@ -352,8 +365,9 @@ ArpL3Protocol::Lookup(Ptr packet, } else { - NS_LOG_LOGIC("Test for possibly unreachable code-- please file a bug report, with " - "a test case, if this is ever hit"); + NS_FATAL_ERROR("Test for possibly unreachable code -- please file a bug report, " + "with a test case - " + << *entry); } } }