tracert: respond from requested IP address

If a device does a traceroute to the opposite side of a router,
the traceroute request will continue on to the next gateway
until it dies from not being able to return on the same NIC.

Instead, respond to traceroute requests from the "pinged"
ip address (so that the originator stops requesting more
tracert packets) instead of the closest address to the
originator.

Scenario: Level 3 It is dead, Jim
1.) from PC1, traceroute to the far side of router2 (192.168.3.2).
Notice that the tracert continues on two times to router0 before
dying.
This commit is contained in:
Tim Young 2019-04-13 10:18:02 -05:00
parent f5cb1875d2
commit c2f41ae5b9
1 changed files with 6 additions and 1 deletions

View File

@ -3290,7 +3290,12 @@ namespace EduNetworkBuilder
//Console.WriteLine(" Tracert bounce: " + tPacket.OrigTTL + " " + hostname + " " + tPacket.payloadData);
//Finish setting up the new packet - sending it back
nPacket.sourceIP = new NB_IPAddress(NB.ZeroIPString);
// respond from requested address, not outgoing address: important for routers.
if (HasIPAddress(tPacket.destIP))
nPacket.sourceIP = tPacket.destIP;
else
nPacket.sourceIP = new NB_IPAddress(NB.ZeroIPString);
nPacket.TsourceIP = new NB_IPAddress(NB.ZeroIPString);
myNet.addPacket(nPacket);
//Console.WriteLine(" Tracert bounce pkt:" + nPacket.OrigTTL + nPacket.payloadData);