diff --git a/EduNetworkBuilder/ActionClass.cs b/EduNetworkBuilder/ActionClass.cs index 6d7137f..5514b5f 100644 --- a/EduNetworkBuilder/ActionClass.cs +++ b/EduNetworkBuilder/ActionClass.cs @@ -225,18 +225,24 @@ namespace EduNetworkBuilder } break; case NBAction.dhcp: + if(source != null) + source.DHCPRequestFromHere(); break; case NBAction.arp: - source.AskArpFromHere(Destination); + if (source != null) + source.AskArpFromHere(Destination); break; case NBAction.cleararp: - source.ClearArps(); + if (source != null) + source.ClearArps(); break; - case NBAction.ping: - source.PingFromHere(Destination) ; + case NBAction.ping: + if (source != null) + source.PingFromHere(Destination) ; break; case NBAction.traceroute: - source.TracerouteFromHere(Destination); + if (source != null) + source.TracerouteFromHere(Destination); break; } } diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index a283fa1..34caea2 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -1435,6 +1435,17 @@ namespace EduNetworkBuilder AC.DoAction(); + } + public static void DoActionDHCP(int HostID) + { + ActionClass AC = new ActionClass(); + AC.Action = NBAction.dhcp; + AC.SourceID = HostID; + + RegisterAction(AC); + + AC.DoAction(); + } public static void DoActionArpDevice(int HostID, NB_IPAddress Destination) { diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 2087215..394c854 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -1329,7 +1329,8 @@ namespace EduNetworkBuilder private void pbNetworkView_DHCPRequest_Click(object sender, EventArgs e) { - ItemClickedOn.DHCPRequestFromHere(); + //ItemClickedOn.DHCPRequestFromHere(); + NB.DoActionDHCP(ItemClickedOn.GetUniqueIdentifier); myNetwork.ProcessPackets(); UpdateMessages(); pbNetworkView.Update();