From 0387295b7a55d8918ae06af88e490490bf8371ca Mon Sep 17 00:00:00 2001 From: Tim Young Date: Wed, 26 Aug 2015 17:20:26 -0700 Subject: [PATCH] Keep from sending broadcast packets out the port they came in on --- EduNetworkBuilder/NetworkCard.cs | 4 ++++ EduNetworkBuilder/Packet.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 956cdbf..616ed8b 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -513,6 +513,8 @@ namespace EduNetworkBuilder break; case NicType.port: 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); if (HasBroadcastAddresses(tPacket.destIP)) { @@ -563,6 +565,8 @@ namespace EduNetworkBuilder Network mynet; NetworkDevice nd; //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) { //Try tracking the arp if we can diff --git a/EduNetworkBuilder/Packet.cs b/EduNetworkBuilder/Packet.cs index bf091b1..ecc3393 100644 --- a/EduNetworkBuilder/Packet.cs +++ b/EduNetworkBuilder/Packet.cs @@ -55,6 +55,7 @@ namespace EduNetworkBuilder public bool packet_good = true; DateTime StartTime = DateTime.Now; public NetworkCard OutboundNic = null; + public NetworkCard InboundNic = null; public NetworkInterface OutboundIF = null; public IPAddress OutboundIP = new IPAddress(NB.ZeroIPString); public string OutboundMAC = ""; @@ -323,6 +324,7 @@ namespace EduNetworkBuilder public void StartOnLink(NetworkLink theLink, NetworkDevice start_device) { if (theLink == null) return; + InboundNic = null; WhereAmI = theLink; MyStatus = PacketStatus.moving; myLinkPercent = 0;