diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs
index 5647d7a..bd505fc 100644
--- a/EduNetworkBuilder/NB.cs
+++ b/EduNetworkBuilder/NB.cs
@@ -51,7 +51,7 @@ namespace EduNetworkBuilder
None, DHCP, DHCPServer, Firewall, Gateway, Help, IPAddress, Link, Subnet, Ping,
VPN, Hub, Switch, ARP, StaticRoute, Subnetting, WhenToSubnet, ComparingAddresses, MACAddress,
Network, Packet, NIC, Interface, Router, PacketCorruption, GeneralWireless, WirelessSSID, WirelessKey,
- WirelessAP, WirelessRouter, WirelessRepeater, WirelessBridge
+ WirelessAP, WirelessRouter, WirelessRepeater, WirelessBridge, VLAN
}
public enum PuzzleNames
{
diff --git a/EduNetworkBuilder/NetworkInterface.cs b/EduNetworkBuilder/NetworkInterface.cs
index 2eddc28..ede2fdc 100644
--- a/EduNetworkBuilder/NetworkInterface.cs
+++ b/EduNetworkBuilder/NetworkInterface.cs
@@ -75,6 +75,17 @@ namespace EduNetworkBuilder
public void SetVLANTag(int id, VLANTagType Tag)
{
bool foundit = false;
+ Network theNet = NB.GetNetwork();
+ NetworkDevice ND = theNet.GetDeviceFromID(AttachedToHostNic);
+ NetworkCard NC = ND.NicFromID(AttachedToHostNic);
+ NicType NT = NC.GetNicType;
+ bool isPort = NT == NicType.port;
+
+ //Ports (switches) can have multiple tagged ports.
+ //WAN, ETH0, etc, can only have one tagged or untagged per interface
+ //nothing can have multiple untagged ports
+ // If something is untagged, everything else is forbidden
+
foreach (VLANInfo one in VLANs)
{
if (one.ID == id)
@@ -84,8 +95,10 @@ namespace EduNetworkBuilder
}
else
{
- if (Tag == VLANTagType.Untagged && one.Tag == VLANTagType.Untagged)
- one.Tag = VLANTagType.Tagged;
+ if (Tag == VLANTagType.Untagged)
+ one.Tag = VLANTagType.Forbidden;
+ if (Tag == VLANTagType.Tagged && !isPort) //Ports can have multiple tags on one interface
+ one.Tag = VLANTagType.Forbidden;
}
}
if (!foundit)
diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx
index 7ea93a3..5da3f64 100644
--- a/EduNetworkBuilder/Resources/languages/edustrings.resx
+++ b/EduNetworkBuilder/Resources/languages/edustrings.resx
@@ -1529,4 +1529,12 @@
Packed forbidden to go out this port
NI_VLANOut = Packed forbidden to go out this port
+
+ VLANs:
+ Text from the help document that we jump to
+
+
+ VLANs
+ Text used in the program on buttons and the like
+
\ No newline at end of file
diff --git a/EduNetworkBuilder/VLANConfig.Designer.cs b/EduNetworkBuilder/VLANConfig.Designer.cs
index 02b3249..9fccb2c 100644
--- a/EduNetworkBuilder/VLANConfig.Designer.cs
+++ b/EduNetworkBuilder/VLANConfig.Designer.cs
@@ -50,6 +50,7 @@
this.dgv_VLANAssignments.Size = new System.Drawing.Size(313, 195);
this.dgv_VLANAssignments.TabIndex = 0;
this.dgv_VLANAssignments.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv_VLANAssignments_CellValueChanged);
+ this.dgv_VLANAssignments.CurrentCellDirtyStateChanged += new System.EventHandler(this.dgv_VLANAssignments_CurrentCellDirtyStateChanged);
//
// dgv_VLANNames
//
diff --git a/EduNetworkBuilder/VLANConfig.cs b/EduNetworkBuilder/VLANConfig.cs
index 331c8c2..455e908 100644
--- a/EduNetworkBuilder/VLANConfig.cs
+++ b/EduNetworkBuilder/VLANConfig.cs
@@ -42,6 +42,13 @@ namespace EduNetworkBuilder
processing = true;
//Bind the vlan names
Network theNet = NB.GetNetwork();
+ int selectedrow = -1;
+ int selectedcol = -1;
+ if (dgv_VLANAssignments.CurrentCell != null)
+ {
+ selectedrow = dgv_VLANAssignments.CurrentCell.RowIndex;
+ selectedcol = dgv_VLANAssignments.CurrentCell.ColumnIndex;
+ }
//theNet.VlanNames.Sort((x, y) => x.ID.CompareTo(y.ID));
List tList = theNet.VlanNames.OrderBy(x => x.ID).ToList();
@@ -65,6 +72,13 @@ namespace EduNetworkBuilder
NetworkCard NIC = TheDevice.NicFromName(oneNic);
if (NIC.GetNicType == NicType.lo) continue;
if (NIC.GetNicType == NicType.management_interface) continue;
+ if (NIC.GetNicType == NicType.wport) continue;
+ if (NIC.GetNicType == NicType.wlan) continue;
+ if (NIC.GetNicType == NicType.vpn) continue;
+ if (NIC.GetNicType == NicType.none) continue;
+ if (NIC.GetNicType == NicType.tun) continue;
+
+
for (int i = 0; i < NIC.IFCount; i++)
{
NetworkInterface nif = NIC.GetInterface(i);
@@ -111,6 +125,9 @@ namespace EduNetworkBuilder
int checksize = 50 + 120 + (many * 80) + 25; //the record indicator, and the size of the name. + width of each item
if (Width < checksize) Width = checksize; //Make it fit better
processing = false;
+
+ if (selectedcol >=0 && selectedcol < dgv_VLANAssignments.Columns.Count && selectedrow < dgv_VLANAssignments.Rows.Count)
+ dgv_VLANAssignments.CurrentCell = dgv_VLANAssignments.Rows[selectedrow].Cells[selectedcol];
}
bool NamesGridHasID(int id)
@@ -289,5 +306,14 @@ namespace EduNetworkBuilder
SetIFVLAN(Which, ID, VTT);
UpdateForm();
}
+
+ private void dgv_VLANAssignments_CurrentCellDirtyStateChanged(object sender, EventArgs e)
+ {
+ if (dgv_VLANAssignments.IsCurrentCellDirty)
+ {
+ // This fires the cell value changed handler below
+ dgv_VLANAssignments.CommitEdit(DataGridViewDataErrorContexts.Commit);
+ }
+ }
}
}