Working on the firewall
This commit is contained in:
parent
6d375c9b60
commit
6f240bc311
17
EduNetworkBuilder/DeviceConfig.Designer.cs
generated
17
EduNetworkBuilder/DeviceConfig.Designer.cs
generated
@ -47,6 +47,7 @@
|
|||||||
this.cbDHCP = new System.Windows.Forms.CheckBox();
|
this.cbDHCP = new System.Windows.Forms.CheckBox();
|
||||||
this.btnDHCP = new System.Windows.Forms.Button();
|
this.btnDHCP = new System.Windows.Forms.Button();
|
||||||
this.btnVLAN = new System.Windows.Forms.Button();
|
this.btnVLAN = new System.Windows.Forms.Button();
|
||||||
|
this.btnFirewall = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// tbHostname
|
// tbHostname
|
||||||
@ -229,14 +230,24 @@
|
|||||||
//
|
//
|
||||||
// btnVLAN
|
// btnVLAN
|
||||||
//
|
//
|
||||||
this.btnVLAN.Location = new System.Drawing.Point(182, 80);
|
this.btnVLAN.Location = new System.Drawing.Point(365, 55);
|
||||||
this.btnVLAN.Name = "btnVLAN";
|
this.btnVLAN.Name = "btnVLAN";
|
||||||
this.btnVLAN.Size = new System.Drawing.Size(75, 23);
|
this.btnVLAN.Size = new System.Drawing.Size(94, 23);
|
||||||
this.btnVLAN.TabIndex = 21;
|
this.btnVLAN.TabIndex = 21;
|
||||||
this.btnVLAN.Text = "VLANs";
|
this.btnVLAN.Text = "VLANs";
|
||||||
this.btnVLAN.UseVisualStyleBackColor = true;
|
this.btnVLAN.UseVisualStyleBackColor = true;
|
||||||
this.btnVLAN.Click += new System.EventHandler(this.btnVLAN_Click);
|
this.btnVLAN.Click += new System.EventHandler(this.btnVLAN_Click);
|
||||||
//
|
//
|
||||||
|
// btnFirewall
|
||||||
|
//
|
||||||
|
this.btnFirewall.Location = new System.Drawing.Point(251, 55);
|
||||||
|
this.btnFirewall.Name = "btnFirewall";
|
||||||
|
this.btnFirewall.Size = new System.Drawing.Size(113, 23);
|
||||||
|
this.btnFirewall.TabIndex = 22;
|
||||||
|
this.btnFirewall.Text = "Firewall";
|
||||||
|
this.btnFirewall.UseVisualStyleBackColor = true;
|
||||||
|
this.btnFirewall.Click += new System.EventHandler(this.btnFirewall_Click);
|
||||||
|
//
|
||||||
// DeviceConfig
|
// DeviceConfig
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.btnOK;
|
this.AcceptButton = this.btnOK;
|
||||||
@ -244,6 +255,7 @@
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.CancelButton = this.btnCancel;
|
this.CancelButton = this.btnCancel;
|
||||||
this.ClientSize = new System.Drawing.Size(471, 365);
|
this.ClientSize = new System.Drawing.Size(471, 365);
|
||||||
|
this.Controls.Add(this.btnFirewall);
|
||||||
this.Controls.Add(this.btnVLAN);
|
this.Controls.Add(this.btnVLAN);
|
||||||
this.Controls.Add(this.btnDHCP);
|
this.Controls.Add(this.btnDHCP);
|
||||||
this.Controls.Add(this.cbDHCP);
|
this.Controls.Add(this.cbDHCP);
|
||||||
@ -292,5 +304,6 @@
|
|||||||
private System.Windows.Forms.CheckBox cbDHCP;
|
private System.Windows.Forms.CheckBox cbDHCP;
|
||||||
private System.Windows.Forms.Button btnDHCP;
|
private System.Windows.Forms.Button btnDHCP;
|
||||||
private System.Windows.Forms.Button btnVLAN;
|
private System.Windows.Forms.Button btnVLAN;
|
||||||
|
private System.Windows.Forms.Button btnFirewall;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -57,6 +57,7 @@ namespace EduNetworkBuilder
|
|||||||
cbDHCP.Text = NB.Translate("DC_cbDHCP");
|
cbDHCP.Text = NB.Translate("DC_cbDHCP");
|
||||||
btnDHCP.Text = NB.Translate("_DHCP");
|
btnDHCP.Text = NB.Translate("_DHCP");
|
||||||
btnVLAN.Text = NB.Translate("DC_btnVLAN");
|
btnVLAN.Text = NB.Translate("DC_btnVLAN");
|
||||||
|
btnFirewall.Text = NB.Translate("DC_btnFirewall");
|
||||||
Text = NB.Translate("DC_Form");
|
Text = NB.Translate("DC_Form");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +96,10 @@ namespace EduNetworkBuilder
|
|||||||
nicLocked = true;
|
nicLocked = true;
|
||||||
interfacesLocked = true;
|
interfacesLocked = true;
|
||||||
}
|
}
|
||||||
|
if (theNet.FirewallEnabled && ndCLonedItem.DoesFirewall())
|
||||||
|
btnFirewall.Visible = true;
|
||||||
|
else
|
||||||
|
btnFirewall.Visible = false;
|
||||||
if (lbNics.SelectedIndex != -1)
|
if (lbNics.SelectedIndex != -1)
|
||||||
{
|
{
|
||||||
string nic_name = StripNicName(lbNics.SelectedItem.ToString());
|
string nic_name = StripNicName(lbNics.SelectedItem.ToString());
|
||||||
@ -512,5 +517,15 @@ namespace EduNetworkBuilder
|
|||||||
VLANConfig VLC = new VLANConfig((NetworkDevice)ClonedItem);
|
VLANConfig VLC = new VLANConfig((NetworkDevice)ClonedItem);
|
||||||
VLC.ShowDialog();
|
VLC.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnFirewall_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//Open a firewall editing window.
|
||||||
|
if (ClonedItem is NetworkDevice)
|
||||||
|
{
|
||||||
|
FirewallEditor FEditor = new FirewallEditor((NetworkDevice)ClonedItem);
|
||||||
|
FEditor.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,6 @@
|
|||||||
<None Include="Resources\Level1-MidDHCP.enbx" />
|
<None Include="Resources\Level1-MidDHCP.enbx" />
|
||||||
<None Include="Resources\Level1-NoGateway.enbx" />
|
<None Include="Resources\Level1-NoGateway.enbx" />
|
||||||
<None Include="Resources\Level1_AddingDevices.enbx" />
|
<None Include="Resources\Level1_AddingDevices.enbx" />
|
||||||
<None Include="Resources\Level1_AddingDevicesenbx" />
|
|
||||||
<None Include="Resources\Level1_BadGateway.enbx" />
|
<None Include="Resources\Level1_BadGateway.enbx" />
|
||||||
<None Include="Resources\Level1_DuplicateMAC.enbx" />
|
<None Include="Resources\Level1_DuplicateMAC.enbx" />
|
||||||
<None Include="Resources\Level1_OneNetTwoSubnets.enbx" />
|
<None Include="Resources\Level1_OneNetTwoSubnets.enbx" />
|
||||||
|
@ -7,23 +7,20 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace EduNetworkBuilder
|
namespace EduNetworkBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
public class FirewallRule
|
|
||||||
{
|
|
||||||
public string Source;
|
|
||||||
public string Destination;
|
|
||||||
public FirewallRuleType Action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial class FirewallEditor : Form
|
public partial class FirewallEditor : Form
|
||||||
{
|
{
|
||||||
public FirewallEditor()
|
NetworkDevice FirewallDevice = null;
|
||||||
|
public FirewallEditor(NetworkDevice WhatToEdit)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
FirewallDevice = WhatToEdit;
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
|
Icon = Properties.Resources.NBIco;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateForm()
|
void UpdateForm()
|
||||||
@ -32,11 +29,32 @@ namespace EduNetworkBuilder
|
|||||||
btnDel.Visible = true;
|
btnDel.Visible = true;
|
||||||
else
|
else
|
||||||
btnDel.Visible = false;
|
btnDel.Visible = false;
|
||||||
|
int selected = lbRules.SelectedIndex;
|
||||||
|
lbRules.Items.Clear();
|
||||||
|
foreach (FirewallRule FW in FirewallDevice.FirewallRules)
|
||||||
|
{
|
||||||
|
string OneLine = FW.Action.ToString() + " " + FW.Source + " -> " + FW.Destination;
|
||||||
|
lbRules.Items.Add(OneLine);
|
||||||
|
}
|
||||||
|
if (selected >= 0 && selected < lbRules.Items.Count)
|
||||||
|
lbRules.SelectedIndex = selected;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lbRules.Items.Count > 0)
|
||||||
|
lbRules.SelectedIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnNew_Click(object sender, EventArgs e)
|
private void btnNew_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
FirewallRule FW = new FirewallRule("","",FirewallRuleType.Drop);
|
||||||
|
NetTestEditor NTE = new NetTestEditor(FW,FirewallDevice);
|
||||||
|
NTE.ShowDialog();
|
||||||
|
if(FW.Source!="" && FW.Destination != "")
|
||||||
|
{
|
||||||
|
FirewallDevice.FirewallRules.Add(FW);
|
||||||
|
}
|
||||||
|
UpdateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDel_Click(object sender, EventArgs e)
|
private void btnDel_Click(object sender, EventArgs e)
|
||||||
@ -46,7 +64,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
private void btnDone_Click(object sender, EventArgs e)
|
private void btnDone_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,6 +230,54 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class FirewallRule
|
||||||
|
{
|
||||||
|
public string Source;
|
||||||
|
public string Destination;
|
||||||
|
public FirewallRuleType Action;
|
||||||
|
|
||||||
|
public FirewallRule(string source, string dest, FirewallRuleType action)
|
||||||
|
{
|
||||||
|
Source = source;
|
||||||
|
Destination = dest;
|
||||||
|
Action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FirewallRule(XmlNode theNode)
|
||||||
|
{
|
||||||
|
foreach (XmlNode Individual in theNode.ChildNodes)
|
||||||
|
{
|
||||||
|
XmlNodeType myNodetype = Individual.NodeType;
|
||||||
|
if (myNodetype == XmlNodeType.Element)
|
||||||
|
{
|
||||||
|
switch (Individual.Name.ToLower())
|
||||||
|
{
|
||||||
|
case "source":
|
||||||
|
Source = Individual.InnerText;
|
||||||
|
break;
|
||||||
|
case "destination":
|
||||||
|
Destination = Individual.InnerText;
|
||||||
|
break;
|
||||||
|
case "action":
|
||||||
|
Action = NB.ParseEnum<FirewallRuleType>(Individual.InnerText);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(XmlWriter writer, string tag)
|
||||||
|
{
|
||||||
|
writer.WriteStartElement(tag);
|
||||||
|
writer.WriteElementString("source", Source);
|
||||||
|
writer.WriteElementString("destination", Destination);
|
||||||
|
writer.WriteElementString("action", Action.ToString());
|
||||||
|
writer.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class NB
|
class NB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -21,12 +21,18 @@ namespace EduNetworkBuilder
|
|||||||
List<string> HostNames = new List<string>();
|
List<string> HostNames = new List<string>();
|
||||||
List<string> Networks = new List<string>();
|
List<string> Networks = new List<string>();
|
||||||
List<string> Broadcasts = new List<string>();
|
List<string> Broadcasts = new List<string>();
|
||||||
|
List<string> Interfaces = new List<string>();
|
||||||
bool processing = false;
|
bool processing = false;
|
||||||
|
FirewallRule RuleToEdit;
|
||||||
|
FirewallRule OrigRule;
|
||||||
|
NetworkDevice FirewallDevice = null;
|
||||||
|
bool EditingFirewallRule = false;
|
||||||
|
|
||||||
public NetTestEditor(NetTest WhatToEdit)
|
public NetTestEditor(NetTest WhatToEdit)
|
||||||
{
|
{
|
||||||
|
EditingFirewallRule = false;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LanguagifyComponents();
|
LanguagifyTestComponents();
|
||||||
OrigTest = WhatToEdit;
|
OrigTest = WhatToEdit;
|
||||||
ToEdit = new NetTest(OrigTest);
|
ToEdit = new NetTest(OrigTest);
|
||||||
|
|
||||||
@ -37,23 +43,65 @@ namespace EduNetworkBuilder
|
|||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LanguagifyComponents()
|
public NetTestEditor(FirewallRule WhatToEdit, NetworkDevice DeviceWorkingOn)
|
||||||
{
|
{
|
||||||
Text = NB.Translate("NTE_lblSource");
|
EditingFirewallRule = true;
|
||||||
Text = NB.Translate("NTE_lblTest");
|
InitializeComponent();
|
||||||
Text = NB.Translate("NTE_lblDest");
|
LanguagifyFWComponents();
|
||||||
Text = NB.Translate("_Done");
|
OrigRule = WhatToEdit;
|
||||||
Text = NB.Translate("_Cancel");
|
FirewallDevice = DeviceWorkingOn;
|
||||||
|
RuleToEdit = new FirewallRule(OrigRule.Source, OrigRule.Destination, OrigRule.Action);
|
||||||
|
// Make a list of all interfaces on this device
|
||||||
|
foreach (string nname in DeviceWorkingOn.NICNames())
|
||||||
|
{
|
||||||
|
NetworkCard nic = DeviceWorkingOn.NicFromName(nname);
|
||||||
|
for (int i = 0; i < nic.IFCount; i++)
|
||||||
|
{
|
||||||
|
NetworkInterface nif = nic.GetInterface(i);
|
||||||
|
Interfaces.Add(nif.nic_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Interfaces.Count < 2)
|
||||||
|
{
|
||||||
|
//we cannot do firewalling on a device that has one or zero interfaces.
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
UpdateForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LanguagifyTestComponents()
|
||||||
|
{
|
||||||
|
lblSource.Text = NB.Translate("NTE_lblSource");
|
||||||
|
lblTest.Text = NB.Translate("NTE_lblTest");
|
||||||
|
lblDest.Text = NB.Translate("NTE_lblDest");
|
||||||
|
btnOK.Text = NB.Translate("_Done");
|
||||||
|
btnCancel.Text = NB.Translate("_Cancel");
|
||||||
Text = NB.Translate("NTE_Form");
|
Text = NB.Translate("NTE_Form");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LanguagifyFWComponents()
|
||||||
|
{
|
||||||
|
LanguagifyTestComponents();
|
||||||
|
lblTest.Text = NB.Translate("NTE_lblTestFW");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OrigTest.UpdateValuesFromAnother(ToEdit);
|
if (EditingFirewallRule)
|
||||||
OrigTest.TaskWasDone = false; //We edited it. Set it to false
|
{
|
||||||
OrigTest.SetInitialDoneState(); //Set some of them to true (locked. etc)
|
OrigRule.Destination = RuleToEdit.Destination;
|
||||||
Close();
|
OrigRule.Source = RuleToEdit.Source;
|
||||||
|
OrigRule.Action = RuleToEdit.Action;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OrigTest.UpdateValuesFromAnother(ToEdit);
|
||||||
|
OrigTest.TaskWasDone = false; //We edited it. Set it to false
|
||||||
|
OrigTest.SetInitialDoneState(); //Set some of them to true (locked. etc)
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
@ -65,202 +113,256 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
NetworkDevice sItem;
|
NetworkDevice sItem;
|
||||||
processing = true;
|
processing = true;
|
||||||
|
List<string> tList = new List<string>();
|
||||||
|
|
||||||
Network theNet = NB.GetNetwork();
|
Network theNet = NB.GetNetwork();
|
||||||
//We add all the hostnames as source
|
//We add all the hostnames as source
|
||||||
cbSource.Items.Clear();
|
if (EditingFirewallRule)
|
||||||
foreach(string host in HostNames)
|
|
||||||
{
|
|
||||||
cbSource.Items.Add(host);
|
|
||||||
}
|
|
||||||
|
|
||||||
//The tests are just the list of available tests.
|
|
||||||
cbTest.Items.Clear();
|
|
||||||
List<string> tList = new List<string>();
|
|
||||||
foreach (string test in Enum.GetNames(typeof(NetTestType)))
|
|
||||||
{
|
|
||||||
tList.Add(test);
|
|
||||||
}
|
|
||||||
tList.Sort(); //Sort them alphabetically. Just to make things easier
|
|
||||||
foreach (string test in tList)
|
|
||||||
{
|
|
||||||
cbTest.Items.Add(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
cbDest.Items.Clear();
|
|
||||||
if (ToEdit.TheTest == NetTestType.NeedsRouteToNet)
|
|
||||||
{ //List all the networks
|
|
||||||
foreach (string subnet in Networks)
|
|
||||||
{
|
|
||||||
cbDest.Items.Add(subnet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.DHCPServerEnabled)
|
|
||||||
{
|
|
||||||
cbDest.Items.Add(true.ToString());
|
|
||||||
cbDest.Items.Add(false.ToString());
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.HelpRequest)
|
|
||||||
{
|
|
||||||
foreach (string HelpLevel in Enum.GetNames(typeof(NetTestVerbosity)))
|
|
||||||
{
|
|
||||||
cbDest.Items.Add(HelpLevel);
|
|
||||||
}
|
|
||||||
cbDest.Items.Add("?Button");
|
|
||||||
cbDest.Items.Add("ViewButton");
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.ReadContextHelp)
|
|
||||||
{
|
{
|
||||||
cbSource.Items.Clear();
|
cbSource.Items.Clear();
|
||||||
List<string> theNames = new List<string>();
|
cbDest.Items.Clear();
|
||||||
theNames.AddRange(Enum.GetNames(typeof(HelpTopics)));
|
cbTest.Items.Clear();
|
||||||
theNames.Sort();
|
|
||||||
theNames.Remove("None");
|
foreach (string one in Interfaces)
|
||||||
foreach (string ContextHelp in theNames)
|
|
||||||
{
|
{
|
||||||
cbSource.Items.Add(ContextHelp);
|
if (one != RuleToEdit.Destination)
|
||||||
|
cbSource.Items.Add(one); //We add all of them except the selected destination
|
||||||
|
if (one != RuleToEdit.Source)
|
||||||
|
cbDest.Items.Add(one); //We add all of them except the selected source
|
||||||
}
|
}
|
||||||
cbDest.Items.Add(NB.Translate("_Read"));
|
foreach (string test in Enum.GetNames(typeof(FirewallRuleType)))
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.LockAll || ToEdit.TheTest == NetTestType.LockGateway)
|
|
||||||
{
|
|
||||||
cbDest.Items.Add(NB.Translate("_All"));
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.LockDHCP)
|
|
||||||
{
|
|
||||||
//return all the dhcp ranges
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach(string ip in sItem.DHCPStrings(false))
|
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(ip);
|
tList.Add(test);
|
||||||
}
|
}
|
||||||
}
|
tList.Sort(); //Sort them alphabetically. Just to make things easier
|
||||||
else if (ToEdit.TheTest == NetTestType.LockIP)
|
foreach (string test in tList)
|
||||||
{
|
|
||||||
//return all the dhcp ranges
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (IPAddress ip in sItem.IPAddressList())
|
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(ip.GetIPString);
|
cbTest.Items.Add(test);
|
||||||
}
|
}
|
||||||
}
|
//select the current stuff
|
||||||
else if (ToEdit.TheTest == NetTestType.LockRoute)
|
if (cbSource.Items.Contains(RuleToEdit.Source))
|
||||||
{
|
|
||||||
//return all the dhcp ranges
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (IPAddress ip in sItem.ListRoutes())
|
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(ip.GetIPString);
|
cbSource.SelectedItem = RuleToEdit.Source;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (ToEdit.TheTest == NetTestType.LockNic)
|
|
||||||
{
|
|
||||||
//return all the dhcp ranges
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (string nname in sItem.NICNames())
|
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(nname);
|
if (cbSource.Items.Count > 0)
|
||||||
|
cbSource.SelectedIndex = 0; //select the first item
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if(ToEdit.TheTest == NetTestType.LockVLANNames)
|
if (cbDest.Items.Contains(RuleToEdit.Source))
|
||||||
{
|
|
||||||
//No items for lockvlannames
|
|
||||||
cbDest.Items.Add(NB.Translate("_All"));
|
|
||||||
cbSource.Items.Clear();
|
|
||||||
cbSource.Items.Add(NB.Translate("_All"));
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.LockNicVLAN)
|
|
||||||
{
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (string nname in sItem.NICNames())
|
|
||||||
{
|
{
|
||||||
NetworkCard nic = sItem.NicFromName(nname);
|
cbDest.SelectedItem = RuleToEdit.Source;
|
||||||
if (!nic.NicCanDoVLANs()) continue;
|
|
||||||
cbDest.Items.Add(nic.NicName());
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (ToEdit.TheTest == NetTestType.LockVLANsOnHost)
|
|
||||||
{
|
|
||||||
//No items for lockvlannames
|
|
||||||
cbDest.Items.Add(NB.Translate("_All"));
|
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.LockInterfaceVLAN)
|
|
||||||
{
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (string nname in sItem.NICNames())
|
|
||||||
{
|
{
|
||||||
NetworkCard nic = sItem.NicFromName(nname);
|
if (cbDest.Items.Count > 0)
|
||||||
if (!nic.NicCanDoVLANs()) continue;
|
cbDest.SelectedIndex = 0; //select the first item
|
||||||
for (int i = 0; i < nic.IFCount; i++)
|
|
||||||
{
|
|
||||||
NetworkInterface nif = nic.GetInterface(i);
|
|
||||||
cbDest.Items.Add(nif.nic_name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (ToEdit.TheTest == NetTestType.NeedsForbiddenVLAN ||
|
if (cbTest.Items.Contains(RuleToEdit.Action.ToString()))
|
||||||
ToEdit.TheTest == NetTestType.NeedsTaggedVLAN ||
|
|
||||||
ToEdit.TheTest == NetTestType.NeedsUntaggedVLAN )
|
|
||||||
{
|
|
||||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
|
||||||
foreach (string nname in sItem.NICNames())
|
|
||||||
{
|
{
|
||||||
NetworkCard nic = sItem.NicFromName(nname);
|
cbTest.SelectedItem = RuleToEdit.Action.ToString();
|
||||||
if (!nic.NicCanDoVLANs()) continue;
|
|
||||||
for (int i = 0; i < nic.IFCount; i++)
|
|
||||||
{
|
|
||||||
NetworkInterface nif = nic.GetInterface(i);
|
|
||||||
foreach (VLANName vn in theNet.VlanNames)
|
|
||||||
{
|
|
||||||
cbDest.Items.Add(nif.nic_name + " - " + vn.ID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
cbTest.SelectedIndex = 0;//select first item
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //List all the hosts
|
{
|
||||||
|
cbSource.Items.Clear();
|
||||||
foreach (string host in HostNames)
|
foreach (string host in HostNames)
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(host);
|
cbSource.Items.Add(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ToEdit.TheTest == NetTestType.SuccessfullyPings)
|
//The tests are just the list of available tests.
|
||||||
{ //List all the network broadcasts
|
cbTest.Items.Clear();
|
||||||
foreach (string subnet in Broadcasts)
|
foreach (string test in Enum.GetNames(typeof(NetTestType)))
|
||||||
|
{
|
||||||
|
tList.Add(test);
|
||||||
|
}
|
||||||
|
tList.Sort(); //Sort them alphabetically. Just to make things easier
|
||||||
|
foreach (string test in tList)
|
||||||
|
{
|
||||||
|
cbTest.Items.Add(test);
|
||||||
|
}
|
||||||
|
|
||||||
|
cbDest.Items.Clear();
|
||||||
|
if (ToEdit.TheTest == NetTestType.NeedsRouteToNet)
|
||||||
|
{ //List all the networks
|
||||||
|
foreach (string subnet in Networks)
|
||||||
{
|
{
|
||||||
cbDest.Items.Add(subnet);
|
cbDest.Items.Add(subnet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (ToEdit.TheTest == NetTestType.DHCPServerEnabled)
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(true.ToString());
|
||||||
|
cbDest.Items.Add(false.ToString());
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.HelpRequest)
|
||||||
|
{
|
||||||
|
foreach (string HelpLevel in Enum.GetNames(typeof(NetTestVerbosity)))
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(HelpLevel);
|
||||||
|
}
|
||||||
|
cbDest.Items.Add("?Button");
|
||||||
|
cbDest.Items.Add("ViewButton");
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.ReadContextHelp)
|
||||||
|
{
|
||||||
|
cbSource.Items.Clear();
|
||||||
|
List<string> theNames = new List<string>();
|
||||||
|
theNames.AddRange(Enum.GetNames(typeof(HelpTopics)));
|
||||||
|
theNames.Sort();
|
||||||
|
theNames.Remove("None");
|
||||||
|
foreach (string ContextHelp in theNames)
|
||||||
|
{
|
||||||
|
cbSource.Items.Add(ContextHelp);
|
||||||
|
}
|
||||||
|
cbDest.Items.Add(NB.Translate("_Read"));
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockAll || ToEdit.TheTest == NetTestType.LockGateway)
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(NB.Translate("_All"));
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockDHCP)
|
||||||
|
{
|
||||||
|
//return all the dhcp ranges
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (string ip in sItem.DHCPStrings(false))
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockIP)
|
||||||
|
{
|
||||||
|
//return all the dhcp ranges
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (IPAddress ip in sItem.IPAddressList())
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(ip.GetIPString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockRoute)
|
||||||
|
{
|
||||||
|
//return all the dhcp ranges
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (IPAddress ip in sItem.ListRoutes())
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(ip.GetIPString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockNic)
|
||||||
|
{
|
||||||
|
//return all the dhcp ranges
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (string nname in sItem.NICNames())
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(nname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockVLANNames)
|
||||||
|
{
|
||||||
|
//No items for lockvlannames
|
||||||
|
cbDest.Items.Add(NB.Translate("_All"));
|
||||||
|
cbSource.Items.Clear();
|
||||||
|
cbSource.Items.Add(NB.Translate("_All"));
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockNicVLAN)
|
||||||
|
{
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (string nname in sItem.NICNames())
|
||||||
|
{
|
||||||
|
NetworkCard nic = sItem.NicFromName(nname);
|
||||||
|
if (!nic.NicCanDoVLANs()) continue;
|
||||||
|
cbDest.Items.Add(nic.NicName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockVLANsOnHost)
|
||||||
|
{
|
||||||
|
//No items for lockvlannames
|
||||||
|
cbDest.Items.Add(NB.Translate("_All"));
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.LockInterfaceVLAN)
|
||||||
|
{
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (string nname in sItem.NICNames())
|
||||||
|
{
|
||||||
|
NetworkCard nic = sItem.NicFromName(nname);
|
||||||
|
if (!nic.NicCanDoVLANs()) continue;
|
||||||
|
for (int i = 0; i < nic.IFCount; i++)
|
||||||
|
{
|
||||||
|
NetworkInterface nif = nic.GetInterface(i);
|
||||||
|
cbDest.Items.Add(nif.nic_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ToEdit.TheTest == NetTestType.NeedsForbiddenVLAN ||
|
||||||
|
ToEdit.TheTest == NetTestType.NeedsTaggedVLAN ||
|
||||||
|
ToEdit.TheTest == NetTestType.NeedsUntaggedVLAN)
|
||||||
|
{
|
||||||
|
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||||
|
foreach (string nname in sItem.NICNames())
|
||||||
|
{
|
||||||
|
NetworkCard nic = sItem.NicFromName(nname);
|
||||||
|
if (!nic.NicCanDoVLANs()) continue;
|
||||||
|
for (int i = 0; i < nic.IFCount; i++)
|
||||||
|
{
|
||||||
|
NetworkInterface nif = nic.GetInterface(i);
|
||||||
|
foreach (VLANName vn in theNet.VlanNames)
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(nif.nic_name + " - " + vn.ID.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //List all the hosts
|
||||||
|
foreach (string host in HostNames)
|
||||||
|
{
|
||||||
|
cbDest.Items.Add(host);
|
||||||
|
}
|
||||||
|
|
||||||
//Now we select all the appropriate items.
|
if (ToEdit.TheTest == NetTestType.SuccessfullyPings)
|
||||||
if(cbSource.Items.Contains(ToEdit.sHost))
|
{ //List all the network broadcasts
|
||||||
{
|
foreach (string subnet in Broadcasts)
|
||||||
cbSource.SelectedItem = ToEdit.sHost;
|
{
|
||||||
}
|
cbDest.Items.Add(subnet);
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
if(cbSource.Items.Count > 0)
|
}
|
||||||
cbSource.SelectedIndex = 0; //select the first item
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cbDest.Items.Contains(ToEdit.dHost))
|
//Now we select all the appropriate items.
|
||||||
{
|
if (cbSource.Items.Contains(ToEdit.sHost))
|
||||||
cbDest.SelectedItem = ToEdit.dHost;
|
{
|
||||||
}
|
cbSource.SelectedItem = ToEdit.sHost;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
if (cbDest.Items.Count > 0)
|
{
|
||||||
cbDest.SelectedIndex = 0; //select the first item
|
if (cbSource.Items.Count > 0)
|
||||||
}
|
cbSource.SelectedIndex = 0; //select the first item
|
||||||
|
}
|
||||||
|
|
||||||
if (cbTest.Items.Contains(ToEdit.TheTest.ToString()))
|
if (cbDest.Items.Contains(ToEdit.dHost))
|
||||||
{
|
{
|
||||||
cbTest.SelectedItem = ToEdit.TheTest.ToString();
|
cbDest.SelectedItem = ToEdit.dHost;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cbTest.Items.Count > 0)
|
if (cbDest.Items.Count > 0)
|
||||||
cbTest.SelectedIndex = 0; //select the first item
|
cbDest.SelectedIndex = 0; //select the first item
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cbTest.Items.Contains(ToEdit.TheTest.ToString()))
|
||||||
|
{
|
||||||
|
cbTest.SelectedItem = ToEdit.TheTest.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (cbTest.Items.Count > 0)
|
||||||
|
cbTest.SelectedIndex = 0; //select the first item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
processing = false;
|
processing = false;
|
||||||
}
|
}
|
||||||
@ -274,77 +376,121 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
if (processing) return true; //If we are processing, we are all OK.
|
if (processing) return true; //If we are processing, we are all OK.
|
||||||
Network theNet = NB.GetNetwork();
|
Network theNet = NB.GetNetwork();
|
||||||
NetTestType ntt = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString());
|
if (EditingFirewallRule)
|
||||||
if (ntt == NetTestType.ReadContextHelp) return true;
|
{
|
||||||
if (ntt == NetTestType.DHCPServerEnabled) return true;
|
//The source cannot be the dest.
|
||||||
if (cbSource.SelectedItem.ToString() == cbDest.SelectedItem.ToString() && ntt != NetTestType.HelpRequest)
|
//The values need to exist
|
||||||
return false; //Source cannot equal dest
|
|
||||||
if (theNet.GetDeviceFromName(cbSource.SelectedItem.ToString()) == null)
|
|
||||||
return false; //This should never happen with a drop-down list, but just in case...
|
|
||||||
if (ntt == NetTestType.LockAll || ntt == NetTestType.LockDHCP || ntt == NetTestType.LockIP ||
|
|
||||||
ntt == NetTestType.LockNic || ntt == NetTestType.LockRoute)
|
|
||||||
return true;
|
return true;
|
||||||
if (ntt == NetTestType.NeedsRouteToNet)
|
|
||||||
{
|
|
||||||
//We should have a network, not a host.
|
|
||||||
}
|
|
||||||
else if (ntt == NetTestType.HelpRequest)
|
|
||||||
{
|
|
||||||
//This uses a verbosity
|
|
||||||
}
|
|
||||||
else if (ntt == NetTestType.LockInterfaceVLAN || ntt == NetTestType.LockNicVLAN ||
|
|
||||||
ntt == NetTestType.LockVLANNames || ntt == NetTestType.LockVLANsOnHost)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (ntt == NetTestType.NeedsUntaggedVLAN || ntt == NetTestType.NeedsTaggedVLAN ||
|
|
||||||
ntt == NetTestType.NeedsForbiddenVLAN)
|
|
||||||
{
|
|
||||||
//We have an interface and a network ID. Verify they exist
|
|
||||||
if (cbDest.SelectedIndex < 0) return false;
|
|
||||||
Match result = Regex.Match(cbDest.SelectedItem.ToString(), @"(?<interface>[A-z:0-9]+) - (?<id>\d+)");
|
|
||||||
if (result.Groups["interface"] != null && result.Groups["id"] != null)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ntt == NetTestType.SuccessfullyPings) return true;
|
NetTestType ntt = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString());
|
||||||
if (theNet.GetDeviceFromName(cbDest.SelectedItem.ToString()) == null)
|
if (ntt == NetTestType.ReadContextHelp) return true;
|
||||||
|
if (ntt == NetTestType.DHCPServerEnabled) return true;
|
||||||
|
if (cbSource.SelectedItem.ToString() == cbDest.SelectedItem.ToString() && ntt != NetTestType.HelpRequest)
|
||||||
|
return false; //Source cannot equal dest
|
||||||
|
if (theNet.GetDeviceFromName(cbSource.SelectedItem.ToString()) == null)
|
||||||
return false; //This should never happen with a drop-down list, but just in case...
|
return false; //This should never happen with a drop-down list, but just in case...
|
||||||
|
if (ntt == NetTestType.LockAll || ntt == NetTestType.LockDHCP || ntt == NetTestType.LockIP ||
|
||||||
|
ntt == NetTestType.LockNic || ntt == NetTestType.LockRoute)
|
||||||
|
return true;
|
||||||
|
if (ntt == NetTestType.NeedsRouteToNet)
|
||||||
|
{
|
||||||
|
//We should have a network, not a host.
|
||||||
|
}
|
||||||
|
else if (ntt == NetTestType.HelpRequest)
|
||||||
|
{
|
||||||
|
//This uses a verbosity
|
||||||
|
}
|
||||||
|
else if (ntt == NetTestType.LockInterfaceVLAN || ntt == NetTestType.LockNicVLAN ||
|
||||||
|
ntt == NetTestType.LockVLANNames || ntt == NetTestType.LockVLANsOnHost)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (ntt == NetTestType.NeedsUntaggedVLAN || ntt == NetTestType.NeedsTaggedVLAN ||
|
||||||
|
ntt == NetTestType.NeedsForbiddenVLAN)
|
||||||
|
{
|
||||||
|
//We have an interface and a network ID. Verify they exist
|
||||||
|
if (cbDest.SelectedIndex < 0) return false;
|
||||||
|
Match result = Regex.Match(cbDest.SelectedItem.ToString(), @"(?<interface>[A-z:0-9]+) - (?<id>\d+)");
|
||||||
|
if (result.Groups["interface"] != null && result.Groups["id"] != null)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ntt == NetTestType.SuccessfullyPings) return true;
|
||||||
|
if (theNet.GetDeviceFromName(cbDest.SelectedItem.ToString()) == null)
|
||||||
|
return false; //This should never happen with a drop-down list, but just in case...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbTest_SelectedValueChanged(object sender, EventArgs e)
|
private void cbTest_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (EditingFirewallRule)
|
||||||
|
{
|
||||||
|
RuleToEdit.Action = NB.ParseEnum<FirewallRuleType>(cbTest.SelectedItem.ToString());
|
||||||
|
if (!processing)
|
||||||
|
UpdateForm();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ToEdit.TheTest = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString());
|
ToEdit.TheTest = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString());
|
||||||
if (!processing)
|
if (!processing)
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbSource_SelectedValueChanged(object sender, EventArgs e)
|
private void cbSource_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (validate_choices())
|
if (EditingFirewallRule)
|
||||||
{
|
{
|
||||||
ToEdit.sHost = cbSource.SelectedItem.ToString();
|
if (validate_choices())
|
||||||
|
{
|
||||||
|
RuleToEdit.Source = cbSource.SelectedItem.ToString();
|
||||||
|
if (!processing) UpdateForm();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!processing)
|
||||||
|
UpdateForm();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!processing)
|
{
|
||||||
|
if (validate_choices())
|
||||||
|
{
|
||||||
|
ToEdit.sHost = cbSource.SelectedItem.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!processing)
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbDest_SelectedValueChanged(object sender, EventArgs e)
|
private void cbDest_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (validate_choices())
|
if (EditingFirewallRule)
|
||||||
{
|
{
|
||||||
ToEdit.dHost = cbDest.SelectedItem.ToString();
|
if (validate_choices())
|
||||||
|
{
|
||||||
|
RuleToEdit.Destination = cbDest.SelectedItem.ToString();
|
||||||
|
if (!processing) UpdateForm();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!processing)
|
||||||
|
UpdateForm();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!processing)
|
{
|
||||||
|
if (validate_choices())
|
||||||
|
{
|
||||||
|
ToEdit.dHost = cbDest.SelectedItem.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!processing)
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace EduNetworkBuilder
|
|||||||
public bool CanAddNics = false;
|
public bool CanAddNics = false;
|
||||||
public Color BackgroundColor = Color.Empty;
|
public Color BackgroundColor = Color.Empty;
|
||||||
protected Color MorphColor = Color.Empty;
|
protected Color MorphColor = Color.Empty;
|
||||||
protected List<FirewallRule> FirewallRules = new List<FirewallRule>();
|
public List<FirewallRule> FirewallRules = new List<FirewallRule>();
|
||||||
|
|
||||||
public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth)
|
public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth)
|
||||||
{
|
{
|
||||||
@ -373,6 +373,10 @@ namespace EduNetworkBuilder
|
|||||||
IPAddress dhcpip = new IPAddress(Individual);
|
IPAddress dhcpip = new IPAddress(Individual);
|
||||||
DHCPRanges.Add(dhcpip);
|
DHCPRanges.Add(dhcpip);
|
||||||
break;
|
break;
|
||||||
|
case "firwallrule":
|
||||||
|
FirewallRule fwr = new FirewallRule(Individual);
|
||||||
|
FirewallRules.Add(fwr);
|
||||||
|
break;
|
||||||
case "morphcolor":
|
case "morphcolor":
|
||||||
MorphColor = Color.FromName(Individual.InnerText);
|
MorphColor = Color.FromName(Individual.InnerText);
|
||||||
break;
|
break;
|
||||||
@ -407,6 +411,10 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
dhcp.Save(writer, "dhcprange");
|
dhcp.Save(writer, "dhcprange");
|
||||||
}
|
}
|
||||||
|
foreach (FirewallRule fwr in FirewallRules)
|
||||||
|
{
|
||||||
|
fwr.Save(writer, "firewallrule");
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ namespace EduNetworkBuilder
|
|||||||
lblStartingHelp.Text = NB.Translate("OW_lblStartingHelp");
|
lblStartingHelp.Text = NB.Translate("OW_lblStartingHelp");
|
||||||
cbVLANs.Text = NB.Translate("OW_cbVLANs");
|
cbVLANs.Text = NB.Translate("OW_cbVLANs");
|
||||||
cb_ColoredPackets.Text = NB.Translate("OW_OWVLANColoredPackets");
|
cb_ColoredPackets.Text = NB.Translate("OW_OWVLANColoredPackets");
|
||||||
|
cbFirewallEnabled.Text = NB.Translate("OW_cbFirewallEnabled");
|
||||||
Text = NB.Translate("OW_Form");
|
Text = NB.Translate("OW_Form");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ namespace EduNetworkBuilder
|
|||||||
cbStartingHelpLevel.Items.Add(helplevel);
|
cbStartingHelpLevel.Items.Add(helplevel);
|
||||||
}
|
}
|
||||||
cbStartingHelpLevel.SelectedItem = myNet.StartingHelpLevel.ToString();
|
cbStartingHelpLevel.SelectedItem = myNet.StartingHelpLevel.ToString();
|
||||||
|
cbVLANs_CheckedChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveValuesToNetwork()
|
private void SaveValuesToNetwork()
|
||||||
|
@ -1609,6 +1609,10 @@
|
|||||||
<value>When packets are passing across a VLAN link, color the packets so we can visualize them better.</value>
|
<value>When packets are passing across a VLAN link, color the packets so we can visualize them better.</value>
|
||||||
<comment>OW_OWVLANColoredPacketsTT = When packets are passing across a VLAN link, color the packets so we can visualize them better.</comment>
|
<comment>OW_OWVLANColoredPacketsTT = When packets are passing across a VLAN link, color the packets so we can visualize them better.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="DC_btnFirewall" xml:space="preserve">
|
||||||
|
<value>Firewall</value>
|
||||||
|
<comment>DC_btnFirewall = Firewall</comment>
|
||||||
|
</data>
|
||||||
<data name="NB_LockedOut" xml:space="preserve">
|
<data name="NB_LockedOut" xml:space="preserve">
|
||||||
<value>Locked Out. Cannot determine settings for this device.</value>
|
<value>Locked Out. Cannot determine settings for this device.</value>
|
||||||
<comment>NB_LockedOut = Locked Out. Cannot determine settings for this device.</comment>
|
<comment>NB_LockedOut = Locked Out. Cannot determine settings for this device.</comment>
|
||||||
@ -1621,4 +1625,12 @@
|
|||||||
<value>ERROR: Packet forbidden by Management Interface VLAN</value>
|
<value>ERROR: Packet forbidden by Management Interface VLAN</value>
|
||||||
<comment>ND_PrepPackVLANErr = ERROR: Packet forbidden by Management Interface VLAN</comment>
|
<comment>ND_PrepPackVLANErr = ERROR: Packet forbidden by Management Interface VLAN</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="NTE_lblTestFW" xml:space="preserve">
|
||||||
|
<value>Action</value>
|
||||||
|
<comment>NTE_lblTestFW = Action</comment>
|
||||||
|
</data>
|
||||||
|
<data name="OW_cbFirewallEnabled" xml:space="preserve">
|
||||||
|
<value>Adv. Firewall Enabled</value>
|
||||||
|
<comment>OW_cbFirewallEnabled = Adv. Firewall Enabled</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user