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;
|
break;
|
||||||
case HowToBreak.LockOutSwitch:
|
case HowToBreak.LockOutSwitch:
|
||||||
//Lock it out
|
//Lock it out
|
||||||
|
if (tDevice.DoesForwarding()) tDevice.LockUsOutOfDevice();
|
||||||
break;
|
break;
|
||||||
case HowToBreak.StaticRouteClear:
|
case HowToBreak.StaticRouteClear:
|
||||||
//Clear out the static route(s)
|
//Clear out the static route(s)
|
||||||
|
@ -2170,7 +2170,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count));
|
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)))
|
//foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
|
||||||
// BreakList.Add(one);
|
// BreakList.Add(one);
|
||||||
count = 0;
|
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)
|
public NetworkInterface InterfaceFromVlanTag(Packet tPacket)
|
||||||
{
|
{
|
||||||
int ID = tPacket.VLANID;
|
int ID = tPacket.VLANID;
|
||||||
|
@ -1381,6 +1381,15 @@ namespace EduNetworkBuilder
|
|||||||
IPConnections.Clear();
|
IPConnections.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LockUsOutOfDevice()
|
||||||
|
{
|
||||||
|
foreach(NetworkCard nic in NICs)
|
||||||
|
{
|
||||||
|
if (nic.GetNicType == NicType.lo) continue;
|
||||||
|
nic.LockUsOutOfCard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseToPacket HowToRespondToPacket(Packet tPacket)
|
public ResponseToPacket HowToRespondToPacket(Packet tPacket)
|
||||||
{
|
{
|
||||||
bool typesMatch=false;
|
bool typesMatch=false;
|
||||||
|
@ -127,6 +127,17 @@ namespace EduNetworkBuilder
|
|||||||
VLANs.Add(new VLANInfo(id, Tag));
|
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)
|
public void Save(XmlWriter writer)
|
||||||
{
|
{
|
||||||
writer.WriteStartElement("interface");
|
writer.WriteStartElement("interface");
|
||||||
|
Loading…
Reference in New Issue
Block a user