Tracert works better with VPN. VPN-Endpoints did not decrement tracert ttls. Now it works as it ought.
This commit is contained in:
parent
d4acde7b18
commit
9071ea404a
@ -1689,6 +1689,10 @@ namespace EduNetworkBuilder
|
|||||||
nPacket.Tracking.AddMessage(DebugLevel.info, this, NB.Translate("ND_ProcessArrival_CommingOut"));
|
nPacket.Tracking.AddMessage(DebugLevel.info, this, NB.Translate("ND_ProcessArrival_CommingOut"));
|
||||||
myNet.addPacket(nPacket);
|
myNet.addPacket(nPacket);
|
||||||
tPacket.payloadPacket = null;
|
tPacket.payloadPacket = null;
|
||||||
|
if (ProcessTracertPacket(nPacket))
|
||||||
|
{
|
||||||
|
return; //the packet stops if it gets bounced.
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1832,7 +1836,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Tracert_request is processed on the link arrivak
|
//Tracert_request is processed on the link arrival
|
||||||
if (tPacket.MyType == PacketType.tracert_reply)
|
if (tPacket.MyType == PacketType.tracert_reply)
|
||||||
{
|
{
|
||||||
ResponseToPacket response = HowToRespondToPacket(tPacket);
|
ResponseToPacket response = HowToRespondToPacket(tPacket);
|
||||||
@ -2520,33 +2524,7 @@ namespace EduNetworkBuilder
|
|||||||
//Traceroute bounce-back
|
//Traceroute bounce-back
|
||||||
if(tPacket.MyType == PacketType.tracert_request)
|
if(tPacket.MyType == PacketType.tracert_request)
|
||||||
{
|
{
|
||||||
tPacket.TTL--;
|
if (ProcessTracertPacket(tPacket)) return; //the packet stops if it gets bounced.
|
||||||
//If it is a router, or this is the destination
|
|
||||||
if(tPacket.TTL < 1 && (RoutesPackets() || HasMac(tPacket.destMAC)))
|
|
||||||
{
|
|
||||||
//The packet reached the end of its ttl. Bounce back.
|
|
||||||
//this packet ends, another begins.
|
|
||||||
Network myNet = NB.GetNetwork();
|
|
||||||
|
|
||||||
//We create a new packet
|
|
||||||
Packet nPacket = new Packet(this, tPacket.sourceIP, tPacket.payloadData, PacketType.tracert_reply, tPacket.packetID);
|
|
||||||
nPacket.OrigTTL = tPacket.OrigTTL;
|
|
||||||
nPacket.OriginalDestIP = tPacket.destIP;
|
|
||||||
nPacket.isFresh = true; //So it starts from here
|
|
||||||
nPacket.Tracking = new PacketMessage();
|
|
||||||
|
|
||||||
//The original packet stops here
|
|
||||||
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_TracerouteArrived") + " " + hostname);
|
|
||||||
tPacket.Tracking.Status = NB.LeftPad(hostname) + " Traceroute: " + NB.Translate("ND_ProcessArrival_TracerouteArrived") + " "+ hostname;
|
|
||||||
tPacket.MyStatus = PacketStatus.finished_ok;
|
|
||||||
//Console.WriteLine(" Tracert bounce: " + tPacket.OrigTTL + " " + hostname + " " + tPacket.payloadData);
|
|
||||||
|
|
||||||
//Finish setting up the new packet - sending it back
|
|
||||||
nPacket.sourceIP = new IPAddress(NB.ZeroIPString);
|
|
||||||
nPacket.TsourceIP = new IPAddress(NB.ZeroIPString);
|
|
||||||
myNet.addPacket(nPacket);
|
|
||||||
//Console.WriteLine(" Tracert bounce pkt:" + nPacket.OrigTTL + nPacket.payloadData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer)
|
if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer)
|
||||||
@ -2588,6 +2566,39 @@ namespace EduNetworkBuilder
|
|||||||
tPacket.StartOnDevice(this);
|
tPacket.StartOnDevice(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ProcessTracertPacket(Packet tPacket)
|
||||||
|
{
|
||||||
|
tPacket.TTL--;
|
||||||
|
//If it is a router, or this is the destination
|
||||||
|
if (tPacket.TTL < 1 && (RoutesPackets() || HasMac(tPacket.destMAC)))
|
||||||
|
{
|
||||||
|
//The packet reached the end of its ttl. Bounce back.
|
||||||
|
//this packet ends, another begins.
|
||||||
|
Network myNet = NB.GetNetwork();
|
||||||
|
|
||||||
|
//We create a new packet
|
||||||
|
Packet nPacket = new Packet(this, tPacket.sourceIP, tPacket.payloadData, PacketType.tracert_reply, tPacket.packetID);
|
||||||
|
nPacket.OrigTTL = tPacket.OrigTTL;
|
||||||
|
nPacket.OriginalDestIP = tPacket.destIP;
|
||||||
|
nPacket.isFresh = true; //So it starts from here
|
||||||
|
nPacket.Tracking = new PacketMessage();
|
||||||
|
|
||||||
|
//The original packet stops here
|
||||||
|
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_TracerouteArrived") + " " + hostname);
|
||||||
|
tPacket.Tracking.Status = NB.LeftPad(hostname) + " Traceroute: " + NB.Translate("ND_ProcessArrival_TracerouteArrived") + " " + hostname;
|
||||||
|
tPacket.MyStatus = PacketStatus.finished_ok;
|
||||||
|
//Console.WriteLine(" Tracert bounce: " + tPacket.OrigTTL + " " + hostname + " " + tPacket.payloadData);
|
||||||
|
|
||||||
|
//Finish setting up the new packet - sending it back
|
||||||
|
nPacket.sourceIP = new IPAddress(NB.ZeroIPString);
|
||||||
|
nPacket.TsourceIP = new IPAddress(NB.ZeroIPString);
|
||||||
|
myNet.addPacket(nPacket);
|
||||||
|
//Console.WriteLine(" Tracert bounce pkt:" + nPacket.OrigTTL + nPacket.payloadData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this is a switch/hub/wap
|
/// Return true if this is a switch/hub/wap
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user