Keep from sending broadcast packets out the port they came in on

This commit is contained in:
Tim Young 2015-08-26 17:20:26 -07:00
parent 9136a0aa74
commit 0387295b7a
2 changed files with 6 additions and 0 deletions

View File

@ -513,6 +513,8 @@ namespace EduNetworkBuilder
break; break;
case NicType.port: case NicType.port:
case NicType.wport: case NicType.wport:
if (tPacket.InboundNic == this)
break; //This is the port we came in on. Do not sent it back out this port
nPacket = new Packet(tPacket); nPacket = new Packet(tPacket);
if (HasBroadcastAddresses(tPacket.destIP)) if (HasBroadcastAddresses(tPacket.destIP))
{ {
@ -563,6 +565,8 @@ namespace EduNetworkBuilder
Network mynet; Network mynet;
NetworkDevice nd; NetworkDevice nd;
//We make sure the MAC matches. //We make sure the MAC matches.
if (tPacket == null) return;
tPacket.InboundNic = this; //track which nic we came in on.
if (myNicType == NicType.port || myNicType == NicType.wport) if (myNicType == NicType.port || myNicType == NicType.wport)
{ {
//Try tracking the arp if we can //Try tracking the arp if we can

View File

@ -55,6 +55,7 @@ namespace EduNetworkBuilder
public bool packet_good = true; public bool packet_good = true;
DateTime StartTime = DateTime.Now; DateTime StartTime = DateTime.Now;
public NetworkCard OutboundNic = null; public NetworkCard OutboundNic = null;
public NetworkCard InboundNic = null;
public NetworkInterface OutboundIF = null; public NetworkInterface OutboundIF = null;
public IPAddress OutboundIP = new IPAddress(NB.ZeroIPString); public IPAddress OutboundIP = new IPAddress(NB.ZeroIPString);
public string OutboundMAC = ""; public string OutboundMAC = "";
@ -323,6 +324,7 @@ namespace EduNetworkBuilder
public void StartOnLink(NetworkLink theLink, NetworkDevice start_device) public void StartOnLink(NetworkLink theLink, NetworkDevice start_device)
{ {
if (theLink == null) return; if (theLink == null) return;
InboundNic = null;
WhereAmI = theLink; WhereAmI = theLink;
MyStatus = PacketStatus.moving; MyStatus = PacketStatus.moving;
myLinkPercent = 0; myLinkPercent = 0;