make it so we can lock ourselves out of a switch
This commit is contained in:
parent
d3b6abf1e1
commit
e58a75d84e
@ -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)
|
||||
|
@ -2170,7 +2170,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count));
|
||||
|
||||
List<HowToBreak> BreakList = new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.EthernetBreak };
|
||||
List<HowToBreak> BreakList = new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.EthernetBreak, HowToBreak.LockOutSwitch };
|
||||
//foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
|
||||
// BreakList.Add(one);
|
||||
count = 0;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user