adding traversal information as the packet moves around

This commit is contained in:
Tim Young 2017-08-25 10:37:20 -05:00
parent 9b78092b5a
commit eaab7771ff
3 changed files with 8 additions and 2 deletions

View File

@ -90,7 +90,7 @@ namespace EduNetworkBuilder
packet_in=4, packet_out=8, packet_duplicate=16, all=63,
dump=256, pause=512}
public enum TraversalTechnology { gateway, static_route, vlan, ethernet, wireless, firewall,
vpn, vpn_encryption, ip_address}
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade}
[Serializable]
public struct HostNicID //This holds a unique identifier for a network card. Links use this to know what it is connected to

View File

@ -559,6 +559,7 @@ namespace EduNetworkBuilder
{
//When we leave the WAN port, we are masqueraded. Track that.
WhereFrom.StoreOutgoingPacketInfo(nPacket, ResponseToPacket.masq);
tPacket.TraversalInformation.AddPath(WhereFrom.hostname, TraversalTechnology.masquerade); //We just masqueraded
//Now, we masquerade the packet so it looks like it comes fromhere
nPacket.Tracking.AddMessage(DebugLevel.natting, WhereFrom.hostname, string.Format(NB.Translate("NC_ChangeIPStr"), nf.myIP.GetIPString));
nPacket.sourceIP = nf.myIP;
@ -599,6 +600,7 @@ namespace EduNetworkBuilder
{
//We need to tell the original packet that it is inside another packet
tPacket.MyStatus = PacketStatus.encapsulated;
tPacket.TraversalInformation.AddPath(WhereFrom.hostname, TraversalTechnology.vpn); //We just started a VPN
tPacket.TsourceIP = nf.myIP;
tPacket.destMAC = WhereFrom.LookupArpFromIP(tPacket.OutboundIP.GetIPString);
if (nf != null)
@ -611,6 +613,8 @@ namespace EduNetworkBuilder
WhereFrom.TunnelPacketFromHere(TunnelEndpoint, rnPacket, EncryptionKey);
//We need to send the new packet on (pass it back to the device to process)
madeprogress = true;
if(EncryptionKey != "")
tPacket.TraversalInformation.AddPath(WhereFrom.hostname, TraversalTechnology.vpn_encryption); //We the packet is "encrypted"
}
}
break;

View File

@ -1504,7 +1504,8 @@ namespace EduNetworkBuilder
tPacket.MyStatus = PacketStatus.finished_failed;
return;
}
if(dest.GetIP == tPacket.destIP.GetIP)
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.ip_address); //We will use an outbound ip.
if (dest.GetIP == tPacket.destIP.GetIP)
{
//It is a local packet. Let it go out the interface it needs to go out
tPacket.OutboundIP = tPacket.destIP;
@ -1514,6 +1515,7 @@ namespace EduNetworkBuilder
{
//it needs to go to a gateway. Set the next destination is the GW
tPacket.OutboundIP = dest;
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.gateway); //We just used a gateway
tPacket.TsourceIP = null;
}
else