Compare commits
25 Commits
master
...
Developmen
Author | SHA1 | Date | |
---|---|---|---|
fdc3877e4f | |||
93f0c6e4a3 | |||
5d06bfd8f3 | |||
a0790918fb | |||
c2f41ae5b9 | |||
f5cb1875d2 | |||
5e39a2896d | |||
4a72518ccc | |||
cecd14a901 | |||
073cba135e | |||
e27d960403 | |||
4014439162 | |||
c0b655386e | |||
199ecbcf06 | |||
966f4fe8a8 | |||
b1a13b95bc | |||
fded1f454a | |||
a72aec9f9a | |||
bed1a8a846 | |||
9bf9d58c48 | |||
2a17fba36c | |||
886e1d7911 | |||
06eb896558 | |||
ddebafeec9 | |||
2ae5781bea |
@ -62,12 +62,12 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public ActionClass RunAction(int WhichIndex, bool NoteAllChanges = false)
|
||||
public ActionClass RunAction(int WhichIndex)
|
||||
{
|
||||
if (CurrentNetAction == null) return null;
|
||||
if (WhichIndex < CurrentNetAction.Actions.Count)
|
||||
{
|
||||
CurrentNetAction.Actions[WhichIndex].DoAction(NoteAllChanges);
|
||||
CurrentNetAction.Actions[WhichIndex].DoAction();
|
||||
return CurrentNetAction.Actions[WhichIndex];
|
||||
}
|
||||
return null;
|
||||
@ -180,21 +180,19 @@ namespace EduNetworkBuilder
|
||||
public NetworkComponentType newItemType = NetworkComponentType.none; //Making new device
|
||||
public NetworkComponent ChangedComponent = null;
|
||||
|
||||
public void DoAction(bool NoteAllChanges=false)
|
||||
public void DoAction()
|
||||
{
|
||||
Network myNet = NB.GetNetwork();
|
||||
NetworkDevice source = myNet.GetDeviceFromID(SourceID);
|
||||
NetworkComponent sourceC = myNet.GetComponentFromID(SourceID);
|
||||
NetworkLink sourceNL;
|
||||
string indent = " ";
|
||||
switch (Action)
|
||||
{
|
||||
case NBAction.changecomponent:
|
||||
//This could be a link or a device we are changing.
|
||||
if(ChangedComponent is NetworkDevice)
|
||||
{
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_ChangeDevice") + " " + source.hostname); }
|
||||
source.UpdateFromComponent(ChangedComponent, NoteAllChanges); //Copy any changes across
|
||||
source.UpdateFromComponent(ChangedComponent); //Copy any changes across
|
||||
source.SetImageFromType(); //The image was not saved. Re-make it
|
||||
}
|
||||
else
|
||||
@ -202,7 +200,6 @@ namespace EduNetworkBuilder
|
||||
if(source != null)
|
||||
myNet.RemoveComponent(source);
|
||||
sourceNL = (NetworkLink)ChangedComponent;
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Replace_Link") + " " + sourceNL.Src.HostName + " - " + sourceNL.Dst.HostName); }
|
||||
myNet.MarkAsLinked(sourceNL.Src, sourceNL.GetUniqueIdentifier);
|
||||
myNet.MarkAsLinked(sourceNL.Dst, sourceNL.GetUniqueIdentifier);
|
||||
myNet.AddItem(ChangedComponent);
|
||||
@ -215,7 +212,6 @@ namespace EduNetworkBuilder
|
||||
source.ChangeLocation(Location);
|
||||
source.UnHide(); //In case it was hidden
|
||||
if (NB.DebugActions) { Console.WriteLine("Changing location for: " + source + " " + Location.X + ":" +Location.Y); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_MoveDevice") + " " + source.hostname + " - " +Location.X + ":" + Location.Y); }
|
||||
}
|
||||
break;
|
||||
case NBAction.deletecomponent:
|
||||
@ -232,7 +228,6 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
myNet.RemoveComponent(source);
|
||||
if (NB.DebugActions) { Console.WriteLine("Deleting a device: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_DeleteDevice") + " " + source.hostname + " - " + source.myType.ToString()); }
|
||||
} else if(sourceC != null && sourceC is NetworkLink)
|
||||
{
|
||||
if (myNet.ItemIsCritical(sourceC.hostname))
|
||||
@ -241,7 +236,6 @@ namespace EduNetworkBuilder
|
||||
SourceL.Destroy(); //Mark both ends as being deleted
|
||||
myNet.RemoveComponent(SourceL); //Get rid of this link
|
||||
if (NB.DebugActions) { Console.WriteLine("Deleting a link: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_DeleteLink") + " " + SourceL.Src.HostName + " - " + SourceL.Dst.HostName); }
|
||||
}
|
||||
break;
|
||||
case NBAction.newdevice:
|
||||
@ -260,15 +254,13 @@ namespace EduNetworkBuilder
|
||||
if (myNet.BlockedByTree(BottomLeft)) CanDo = false;
|
||||
if (CanDo)
|
||||
{
|
||||
NetworkDevice newdevice = (NetworkDevice)myNet.AddItem(newItemType, Location);
|
||||
|
||||
if (NB.DebugActions && source != null) { Console.WriteLine("Adding a Device: " + newdevice.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_AddDevice") + " " + newdevice.hostname + " - " + newdevice.myType.ToString()); }
|
||||
ChangedComponent = (NetworkDevice)myNet.AddItem(newItemType, Location);
|
||||
if (NB.DebugActions && source != null) { Console.WriteLine("Adding a Device: " + source.hostname); }
|
||||
}
|
||||
else
|
||||
{
|
||||
NB.SetBuilderWindowStatis(NB.Translate("NB_TreePlacementError"));
|
||||
if (NB.DebugActions) { Console.WriteLine("Unable to add device: " + ChangedComponent.hostname); }
|
||||
if (NB.DebugActions) { Console.WriteLine("Unable to add device: " + source.hostname); }
|
||||
}
|
||||
break;
|
||||
case NBAction.dhcp:
|
||||
@ -276,25 +268,20 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
source.DHCPRequestFromHere();
|
||||
if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_RequestDHCP") + " " + source.hostname); }
|
||||
}
|
||||
break;
|
||||
case NBAction.arp:
|
||||
if (source != null)
|
||||
{
|
||||
//We have not implimented this well. But, here it is anyway. We would do this if showing ethernet stuff
|
||||
source.AskArpFromHere(Destination);
|
||||
if (NB.DebugActions) { Console.WriteLine("Requesting ARP: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_RequestARP") + " " + source.hostname + " - " + Destination.GetIPString); }
|
||||
if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source.hostname); }
|
||||
}
|
||||
break;
|
||||
case NBAction.cleararp:
|
||||
if (source != null)
|
||||
{
|
||||
//We have not implimented this well. But, here it is anyway. We would do this if showing ethernet stuff
|
||||
source.ClearArps();
|
||||
if (NB.DebugActions) { Console.WriteLine("Clearing ARP: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_ClearArp") + " " + source.hostname + " - " + Destination.GetIPString); }
|
||||
}
|
||||
break;
|
||||
case NBAction.ping:
|
||||
@ -302,7 +289,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
source.PingFromHere(Destination);
|
||||
if (NB.DebugActions) { Console.WriteLine("Pinging " + Destination.GetIPString + " from " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_DoPing") + " " + source.hostname + " - " + Destination.GetIPString); }
|
||||
}
|
||||
break;
|
||||
case NBAction.traceroute:
|
||||
@ -310,7 +296,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
source.TracerouteFromHere(Destination);
|
||||
if (NB.DebugActions) { Console.WriteLine("Traceroute: " + Destination.GetIPString + " from " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_DoTraceroute") + " " + source.hostname + " - " + Destination.GetIPString ); }
|
||||
}
|
||||
break;
|
||||
case NBAction.replace:
|
||||
@ -325,7 +310,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
myNet.RegisterDeviceReplaced(source.hostname); //replace it.
|
||||
if (NB.DebugActions) { Console.WriteLine("Replacing device: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Replace_Device") + " " + source.hostname); }
|
||||
}
|
||||
else if (sourceC is NetworkLink)
|
||||
{
|
||||
@ -338,32 +322,27 @@ namespace EduNetworkBuilder
|
||||
myNet.RemoveComponent(sourceNL);
|
||||
NetworkLink nNL = new NetworkLink(sourceID, destID, LinkType.normal);
|
||||
myNet.AddItem(nNL);
|
||||
if (NB.DebugActions) { Console.WriteLine("Replacing link: " + sourceID.HostName + " - " + destID.HostName); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Replace_Link") + " " + sourceID.HostName + " - " + destID.HostName); }
|
||||
if (NB.DebugActions) { Console.WriteLine("Replacing link: " + source.hostname); }
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NBAction.replaceUPS:
|
||||
myNet.RegisterUPSAdded(source.hostname);
|
||||
if (NB.DebugActions) { Console.WriteLine("Replacing UPS on: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Replace_UPS") + " " + source.hostname); }
|
||||
break;
|
||||
case NBAction.poweroff:
|
||||
source.PowerOff = true;
|
||||
myNet.RegisterDeviceReset(source.hostname);
|
||||
if (NB.DebugActions) { Console.WriteLine("Powering off: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Powering_OFF") + " " + source.hostname); }
|
||||
break;
|
||||
case NBAction.poweron:
|
||||
source.PowerOff = false;
|
||||
if (NB.DebugActions) { Console.WriteLine("Powering on: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Powering_ON") + " " + source.hostname); }
|
||||
//We might see about exploding the device here.
|
||||
break;
|
||||
case NBAction.reset:
|
||||
source.ClearIPs(); //reset the device - IPs and VLANs
|
||||
if (NB.DebugActions) { Console.WriteLine("Resetting: " + source.hostname); }
|
||||
if (NoteAllChanges) { NB.AddNetMessage("", indent + NB.Translate("AC_Resetting") + " " + source.hostname); }
|
||||
//We might see about exploding the device here.
|
||||
break;
|
||||
|
||||
|
@ -357,7 +357,7 @@ namespace EduNetworkBuilder
|
||||
tnic = ndCLonedItem.AddNic(WhatToAdd[cbQuestions.SelectedIndex]);
|
||||
}
|
||||
}
|
||||
if(tnet != null)
|
||||
if(tnet != null && tnic != null)
|
||||
tnet.RegisterNICAdded(ndCLonedItem.hostname, tnic.NicName());
|
||||
}
|
||||
UpdateForm();
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\WiX.3.11.2\build\wix.props" Condition="Exists('..\packages\WiX.3.11.2\build\wix.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@ -23,19 +22,17 @@
|
||||
<UpdatePeriodically>true</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://tyounglightsys.com/EduNetworkBuilder/v1/</InstallUrl>
|
||||
<InstallUrl>http://tyounglightsys.ddns.info/EduNetworkBuilder/v1/</InstallUrl>
|
||||
<UpdateUrl>http://tyounglightsys.ddns.info/EduNetworkBuilder/v1/</UpdateUrl>
|
||||
<ProductName>EduNetworkBuilder</ProductName>
|
||||
<PublisherName>Tim Young</PublisherName>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.htm</WebPage>
|
||||
<ApplicationRevision>54</ApplicationRevision>
|
||||
<ApplicationRevision>51</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -122,6 +119,7 @@
|
||||
<DependentUpon>ListBoxWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NB.cs" />
|
||||
<Compile Include="NBRenumberData.cs" />
|
||||
<Compile Include="NBSettings.cs" />
|
||||
<Compile Include="NetShape.cs" />
|
||||
<Compile Include="NetTest.cs" />
|
||||
@ -266,7 +264,6 @@
|
||||
<DependentUpon>VLANConfig.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="EduNetworkBuilder_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@ -479,12 +476,6 @@
|
||||
<Content Include="Resources\NBIco.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\WiX.3.11.2\build\wix.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WiX.3.11.2\build\wix.props'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
@ -80,6 +80,11 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIP(UInt32 newIP)
|
||||
{
|
||||
_ip = newIP;
|
||||
}
|
||||
|
||||
public bool Equals(NB_IPAddress CompareWith)
|
||||
{
|
||||
if (_ip != CompareWith._ip) return false;
|
||||
@ -241,6 +246,10 @@ namespace EduNetworkBuilder
|
||||
get { return NetworkAddress + ~_mask; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of hosts in the subnet.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<UInt32> Hosts()
|
||||
{
|
||||
for (var host = NetworkAddress + 1; host < BroadcastAddress; host++)
|
||||
|
1
EduNetworkBuilder/IPAddressEntry.Designer.cs
generated
1
EduNetworkBuilder/IPAddressEntry.Designer.cs
generated
@ -103,6 +103,7 @@
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
this.btnCancel.CausesValidation = false;
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
|
@ -17,10 +17,24 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
NB_IPAddress WhatToEdit;
|
||||
NB_IPAddress DHCPInterface=null;
|
||||
bool WellDone = true;
|
||||
bool WellDone = false;
|
||||
NetworkDevice ParentDevice = null;
|
||||
Point StartLocation = new Point (50,50);
|
||||
|
||||
NB_IPAddress SavedIPAddress = null;
|
||||
ToolTip myTooltip = new ToolTip();
|
||||
|
||||
//variable to hold true if the for is closing
|
||||
private bool isFormClosing = false;
|
||||
// Contant for the close message
|
||||
private const int WM_CLOSE = 16;
|
||||
//override the WndProc msg to trap the WM_CLOSE message
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_CLOSE)
|
||||
isFormClosing = true;
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
public IPAddressEntry(NB_IPAddress toEdit, NetworkDevice ToEdit, Form ParentForm, bool JustPinging=false)
|
||||
{
|
||||
@ -34,6 +48,7 @@ namespace EduNetworkBuilder
|
||||
ParentDevice = ToEdit;
|
||||
Network myNet = NB.GetNetwork();
|
||||
NB_IPAddress lastIP = myNet.RetrieveLastIP();
|
||||
SavedIPAddress = new NB_IPAddress(toEdit);
|
||||
WhatToEdit = toEdit;
|
||||
string hostname = "";
|
||||
if (ToEdit != null)
|
||||
@ -148,6 +163,7 @@ namespace EduNetworkBuilder
|
||||
WhatToEdit.Reparse(tbIPAddress.Text, tbNetmask.Text, tbGateway.Text);
|
||||
Network myNet = NB.GetNetwork();
|
||||
myNet.StoreLastIP(WhatToEdit);
|
||||
WellDone = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
@ -182,13 +198,16 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(SavedIPAddress != null)
|
||||
WhatToEdit.Reparse(SavedIPAddress.GetIPString, SavedIPAddress.GetMaskString, SavedIPAddress.GetGateway.ToIpString());
|
||||
UpdateFieldsFromAddress();
|
||||
WellDone = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void tbGateway_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (isFormClosing) return;
|
||||
|
||||
Network mynet = NB.GetNetwork();
|
||||
if (ParentDevice != null)
|
||||
{
|
||||
@ -216,6 +235,8 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void tbNetmask_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (isFormClosing) return;
|
||||
|
||||
UInt32 taddress = tbNetmask.Text.ParseIp();
|
||||
tbNetmask.Text = taddress.ToIpString();
|
||||
if (DHCPInterface != null)
|
||||
@ -231,6 +252,8 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void tbIPAddress_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (isFormClosing) return;
|
||||
|
||||
UInt32 taddress;
|
||||
Network mynet = NB.GetNetwork();
|
||||
NB_IPAddress tIPAddress = null;
|
||||
@ -238,9 +261,11 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
tIPAddress = mynet.DNSLookup(ParentDevice, tbIPAddress.Text);
|
||||
}
|
||||
if(tIPAddress != null)
|
||||
if (tIPAddress != null) //device name used, convert to IP address and netmask
|
||||
{
|
||||
taddress = tIPAddress.GetIP;
|
||||
if (DHCPInterface == null)
|
||||
tbNetmask.Text = tIPAddress.GetMaskString;
|
||||
}
|
||||
else
|
||||
taddress = tbIPAddress.Text.ParseIp();
|
||||
@ -258,5 +283,27 @@ namespace EduNetworkBuilder
|
||||
if (tLocation.X < 0 || tLocation.Y < 0) tLocation = new Point(50, 50);
|
||||
Location = tLocation;
|
||||
}
|
||||
|
||||
public void ShowAsSubnetGateway()
|
||||
{
|
||||
lblIP.Text = NB.Translate("IPE_Network");
|
||||
Text = NB.Translate("NB_Subnet");
|
||||
|
||||
myTooltip.AutoPopDelay = 5000;
|
||||
myTooltip.InitialDelay = 1000;
|
||||
myTooltip.ReshowDelay = 500;
|
||||
// Force the ToolTip text to be displayed whether or not the form is active.
|
||||
myTooltip.ShowAlways = true;
|
||||
|
||||
myTooltip.SetToolTip(tbIPAddress, NB.Translate("IPE_NetworkTooltip"));
|
||||
myTooltip.SetToolTip(tbGateway, NB.Translate("IPE_GatewayTooltip"));
|
||||
myTooltip.SetToolTip(tbNetmask, NB.Translate("IPE_NetmaskTooltip"));
|
||||
|
||||
myTooltip.SetToolTip(lblIP, NB.Translate("IPE_NetworkTooltip"));
|
||||
myTooltip.SetToolTip(lblGateway, NB.Translate("IPE_GatewayTooltip"));
|
||||
myTooltip.SetToolTip(lblNetmask, NB.Translate("IPE_NetmaskTooltip"));
|
||||
|
||||
ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
89
EduNetworkBuilder/LinkEditor.Designer.cs
generated
89
EduNetworkBuilder/LinkEditor.Designer.cs
generated
@ -35,63 +35,53 @@
|
||||
this.btnLink = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.cbLinkType = new System.Windows.Forms.ComboBox();
|
||||
this.pbSource = new System.Windows.Forms.PictureBox();
|
||||
this.pbDest = new System.Windows.Forms.PictureBox();
|
||||
this.lblInstructions = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbSource)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbDest)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbSrcHost
|
||||
//
|
||||
this.lbSrcHost.FormattingEnabled = true;
|
||||
this.lbSrcHost.ItemHeight = 29;
|
||||
this.lbSrcHost.Location = new System.Drawing.Point(20, 185);
|
||||
this.lbSrcHost.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbSrcHost.ItemHeight = 16;
|
||||
this.lbSrcHost.Location = new System.Drawing.Point(9, 18);
|
||||
this.lbSrcHost.Name = "lbSrcHost";
|
||||
this.lbSrcHost.Size = new System.Drawing.Size(177, 149);
|
||||
this.lbSrcHost.Size = new System.Drawing.Size(103, 84);
|
||||
this.lbSrcHost.TabIndex = 0;
|
||||
this.lbSrcHost.SelectedIndexChanged += new System.EventHandler(this.lbSrcHost_SelectedIndexChanged);
|
||||
//
|
||||
// lbSrcNic
|
||||
//
|
||||
this.lbSrcNic.FormattingEnabled = true;
|
||||
this.lbSrcNic.ItemHeight = 29;
|
||||
this.lbSrcNic.Location = new System.Drawing.Point(210, 185);
|
||||
this.lbSrcNic.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbSrcNic.ItemHeight = 16;
|
||||
this.lbSrcNic.Location = new System.Drawing.Point(118, 18);
|
||||
this.lbSrcNic.Name = "lbSrcNic";
|
||||
this.lbSrcNic.Size = new System.Drawing.Size(153, 149);
|
||||
this.lbSrcNic.Size = new System.Drawing.Size(89, 84);
|
||||
this.lbSrcNic.TabIndex = 1;
|
||||
this.lbSrcNic.SelectedIndexChanged += new System.EventHandler(this.lbSrcNic_SelectedIndexChanged);
|
||||
//
|
||||
// lbDstNic
|
||||
//
|
||||
this.lbDstNic.FormattingEnabled = true;
|
||||
this.lbDstNic.ItemHeight = 29;
|
||||
this.lbDstNic.Location = new System.Drawing.Point(702, 185);
|
||||
this.lbDstNic.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbDstNic.ItemHeight = 16;
|
||||
this.lbDstNic.Location = new System.Drawing.Point(399, 18);
|
||||
this.lbDstNic.Name = "lbDstNic";
|
||||
this.lbDstNic.Size = new System.Drawing.Size(153, 149);
|
||||
this.lbDstNic.Size = new System.Drawing.Size(89, 84);
|
||||
this.lbDstNic.TabIndex = 3;
|
||||
this.lbDstNic.SelectedIndexChanged += new System.EventHandler(this.lbDstNic_SelectedIndexChanged);
|
||||
//
|
||||
// lbDstHost
|
||||
//
|
||||
this.lbDstHost.FormattingEnabled = true;
|
||||
this.lbDstHost.ItemHeight = 29;
|
||||
this.lbDstHost.Location = new System.Drawing.Point(512, 185);
|
||||
this.lbDstHost.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbDstHost.ItemHeight = 16;
|
||||
this.lbDstHost.Location = new System.Drawing.Point(290, 18);
|
||||
this.lbDstHost.Name = "lbDstHost";
|
||||
this.lbDstHost.Size = new System.Drawing.Size(177, 149);
|
||||
this.lbDstHost.Size = new System.Drawing.Size(103, 84);
|
||||
this.lbDstHost.TabIndex = 2;
|
||||
this.lbDstHost.SelectedIndexChanged += new System.EventHandler(this.lbDstHost_SelectedIndexChanged);
|
||||
//
|
||||
// btnLink
|
||||
//
|
||||
this.btnLink.Location = new System.Drawing.Point(372, 185);
|
||||
this.btnLink.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.btnLink.Location = new System.Drawing.Point(210, 18);
|
||||
this.btnLink.Name = "btnLink";
|
||||
this.btnLink.Size = new System.Drawing.Size(131, 42);
|
||||
this.btnLink.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnLink.TabIndex = 4;
|
||||
this.btnLink.Text = "Link";
|
||||
this.btnLink.UseVisualStyleBackColor = true;
|
||||
@ -99,10 +89,9 @@
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(372, 237);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.btnCancel.Location = new System.Drawing.Point(210, 47);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(131, 42);
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 5;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
@ -111,47 +100,16 @@
|
||||
// cbLinkType
|
||||
//
|
||||
this.cbLinkType.FormattingEnabled = true;
|
||||
this.cbLinkType.Location = new System.Drawing.Point(372, 290);
|
||||
this.cbLinkType.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.cbLinkType.Location = new System.Drawing.Point(210, 76);
|
||||
this.cbLinkType.Name = "cbLinkType";
|
||||
this.cbLinkType.Size = new System.Drawing.Size(128, 37);
|
||||
this.cbLinkType.Size = new System.Drawing.Size(75, 24);
|
||||
this.cbLinkType.TabIndex = 6;
|
||||
//
|
||||
// pbSource
|
||||
//
|
||||
this.pbSource.Location = new System.Drawing.Point(120, 28);
|
||||
this.pbSource.Name = "pbSource";
|
||||
this.pbSource.Size = new System.Drawing.Size(167, 149);
|
||||
this.pbSource.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pbSource.TabIndex = 7;
|
||||
this.pbSource.TabStop = false;
|
||||
//
|
||||
// pbDest
|
||||
//
|
||||
this.pbDest.Location = new System.Drawing.Point(607, 28);
|
||||
this.pbDest.Name = "pbDest";
|
||||
this.pbDest.Size = new System.Drawing.Size(167, 149);
|
||||
this.pbDest.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pbDest.TabIndex = 8;
|
||||
this.pbDest.TabStop = false;
|
||||
//
|
||||
// lblInstructions
|
||||
//
|
||||
this.lblInstructions.AutoSize = true;
|
||||
this.lblInstructions.Location = new System.Drawing.Point(15, 351);
|
||||
this.lblInstructions.Name = "lblInstructions";
|
||||
this.lblInstructions.Size = new System.Drawing.Size(79, 29);
|
||||
this.lblInstructions.TabIndex = 9;
|
||||
this.lblInstructions.Text = "label1";
|
||||
//
|
||||
// LinkEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(866, 389);
|
||||
this.Controls.Add(this.lblInstructions);
|
||||
this.Controls.Add(this.pbDest);
|
||||
this.Controls.Add(this.pbSource);
|
||||
this.ClientSize = new System.Drawing.Size(495, 117);
|
||||
this.Controls.Add(this.cbLinkType);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnLink);
|
||||
@ -161,14 +119,10 @@
|
||||
this.Controls.Add(this.lbSrcHost);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.Name = "LinkEditor";
|
||||
this.Text = "LinkEditor";
|
||||
this.Shown += new System.EventHandler(this.LinkEditor_Shown);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbSource)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbDest)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -181,8 +135,5 @@
|
||||
private System.Windows.Forms.Button btnLink;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.ComboBox cbLinkType;
|
||||
private System.Windows.Forms.PictureBox pbSource;
|
||||
private System.Windows.Forms.PictureBox pbDest;
|
||||
private System.Windows.Forms.Label lblInstructions;
|
||||
}
|
||||
}
|
@ -45,7 +45,6 @@ namespace EduNetworkBuilder
|
||||
lbSrcHost.SelectedIndex = tindex;
|
||||
UpdateDeviceList();
|
||||
}
|
||||
pbSource.Image = new Bitmap(Source.GetImage());
|
||||
}
|
||||
if (Dest != null)
|
||||
{
|
||||
@ -55,7 +54,6 @@ namespace EduNetworkBuilder
|
||||
lbDstHost.SelectedIndex = tindex;
|
||||
UpdateDeviceList();
|
||||
}
|
||||
pbDest.Image = new Bitmap(Dest.GetImage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,12 +86,11 @@ namespace EduNetworkBuilder
|
||||
if (lbDstHost.SelectedItem != null)
|
||||
DstHost = lbDstHost.SelectedItem.ToString();
|
||||
string SrcNic = "";
|
||||
NetworkDevice Src = null;
|
||||
if (lbSrcNic.SelectedItem != null)
|
||||
{
|
||||
Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
SrcNic = lbSrcNic.SelectedItem.ToString();
|
||||
int sNicIndex = lbSrcNic.SelectedIndex;
|
||||
NetworkDevice Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
NetworkCard sNic = null;
|
||||
if(Src != null) sNic = Src.NicFromName(lbSrcNic.SelectedItem.ToString());
|
||||
if(sNic != null) srcNicType = sNic.GetNicType;
|
||||
@ -179,34 +176,7 @@ namespace EduNetworkBuilder
|
||||
lbDstNic.SelectedIndex = tint;
|
||||
}
|
||||
|
||||
if (lbSrcHost.SelectedItem != null)
|
||||
{
|
||||
Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
pbSource.Image = Src.GetImage();
|
||||
pbSource.Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbSource.Image = null;
|
||||
pbSource.Invalidate();
|
||||
}
|
||||
|
||||
if (lbDstHost.SelectedItem != null)
|
||||
{
|
||||
NetworkDevice Dest = myNet.DeviceFromName(lbDstHost.SelectedItem.ToString());
|
||||
if (Dest != null)
|
||||
{
|
||||
pbDest.Image = Dest.GetImage();
|
||||
pbDest.Invalidate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pbDest.Image = null;
|
||||
pbDest.Invalidate();
|
||||
}
|
||||
|
||||
if (lbDstNic.SelectedIndex > -1 && lbSrcNic.SelectedIndex > -1)
|
||||
if(lbDstNic.SelectedIndex > -1 && lbSrcNic.SelectedIndex > -1)
|
||||
{
|
||||
btnLink.Enabled = true;
|
||||
}
|
||||
@ -232,43 +202,6 @@ namespace EduNetworkBuilder
|
||||
cbLinkType.SelectedItem = theLinkType;
|
||||
else
|
||||
cbLinkType.SelectedIndex = 0;
|
||||
|
||||
//Update the instructions.
|
||||
lblInstructions.Text = ""; //empty them out if we do not need instructions
|
||||
lbSrcHost.ResetForeColor() ;
|
||||
lbSrcNic.ResetForeColor();
|
||||
lbDstHost.ResetForeColor();
|
||||
lbDstNic.ResetForeColor();
|
||||
btnLink.ForeColor = Color.Black;
|
||||
if (lbSrcHost.SelectedItem == null)
|
||||
{
|
||||
lblInstructions.Text = "Choose the source device.";
|
||||
lbSrcHost.ForeColor = Color.Red;
|
||||
}
|
||||
else if (lbSrcNic.SelectedItem == null)
|
||||
{
|
||||
lblInstructions.Text = "Choose the NIC / Port on the source device.";
|
||||
lbSrcNic.ForeColor = Color.Red;
|
||||
}
|
||||
else if (lbDstHost.SelectedItem == null)
|
||||
{
|
||||
lblInstructions.Text = "Choose the destination device.";
|
||||
lbDstHost.ForeColor = Color.Red;
|
||||
}
|
||||
else if (lbDstNic.SelectedItem == null)
|
||||
{
|
||||
lblInstructions.Text = "Choose the NIC / Port on the destination device.";
|
||||
lbDstNic.ForeColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
//We have a valid link. We are ready to press the link.
|
||||
lblInstructions.Text = "This is a valid link. Press LINK to continue";
|
||||
btnLink.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
|
||||
|
||||
processing = false;
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,10 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
NB_IPAddress newip = new NB_IPAddress(NB.ZeroIPString, NB.ZeroIPString, NB.ZeroIPString);
|
||||
newip.Edit(myNetDevice, this, NB.Translate("LBW_AddRouteCreate"));
|
||||
if (!newip.Equals(new NB_IPAddress(NB.ZeroIPString, NB.ZeroIPString, NB.ZeroIPString)))
|
||||
{
|
||||
myNetDevice.AddRoute(newip);
|
||||
}
|
||||
UpdateForm();
|
||||
}
|
||||
|
||||
|
@ -379,6 +379,8 @@ namespace EduNetworkBuilder
|
||||
public static int NormalRotation = 5;
|
||||
public static int PacketDamageDistance = 25;
|
||||
|
||||
public static int InvalidVLAN = -999; //What we return when it is invalid
|
||||
|
||||
public static bool DebugActions = false;
|
||||
public static bool DebugTests = false;
|
||||
|
||||
@ -934,6 +936,46 @@ namespace EduNetworkBuilder
|
||||
return tbEvent.Text;
|
||||
}
|
||||
|
||||
public static string ComboBoxPromptBox(string title, string prompt, List<string> Options, string value)
|
||||
{
|
||||
Form QuestionForm = new Form();
|
||||
QuestionForm.Text = title;
|
||||
Label lbPrompt = new Label();
|
||||
lbPrompt.Text = prompt;
|
||||
lbPrompt.Location = new Point(1, 1);
|
||||
lbPrompt.Size = new Size(200, lbPrompt.Size.Height);
|
||||
|
||||
ComboBox Choice = new ComboBox();
|
||||
List<string> tlist = new List<string>();
|
||||
foreach (string tstring in Options)
|
||||
{
|
||||
Choice.Items.Add(tstring);
|
||||
}
|
||||
|
||||
if (value != "" && Choice.Items.Contains(value))
|
||||
{
|
||||
Choice.SelectedItem = value;
|
||||
}
|
||||
Choice.Location = new Point(1, lbPrompt.Location.Y + lbPrompt.Height + 5);
|
||||
|
||||
Button Done = new Button();
|
||||
Done.Click += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; f.Close(); };
|
||||
Choice.DoubleClick += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; Choice.SelectedIndex = -1; f.Close(); }; ;
|
||||
Done.Text = NB.Translate("_Done");
|
||||
Done.Location = new Point(1, Choice.Location.Y + Choice.Height + 5);
|
||||
QuestionForm.Controls.Clear();
|
||||
QuestionForm.Controls.Add(Choice);
|
||||
QuestionForm.Controls.Add(Done);
|
||||
QuestionForm.Controls.Add(lbPrompt);
|
||||
QuestionForm.AcceptButton = Done;
|
||||
QuestionForm.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
QuestionForm.AutoSize = true;
|
||||
QuestionForm.Height = Done.Location.Y + Done.Height + 5; //This is too small for the form, it autosizes to "big enough"
|
||||
QuestionForm.Width = Choice.Location.X + Choice.Width + 5;
|
||||
QuestionForm.ShowDialog();
|
||||
if (Choice.SelectedIndex >= 0) return Choice.SelectedItem.ToString();
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Dictionary<string, bool> CheckPromptBox(Dictionary<string, bool> Checks)
|
||||
{
|
||||
@ -1078,14 +1120,6 @@ namespace EduNetworkBuilder
|
||||
return randomizedList;
|
||||
}
|
||||
|
||||
public static void AddNetMessage(string host, string message)
|
||||
{
|
||||
Network thenet = GetNetwork();
|
||||
//Console.WriteLine("Adding message: " + host + " : " + message);
|
||||
if (thenet == null) return; //we cannot add it. do not blow up
|
||||
thenet.AddMessage(new PacketMessage(host, message));
|
||||
}
|
||||
|
||||
public static bool OpenURLInExternalBrowser(string URL)
|
||||
{
|
||||
Uri uriResult;
|
||||
|
293
EduNetworkBuilder/NBRenumberData.cs
Normal file
293
EduNetworkBuilder/NBRenumberData.cs
Normal file
@ -0,0 +1,293 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EduNetworkBuilder
|
||||
{
|
||||
public class NBRenumberer
|
||||
{
|
||||
private bool renumbered = false;
|
||||
public List<NBRenumberData> ListOfItems = new List<NBRenumberData>();
|
||||
|
||||
public void Count(string what)
|
||||
{
|
||||
NBRenumberData entry = DataFromName(what);
|
||||
if(entry != null)
|
||||
{
|
||||
entry.ActiveCount++;
|
||||
return;
|
||||
}
|
||||
//If we get here, we have not found it yet.
|
||||
NBRenumberData One = new NBRenumberData(what, ListOfItems.Count);
|
||||
One.ActiveCount++;
|
||||
ListOfItems.Add(One);
|
||||
}
|
||||
public void SetAsGateway(string what)
|
||||
{
|
||||
NBRenumberData GW = DataFromName(what);
|
||||
if (GW == null) {
|
||||
GW = new NBRenumberData(what, ListOfItems.Count);
|
||||
ListOfItems.Add(GW);
|
||||
}
|
||||
GW.isTheGateway = true;
|
||||
GW.UpdateSortOrder();
|
||||
//We can only have one gateway. Make sure all the rest are set not to be the GW
|
||||
foreach(NBRenumberData one in ListOfItems)
|
||||
{
|
||||
if (one != GW) {
|
||||
one.isTheGateway = false;
|
||||
one.UpdateSortOrder();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public NBRenumberData DataFromName(string hostname)
|
||||
{
|
||||
foreach (NBRenumberData NBRD in ListOfItems)
|
||||
{
|
||||
if (NBRD.Hostname == hostname)
|
||||
{
|
||||
return NBRD;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool TryRenumbering(NB_IPAddress Network, NB_IPAddress Gateway)
|
||||
{
|
||||
renumbered = true;
|
||||
//Separate out the devices by type
|
||||
// Find the gateway too
|
||||
int biggestcount = 0;
|
||||
int spacing = 10;
|
||||
bool HasGateway = false;
|
||||
foreach (NBRenumberData NBRD in ListOfItems)
|
||||
{
|
||||
if (NBRD.ActiveCount > biggestcount) biggestcount = NBRD.ActiveCount;
|
||||
}
|
||||
//now, we can prune off everything that is not part of biggestcount.
|
||||
for(int i=ListOfItems.Count-1; i>=0; i--)
|
||||
{
|
||||
if (ListOfItems[i].ActiveCount != biggestcount)
|
||||
ListOfItems.RemoveAt(i);
|
||||
else
|
||||
{
|
||||
if (ListOfItems[i].isTheGateway) HasGateway = true;
|
||||
ListOfItems[i].SuggestedIP = "";
|
||||
}
|
||||
}
|
||||
if (!HasGateway)
|
||||
for (int i = ListOfItems.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (ListOfItems[i].Device.HasIPAddress(Gateway))
|
||||
SetAsGateway(ListOfItems[i].Hostname);
|
||||
}
|
||||
|
||||
int switches = 0;
|
||||
int servers = 0;
|
||||
int printers = 0;
|
||||
int wireless = 0;
|
||||
int clients = 0;
|
||||
foreach(NBRenumberData NBRD in ListOfItems)
|
||||
{
|
||||
switch(NBRD.TypeString())
|
||||
{
|
||||
case "client":
|
||||
clients++;
|
||||
break;
|
||||
|
||||
case "printer":
|
||||
printers++;
|
||||
break;
|
||||
|
||||
case "switch":
|
||||
switches++;
|
||||
break;
|
||||
|
||||
case "server":
|
||||
servers++;
|
||||
break;
|
||||
case "wireless":
|
||||
wireless++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Decide on which way we want to do this.
|
||||
biggestcount = 0;
|
||||
if (servers > biggestcount) biggestcount = servers;
|
||||
if (switches > biggestcount) biggestcount = switches;
|
||||
if (printers > biggestcount) biggestcount = printers;
|
||||
if (wireless > biggestcount) biggestcount = wireless;
|
||||
if (clients > biggestcount) biggestcount = clients;
|
||||
|
||||
ListOfItems.Sort((p, q) => p.sortorder.CompareTo(q.sortorder));
|
||||
|
||||
//If it works to do 10 for each bunch, do that. Otherwise, see what the smallest bunch that works is.
|
||||
if (biggestcount < 10)
|
||||
{
|
||||
spacing = 10;
|
||||
}
|
||||
if (biggestcount > 10)
|
||||
spacing = 99; //Don't bother with anything fancy. Punt if it does not fit the first time
|
||||
//Fallback is to simply count up from the gateway.
|
||||
if (Network.NumberOfHosts < ListOfItems.Count)
|
||||
return false;
|
||||
if(spacing * 5 > Network.NumberOfHosts)
|
||||
{
|
||||
renumberlist(Network, 1, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//We can do this in parts
|
||||
renumberlist(Network, 1, "Gateway");
|
||||
renumberlist(Network, 2, "server");
|
||||
renumberlist(Network, spacing * 1, "switch");
|
||||
renumberlist(Network, spacing * 2, "wireless");
|
||||
renumberlist(Network, spacing * 3, "printer");
|
||||
renumberlist(Network, spacing * 4, "client");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renumberlist(NB_IPAddress Network, int Base, string filter)
|
||||
{
|
||||
int count = Base;
|
||||
for (int i = 0; i < ListOfItems.Count; i++)
|
||||
{
|
||||
if (ListOfItems[i].SuggestedIP != "") continue;
|
||||
if (filter == "" || ListOfItems[i].TypeString() == filter || filter == "Gateway" && ListOfItems[i].isTheGateway)
|
||||
{
|
||||
NB_IPAddress next = new NB_IPAddress(Network);
|
||||
next._ip += (UInt32)count;
|
||||
ListOfItems[i].SuggestedIP = next.GetIPString;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DoRenumbering(NB_IPAddress Network, NB_IPAddress Gateway, int vlanID)
|
||||
{
|
||||
if (!renumbered) TryRenumbering(Network, Gateway);
|
||||
|
||||
//loop through and set all the IPs and the gateway IP if not DHCPS
|
||||
for(int i = 0; i < ListOfItems.Count; i++)
|
||||
{
|
||||
ListOfItems[i].Device.RenumberIP(ListOfItems[i].SuggestedIP, Gateway, vlanID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class NBRenumberData
|
||||
{
|
||||
public string Hostname = "";
|
||||
public NetworkDevice Device {
|
||||
get {
|
||||
Network myNet = NB.GetNetwork();
|
||||
if (myNet == null) return null;
|
||||
return myNet.DeviceFromName(Hostname);
|
||||
}
|
||||
}
|
||||
public int ActiveCount=0;
|
||||
public string nicname;
|
||||
public string SuggestedIP;
|
||||
public int sortorder = 0;
|
||||
private int _index = 0;
|
||||
public NetworkComponentType mytype = NetworkComponentType.none;
|
||||
|
||||
public bool isTheGateway = false;
|
||||
|
||||
private bool _isRouter = false;
|
||||
/// <summary>
|
||||
/// Return true if the Device specified by hostname does routing.
|
||||
/// </summary>
|
||||
public bool IsRouter {
|
||||
get {
|
||||
if (_isRouter) return true;
|
||||
NetworkDevice ND = Device;
|
||||
if(ND.RoutesPackets())
|
||||
{
|
||||
_isRouter = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public NBRenumberData(string hostname, int index)
|
||||
{
|
||||
Hostname = hostname;
|
||||
NetworkDevice nd = Device;
|
||||
mytype = nd.myType;
|
||||
_index = index;
|
||||
UpdateSortOrder();
|
||||
}
|
||||
|
||||
public void UpdateSortOrder()
|
||||
{
|
||||
switch (TypeString())
|
||||
{
|
||||
case "client":
|
||||
sortorder=5000;
|
||||
break;
|
||||
|
||||
case "printer":
|
||||
sortorder = 4000;
|
||||
break;
|
||||
|
||||
case "switch":
|
||||
sortorder=2000;
|
||||
break;
|
||||
|
||||
case "server":
|
||||
sortorder=1000;
|
||||
break;
|
||||
case "wireless":
|
||||
sortorder=3000;
|
||||
break;
|
||||
}
|
||||
sortorder = sortorder + _index;
|
||||
if (isTheGateway) sortorder = 0;
|
||||
}
|
||||
|
||||
public string TypeString()
|
||||
{
|
||||
string what = "";
|
||||
switch (mytype)
|
||||
{
|
||||
case NetworkComponentType.cellphone:
|
||||
case NetworkComponentType.ip_phone:
|
||||
case NetworkComponentType.laptop:
|
||||
case NetworkComponentType.pc:
|
||||
case NetworkComponentType.tablet:
|
||||
what = "client";
|
||||
break;
|
||||
|
||||
case NetworkComponentType.printer:
|
||||
case NetworkComponentType.copier:
|
||||
what = "printer";
|
||||
break;
|
||||
|
||||
case NetworkComponentType.net_hub:
|
||||
case NetworkComponentType.net_switch:
|
||||
what = "switch";
|
||||
break;
|
||||
|
||||
case NetworkComponentType.firewall:
|
||||
case NetworkComponentType.router:
|
||||
case NetworkComponentType.server:
|
||||
what = "server";
|
||||
break;
|
||||
case NetworkComponentType.wap:
|
||||
case NetworkComponentType.wbridge:
|
||||
case NetworkComponentType.wrepeater:
|
||||
case NetworkComponentType.wrouter:
|
||||
what = "wireless";
|
||||
break;
|
||||
}
|
||||
return what;
|
||||
}
|
||||
}
|
||||
}
|
@ -1696,7 +1696,7 @@ namespace EduNetworkBuilder
|
||||
//We are doing a replay and enough time has passed from the last replay...
|
||||
NBSettings Settings = NB.GetSettings();
|
||||
ActionCollection AC = Settings.GetUserActionCollection();
|
||||
ActionClass Success = AC.RunAction(NextReplayIndex++, true); //note all changes as we do them
|
||||
ActionClass Success = AC.RunAction(NextReplayIndex++);
|
||||
|
||||
|
||||
NextReplayAction = DateTime.UtcNow.AddMilliseconds(NB.MillisecondsBetweenReplays);
|
||||
|
@ -919,6 +919,12 @@ namespace EduNetworkBuilder
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("_Delete"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Delete_Click;
|
||||
|
||||
if(!myNetwork.LoadedFromResource)
|
||||
{
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_Renumber"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkRenumber;
|
||||
}
|
||||
|
||||
//We can color-code multiple items
|
||||
if (myNetwork.VLANsEnabled)
|
||||
{
|
||||
@ -1129,6 +1135,150 @@ namespace EduNetworkBuilder
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to renumber a chunk of a network
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void pbNetworkRenumber(object sender, EventArgs e)
|
||||
{
|
||||
//come up with a plan
|
||||
// sort items by type
|
||||
// loop through the items
|
||||
// come up with the numbers we want to use
|
||||
// Decide which nics to change
|
||||
// On a router, find the nic that is connected to other items in the list
|
||||
// On other devices, find first nic that is connected that is not DHCP
|
||||
// track hostname, nicname, ip_address
|
||||
//print out a list of what we are going to do
|
||||
//Ask if we want to do it. Yes/No
|
||||
//do it
|
||||
if (ItemsSelected.Count > 0)
|
||||
{
|
||||
//This next entry should never happen.
|
||||
if (ItemsSelected.Count < 2)
|
||||
{
|
||||
MessageBox.Show("You need to have more items selected");
|
||||
return;
|
||||
}
|
||||
|
||||
int ChosenVlanID = 1;
|
||||
if(myNetwork != null && myNetwork.VLANsEnabled)
|
||||
{
|
||||
List<string> vnames = new List<string>();
|
||||
foreach(VLANName vn in myNetwork.VlanNames)
|
||||
{
|
||||
vnames.Add(vn.Name);
|
||||
}
|
||||
string ChosenVlanName = "";
|
||||
if (vnames.Count > 0) ChosenVlanName = vnames[0]; //Usually "Default"
|
||||
if (vnames.Count > 1)
|
||||
{
|
||||
//we need to prompt
|
||||
ChosenVlanName = NB.ComboBoxPromptBox(NB.Translate("NB_ChooseVLANRenumberTitle"), NB.Translate("NB_ChooseVLANRenumber"), vnames, vnames[0]);
|
||||
}
|
||||
ChosenVlanID = myNetwork.VLANIDFromName(ChosenVlanName);
|
||||
}
|
||||
|
||||
NB_IPAddress prompted = new NB_IPAddress("192.168.1.0","255.255.255.0","192.168.1.1");
|
||||
|
||||
IPAddressEntry IPE = new IPAddressEntry(prompted, null, this, false);
|
||||
|
||||
//Read in the settings we will use
|
||||
IPE.ShowAsSubnetGateway();
|
||||
|
||||
//pull out the gateway address
|
||||
NB_IPAddress gw = new NB_IPAddress(prompted.GetGateway.ToIpString(), prompted._mask.ToIpString(),IPAddressType.gw);
|
||||
|
||||
//pull out the network address
|
||||
NB_IPAddress network = new NB_IPAddress(prompted.NetworkAddress.ToIpString(), prompted._mask.ToIpString(), IPAddressType.gw);
|
||||
|
||||
//We need to find the gateway device. If no such device exists, find the most likely candidate
|
||||
string gateway_name = myNetwork.ReverseDNSLookup(ItemsSelected[0],gw);
|
||||
|
||||
NetworkDevice gwDevice = myNetwork.DeviceFromName(gateway_name);
|
||||
if(gwDevice == null)
|
||||
{
|
||||
//Make a list of possibilities
|
||||
//Prompt user to select one of them
|
||||
List<NetworkDevice> gwdevices = new List<NetworkDevice>();
|
||||
for (int i = ItemsSelected.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (ItemsSelected[i].RoutesPackets()) gwdevices.Add(ItemsSelected[i]);
|
||||
}
|
||||
if (gwdevices.Count == 1) gwDevice = gwdevices[0];
|
||||
else
|
||||
{
|
||||
//We need to prompt which device
|
||||
List<string> names = new List<string>();
|
||||
foreach(NetworkDevice one in gwdevices)
|
||||
{
|
||||
names.Add(one.hostname);
|
||||
}
|
||||
names.Sort();
|
||||
gateway_name = NB.ComboBoxPromptBox(NB.Translate("_Gateway"), NB.Translate("NB_ChooseGateway"), names, names[0]);
|
||||
gwDevice = myNetwork.DeviceFromName(gateway_name);
|
||||
}
|
||||
}
|
||||
if (gwDevice == null) return; //No gateway device selected
|
||||
|
||||
|
||||
NBRenumberer Renumberer = new NBRenumberer();
|
||||
|
||||
//If we get here, we have a gateway and a list of items to renumber.
|
||||
//Loop through all the items
|
||||
//Find find all connected items
|
||||
//loop through all connected items & count them (excluding them if they are not selected)
|
||||
//set the gateway.
|
||||
//count them and exclude items that are not within the threshhold.
|
||||
|
||||
foreach(NetworkDevice one in ItemsSelected)
|
||||
{
|
||||
List<NetworkDevice> alreadydone = new List<NetworkDevice>();
|
||||
List<NetworkDevice> connections = one.ConnectedTo();
|
||||
|
||||
for(int i=0; i< connections.Count; i++)
|
||||
{
|
||||
NetworkDevice connection = connections[i];
|
||||
//If we have not done it yet
|
||||
if (!ItemsSelected.Contains(connection))
|
||||
continue;
|
||||
if (myNetwork.VLANsEnabled && (ChosenVlanID != connection.PrimaryVLAN() && connection.myType != NetworkComponentType.net_switch))
|
||||
continue; //Skip the device if it is not on the primary vlan, and is not a switch (asuming switches are taggexd)
|
||||
if (!alreadydone.Contains(connection))
|
||||
{
|
||||
alreadydone.Add(connection);
|
||||
|
||||
if(!connection.RoutesPackets() || connection.myType == NetworkComponentType.wrouter)
|
||||
connections.AddRange(connection.ConnectedTo(true));
|
||||
Renumberer.Count(connection.hostname);
|
||||
}
|
||||
}
|
||||
}
|
||||
Renumberer.SetAsGateway(gwDevice.hostname);
|
||||
|
||||
Renumberer.TryRenumbering(network, gw);
|
||||
|
||||
if (Renumberer.ListOfItems.Count > network.NumberOfHosts)
|
||||
{
|
||||
//Not enough room in the subnet for the various items.
|
||||
MessageBox.Show("There are not enough IP addresses in the subnet you specified for the number of items we need to renumber.");
|
||||
return;
|
||||
}
|
||||
|
||||
//We should print off the things we are hoping to do.
|
||||
string message = "What we are trying to do:\n";
|
||||
foreach(NBRenumberData NBRD in Renumberer.ListOfItems)
|
||||
{
|
||||
message += NBRD.Hostname + " " + NBRD.TypeString() + " -> " + NBRD.SuggestedIP + "\n";
|
||||
}
|
||||
DialogResult answer = MessageBox.Show(message,"Renumber?",MessageBoxButtons.OKCancel);
|
||||
if (answer == DialogResult.OK)
|
||||
Renumberer.DoRenumbering(network, gw, ChosenVlanID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void pbNetworkView_Hide_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
@ -1886,7 +2036,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
Image tImage;
|
||||
//Only do this 10 times a second
|
||||
if (DateTime.UtcNow - LastMoveTime < TimeSpan.FromMilliseconds(100)) return;
|
||||
|
||||
@ -1895,25 +2044,7 @@ namespace EduNetworkBuilder
|
||||
//If we are dragging lines, do that first.
|
||||
if (selectedButton == "btnLink")
|
||||
{
|
||||
if (MouseIsDown)
|
||||
{
|
||||
//We are trying to do a link. Drag a line...
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
Point OrigCenter = ItemClickedOn.GetCenter();
|
||||
//Draw a line from the item-clicked on to the mouse
|
||||
tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height);
|
||||
Graphics tGraphics = Graphics.FromImage(tImage);
|
||||
tGraphics.Clear(Color.Transparent); //erase the whole thing
|
||||
|
||||
//draw the line
|
||||
//tGraphics.FillRectangle(semiTransBrush, selectbox);
|
||||
tGraphics.DrawLine(Pens.Black, OrigCenter, MouseLocation);
|
||||
pbNetworkView.Image = tImage;
|
||||
pbNetworkView.Invalidate();
|
||||
|
||||
}
|
||||
}
|
||||
//We are trying to do a link. Do not drag...
|
||||
}
|
||||
else if (MouseIsDown && LastBackgroundImage != null && ItemClickedOn != null && ItemsSelected.Count == 0) //We are trying to drag something
|
||||
{
|
||||
@ -1943,7 +2074,7 @@ namespace EduNetworkBuilder
|
||||
else if (MouseIsDown && ItemClickedOn == null) //Dragging an empty area
|
||||
{
|
||||
//make a rectangle
|
||||
tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height);
|
||||
Image tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height);
|
||||
Graphics tGraphics = Graphics.FromImage(tImage);
|
||||
tGraphics.Clear(Color.Transparent); //erase the whole thing
|
||||
int sx;
|
||||
|
@ -978,17 +978,6 @@ namespace EduNetworkBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
public string AllInterfacesString(bool UseCidr= false)
|
||||
{
|
||||
string thestring = "";
|
||||
foreach (NetworkInterface oneIF in interfaces)
|
||||
{
|
||||
if (thestring != "") thestring += ",";
|
||||
thestring += oneIF.InterfaceString(UseCidr);
|
||||
}
|
||||
return thestring;
|
||||
}
|
||||
|
||||
public NB_IPAddress FirstIP()
|
||||
{
|
||||
List<NB_IPAddress> addresses = IPAddressList();
|
||||
|
@ -99,7 +99,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void UpdateFromComponent(NetworkComponent CopyFrom, bool NoteAllChanges = false)
|
||||
public virtual void UpdateFromComponent(NetworkComponent CopyFrom)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace EduNetworkBuilder
|
||||
myType = what;
|
||||
|
||||
SetImageFromType(what);
|
||||
NetworkCard tnic = new NetworkCard(0,GetUniqueIdentifier,hostname,NicType.lo);
|
||||
NetworkCard tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.lo);
|
||||
NICs.Add(tnic);
|
||||
if (what == NetworkComponentType.net_switch || what == NetworkComponentType.net_hub)
|
||||
{
|
||||
@ -58,7 +58,7 @@ namespace EduNetworkBuilder
|
||||
tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.management_interface);
|
||||
NICs.Add(tnic);
|
||||
}
|
||||
for(int looper=1; looper < 8; looper++)
|
||||
for (int looper = 1; looper < 8; looper++)
|
||||
{
|
||||
tnic = new NetworkCard(looper, GetUniqueIdentifier, hostname, NicType.port);
|
||||
NICs.Add(tnic);
|
||||
@ -71,16 +71,16 @@ namespace EduNetworkBuilder
|
||||
tnic = new NetworkCard(0, GetUniqueIdentifier, hostname);
|
||||
NICs.Add(tnic);
|
||||
}
|
||||
if(what == NetworkComponentType.router)
|
||||
if (what == NetworkComponentType.router)
|
||||
{
|
||||
tnic = new NetworkCard(1, GetUniqueIdentifier, hostname);
|
||||
NICs.Add(tnic);
|
||||
}
|
||||
//**********Wireless***********
|
||||
//Add a wireless network card to laptops, wireless bridge and wireless repeater
|
||||
if (what == NetworkComponentType.laptop )
|
||||
if (what == NetworkComponentType.laptop)
|
||||
{
|
||||
tnic = new NetworkCard(NICs.Count(), GetUniqueIdentifier, hostname,NicType.wlan); //Add a wireless nic
|
||||
tnic = new NetworkCard(NICs.Count(), GetUniqueIdentifier, hostname, NicType.wlan); //Add a wireless nic
|
||||
tnic.UsesDHCP = true;
|
||||
NICs.Add(tnic);
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace EduNetworkBuilder
|
||||
NICs.Add(tnic);
|
||||
//Add one wan port
|
||||
tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.wan);
|
||||
NICs.Insert(1,tnic); //Make this first in the list
|
||||
NICs.Insert(1, tnic); //Make this first in the list
|
||||
}
|
||||
if (what == NetworkComponentType.cellphone || what == NetworkComponentType.tablet)
|
||||
{
|
||||
@ -179,9 +179,9 @@ namespace EduNetworkBuilder
|
||||
public int CountNics(NicType TheType)
|
||||
{
|
||||
int count = 0;
|
||||
foreach(NetworkCard nic in NICs)
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.GetNicType == TheType)
|
||||
if (nic.GetNicType == TheType)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@ -197,7 +197,7 @@ namespace EduNetworkBuilder
|
||||
string tname = TheType.ToString() + count.ToString();
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.NicName() == tname)
|
||||
if (nic.NicName() == tname)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@ -276,7 +276,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void setNicsCanUseDHCP(bool CanUse)
|
||||
{
|
||||
foreach(NetworkCard nic in NICs)
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
//if the device must use DHCP. we set it here.
|
||||
if (MustUseDHCP && nic.CanUseDHCP)
|
||||
@ -355,12 +355,12 @@ namespace EduNetworkBuilder
|
||||
NetworkLink nl;
|
||||
if (myNet != null)
|
||||
{
|
||||
foreach(NetworkCard nic in NICs)
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.ConnectedLink != -1)
|
||||
if (nic.ConnectedLink != -1)
|
||||
{
|
||||
nl = myNet.GetLinkFromID(nic.ConnectedLink);
|
||||
if(nl != null)
|
||||
if (nl != null)
|
||||
{
|
||||
myNet.RemoveComponent(nl);
|
||||
nl.Destroy();
|
||||
@ -373,19 +373,19 @@ namespace EduNetworkBuilder
|
||||
|
||||
public void EditGateway(Form ParentForm)
|
||||
{
|
||||
DefaultGW.Edit(this,ParentForm,NB.Translate("ND_EdtGteway"));
|
||||
DefaultGW.Edit(this, ParentForm, NB.Translate("ND_EdtGteway"));
|
||||
}
|
||||
|
||||
public NB_IPAddress GetGateway()
|
||||
{
|
||||
if(!HasNonDHCPConnected() && CanUseDHCP)
|
||||
if (!HasNonDHCPConnected() && CanUseDHCP)
|
||||
{
|
||||
foreach(NetworkCard nic in NICs)
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.UsesDHCP)
|
||||
if (nic.UsesDHCP)
|
||||
{
|
||||
List<NB_IPAddress> tlist = nic.IPAddressList();
|
||||
if(tlist.Count > 0)
|
||||
if (tlist.Count > 0)
|
||||
{
|
||||
NB_IPAddress newIP = new NB_IPAddress(tlist[0].GetGateway.ToIpString());
|
||||
return newIP;
|
||||
@ -422,7 +422,7 @@ namespace EduNetworkBuilder
|
||||
XmlNodeType myNodetype = Individual.NodeType;
|
||||
if (myNodetype == XmlNodeType.Element)
|
||||
{
|
||||
switch(Individual.Name.ToLower())
|
||||
switch (Individual.Name.ToLower())
|
||||
{
|
||||
case "location":
|
||||
string[] pointstr = Individual.InnerText.Split(',');
|
||||
@ -510,13 +510,13 @@ namespace EduNetworkBuilder
|
||||
writer.WriteElementString("mytype", myType.ToString());
|
||||
writer.WriteElementString("isdns", isDNSServer.ToString());
|
||||
writer.WriteElementString("isdhcp", isDHCPServer.ToString());
|
||||
if(IsBurned)
|
||||
if (IsBurned)
|
||||
writer.WriteElementString("isburned", IsBurned.ToString());
|
||||
if (HasAdvFirewall)
|
||||
writer.WriteElementString("hasadvfirewall", HasAdvFirewall.ToString());
|
||||
if (MorphColor != Color.Empty)
|
||||
writer.WriteElementString("morphcolor", MorphColor.Name);
|
||||
if(PowerOff == true)
|
||||
if (PowerOff == true)
|
||||
writer.WriteElementString("poweroff", PowerOff.ToString());
|
||||
if (isInvisible == true)
|
||||
writer.WriteElementString("isinvisible", isInvisible.ToString());
|
||||
@ -586,12 +586,12 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (nic.GetNicType == NicType.wport || nic.GetNicType == NicType.port)
|
||||
continue;
|
||||
foreach(string addr in nic.IPAddresses())
|
||||
foreach (string addr in nic.IPAddresses())
|
||||
{
|
||||
answer += System.Environment.NewLine + addr;
|
||||
}
|
||||
}
|
||||
if(BackgroundColor != Color.Empty)
|
||||
if (BackgroundColor != Color.Empty)
|
||||
{
|
||||
//There is something wrong with it?
|
||||
Network myNet = NB.GetNetwork();
|
||||
@ -607,13 +607,13 @@ namespace EduNetworkBuilder
|
||||
public List<string> ListOfConnectedHosts()
|
||||
{
|
||||
List<string> thelist = new List<string>();
|
||||
foreach(NetworkCard nic in NICs)
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.ConnectedLink != -1)
|
||||
if (nic.ConnectedLink != -1)
|
||||
{
|
||||
Network myNet = NB.GetNetwork();
|
||||
NetworkLink Link = myNet.GetLinkFromID(nic.ConnectedLink);
|
||||
if(Link != null)
|
||||
if (Link != null)
|
||||
{
|
||||
NetworkDevice tmp = myNet.GetDeviceFromID(Link.Src);
|
||||
if (tmp == null) continue;
|
||||
@ -655,6 +655,196 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of devices connected to this device
|
||||
/// </summary>
|
||||
/// <param name="skipwan">For routers, do not show things connected on the WAN</param>
|
||||
/// <returns>A list of devices</returns>
|
||||
public List<NetworkDevice> ConnectedTo(bool skipwan= false)
|
||||
{
|
||||
List<NetworkDevice> connected = new List<NetworkDevice>();
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
//We want to skip connections through the wan when searching a broadcast network
|
||||
if (!(myType == NetworkComponentType.wrouter && skipwan && nic.GetNicType == NicType.wan))
|
||||
{
|
||||
NetworkDevice nd = ConnectedTo(nic);
|
||||
if (nd != null) connected.Add(nd);
|
||||
}
|
||||
}
|
||||
return connected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="NIC"></param>
|
||||
/// <returns></returns>
|
||||
public NetworkDevice ConnectedTo(NetworkCard NIC)
|
||||
{
|
||||
return NIC.ConnectedTo();
|
||||
}
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="NIC">the network card ID</param>
|
||||
/// <returns></returns>
|
||||
public NetworkDevice ConnectedTo(HostNicID NIC)
|
||||
{
|
||||
NetworkCard nic = NicFromID(NIC);
|
||||
if (nic == null) return null;
|
||||
return nic.ConnectedTo();
|
||||
}
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="nicname">The network card name</param>
|
||||
/// <returns></returns>
|
||||
public NetworkDevice ConnectedTo(string nicname)
|
||||
{
|
||||
NetworkCard nic = NicFromName(nicname);
|
||||
if (nic == null) return null;
|
||||
return nic.ConnectedTo();
|
||||
}
|
||||
|
||||
public int VLANFromNIF(NetworkInterface nif, int level = 0)
|
||||
{
|
||||
level++;
|
||||
if (DoesVLANs())
|
||||
{
|
||||
//This device itself does vlans
|
||||
int vlan = nif.GetUntaggedVLAN();
|
||||
if (vlan != NB.InvalidVLAN)
|
||||
{
|
||||
return vlan;
|
||||
}
|
||||
}
|
||||
if (nif == null) return NB.InvalidVLAN;
|
||||
NetworkCard nic = NicFromID(nif.AttachedToHostNic);
|
||||
if (nic == null) return NB.InvalidVLAN; //Nothing
|
||||
if (level > 5) return NB.InvalidVLAN;
|
||||
return VLANFromNIC(nic, level);
|
||||
}
|
||||
|
||||
public int VLANFromNIC(NetworkCard nic, int level=0)
|
||||
{
|
||||
level++;
|
||||
int vlan = NB.InvalidVLAN;
|
||||
if (DoesVLANs())
|
||||
{
|
||||
foreach (NetworkInterface nif in nic.interfaces)
|
||||
{
|
||||
int tvlan = NB.InvalidVLAN;
|
||||
if(DoesVLANs())
|
||||
tvlan = VLANFromNIF(nif, level);
|
||||
if (tvlan != NB.InvalidVLAN)
|
||||
{
|
||||
if (vlan != NB.InvalidVLAN && vlan != tvlan)
|
||||
return NB.InvalidVLAN; //We have multiple VLANs defined on this nic. Cannot determine it from the nic. Need to look using nif
|
||||
vlan = tvlan;
|
||||
}
|
||||
}
|
||||
return vlan;
|
||||
}
|
||||
//If the device does not do vlans, we need to trace the wire to the device.
|
||||
NetworkDevice FarEnd = ConnectedTo(nic);
|
||||
if (FarEnd == null) return NB.InvalidVLAN; //Nothing connected to this link
|
||||
|
||||
//if it is a switch or wrouter(does vlans), return vlan for the device
|
||||
if (FarEnd.myType == NetworkComponentType.net_switch || FarEnd.myType == NetworkComponentType.wrouter)
|
||||
return FarEnd.VLANFromSwitchPort(hostname);
|
||||
//if it is a hub, return invalid
|
||||
if (FarEnd.myType == NetworkComponentType.net_hub)
|
||||
return NB.InvalidVLAN;
|
||||
//if it is a wireless device, find the vlan the device is attached to.
|
||||
if (FarEnd.IsWirelessForwarder())
|
||||
{
|
||||
return FarEnd.PrimaryVLAN();
|
||||
}
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by PrimaryVLAN
|
||||
/// </summary>
|
||||
/// <param name="tList"></param>
|
||||
/// <returns></returns>
|
||||
private int ProcessVLANlist(List<NetworkCard> tList)
|
||||
{
|
||||
int VLAN = NB.InvalidVLAN;
|
||||
int tvlan = NB.InvalidVLAN;
|
||||
foreach(NetworkCard nic in tList)
|
||||
{
|
||||
tvlan = VLANFromNIC(nic);
|
||||
if(VLAN != NB.InvalidVLAN && tvlan != VLAN)
|
||||
{
|
||||
//We have multiple VLANs defined on these nics. We do not know what is primary
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
VLAN = tvlan;
|
||||
}
|
||||
return VLAN;
|
||||
}
|
||||
/// <summary>
|
||||
/// Return the primary vlan of the device.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int PrimaryVLAN()
|
||||
{
|
||||
int tVLAN;
|
||||
List<NetworkCard> Connections;
|
||||
|
||||
Connections = NICsFromTypeNic(NicType.management_interface);
|
||||
tVLAN = ProcessVLANlist(Connections);
|
||||
if (tVLAN != NB.InvalidVLAN) return tVLAN;
|
||||
|
||||
//Connections = NICsFromTypeNic(NicType.wan); //If the device has a wan vlan defined
|
||||
//tVLAN = ProcessVLANlist(Connections);
|
||||
//if (tVLAN != NB.InvalidVLAN) return tVLAN;
|
||||
|
||||
Connections = NICsFromTypeNic(NicType.eth);
|
||||
tVLAN = ProcessVLANlist(Connections);
|
||||
if (tVLAN != NB.InvalidVLAN) return tVLAN;
|
||||
|
||||
Connections = NICsFromTypeNic(NicType.wlan);
|
||||
tVLAN = ProcessVLANlist(Connections);
|
||||
if (tVLAN != NB.InvalidVLAN) return tVLAN;
|
||||
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On a switch, return the vlan that hostname is attached to. Returns invalid if not found on this switch
|
||||
/// </summary>
|
||||
/// <param name="hostname">the hostname of the device</param>
|
||||
/// <returns>nb.invalid if it is not attached to this switch, or if this is not a switch</returns>
|
||||
public int VLANFromSwitchPort(string hostname)
|
||||
{
|
||||
if (myType == NetworkComponentType.net_hub) return NB.InvalidVLAN; //Hubs do not know what vlan they are on
|
||||
if(myType == NetworkComponentType.net_switch || myType == NetworkComponentType.wrouter)
|
||||
{
|
||||
//We want to find the port the hostname is on.
|
||||
foreach(NetworkCard nic in NICs)
|
||||
{
|
||||
NetworkDevice FarEnd = ConnectedTo(nic); //Get the device at the far end
|
||||
if (FarEnd == null) continue;
|
||||
if(FarEnd.hostname == hostname)
|
||||
{
|
||||
//This is the port the host is on
|
||||
return VLANFromNIC(nic);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
|
||||
public int VLANFromIP(string ip)
|
||||
{
|
||||
NetworkInterface nif = InterfaceFromIP(ip);
|
||||
if (nif == null) return NB.InvalidVLAN; //Nothing
|
||||
return VLANFromNIF(nif);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if the device has a link to the specified host
|
||||
/// </summary>
|
||||
@ -755,15 +945,6 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a copy of the image for this device
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Image GetImage()
|
||||
{
|
||||
return new Bitmap(MyImage);
|
||||
}
|
||||
|
||||
//This function heavily borrowed from: http://stackoverflow.com/questions/1563038/fast-work-with-bitmaps-in-c-sharp
|
||||
public Image ColoredImage(Image BaseImage)
|
||||
{
|
||||
@ -1173,6 +1354,73 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NetworkInterface InterfaceFromIP(string IP)
|
||||
{
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
foreach (NetworkInterface nif in nic.interfaces)
|
||||
{
|
||||
if (nif.myIP.GetIPString == IP)
|
||||
return nif;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool RenumberIP(string newip, NB_IPAddress gateway, int vlanID)
|
||||
{
|
||||
DefaultGW = new NB_IPAddress(gateway);
|
||||
//figure out which interface to change.
|
||||
|
||||
if (!RenumberIP(newip, gateway, NicType.management_interface, vlanID))
|
||||
if (!RenumberIP(newip, gateway, NicType.eth, vlanID))
|
||||
return RenumberIP(newip, gateway, NicType.wlan, vlanID);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RenumberIP(string newip, NB_IPAddress gateway, NicType what, int vlan)
|
||||
{
|
||||
List<NetworkCard> smalllist = NICsFromTypeNic(what);
|
||||
smalllist.Sort((p, q) => p._nic_name.CompareTo(q._nic_name));
|
||||
foreach (NetworkCard nic in smalllist)
|
||||
{
|
||||
//see if we can renumber this one
|
||||
//It cannot be dhcp, and must be connected.
|
||||
if((!nic.UsesDHCP && nic.isConnected(false)) || nic.GetNicType == NicType.management_interface)
|
||||
{
|
||||
//If we are doing vlans, the vlan should match the interface if eth
|
||||
//If we are doing vlans, the vlan should match if we are doing management interface
|
||||
//
|
||||
//right now, just do it.
|
||||
NetworkInterface nif = nic.PrimaryInterface();
|
||||
if(nif == null)
|
||||
{ //There are multiple interfaces, or there are no interfaces.
|
||||
//If multiple interfaces, try one with the specified vlan.
|
||||
nif = nic.InterfaceFromVlanTag(vlan);
|
||||
}
|
||||
if (nif != null)
|
||||
{
|
||||
nif.myIP = new NB_IPAddress(newip, gateway._mask.ToIpString(), IPAddressType.ip);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public NetworkCard NicFromIP(string IP)
|
||||
{
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
foreach(NetworkInterface nif in nic.interfaces)
|
||||
{
|
||||
if (nif.myIP.GetIPString == IP)
|
||||
return nic;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public NetworkCard NicFromID(HostNicID ID)
|
||||
{
|
||||
return NicFromID(ID.NicID);
|
||||
@ -1440,7 +1688,12 @@ namespace EduNetworkBuilder
|
||||
public bool HasBroadcastAddress(NB_IPAddress dest)
|
||||
{
|
||||
if (dest.BroadcastAddress == dest.GetIP) return true;
|
||||
foreach(NetworkCard nic in NICs)
|
||||
|
||||
//This "fixes" a strange fringe case of when we configure a subnet such that
|
||||
//a packet that is traversing the network suddenly is a broadcast packet on the
|
||||
//target network. Gotta have odd subnetting for this to happen
|
||||
if (NB.BroadcastIPString == dest.GetIPString) return true;
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if (nic.HasBroadcastAddresses(dest))
|
||||
return true;
|
||||
@ -1518,109 +1771,28 @@ namespace EduNetworkBuilder
|
||||
return arps;
|
||||
}
|
||||
|
||||
public override void UpdateFromComponent(NetworkComponent CopyFrom, bool NoteAllChanges = false)
|
||||
public override void UpdateFromComponent(NetworkComponent CopyFrom)
|
||||
{
|
||||
if (CopyFrom.GetType() != this.GetType()) return; //we cannot copy from it if it is different
|
||||
NetworkDevice ndCopyFrom = (NetworkDevice)CopyFrom;
|
||||
if (Object.ReferenceEquals(this, CopyFrom)) return; //No need to copy values to itself
|
||||
|
||||
Network mainnet = NB.GetNetwork();
|
||||
string indent = " ";
|
||||
//if(NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + NB.Translate("NDUpdateComponent")));
|
||||
|
||||
if (hostname != ndCopyFrom.hostname)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "hostname: " + hostname + " -> " + ndCopyFrom.hostname));
|
||||
hostname = ndCopyFrom.hostname;
|
||||
}
|
||||
|
||||
Size = ndCopyFrom.Size;
|
||||
if (DefaultGW.GetIPString != ndCopyFrom.DefaultGW.GetIPString)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "DefaultGW: " + DefaultGW.GetIPString + " -> " + ndCopyFrom.DefaultGW.GetIPString));
|
||||
DefaultGW = ndCopyFrom.DefaultGW;
|
||||
}
|
||||
if (ndCopyFrom.MyImage != null)
|
||||
MyImage = new Bitmap(ndCopyFrom.MyImage);
|
||||
else
|
||||
MyImage = null;
|
||||
|
||||
if (CanAddNics != ndCopyFrom.CanAddNics)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "CanAddNics: " + CanAddNics + " -> " + ndCopyFrom.CanAddNics));
|
||||
CanAddNics = ndCopyFrom.CanAddNics;
|
||||
}
|
||||
|
||||
if (CanServeDHCP != ndCopyFrom.CanServeDHCP)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "CanServeDHCP: " + CanServeDHCP + " -> " + ndCopyFrom.CanServeDHCP));
|
||||
CanServeDHCP = ndCopyFrom.CanServeDHCP;
|
||||
}
|
||||
|
||||
if (CanUseDHCP != ndCopyFrom.CanUseDHCP)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "CanUseDHCP: " + CanUseDHCP + " -> " + ndCopyFrom.CanUseDHCP));
|
||||
CanUseDHCP = ndCopyFrom.CanUseDHCP;
|
||||
}
|
||||
|
||||
if (MustUseDHCP != ndCopyFrom.MustUseDHCP)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "MustUseDHCP: " + MustUseDHCP + " -> " + ndCopyFrom.MustUseDHCP));
|
||||
MustUseDHCP = ndCopyFrom.MustUseDHCP;
|
||||
}
|
||||
|
||||
if (isDHCPServer != ndCopyFrom.isDHCPServer)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "IsDHCPServer: " + isDHCPServer + " -> " + ndCopyFrom.isDHCPServer));
|
||||
isDHCPServer = ndCopyFrom.isDHCPServer;
|
||||
}
|
||||
|
||||
if (isDNSServer != ndCopyFrom.isDNSServer)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "IsDNSserver: " + isDNSServer + " -> " + ndCopyFrom.isDNSServer));
|
||||
isDNSServer = ndCopyFrom.isDNSServer;
|
||||
}
|
||||
|
||||
if (HasAdvFirewall != ndCopyFrom.HasAdvFirewall)
|
||||
{
|
||||
if (NoteAllChanges && mainnet != null) mainnet.AddMessage(new PacketMessage("", indent + "HasAdvancedFirewall: " + HasAdvFirewall + " -> " + ndCopyFrom.HasAdvFirewall));
|
||||
HasAdvFirewall = ndCopyFrom.HasAdvFirewall;
|
||||
}
|
||||
|
||||
MyLocation = ndCopyFrom.MyLocation;
|
||||
|
||||
//Process NICs.
|
||||
if (NoteAllChanges && mainnet != null)
|
||||
{
|
||||
//List all nics that we are dropping
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
NetworkCard foundnic = ndCopyFrom.NicFromName(nic.NicName());
|
||||
if (foundnic == null)
|
||||
mainnet.AddMessage(new PacketMessage("", indent + "DropNIC: " + nic.NicName()));
|
||||
else
|
||||
{
|
||||
//The nic still exists. Note any major changes. IP, netmask
|
||||
if((foundnic.myNicType == NicType.wport || foundnic.myNicType == NicType.wlan) && foundnic.SSID != nic.SSID)
|
||||
mainnet.AddMessage(new PacketMessage("", indent + "SSID: " + nic.SSID + " -> " + foundnic.SSID));
|
||||
if ((foundnic.myNicType == NicType.vpn || foundnic.myNicType == NicType.vpn) && foundnic.EncryptionKey != nic.EncryptionKey)
|
||||
mainnet.AddMessage(new PacketMessage("", indent + "EncryptionKey: " + nic.EncryptionKey + " -> " + foundnic.EncryptionKey));
|
||||
|
||||
//Compare interfaces - should be done at nic level...
|
||||
if (foundnic.AllInterfacesString() != nic.AllInterfacesString())
|
||||
mainnet.AddMessage(new PacketMessage("", indent + "Interfaces: " + nic.AllInterfacesString(true) + " -> " + foundnic.AllInterfacesString(true)));
|
||||
}
|
||||
}
|
||||
//List all nics that we are dropping
|
||||
foreach (NetworkCard nic in ndCopyFrom.NICs)
|
||||
{
|
||||
NetworkCard mynic = NicFromName(nic.NicName());
|
||||
if (mynic == null)
|
||||
mainnet.AddMessage(new PacketMessage("", indent + "AddNIC: " + nic.NicName() + " " +nic.AllInterfacesString()));
|
||||
}
|
||||
}
|
||||
|
||||
//Now, copy across the NICs
|
||||
NICs.Clear();
|
||||
foreach(NetworkCard nic in ndCopyFrom.NICs)
|
||||
{
|
||||
@ -1634,6 +1806,24 @@ namespace EduNetworkBuilder
|
||||
RouteTable.AddRange(ndCopyFrom.RouteTable);
|
||||
DHCPRanges.Clear();
|
||||
DHCPRanges.AddRange(ndCopyFrom.DHCPRanges);
|
||||
//if the IP address has changed, also update the corresponding address in DHCP rules
|
||||
foreach (NB_IPAddress dhcpIP in DHCPRanges)
|
||||
{
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
NetworkInterface matchingIF = nic.LocalInterface(dhcpIP, null);
|
||||
if (matchingIF != null && !matchingIF.myIP.Equals(dhcpIP.GetIP) && !matchingIF.myIP.Equals(0))
|
||||
{
|
||||
//only validate the entry if the new address doesn't conflict with the DHCP range.
|
||||
UInt32 nStartingDHCP = dhcpIP.GetMask;
|
||||
UInt32 nEndingDHCP = dhcpIP.GetGateway;
|
||||
if (matchingIF.myIP.GetIP < nStartingDHCP || matchingIF.myIP.GetIP > nEndingDHCP)
|
||||
{
|
||||
dhcpIP.SetIP(matchingIF.myIP.GetIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DHCPLeases.Clear();
|
||||
DHCPLeases.AddRange(ndCopyFrom.DHCPLeases);
|
||||
|
||||
@ -1913,7 +2103,7 @@ namespace EduNetworkBuilder
|
||||
//Change this. Need a new ProcessArrival
|
||||
if (tPacket.MyType != PacketType.dhcp_answer) //If it is a match, it should be handled elsewhere
|
||||
ProcessArrival(tPacket);
|
||||
if (ExactMatch && tPacket.isFinshed())
|
||||
if (ExactMatch && tPacket.isFinished())
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1960,7 +2150,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
}
|
||||
|
||||
if (tPacket.isFinshed() && !BroadcastMatch) return;
|
||||
if (tPacket.isFinished() && !BroadcastMatch) return;
|
||||
|
||||
NetworkCard dNic = null;
|
||||
NetworkCard sNic = null;
|
||||
@ -2642,7 +2832,12 @@ namespace EduNetworkBuilder
|
||||
NetworkCard tCard = null;
|
||||
NB_IPAddress DestAddr;
|
||||
string DHCPGW = "";
|
||||
foreach( NB_IPAddress ip in RouteTable)
|
||||
|
||||
//Do not ping the zero string. Should not go anywhere
|
||||
if (dest != null && dest.GetIPString == NB.ZeroIPString)
|
||||
return new NB_IPAddress(NB.ZeroIPString);
|
||||
|
||||
foreach ( NB_IPAddress ip in RouteTable)
|
||||
{
|
||||
if (ip.IsLocal(dest))
|
||||
return new NB_IPAddress(ip.GetGateway.ToIpString());//We return the gateway
|
||||
@ -2875,6 +3070,19 @@ namespace EduNetworkBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<NetworkCard> NICsFromTypeNic(NicType What)
|
||||
{
|
||||
List<NetworkCard> tList = new List<NetworkCard>();
|
||||
foreach (NetworkCard nic in NB.Randomize(NICs).ToList())
|
||||
{
|
||||
if (nic.GetNicType == What)
|
||||
{
|
||||
tList.Add(nic);
|
||||
}
|
||||
}
|
||||
return tList;
|
||||
}
|
||||
|
||||
public NB_IPAddress BestIPForThis(NetworkDevice Source=null)
|
||||
{
|
||||
NB_IPAddress answer=null;
|
||||
@ -3002,14 +3210,16 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (!ForwardsPackets())
|
||||
if (!ForwardsPackets() || HasIPAddress(tPacket.destIP))
|
||||
{
|
||||
//Traceroute bounce-back
|
||||
if(tPacket.MyType == PacketType.tracert_request)
|
||||
if (tPacket.MyType == PacketType.tracert_request)
|
||||
{
|
||||
if (ProcessTracertPacket(tPacket)) return; //the packet stops if it gets bounced.
|
||||
}
|
||||
|
||||
}
|
||||
if (!ForwardsPackets())
|
||||
{
|
||||
if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer)
|
||||
{
|
||||
tPacket.AddMessage(DebugLevel.debug, NB.LeftPad(hostname) + " " +string.Format(NB.Translate("ND_DoInFromLnkDeaf")));
|
||||
@ -3080,7 +3290,12 @@ namespace EduNetworkBuilder
|
||||
//Console.WriteLine(" Tracert bounce: " + tPacket.OrigTTL + " " + hostname + " " + tPacket.payloadData);
|
||||
|
||||
//Finish setting up the new packet - sending it back
|
||||
// respond from requested address, not outgoing address: important for routers.
|
||||
if (HasIPAddress(tPacket.destIP))
|
||||
nPacket.sourceIP = tPacket.destIP;
|
||||
else
|
||||
nPacket.sourceIP = new NB_IPAddress(NB.ZeroIPString);
|
||||
|
||||
nPacket.TsourceIP = new NB_IPAddress(NB.ZeroIPString);
|
||||
myNet.addPacket(nPacket);
|
||||
//Console.WriteLine(" Tracert bounce pkt:" + nPacket.OrigTTL + nPacket.payloadData);
|
||||
|
@ -123,6 +123,16 @@ namespace EduNetworkBuilder
|
||||
return VLANTagType.Forbidden; //if not defined, it is forbidden
|
||||
}
|
||||
|
||||
public int GetUntaggedVLAN()
|
||||
{
|
||||
foreach (VLANInfo vin in VLANs)
|
||||
{
|
||||
if (vin.Tag == VLANTagType.Untagged)
|
||||
return vin.ID;
|
||||
}
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
|
||||
public int GetNonForbiddenVLANID()
|
||||
{
|
||||
foreach(VLANInfo vin in VLANs)
|
||||
@ -130,7 +140,7 @@ namespace EduNetworkBuilder
|
||||
if (vin.Tag != VLANTagType.Forbidden)
|
||||
return vin.ID;
|
||||
}
|
||||
return -999;
|
||||
return NB.InvalidVLAN;
|
||||
}
|
||||
|
||||
public void SetVLANTag(int id, VLANTagType Tag)
|
||||
|
@ -489,7 +489,7 @@ namespace EduNetworkBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool isFinshed()
|
||||
public bool isFinished()
|
||||
{
|
||||
if (_MyStatus == PacketStatus.finished_ok) return true;
|
||||
if (_MyStatus == PacketStatus.finished_failed) return true;
|
||||
|
@ -70,7 +70,7 @@
|
||||
<interface>
|
||||
<nicname>management_interface0</nicname>
|
||||
<myip>
|
||||
<ip>102.168.1.4</ip>
|
||||
<ip>192.168.1.4</ip>
|
||||
<mask>255.255.255.0</mask>
|
||||
<gateway>0.0.0.0</gateway>
|
||||
<type>ip</type>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<EduNetworkBuilder>
|
||||
<!--This is a network file for EduNetworkBuilder.-->
|
||||
<Network>
|
||||
<en_message>The one router got replaced and needs the correct IP-Addresses given to it.</en_message>
|
||||
<fr_message>Le routeur a été remplacé et a besoin des adresses IP correctes qui lui ont été attribuées.</fr_message>
|
||||
<en_message>The one router got replaced and needs the correct IP-Addresses and routes given to it.</en_message>
|
||||
<fr_message>Le routeur a été remplacé et a besoin des adresses IP correctes qui lui ont été attribuées et des itinéraires.</fr_message>
|
||||
<en_title>Router Replacement</en_title>
|
||||
<height>1024</height>
|
||||
<width>1024</width>
|
||||
@ -1205,18 +1205,6 @@
|
||||
ID="1">Untagged</VLAN>
|
||||
</interface>
|
||||
</nic>
|
||||
<route>
|
||||
<ip>172.16.1.2</ip>
|
||||
<mask>255.255.255.252</mask>
|
||||
<gateway>172.16.1.9</gateway>
|
||||
<type>route</type>
|
||||
</route>
|
||||
<route>
|
||||
<ip>172.16.1.18</ip>
|
||||
<mask>255.255.255.252</mask>
|
||||
<gateway>172.16.1.14</gateway>
|
||||
<type>route</type>
|
||||
</route>
|
||||
</device>
|
||||
<device>
|
||||
<hostname>router4</hostname>
|
||||
|
@ -1478,6 +1478,11 @@ Someone is complaining that they cannot access the servers on the other side of
|
||||
<dhost>pc3</dhost>
|
||||
<thetest>SuccessfullyPings</thetest>
|
||||
</nettest>
|
||||
<nettest>
|
||||
<shost>laptop0</shost>
|
||||
<dhost>server0</dhost>
|
||||
<thetest>NeedsLocalIPTo</thetest>
|
||||
</nettest>
|
||||
<VLANName
|
||||
ID="1"
|
||||
Color="Blue">Default</VLANName>
|
||||
|
@ -1102,6 +1102,6 @@ Ce puzzle a un interrupteur que vous avez été bloqué. Réinitialisez-le (clic
|
||||
Color="Blue">Default</VLANName>
|
||||
<VLANName
|
||||
ID="2"
|
||||
Color="Blue">Sttaff</VLANName>
|
||||
Color="Blue">Staff</VLANName>
|
||||
</Network>
|
||||
</EduNetworkBuilder>
|
@ -3,7 +3,7 @@
|
||||
<!--This is a network file for EduNetworkBuilder.-->
|
||||
<Network>
|
||||
<en_message>Switch Ports can have three states:
|
||||
Unagged
|
||||
UnTagged
|
||||
Tagged
|
||||
Forbidden
|
||||
When you are connecting switch-to-switch, they should be "Tagged." This makes a "Trunk", or a backbone link that can pass any VLAN. This allows packets to go to all the switches, and let the switches determine what devices they can go to from there.
|
||||
@ -1124,6 +1124,6 @@ Pour compléter ce puzzle, vérifiez les deux commutateurs. L'un d'eux n'a pas l
|
||||
Color="Blue">Default</VLANName>
|
||||
<VLANName
|
||||
ID="2"
|
||||
Color="Blue">Sttaff</VLANName>
|
||||
Color="Blue">Staff</VLANName>
|
||||
</Network>
|
||||
</EduNetworkBuilder>
|
@ -2,7 +2,7 @@
|
||||
<EduNetworkBuilder>
|
||||
<!--This is a network file for EduNetworkBuilder.-->
|
||||
<Network>
|
||||
<en_message>A staff memner brought in a laptop and they have problems. As always, they want you to fix it.
|
||||
<en_message>A staff member brought in a laptop and they have problems. As always, they want you to fix it.
|
||||
Some vlan issues are a lot simpler than they originally look.</en_message>
|
||||
<fr_message>Un membre du personnel a apporté un ordinateur portable et ils ont des problèmes. Comme toujours, ils veulent que vous le répariez.
|
||||
Certains problèmes de vlan sont beaucoup plus simples qu'ils ne le paraissent à l'origine.</fr_message>
|
||||
|
@ -1204,6 +1204,6 @@
|
||||
Color="Blue">Default</VLANName>
|
||||
<VLANName
|
||||
ID="2"
|
||||
Color="Blue">Sttaff</VLANName>
|
||||
Color="Blue">Staff</VLANName>
|
||||
</Network>
|
||||
</EduNetworkBuilder>
|
@ -1214,6 +1214,6 @@ Pour que cela fonctionne, nous avons besoin de deux VLAN différents sur le seul
|
||||
Color="Blue">Default</VLANName>
|
||||
<VLANName
|
||||
ID="2"
|
||||
Color="Blue">Sttaff</VLANName>
|
||||
Color="Blue">Staff</VLANName>
|
||||
</Network>
|
||||
</EduNetworkBuilder>
|
@ -1121,6 +1121,6 @@ Faites un ping sur un certain nombre d'ordinateurs et faites des pings de diffus
|
||||
Color="Blue">Default</VLANName>
|
||||
<VLANName
|
||||
ID="2"
|
||||
Color="Blue">Sttaff</VLANName>
|
||||
Color="Blue">Staff</VLANName>
|
||||
</Network>
|
||||
</EduNetworkBuilder>
|
@ -42,6 +42,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>101</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -66,6 +68,8 @@
|
||||
<nictype>wan</nictype>
|
||||
<uniqueidentifier>104</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>wan0</nicname>
|
||||
<myip>
|
||||
@ -90,6 +94,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>102</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -153,6 +159,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>103</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth1</nicname>
|
||||
<myip>
|
||||
@ -202,6 +210,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>106</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -226,6 +236,8 @@
|
||||
<nictype>management_interface</nictype>
|
||||
<uniqueidentifier>107</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>management_interface0</nicname>
|
||||
<myip>
|
||||
@ -250,6 +262,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>108</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port1</nicname>
|
||||
<myip>
|
||||
@ -276,6 +290,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>109</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port2</nicname>
|
||||
<myip>
|
||||
@ -302,6 +318,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>110</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port3</nicname>
|
||||
<myip>
|
||||
@ -328,6 +346,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>111</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port4</nicname>
|
||||
<myip>
|
||||
@ -354,6 +374,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>112</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port5</nicname>
|
||||
<myip>
|
||||
@ -380,6 +402,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>113</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port6</nicname>
|
||||
<myip>
|
||||
@ -410,6 +434,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>114</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port7</nicname>
|
||||
<myip>
|
||||
@ -455,6 +481,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>116</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -479,6 +507,8 @@
|
||||
<nictype>management_interface</nictype>
|
||||
<uniqueidentifier>117</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>management_interface0</nicname>
|
||||
<myip>
|
||||
@ -505,6 +535,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>118</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port1</nicname>
|
||||
<myip>
|
||||
@ -533,6 +565,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>119</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port2</nicname>
|
||||
<myip>
|
||||
@ -542,11 +576,11 @@
|
||||
<type>ip</type>
|
||||
</myip>
|
||||
<VLAN
|
||||
ID="1">Untagged</VLAN>
|
||||
ID="1">Forbidden</VLAN>
|
||||
<VLAN
|
||||
ID="2">Forbidden</VLAN>
|
||||
<VLAN
|
||||
ID="3">Forbidden</VLAN>
|
||||
ID="3">Untagged</VLAN>
|
||||
</interface>
|
||||
</nic>
|
||||
<nic>
|
||||
@ -561,6 +595,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>120</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port3</nicname>
|
||||
<myip>
|
||||
@ -589,6 +625,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>121</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port4</nicname>
|
||||
<myip>
|
||||
@ -617,6 +655,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>122</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port5</nicname>
|
||||
<myip>
|
||||
@ -645,6 +685,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>123</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port6</nicname>
|
||||
<myip>
|
||||
@ -675,6 +717,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>124</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port7</nicname>
|
||||
<myip>
|
||||
@ -720,6 +764,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>126</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -744,6 +790,8 @@
|
||||
<nictype>management_interface</nictype>
|
||||
<uniqueidentifier>127</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>management_interface0</nicname>
|
||||
<myip>
|
||||
@ -770,6 +818,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>128</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port1</nicname>
|
||||
<myip>
|
||||
@ -798,6 +848,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>129</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port2</nicname>
|
||||
<myip>
|
||||
@ -826,6 +878,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>130</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port3</nicname>
|
||||
<myip>
|
||||
@ -852,6 +906,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>131</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port4</nicname>
|
||||
<myip>
|
||||
@ -878,6 +934,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>132</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port5</nicname>
|
||||
<myip>
|
||||
@ -904,6 +962,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>133</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port6</nicname>
|
||||
<myip>
|
||||
@ -934,6 +994,8 @@
|
||||
<nictype>port</nictype>
|
||||
<uniqueidentifier>134</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>port7</nicname>
|
||||
<myip>
|
||||
@ -980,6 +1042,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>136</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1004,6 +1068,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>137</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1044,6 +1110,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>139</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1068,6 +1136,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>140</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1108,6 +1178,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>142</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1132,6 +1204,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>143</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1172,6 +1246,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>145</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1196,6 +1272,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>146</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1236,6 +1314,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>148</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1260,6 +1340,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>149</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1300,6 +1382,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>151</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1324,6 +1408,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>152</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
@ -1364,6 +1450,8 @@
|
||||
<nictype>lo</nictype>
|
||||
<uniqueidentifier>154</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>lo0</nicname>
|
||||
<myip>
|
||||
@ -1388,6 +1476,8 @@
|
||||
<nictype>eth</nictype>
|
||||
<uniqueidentifier>155</uniqueidentifier>
|
||||
<usesdhcp>False</usesdhcp>
|
||||
<encryptionkey />
|
||||
<ssid />
|
||||
<interface>
|
||||
<nicname>eth0</nicname>
|
||||
<myip>
|
||||
|
@ -1,306 +1,689 @@
|
||||
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}}
|
||||
{\colortbl ;\red0\green0\blue255;}
|
||||
{\*\generator Riched20 10.0.22621}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
|
||||
\pard\nowidctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Version 1.0.54\b0\par
|
||||
* Minor changefor developers allowing more information about what is happening during regression testing. \par
|
||||
\b Version 1.0.53\par
|
||||
*\b0 Show a line between devices when dragging ethernet cables. Makes it easier to see.\par
|
||||
* Tried highlighting what you are supposed to be filling out next, when creating network links.\b\par
|
||||
Version 1.0.52\par
|
||||
\b0 * Change publish URL to an actual domain.\b\par
|
||||
Version 1.0.51\par
|
||||
\b0 * Added small time-based delay when printing packets; on fast computers the packets would fly by too fast.\par
|
||||
\b Version 1.0.50\par
|
||||
\b0 * Added regression testing for making sure we do not break things while making changes to the UI or how the system works.\par
|
||||
* Added regression tests for most all the networks\par
|
||||
* Able to change gateway if the primary network connection does not have DHCP. There was an issue with a puzzle because of this.\par
|
||||
* Do not check firewall rules if the firewall checkmark is turned off. You can disable the firewall rules by turning off the firewall.\par
|
||||
* Get the reload button working properly. You can reload a puzzle and it will reset to its original state.\par
|
||||
* Better listing of puzzles and highlighting the next puzzle to do.\par
|
||||
* When resetting a switch, reset the vlans on that switch. Somewhere this broke and we needed to put it back.\par
|
||||
* Added some action debugging. No impact on users, just developers.\par
|
||||
* Better processing of wireless link autojoin\par
|
||||
\b Version 1.0.49\par
|
||||
\b0 * Change level1_practice5. It had been a puzzle with two DHCP servers, but we have not taught that concept yet. I change it so the DHCP server was passing out bad DHCP. IPs already exist.\par
|
||||
* Fixed a few bugs in other \ldblquote practice\rdblquote levels.\par
|
||||
* Made a test for a network loop. So we can have a \ldblquote ping without looping\rdblquote test. So we need to have a successful ping that does not cause a network loop.\par
|
||||
* Fixed an issue with wireless bridges. They were routing packets instead of forwarding packets, which broke them in a few instances.\par
|
||||
* Make it so a NIC can spray. It creates bad packets that just keep coming.\par
|
||||
* Fix some issues with wireless links. Some puzzles had saved multiple wireless links to the same device, which ended up having some rather bizarre issues. Since all wireless links are rebuilt on load, I made it so none of the wireless links are saved, and if they are loaded, they are discarded. It solved a number of issues. \par
|
||||
\b Version 1.0.48\par
|
||||
\b0 * Fix a traversal class not serializable error\par
|
||||
* Close the file -> load toolstrip menu after a load. It had remained annoyingly open.\par
|
||||
* Added a bunch of \ldblquote practice\rdblquote puzzles. These are for practicing troubleshooting. They do not give you a lot of information about what the problem is; you need to do a bit more testing and trying things to figure them out.\par
|
||||
* Added a bunch of level5 practice puzzles. More physical networking and wireless than routing issues.\par
|
||||
* Added the solved versions of the office networks. One with wireless linking between them, and the other having physical wires.\par
|
||||
\b Version 1.0.47\par
|
||||
\b0 * YAY! The long-awaited ctrl-z / ctrl-y works. Undo / redo.\par
|
||||
* Lock a device to a location\par
|
||||
* Add a tree. Wireless packets cannot go through a tree.\par
|
||||
* Add background shapes. So we can draw a building and have understandable line of sight.\par
|
||||
* Add a wireless line of sight puzzle.\par
|
||||
* Went through old puzzles and locked some items in their locations. Makes some puzzles need to be solved the way the puzzle was intended to be solved.\par
|
||||
\b Version 1.0.46\par
|
||||
\b0 * Added a frozen device. Fix it with a reboot. (power off / power on)\par
|
||||
* Added a bad power-supply (device catches fire when powered on. Need to replace the device to fix)\par
|
||||
* Added bad electricity. (device continues to catch fire, even after being replaced, until a UPS is added)\par
|
||||
* Can right-click a network wire. Delete, edit, replace.\par
|
||||
* Added frozen device, bad power-supply and Needs UPS as ways to randomly break networks.\par
|
||||
* Optimize the redrawing of the screen packets. Speeded it up considerably\par
|
||||
* Add puzzles for frozen device, bad power-supply, and needs a UPS.\par
|
||||
\b Version 1.0.45\par
|
||||
\b0 * More infrastructure for translating the main program\par
|
||||
\b Version 1.0.44\par
|
||||
\b0 * Added ability to add a video URL to a help topic\par
|
||||
* Added video URL for individual puzzles\par
|
||||
* Added some initial videos\par
|
||||
* More work on translation window (most people will not see this)\par
|
||||
* Fix order of help-level radio-buttons.\par
|
||||
* Some puzzles are properly translated to French\par
|
||||
\b Version 1.0.43\par
|
||||
\b0 * Added the title to the translation window. Puzzle titles can now be translated.\par
|
||||
* Use the translated titles for the puzzle names on the puzzle selection box\par
|
||||
\b Version 1.0.42\par
|
||||
\b0 * Fixed some bugs with working in French \endash puzzles would not show\par
|
||||
* Fixed bug in French \endash \ldblquote Ping to\rdblquote would not work\par
|
||||
* Added a translation box when working on puzzles. Ctrl-click the network message in the options window to pull up a translation box. Look at two languages simultaneously. Has save button to save your changes from there.\par
|
||||
\b Version 1.0.41\par
|
||||
\b0 * Have the ability to randomly break a network. If you want to just test your brain for fun, or if you are a teacher and just want to generate some homework of some sort. This can help.\par
|
||||
* Added another solved network (InternetHomeAndOffice)\par
|
||||
* Give us more options for viewing text under devices. This lets us see things much more cleanly.\par
|
||||
* Allow different captioning systems. Hostname only, IP only, host + IP, none, full\par
|
||||
* firewall rules can now affect VPN traffic. You can block from a VPN to the office VLAN, for example. Also, can block guest VLAN from pinging something across the VPN.\par
|
||||
\b Version 1.0.40\par
|
||||
\b0 * Jumping ahead version numbers. Adding Educational Mode (see doc on the wiki for a description of the basic functionality added) {{\field{\*\fldinst{HYPERLINK https://git.solidcharity.com/timy/EduNetworkBuilder/wikis/Teacherdoc }}{\fldrslt{https://git.solidcharity.com/timy/EduNetworkBuilder/wikis/Teacherdoc\ul0\cf0}}}}\f0\fs22\par
|
||||
* Added the ability to make msi files for better deployment in multi-user settings\par
|
||||
* Adjusted drag functionality so we do not jostle devices around accidentally\par
|
||||
* Fixed bug when trying to ping wireless devices by name\par
|
||||
* Fixed a bug pinging 0.0.0.0\par
|
||||
* Fixed lots of other bugs\par
|
||||
\b Version 1.0.33\par
|
||||
\b0 * Fixed a major bug in settings that would blow up new installs.\par
|
||||
* ctrl-right-click a device to add \ldblquote hide\rdblquote to the context menu.\par
|
||||
* From the puzzle menu you can ctrl-alt click items to mark them as solved.\par
|
||||
* Display bad subnet masks (that cannot be displayed using CIDR notation) as /?\par
|
||||
* Allow pings from devices that are locked. A bug made it so we could not change the address we wanted to ping to; all ip-addresses were locked, even a \ldblquote ping to\rdblquote address.\par
|
||||
* Minor bug: If we ping a local IP that does not exist, the error message we were getting was the wrong error message. Fixed that.\par
|
||||
* When wireless device is powered off, remove all wireless links. Links connected to WLAN had been reconnected. Fixed that.\par
|
||||
* Cannot go into the network options if we have loaded the network from resources. This way we cannot \ldblquote cheat\rdblquote by changing the network options. This is in preparation for setting this up for school use. Making it harder for students to cheat on homework assignments.\par
|
||||
\b Version 1.0.32\par
|
||||
\b0 * Allow dragging of items\par
|
||||
* Select multiple items for dragging by using a nice big drag-box.\par
|
||||
* Highlight the multiple items if selecting them\par
|
||||
* Allow the ESC key to clear the selected items.\par
|
||||
* Can right-click and delete of multiple selected items\par
|
||||
* Can right-click and change color of multiple selected items\par
|
||||
* Fixed some tracert bugs\par
|
||||
* lots of minor fixes so is more stable on Linux\par
|
||||
* Saves settings in ~/.conf/EduNetworkbuilder_config.xml file on Linux\par
|
||||
* Cannot edit something that is powered off. Also, cannot ping, do DHCP refresh, etc.\par
|
||||
* Fixed losing the VPN password changes when editing VPN Info.\par
|
||||
* Fixed anchoring of puzzle filter box.\par
|
||||
* Added invisible items. Forgotten switches and unseen network wires. Right now, the only way to make something hidden is by editing the file and saying <invisible>true</invisible> on it.\par
|
||||
\b Version 1.0.31\par
|
||||
\b0 * Added powering off switches, routers, and the like\par
|
||||
* Added traceroute\par
|
||||
* Added a few puzzles for those\par
|
||||
* Moved to a new git repository\par
|
||||
* Changed the default location of popups. They worked very strange in a multi-window environment.\par
|
||||
\b Version 1.0.30\par
|
||||
\b0 * Another downloadable (zip only, stable) version.\b\par
|
||||
Version 1.0.29\par
|
||||
\b0 * Lots of VLAN butfixes\par
|
||||
* Fixed ping-fail test\par
|
||||
* Lots more VLAN puzzles\par
|
||||
* Update VLAN documentation\par
|
||||
\b Version 1.0.28\par
|
||||
\b0 * Initial VLAN release\par
|
||||
\b Version 1.0.27\par
|
||||
\b0 * Made distribution easier by CD (does updates from web, but we also have a downloadable zip you can install from)\par
|
||||
\b Version 1.0.26\par
|
||||
\b0 * Major graphics overhaul\par
|
||||
- Packets move on timer\par
|
||||
- Graphics drawn "smarter"\par
|
||||
- Result is that things flow smoother. Loopback2 also works much nicer. \par
|
||||
* Fixed minor issue with "help" puzzle\par
|
||||
* Made help "?" button turn red when it is part of the puzzle\par
|
||||
* Put checkmark to display names and IPs of devices on front form.\par
|
||||
* Add a NetTest to show people to click on the "display Device names and IP" checkmark\b\par
|
||||
Version 1.0.25\par
|
||||
\b0 * Minor changes to help file\par
|
||||
* Fixed size of labels on IP-Address editor box\par
|
||||
* Hide gateway label when we do not need it. (ip-address editor)\par
|
||||
* rename "mixed network" puzzle to be "adding devices" (the puzzle was about adding devices)\par
|
||||
* Changed layout of many messages\par
|
||||
* Save the level we are working on. Allows us to finish level 5 before level 3 if we want to.\par
|
||||
* Make network-loop puzzles sit next to each-other\par
|
||||
* Make it so network-loop2 puzzle asks for second ping after first one finishes \par
|
||||
* Lots of work towards the French translation\b\par
|
||||
Version 1.0.24 \par
|
||||
\b0 * Add sound when ctrl-s is pressed so we know we saved.\par
|
||||
* Add sound fail when save is canceled (will use it later if ctrl-s fails)\par
|
||||
* Added some wireless puzzles\par
|
||||
* Fix issue with WAP not forwarding packets correctly\par
|
||||
* Clear out old status message if we do something. So we do not say "saved" forever...\par
|
||||
* Fixed bad gateway on wireless router issue\par
|
||||
* Fixed wbridge misbehaving. (issue with gateway)\par
|
||||
* Added wireless items to help and context help topics\par
|
||||
* Thanks to Peter Wilson for so much of the translation backbone.\par
|
||||
* Lots of translation string changes. The French translation should be soon in coming.\par
|
||||
\b Version 1.0.23 09/20/2015\par
|
||||
\b0 * Fixed issues with broadcast packets\par
|
||||
* Fixed a network loop issue\par
|
||||
* Fixed issue with multiple interfaces and being able to go out a different interface than we came in on\par
|
||||
* Fixed many small bugs that crept in when fixing other bugs. Now all puzzles seem to play correctly\b\par
|
||||
Version 1.0.22 09/01/2015\b0\par
|
||||
* Added ssid and keys for wireless links\par
|
||||
* Wireless will auto-disconnect if link is too long\par
|
||||
* Wireless will auto-connect if ssid and key match, if link is short enough\par
|
||||
* Packets will drop on wireless links if distance is too great\par
|
||||
* wport has no interface (cannot edit IP address)\par
|
||||
* wireless router works properly - forwards broadcast packets\par
|
||||
* wireless router handles dhcp requests properly (both responds to it but also passes it on)\par
|
||||
* right-clicking light and microwave no longer has ping, arp, edit, and other context menus\par
|
||||
* added net-test for DHCP server status (on/off)\par
|
||||
* If multiple DHCP servers, client randomly chooses which to keep.\par
|
||||
*Add Wireless Puzzle\par
|
||||
*Fix many wireless device bugs\line\b Version 1.0.21 08/15/2015\b0\par
|
||||
* Added a microwave and fluorescent light. They corrupt data when packets run close to them.\par
|
||||
* Added some packet corruption puzzles\par
|
||||
* Fixed window resize-on-load issue where the help window popped up first, then the builder window resized over to hide the help window. \par
|
||||
\b Version 1.0.20 08/12/2015\b0\par
|
||||
* wports do not display on tooltips or when printing the device info\par
|
||||
* Added ctrl-s to quick-save a network we are working on\par
|
||||
* commented out wireless devices for now - doing a big demo and wireless is not yet complete\par
|
||||
* added search box to help\par
|
||||
\b Version 1.0.19 08/08/2015\b0\par
|
||||
*Updated context help for most puzzles that introduce new ideas.\par
|
||||
* Sorted Help topics when adding them in net-tests.\par
|
||||
* Added some images to the help to help clarify things.\par
|
||||
* Start with the help windows being the same "height" as the network window.\par
|
||||
* Open Help so it can be kept open while the puzzles progress.\par
|
||||
* Deal with minimized state better (used to shrink window to smallest possible state)\par
|
||||
* Remember size and location of main window between uses.\par
|
||||
\b Version 1.0.18 08/08/2015\b0\par
|
||||
* Added Context Help for puzzles.\par
|
||||
- Each puzzle can have context help\par
|
||||
- There is a net-test to have us read help\par
|
||||
* fixed minor problem with a "ding" sound when we load a puzzle that has something locked.\par
|
||||
\b Version 1.0.17 08/01/2015\b0\par
|
||||
* Added more help\par
|
||||
* Much progress made in preparing for a French translation\par
|
||||
* allow for Puzzle's description to be in another language\par
|
||||
* Added more to help\par
|
||||
* Removed edit -> cut, paste, copy, undo. They never did anything. So why have them?\par
|
||||
* Save box starts in the directory of the file we opened (if we have one)\par
|
||||
* Choose a language at startup if one has never been chosen, and have option to change language.\par
|
||||
* Added another puzzle, showing what happens (or does not happen) if we have two networks that use the same IP addresses, and we want to build a VPN between them.\par
|
||||
\b Version 1.0.16 07/18/2015\b0\par
|
||||
* Added ability to break links (bad network wire)\par
|
||||
* "connection lights" on network cards / ports when we edit devices\par
|
||||
* Test for "needs link to" does not succeed if the link in question is a broken link\par
|
||||
* Added a puzzle to show you how to find broken links \par
|
||||
* Used broken links in other puzzles\par
|
||||
* Fixed bug: switches could not use DHCP for many different reasons. Now it works for them.\par
|
||||
\b Version 1.0.15 07/11/2015\b0\par
|
||||
* Added ping time progress bar\par
|
||||
* Fixed issue with things timing out before they completed. If the network screen is too large, it makes it go just a tiny bit slower and various things would fail. When the first packet successfully makes it to the far end, it recomputes the time needed and gives extra time.\par
|
||||
* Added context menu ping. If an item is supposed to ping something, right-clicking adds the ping test to the menu. Takes some of the guess-work out of things.\par
|
||||
* Fixed minor issue with this change log. Had two 1.0.11 versions & somehow was stating we were at version 10.x.x instead of 1.x.x (sigh) \par
|
||||
* Fixed the VPNify puzzle. Had a goof in it.\par
|
||||
* Made it so you cannot connect a link to a VPN. A VPN should be a virtual connection, not a physical connection.\par
|
||||
\b Version 1.0.14 07/10/2015\b0\par
|
||||
* When we finish a puzzle, allow us to auto-open the "next puzzle" box.\par
|
||||
* Added lots more puzzles\par
|
||||
* Added more help & documentation\par
|
||||
* Made it so test for local IP also checked to make sure the subnet-masks matched\par
|
||||
* Made it so the test for a matching route compared netmasks\par
|
||||
* Added a printer object\par
|
||||
* Added a copier object\par
|
||||
\b Version 1.0.13 06/21/2015\b0\par
|
||||
* Fixed issues with arp - arp could go through routers. Now works correctly\par
|
||||
* Made it test for puzzle completion after adding devices\par
|
||||
* Made it test for completion after changing / deleting devices\par
|
||||
* Let you delete / add NICs on PCs, primarily so we can solve the duplicate MAC puzzle\par
|
||||
* Replaced the "Network Loop" puzzle with the correct one.\par
|
||||
\b Version 1.0.12 06/20/2015\b0\par
|
||||
* Added VPN and TUN nic types\par
|
||||
* Fixed numerous small bugs\par
|
||||
* Fixed bug with early solution to failed ping test\par
|
||||
* Added "ding" when a test is solved.\par
|
||||
* Added a "firewall" network that has a firewall and vpns\par
|
||||
* Added numerous firewall / vpn puzzles\par
|
||||
* Fixed a DNS issue. It now more intelligently finds the right IP address when you ping it\par
|
||||
\b Version 1.0.11 06/14/2015\b0\par
|
||||
* Added the ability to lock various important features to make puzzles better\par
|
||||
* Able to add interfaces (multiple IPs on a Network Card)\par
|
||||
* Right-click context menu to add net-tests. \par
|
||||
* Del key now deletes the last item we had clicked on\par
|
||||
* Can add NICs (on some devices)\par
|
||||
* Can delete NICs\par
|
||||
* Fixed minor bug with broadcast pinging solving ping test for individual computers\par
|
||||
\b Version 1.0.10 06/13/2015\b0\par
|
||||
* Renamed puzzles to manage them easier\par
|
||||
* Deal with duplicate IPs, and what happens when a packet returns to a computer that did not send it.\par
|
||||
* Change to the help window so you can keep the window open while working with the puzzle.\par
|
||||
* Change to the donation link. Not that it will ever be used, but it makes me feel better having a few places for people to donate to if they wish.\par
|
||||
* Minor change for how broadcast packets work, specifically dealing with duplicate IP addresses.\par
|
||||
* Added a "firewall" device & WAN port with masquerade\par
|
||||
* Added a FailedPing test so we can ping things that must fail (show the firewall works)\par
|
||||
* added more to the help\par
|
||||
* added more puzzles\par
|
||||
\b Version 1.0.0.9 05/29/2015\b0\par
|
||||
* Add a grid to the network map. It makes things easier to straighten up\par
|
||||
* Sorted and organized the puzzles\par
|
||||
* Made a level for each puzzle.\par
|
||||
* Tracked the puzzles which have been completed\par
|
||||
* When we open the puzzle list, we now show the first level of puzzles that have an uncompleted puzzle.\par
|
||||
* Added more "tests", viewing help, pinging, arp, and dhcp.\par
|
||||
* Reset buttons when we load a new network.\par
|
||||
* Added a bunch more puzzles\par
|
||||
* Sometimes the remembered IP gets annoying when it remembers odd gateways and numbers we cannot change. Fixed that in many cases.\par
|
||||
\b Version 1.0.0.8 05/25/2015\b0\par
|
||||
* Always Start with level0 puzzles for now\par
|
||||
* Fixed the icon when program running\par
|
||||
* Added an infrastructure for Puzzles (needs work)\par
|
||||
* Added a number of basic puzzles\par
|
||||
* Fixed DHCP Leases. Now it clears leases when you change the DHCP server range.\par
|
||||
\b Version 1.0.0.7 05/16/2015\b0\par
|
||||
* Added file association so we can double-click an enbx file\par
|
||||
* Fixed the icon so it looks right (removed left edge)\par
|
||||
\b Version 1.0.0.6 05/16/2015\b0\par
|
||||
* Able to delete a route (right click route and delete it)\par
|
||||
* Add map title as something we can load/save\par
|
||||
* Add message as something we can load and save\par
|
||||
* Changing size of items affects all items\par
|
||||
* Allow entering a hostname in the IP address field (ping / gateway)\par
|
||||
\b Version 1.0.0.5 04/26/2015\b0\par
|
||||
* Fixed ping from switch\par
|
||||
* Fixed error message when pinging IP that does not exist\par
|
||||
\b Version 1.0.0.4 04/26/2015\b0\par
|
||||
* Fixed broadcast ping\par
|
||||
*Fixed dhcp request error\par
|
||||
\b Version 1.0.0.3 04/15/2015\par
|
||||
\b0 * Added "file" -> "new" to erase and start a clean new network\par
|
||||
* Fixed pc2 to have gateway on "solved"->"Two Networks"\par
|
||||
* Fixed - only machines capable of doing DHCP do dhcp request if we do DHCP request on all\par
|
||||
* Changed - major overhaul to tcp-stack.\par
|
||||
* Downgrade - Arp temporarily removed from system while tcp-stack overhaul completed\par
|
||||
\b Version 1.0.0.2 4/19/2015\b0\par
|
||||
* Added IP-Phone\par
|
||||
* Packets terminate at the far end - this makes it easier to see packets go both directions\par
|
||||
* Packets are randomized in transit - Allows packets to arrive at slightly different times\par
|
||||
\b Version 1.0.0.1 4/11/2015\b0\par
|
||||
* DHCP selection on nics is not functioning correctly\par
|
||||
* Various small bug-fixes\par
|
||||
\b Version 1.0.0.0 4/10/2015\b0\par
|
||||
This is the initial alpha build\par
|
||||
* basic pinging\par
|
||||
* basic arp\par
|
||||
* Routers\par
|
||||
* Switches/Hubs\par
|
||||
* PCs/Laptops\par
|
||||
* Network Links (ethernet)\par
|
||||
* Basic DHCP\par
|
||||
}
|
||||
|