Working towards fixing an issue with the WAP. Save it in a working state.
This commit is contained in:
parent
0c2e6b064f
commit
3847a90f70
@ -1193,6 +1193,7 @@ namespace EduNetworkBuilder
|
||||
ItemClickedOn.ClearIPs(); //reset the device
|
||||
ItemClickedOn.IsBurned = false; //If it had been burned before, it is no longer burned
|
||||
ItemClickedOn.PowerOff = true;
|
||||
ItemClickedOn.BadSprayCount = 0;
|
||||
//Mark the replace test as "done"
|
||||
myNetwork.RegisterDeviceReset(ItemClickedOn.hostname); //replacing something powers it off
|
||||
|
||||
|
@ -8,7 +8,7 @@ using System.Runtime.Serialization;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace EduNetworkBuilder
|
||||
{
|
||||
@ -49,6 +49,30 @@ namespace EduNetworkBuilder
|
||||
SetIPForDHCP();
|
||||
}
|
||||
|
||||
public NetworkCard(NetworkCard old, bool duplicateID = false)
|
||||
{
|
||||
if (old == null) return;
|
||||
MAC = old.MAC;
|
||||
foreach(NetworkInterface one in old.interfaces)
|
||||
{
|
||||
NetworkInterface nInterface = new NetworkInterface(one);
|
||||
interfaces.Add(nInterface);
|
||||
}
|
||||
UsesDHCP = old.UsesDHCP;
|
||||
CanUseDHCP = old.CanUseDHCP;
|
||||
MustUseDHCP = old.MustUseDHCP;
|
||||
myNicType = old.myNicType;
|
||||
myID = old.myID;
|
||||
if(duplicateID == false)
|
||||
myID = new HostNicID(old.myID.HostID, UniqueIdentifier, old.myID.HostName, old.NicName());
|
||||
ConnectedLink = old.ConnectedLink;
|
||||
if (duplicateID == false)
|
||||
ConnectedLink = -1; //It should be a new card, not connected to anything.
|
||||
TunnelEndpoint = old.TunnelEndpoint;
|
||||
EncryptionKey = old.EncryptionKey;
|
||||
SSID = old.SSID;
|
||||
}
|
||||
|
||||
public NetworkCard(XmlNode theNode)
|
||||
{
|
||||
foreach (XmlNode Individual in theNode.ChildNodes)
|
||||
@ -98,6 +122,25 @@ namespace EduNetworkBuilder
|
||||
SetIPForDHCP();
|
||||
}
|
||||
|
||||
public void ChangeType(NicType newtype)
|
||||
{
|
||||
NicType oldType = myNicType;
|
||||
myNicType = newtype;
|
||||
string index = Regex.Match(_nic_name, @"\d+$").Value;
|
||||
if (index == "") index = "0";
|
||||
string OldName = oldType.ToString() + index.ToString();
|
||||
_nic_name = myNicType.ToString() + index.ToString();
|
||||
foreach (NetworkInterface NI in interfaces)
|
||||
{
|
||||
//NI.nic_name = Regex.Replace(NI.nic_name, OldName, _nic_name);
|
||||
NI.nic_name = _nic_name; //This does not work when we have eth0:1...
|
||||
NI.AttachedToHostNic.NicName = _nic_name;
|
||||
}
|
||||
myID.NicName = _nic_name;
|
||||
if (newtype == NicType.port || newtype == NicType.wport)
|
||||
interfaces.Clear();
|
||||
}
|
||||
|
||||
public bool Equals(NetworkCard compareWith)
|
||||
{
|
||||
if (MAC != compareWith.MAC) return false;
|
||||
|
@ -103,9 +103,10 @@ namespace EduNetworkBuilder
|
||||
NICs.Clear();
|
||||
tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.lo);
|
||||
NICs.Add(tnic);
|
||||
tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.management_interface);
|
||||
NICs.Add(tnic);
|
||||
//tnic = new NetworkCard(0, GetUniqueIdentifier, hostname, NicType.management_interface);
|
||||
//NICs.Add(tnic); --we use the wlan port for this
|
||||
tnic = new NetworkCard(NICs.Count(), GetUniqueIdentifier, hostname, NicType.eth); //Add a physical network card
|
||||
tnic = new NetworkCard(NICs.Count(), GetUniqueIdentifier, hostname, NicType.port); //Add a physical network card
|
||||
NICs.Add(tnic);
|
||||
//A bridge is a switch with an ethernet nic, add some wireless ports
|
||||
for (int a = 0; a < 6; a++)
|
||||
@ -446,6 +447,16 @@ namespace EduNetworkBuilder
|
||||
break;
|
||||
case "nic":
|
||||
newNic = new NetworkCard(Individual);
|
||||
//if (myType == NetworkComponentType.wap && newNic.GetNicType == NicType.eth)
|
||||
//{
|
||||
// //This happened once upon a time. Waps did not have management interfaces.
|
||||
// //Make a management interface for the wap and move the IP from the eth to that.
|
||||
// //Then, change the nic to a port instead of an eth.
|
||||
// NetworkCard tNic = new NetworkCard(newNic);
|
||||
// tNic.ChangeType(NicType.management_interface);
|
||||
// NICs.Add(tNic);
|
||||
// newNic.ChangeType(NicType.port);
|
||||
//}
|
||||
NICs.Add(newNic);
|
||||
break;
|
||||
case "route":
|
||||
@ -576,7 +587,7 @@ namespace EduNetworkBuilder
|
||||
continue;
|
||||
foreach(string addr in nic.IPAddresses())
|
||||
{
|
||||
answer += "\n" + addr;
|
||||
answer += System.Environment.NewLine + addr;
|
||||
}
|
||||
}
|
||||
if(BackgroundColor != Color.Empty)
|
||||
@ -586,7 +597,7 @@ namespace EduNetworkBuilder
|
||||
List<string> DeviceMessages = myNet.GetTestMessages(hostname);
|
||||
foreach (string tString in DeviceMessages)
|
||||
{
|
||||
answer += "\n" + tString;
|
||||
answer += System.Environment.NewLine + tString;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
@ -1433,7 +1444,8 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (myType == NetworkComponentType.router) return true;
|
||||
if (myType == NetworkComponentType.firewall) return true;
|
||||
if (myType == NetworkComponentType.wap) return true;
|
||||
//We changed this to a port so it forwards, not routes
|
||||
//if (myType == NetworkComponentType.wap) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1875,7 +1887,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
NicType NT = nic.GetNicType;
|
||||
//bridges and waps are basically switches
|
||||
if (myType == NetworkComponentType.wap || myType == NetworkComponentType.wbridge)
|
||||
if ((myType == NetworkComponentType.wap || myType == NetworkComponentType.wbridge) && NT != NicType.management_interface)
|
||||
NT = NicType.port;
|
||||
switch(NT)
|
||||
{
|
||||
|
@ -56,6 +56,16 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkInterface(NetworkInterface CopyFrom)
|
||||
{
|
||||
myIP = new NB_IPAddress(CopyFrom.myIP.GetIPString, CopyFrom.myIP.GetMaskString, CopyFrom.myIP.GetAddressType);
|
||||
nic_name = CopyFrom.nic_name;
|
||||
foreach(VLANInfo VLI in CopyFrom.VLANs)
|
||||
{
|
||||
VLANs.Add(new VLANInfo(VLI.ID, VLI.Tag));
|
||||
}
|
||||
}
|
||||
|
||||
public VLANInfo GetVLANInfo(int id)
|
||||
{
|
||||
foreach(VLANInfo one in VLANs)
|
||||
|
Loading…
Reference in New Issue
Block a user