From 635736b035738ea4ea63776db0e160e8365aaca0 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 7 Dec 2020 14:46:50 -0700 Subject: [PATCH] Zeroipstrings --- EduNetworkBuilder/NetworkDevice.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 54755d0..6d61143 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -2709,7 +2709,7 @@ namespace EduNetworkBuilder if (tNic.GetNicType == NicType.lo) continue; //Don't check loopback nics if (tNic.GetNicType == NicType.port) continue; //Don't check ports nif = tNic.LocalInterface(ip, null); - if(nif != null && nif.myIP.GetIPString != NB.ZeroIPString) + if(nif != null && !nif.myIP.IsUnassigned()) { return nif.myIP; } @@ -2834,7 +2834,7 @@ namespace EduNetworkBuilder string DHCPGW = ""; //Do not ping the zero string. Should not go anywhere - if (dest != null && dest.GetIPString == NB.ZeroIPString) + if (dest != null && !dest.IsZeroString()) return new NB_IPAddress(NB.ZeroIPString); foreach ( NB_IPAddress ip in RouteTable) @@ -2850,7 +2850,7 @@ namespace EduNetworkBuilder DHCPGW = nic.FirstIP().GetGateway.ToIpString(); } nIF = nic.LocalInterface(dest,null); - if (nIF != null && nIF.myIP.GetIPString != NB.ZeroIPString) + if (nIF != null && !nIF.myIP.IsZeroString()) { DestAddr = dest; //We found it. Send it to the destination return DestAddr; @@ -2859,9 +2859,13 @@ namespace EduNetworkBuilder if (oNic != null) { List tlist = oNic.IPAddressList(); - if(tlist.Count > 0 && tlist[0].GetGateway.ToIpString() != NB.ZeroIPString) + + if(tlist.Count > 0) { - return new NB_IPAddress(tlist[0].GetGateway.ToIpString()); + //Make sure the address is not the zerostring... + NB_IPAddress nAddress = new NB_IPAddress(tlist[0].GetGateway.ToIpString()); + if(!nAddress.IsZeroString()) + return new NB_IPAddress(tlist[0].GetGateway.ToIpString()); } } if (DHCPGW != "")