wports working as switches, wport not printing and not in toltips
This commit is contained in:
parent
0b974171f6
commit
33e9a61efd
@ -203,6 +203,8 @@ namespace EduNetworkBuilder
|
||||
int dNicIndex = lbDstNic.SelectedIndex;
|
||||
NetworkCard dNic = Dst.NicFromName(lbDstNic.SelectedItem.ToString());
|
||||
LinkType LT = NB.ParseEnum<LinkType>(cbLinkType.SelectedItem.ToString());
|
||||
if (sNic.GetNicType == NicType.wport || sNic.GetNicType == NicType.wlan)
|
||||
LT = LinkType.wireless; //We cannot have broken wireless links the same way.
|
||||
NetworkLink newLink = new NetworkLink(sNic.myID, dNic.myID, LT);
|
||||
Net.AddItem(newLink);
|
||||
Close();
|
||||
|
@ -348,6 +348,7 @@ namespace EduNetworkBuilder
|
||||
case NicType.none:
|
||||
break; //Do nothing
|
||||
case NicType.eth:
|
||||
case NicType.wlan:
|
||||
//see if it the packet dest is local to this nic
|
||||
foreach (NetworkInterface nf in interfaces.ToList())
|
||||
{
|
||||
@ -472,6 +473,7 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
break;
|
||||
case NicType.port:
|
||||
case NicType.wport:
|
||||
nPacket = new Packet(tPacket);
|
||||
if (HasBroadcastAddresses(tPacket.destIP))
|
||||
{
|
||||
@ -522,7 +524,7 @@ namespace EduNetworkBuilder
|
||||
Network mynet;
|
||||
NetworkDevice nd;
|
||||
//We make sure the MAC matches.
|
||||
if (myNicType == NicType.port)
|
||||
if (myNicType == NicType.port || myNicType == NicType.wport)
|
||||
{
|
||||
//Try tracking the arp if we can
|
||||
mynet = NB.GetNetwork();
|
||||
|
@ -386,6 +386,8 @@ namespace EduNetworkBuilder
|
||||
//Add IP Addresses that are assigned
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if (nic.GetNicType == NicType.wport || nic.GetNicType == NicType.port)
|
||||
continue;
|
||||
foreach(string addr in nic.IPAddresses())
|
||||
{
|
||||
answer += "\n" + addr;
|
||||
@ -755,7 +757,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.GetNicType != NicType.lo && nic.GetNicType != NicType.port)
|
||||
if(nic.GetNicType != NicType.lo && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport)
|
||||
{
|
||||
string title = "";
|
||||
if (nic.GetNicType == NicType.management_interface)
|
||||
@ -888,6 +890,9 @@ namespace EduNetworkBuilder
|
||||
if (myType == NetworkComponentType.net_hub) return true;
|
||||
if (myType == NetworkComponentType.net_switch) return true;
|
||||
if (myType == NetworkComponentType.wap) return true;
|
||||
if (myType == NetworkComponentType.wbridge) return true;
|
||||
if (myType == NetworkComponentType.wrepeater) return true;
|
||||
if (myType == NetworkComponentType.wrouter) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1130,8 +1135,6 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myType == NetworkComponentType.net_hub || myType == NetworkComponentType.wap)
|
||||
dNic = null; //Hubs/WAPs never know the dnic. They still need the sNic, however
|
||||
|
||||
//Delivery
|
||||
//Loop through all nics (skip the interface) it came in on
|
||||
@ -1156,6 +1159,7 @@ namespace EduNetworkBuilder
|
||||
case NicType.tun:
|
||||
case NicType.vpn:
|
||||
case NicType.wan:
|
||||
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()))
|
||||
@ -1172,6 +1176,21 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
break;
|
||||
case NicType.port:
|
||||
case NicType.wport:
|
||||
NetworkCard tdNic = dNic;
|
||||
if (myType == NetworkComponentType.wrouter)
|
||||
{
|
||||
//On wRouters, the wPorts are hubs, but the ports are switches
|
||||
if (dNic != null && dNic.GetNicType == NicType.wport && nic.GetNicType == NicType.wport)
|
||||
tdNic = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nic.GetNicType == NicType.port && myType == NetworkComponentType.net_hub)
|
||||
tdNic = null; //Hubs/WAPs never know the dnic. They still need the sNic, however
|
||||
if (nic.GetNicType == NicType.wport)
|
||||
tdNic = null; //Hubs/WAPs never know the dnic. They still need the sNic, however
|
||||
}
|
||||
if (!ExactMatch && !MacAddressMatch)
|
||||
{
|
||||
//If the packet does not terminate here, and we are not routing it to here...
|
||||
@ -1179,7 +1198,7 @@ namespace EduNetworkBuilder
|
||||
//Do not send it out the port it came in on (sNic)
|
||||
//If we know the dNic, only send it out that
|
||||
//But if we do not know a dnic, send it out all of them (except the sNic)
|
||||
if (sNic != nic && (dNic == null || (dNic != null && dNic.ConnectedLink == -1) || dNic == nic))
|
||||
if (sNic != nic && (tdNic == null || (tdNic != null && tdNic.ConnectedLink == -1) || tdNic == nic))
|
||||
{
|
||||
if (nic.SendPacketOutNIC(tPacket))
|
||||
{
|
||||
@ -1944,7 +1963,9 @@ namespace EduNetworkBuilder
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(nf == null && myType != NetworkComponentType.net_switch && myType != NetworkComponentType.net_hub)
|
||||
if(nf == null && myType != NetworkComponentType.net_switch && myType != NetworkComponentType.net_hub &&
|
||||
myType != NetworkComponentType.wbridge && myType != NetworkComponentType.wrepeater &&
|
||||
myType != NetworkComponentType.wrouter)
|
||||
{
|
||||
tPacket.AddMessage(DebugLevel.debug, hostname + " The device had no local IPs. Quietly dropped.");
|
||||
tPacket.Tracking.Status = hostname + " Failed: no IPs local to the packet.";
|
||||
@ -1970,6 +1991,8 @@ namespace EduNetworkBuilder
|
||||
if (myType == NetworkComponentType.net_hub) return true;
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
@ -1980,6 +2003,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (myType == NetworkComponentType.router) return true;
|
||||
if (myType == NetworkComponentType.firewall) return true;
|
||||
if (myType == NetworkComponentType.wrouter) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,12 @@ namespace EduNetworkBuilder
|
||||
Point sPoint = Src.GetCenter();
|
||||
Point dPoint = Dst.GetCenter();
|
||||
Pen tPen = new Pen(Color.Black, 4);
|
||||
if(theLinkType == LinkType.wireless)
|
||||
{
|
||||
//tPen = new Pen(Color.DarkSlateGray);
|
||||
tPen.DashCap = System.Drawing.Drawing2D.DashCap.Round;
|
||||
tPen.DashPattern = new float[] { 8.0F, 2.0F};
|
||||
}
|
||||
Graphics.FromImage(BaseImage).DrawLine(tPen,sPoint,dPoint);
|
||||
IsDirty = false; //we have printed, we are no longer dirty.
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user