diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 03a193c..2160f3f 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1963,6 +1963,7 @@ namespace EduNetworkBuilder break; case HowToBreak.LockOutSwitch: //Lock it out + if (tDevice.DoesForwarding()) tDevice.LockUsOutOfDevice(); break; case HowToBreak.StaticRouteClear: //Clear out the static route(s) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 15e537f..4afdfd0 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2170,7 +2170,7 @@ namespace EduNetworkBuilder TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count)); - List BreakList = new List() { HowToBreak.PowerOff, HowToBreak.EthernetBreak }; + List BreakList = new List() { HowToBreak.PowerOff, HowToBreak.EthernetBreak, HowToBreak.LockOutSwitch }; //foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak))) // BreakList.Add(one); count = 0; diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index e9cb54e..689052d 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -785,6 +785,18 @@ namespace EduNetworkBuilder } } + public void LockUsOutOfCard() + { + foreach (NetworkInterface nf in interfaces) + { + if (myNicType != NicType.lo) + { + nf.myIP = new IPAddress(NB.ZeroIPString); + nf.LockOutVLANInterface(); + } + } + } + public NetworkInterface InterfaceFromVlanTag(Packet tPacket) { int ID = tPacket.VLANID; diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 765ada7..e0bf383 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -1381,6 +1381,15 @@ namespace EduNetworkBuilder IPConnections.Clear(); } + public void LockUsOutOfDevice() + { + foreach(NetworkCard nic in NICs) + { + if (nic.GetNicType == NicType.lo) continue; + nic.LockUsOutOfCard(); + } + } + public ResponseToPacket HowToRespondToPacket(Packet tPacket) { bool typesMatch=false; diff --git a/EduNetworkBuilder/NetworkInterface.cs b/EduNetworkBuilder/NetworkInterface.cs index 97128a0..d224940 100644 --- a/EduNetworkBuilder/NetworkInterface.cs +++ b/EduNetworkBuilder/NetworkInterface.cs @@ -127,6 +127,17 @@ namespace EduNetworkBuilder VLANs.Add(new VLANInfo(id, Tag)); } + public void LockOutVLANInterface() + { + Network theNet = NB.GetNetwork(); + if (theNet == null) + return; + foreach(VLANName one in theNet.VlanNames) + { + SetVLANTag(one.ID, VLANTagType.Forbidden); + } + } + public void Save(XmlWriter writer) { writer.WriteStartElement("interface");