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;