diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 206b3c9..36c3e73 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -173,7 +173,12 @@ namespace EduNetworkBuilder string connected = " "; if (isConnected(true)) connected = "*"; if (myNicType == NicType.port || myNicType == NicType.wport) + { + NetworkDevice ND = ConnectedTo(); + if(ND != null) + return NicName() + connected + " -> " + ND.hostname; return NicName() + connected; + } return NicName() + connected + " " + MAC; } @@ -289,6 +294,20 @@ namespace EduNetworkBuilder return false; } + public NetworkDevice ConnectedTo() + { + if (ConnectedLink != -1) + { + Network myNet = NB.GetNetwork(); + NetworkLink NL = myNet.GetLinkFromID(ConnectedLink); + if (NL != null) + { + if (NL.IsSource(myID.HostID)) return myNet.GetDeviceFromID(NL.Dst); + else return myNet.GetDeviceFromID(NL.Src); + } + } + return null; + } public void Edit() { NetworkCardEditor nce = new NetworkCardEditor(this);