Fix an odd traceroute reply issue. Routers would reply if the packet had the start and dest on the same subnet.

This commit is contained in:
Tim Young 2017-06-21 09:11:11 -05:00
parent 29e6d64614
commit efd3f26431

View File

@ -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;