Fixed issue where we need to go out same nic as we came in on (but different interface)

This commit is contained in:
Tim Young 2015-09-06 13:59:41 -05:00
parent 985e3d092d
commit 211fa6f2bb
5 changed files with 16 additions and 4 deletions

View File

@ -392,8 +392,13 @@ namespace EduNetworkBuilder
case NicType.eth:
case NicType.wlan:
//see if it the packet dest is local to this nic
if (WhereFrom.hostname == "router0")
Console.WriteLine("wearehere");
foreach (NetworkInterface nf in interfaces.ToList())
{
if (tPacket.InboundNic != null && tPacket.InboundNic == this &&
tPacket.InboundInterface != null && tPacket.InboundInterface == nf)
continue; //skip sending it out this interface if it came in this interface.
if (tPacket.MyType == PacketType.arp_request && !nf.isLocal(tPacket.destIP))
continue; //only send out arp requests on local networks
nPacket = new Packet(tPacket);//Creates a new packet but sets isfresh=false

View File

@ -1366,7 +1366,7 @@ namespace EduNetworkBuilder
if ((tPacket.isFresh && !ExactMatch ) || (NeedsRouting && DoesRouting()) ||
IsWirelessForwarder())
{
if (nic == tPacket.InboundNic) break; //never send it out the nic it came in on
// if (nic == tPacket.InboundNic) break; //this case is dealt with in nic.SendPacketOutNic
//Pass it to the NIC to send out each nic+interface.
//The nic checks to see if it works and then processes it
string tMAC = tPacket.destMAC;
@ -2161,7 +2161,7 @@ namespace EduNetworkBuilder
ProcessArrival(tPacket);
return;
}
NetworkInterface nf = nc.LocalInterface(tPacket.destIP, tPacket.Tracking);
NetworkInterface nf = nc.LocalInterface(tPacket.sourceIP, tPacket.Tracking);
if(nf == null)
{
nf = nc.LocalInterface(tPacket.TsourceIP, tPacket.Tracking);

View File

@ -100,6 +100,7 @@ namespace EduNetworkBuilder
/// <param name="tPacket"></param>
public void ProcessOutboundPacket(Packet tPacket)
{
tPacket.InboundInterface = null; //forget the interface we had come in on now that we are leaving.
if (tPacket.sourceIP == null || tPacket.sourceIP.GetIP.ToIpString() == NB.ZeroIPString)
{
//This happens if we are starting a new packet. We should also do this if we are masquerading.
@ -114,6 +115,8 @@ namespace EduNetworkBuilder
if (tPacket.destIP != null && myIP.IsLocal(tPacket.destIP)) isgood = true;
if (myIP.NetworkAddress == myIP.GetIP) isgood = true;
tPacket.InboundInterface = this;
if(isgood)
{
//anything we should do here?

View File

@ -56,6 +56,7 @@ namespace EduNetworkBuilder
DateTime StartTime = DateTime.Now;
public NetworkCard OutboundNic = null;
public NetworkCard InboundNic = null;
public NetworkInterface InboundInterface = null;
public NetworkInterface OutboundIF = null;
public IPAddress OutboundIP = new IPAddress(NB.ZeroIPString);
public string OutboundMAC = "";
@ -326,6 +327,7 @@ namespace EduNetworkBuilder
{
if (theLink == null) return;
InboundNic = null;
InboundInterface = null;
WhereAmI = theLink;
MyStatus = PacketStatus.moving;
myLinkPercent = 0;

View File

@ -1,7 +1,9 @@
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.10240}\viewkind4\uc1
\pard\sa200\sl276\slmult1\b\f0\fs22\lang9 Version 1.0.23 \par
\b0 * Fixed issues with broadcast packets\b\par
\b0 * Fixed issues with broadcast packets\par
* Fixed a network loop issue\par
* Fixed issue with multiple interfaces and being able to go out a different interface than we came in on\b\par
Version 1.0.22 09/01/2015\b0\par
* Added ssid and keys for wireless links\par
* Wireless will auto-disconnect if link is too long\par