From efd3f26431a26ac1a8092de5ca80f924682d8316 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Wed, 21 Jun 2017 09:11:11 -0500 Subject: [PATCH] Fix an odd traceroute reply issue. Routers would reply if the packet had the start and dest on the same subnet. --- EduNetworkBuilder/NetworkDevice.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 5851961..9addf6d 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -2594,8 +2594,15 @@ namespace EduNetworkBuilder { //The packet reached the end of its ttl. Bounce back. //this packet ends, another begins. + Network myNet = NB.GetNetwork(); + //There is a fringe case. Do not bounce back if the target device is on the same LAN that this packet came in on + // Otherwise, the traceroute gets an odd reply. + // Do not do a tracert reply if the src and dest are local to each-other, and if this is not the device that is the endpoint + bool LocalToEachOther = tPacket.sourceIP.IsLocal(new IPAddress(tPacket.payloadData)); + if (LocalToEachOther && RoutesPackets() && !HasMac(tPacket.destMAC)) return false; + //We create a new packet Packet nPacket = new Packet(this, tPacket.sourceIP, tPacket.payloadData, PacketType.tracert_reply, tPacket.packetID); nPacket.OrigTTL = tPacket.OrigTTL;