From 7c292f5b7d140213a6b6c3b9cad5d51cc1ea4553 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 22 Feb 2019 13:15:43 -0600 Subject: [PATCH] Justin Luth: ping source is firewall ? set sourceIP to vpn IP address The problem can be seen easily in Puzzle 2, VPN Demo. From firewall2, ping firewall0. The ping request tunnels to firewall0 with a source address of 0.0.0.0, and so the reply returns untunneled and drops at the default gateway. This patch probably needs to be tweaked a bit in case it covers too many situations, but in general something like this is needed. --- EduNetworkBuilder/NetworkCard.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 1d7d5d5..0f32875 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -701,6 +701,15 @@ namespace EduNetworkBuilder } } } + if (nf != null && nf.myIP != null && nf.myIP.GetIPString != NB.ZeroIPString) + { + //If the source IP is empty then it originated from here. We set the source to be us + if (tPacket.sourceIP == null || tPacket.sourceIP.GetIPString == NB.ZeroIPString) + { + tPacket.sourceIP = nf.myIP; + WhereFrom.StoreOutgoingPacketInfo(tPacket); //the packet is not yet tunneled + } + } if (nf.isLocal(tPacket.OutboundIP, false)) { //We need to tell the original packet that it is inside another packet