diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 4914d67..0d63311 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -752,6 +752,7 @@ namespace EduNetworkBuilder //We are making a link LinkEditor myEditor = new LinkEditor(ItemClickedOn, ReleasedOn); myEditor.ShowDialog(); + UpdateLinks(); pbNetworkView.Invalidate(); //In case any changes have been made } else if (ItemClickedOn == null) diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 616ed8b..63f7bb0 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -394,7 +394,7 @@ namespace EduNetworkBuilder if (tPacket.MyType == PacketType.arp_request && !nf.isLocal(tPacket.destIP)) continue; //only send out arp requests on local networks nPacket = new Packet(tPacket);//Creates a new packet but sets isfresh=false - if (nf.isLocal(tPacket.OutboundIP) || tPacket.OutboundIP.GetIPString == NB.BroadcastIPString) + if (tPacket.OutboundIP == null || (nf.isLocal(tPacket.OutboundIP) || tPacket.OutboundIP.GetIPString == NB.BroadcastIPString)) { if ((nf != null && nf.myIP.GetIPString != NB.ZeroIPString) || nPacket.MyType == PacketType.dhcp_request) { @@ -442,7 +442,7 @@ namespace EduNetworkBuilder foreach (NetworkInterface nf in interfaces.ToList()) { nPacket = new Packet(tPacket);//Creates a new packet but sets isfresh=false - if (nf.isLocal(tPacket.OutboundIP) || tPacket.OutboundIP.GetIPString == NB.BroadcastIPString) + if (tPacket.OutboundIP != null && (nf.isLocal(tPacket.OutboundIP) || tPacket.OutboundIP.GetIPString == NB.BroadcastIPString)) { if ((nf != null && nf.myIP != null && nf.myIP.GetIPString != NB.ZeroIPString) || nPacket.MyType == PacketType.dhcp_request) { @@ -531,7 +531,7 @@ namespace EduNetworkBuilder //set it to be the ip of management interface nPacket.sourceIP = WhereFrom.HubManagementIP(); } - if (nPacket.destMAC == null || nPacket.destMAC == "") + if (nPacket.destMAC == null || nPacket.destMAC == "" && tPacket.OutboundIP != null) { nPacket.destMAC = WhereFrom.LookupArpFromIP(tPacket.OutboundIP.GetIPString); } @@ -565,13 +565,13 @@ namespace EduNetworkBuilder Network mynet; NetworkDevice nd; //We make sure the MAC matches. + mynet = NB.GetNetwork(); + nd = mynet.GetDeviceFromID(myID); if (tPacket == null) return; tPacket.InboundNic = this; //track which nic we came in on. - if (myNicType == NicType.port || myNicType == NicType.wport) + if (myNicType == NicType.port || myNicType == NicType.wport || (nd.IsWirelessForwarder() && myNicType == NicType.wlan)) { //Try tracking the arp if we can - mynet = NB.GetNetwork(); - nd = mynet.GetDeviceFromID(myID); if (tPacket.TsourceIP == null) tPacket.TsourceIP = tPacket.sourceIP; nd.StoreArp(tPacket.sourceMAC, tPacket.TsourceIP.GetIP.ToIpString(), myID); //If it is a return DHCP packet. We should try to update the MAC diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index b684909..4d01190 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -251,6 +251,7 @@ namespace EduNetworkBuilder if(nl != null) { myNet.RemoveComponent(nl); + nl.Destroy(); } nic.ConnectedLink = -1; } @@ -647,7 +648,9 @@ namespace EduNetworkBuilder NICs[index].Edit(); //If the nic was a wireless, make sure we copy the ssid and key to all other of identical type if (NICs[index].GetNicType == NicType.wport || NICs[index].GetNicType == NicType.wlan) + { duplicateSSIDnKey(NICs[index].SSID, NICs[index].WirelessKey, NICs[index].GetNicType); + } } public void DeleteNic(int index) { @@ -1195,6 +1198,15 @@ namespace EduNetworkBuilder return null; } + public bool IsWirelessForwarder() + { + if (myType == NetworkComponentType.wrepeater) return true; + if (myType == NetworkComponentType.wap) return true; + if (myType == NetworkComponentType.wbridge) return true; + if (myType == NetworkComponentType.wrouter) return true; + return false; + } + public override void ProcessPacket(Packet tPacket) { //Psuedo code for processing a packet @@ -1306,7 +1318,8 @@ namespace EduNetworkBuilder case NicType.wlan: //If the packet is a new packet and is not connecting to itself //or, if it is routing away. - if ((tPacket.isFresh && !ExactMatch ) || (NeedsRouting && DoesRouting())) + if ((tPacket.isFresh && !ExactMatch ) || (NeedsRouting && DoesRouting()) || + IsWirelessForwarder()) { //Pass it to the NIC to send out each nic+interface. //The nic checks to see if it works and then processes it @@ -2160,7 +2173,8 @@ namespace EduNetworkBuilder if (myType == NetworkComponentType.net_switch) return true; if (myType == NetworkComponentType.wap) return true; if (myType == NetworkComponentType.wrouter) return true; - if (myType == NetworkComponentType.wbridge) return true; + if (myType == NetworkComponentType.wrepeater) return true; + if (myType == NetworkComponentType.wrouter) return true; return false; } /// diff --git a/EduNetworkBuilder/NetworkLink.cs b/EduNetworkBuilder/NetworkLink.cs index 100bba0..220560b 100644 --- a/EduNetworkBuilder/NetworkLink.cs +++ b/EduNetworkBuilder/NetworkLink.cs @@ -47,7 +47,7 @@ namespace EduNetworkBuilder Client = sNic; IsWireless = true; } - if(IsWireless && AccessPoint != null && Client != null) + if(IsWireless && AccessPoint != null && Client != null && AccessPoint.SSID != null && AccessPoint.SSID != "") { bool donesomething=false; if(AccessPoint.SSID != Client.SSID)