Break ethernet by removing the link entirely

This commit is contained in:
Tim Young 2017-08-29 16:01:34 -05:00
parent 41ae808c39
commit 59992d0e28
3 changed files with 19 additions and 9 deletions

View File

@ -91,7 +91,7 @@ namespace EduNetworkBuilder
dump=256, pause=512} dump=256, pause=512}
public enum TraversalTechnology { any, none, gateway, static_route, vlan, ethernet, wireless, firewall, public enum TraversalTechnology { any, none, gateway, static_route, vlan, ethernet, wireless, firewall,
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived, network_interface} vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived, network_interface}
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch, public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, EthernetRemoveLink, LockOutSwitch,
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear, WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey} StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}
@ -1148,7 +1148,7 @@ namespace EduNetworkBuilder
switch(What) switch(What)
{ {
case TraversalTechnology.ethernet: case TraversalTechnology.ethernet:
return new List<HowToBreak>() { HowToBreak.EthernetBreak, HowToBreak.EthernetCorrupt }; return new List<HowToBreak>() { HowToBreak.EthernetBreak, HowToBreak.EthernetCorrupt, HowToBreak.EthernetRemoveLink };
case TraversalTechnology.forward: case TraversalTechnology.forward:
return new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.LockOutSwitch }; return new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.LockOutSwitch };
case TraversalTechnology.gateway: case TraversalTechnology.gateway:
@ -1185,6 +1185,7 @@ namespace EduNetworkBuilder
return TraversalTechnology.network_interface; return TraversalTechnology.network_interface;
case HowToBreak.EthernetBreak: case HowToBreak.EthernetBreak:
case HowToBreak.EthernetCorrupt: case HowToBreak.EthernetCorrupt:
case HowToBreak.EthernetRemoveLink:
return TraversalTechnology.ethernet; return TraversalTechnology.ethernet;
case HowToBreak.LockOutSwitch: case HowToBreak.LockOutSwitch:
return TraversalTechnology.forward; //we can only lock ourselves out of switchs and hubs return TraversalTechnology.forward; //we can only lock ourselves out of switchs and hubs

View File

@ -1963,8 +1963,19 @@ namespace EduNetworkBuilder
break; break;
case HowToBreak.EthernetBreak: case HowToBreak.EthernetBreak:
//break the link itself //break the link itself
if (tLink.theLinkType == LinkType.normal)
{
tLink.theLinkType = LinkType.broken; tLink.theLinkType = LinkType.broken;
didit = 1; didit = 1;
}
break;
case HowToBreak.EthernetRemoveLink:
if (tLink.theLinkType == LinkType.normal)
{
tLink.Destroy();
RemoveComponent(tLink);
didit = 1;
}
break; break;
case HowToBreak.EthernetCorrupt: case HowToBreak.EthernetCorrupt:
//Add a flourescent light //Add a flourescent light

View File

@ -2170,11 +2170,9 @@ 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.LockOutSwitch, HowToBreak.WirelessBreakKey, HowToBreak.WirelessBreakSSID, HowToBreak.VPNChangeKey, foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
HowToBreak.DeviceChangeIP, HowToBreak.DeviceChangeGW}; BreakList.Add(one);
//foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
// BreakList.Add(one);
count = 0; count = 0;
int HowHard = 0; int HowHard = 0;
int TraversalIndex = 0; int TraversalIndex = 0;