Zeroipstrings

This commit is contained in:
Tim Young 2020-12-07 14:46:50 -07:00
parent 774797a28f
commit 635736b035

View File

@ -2709,7 +2709,7 @@ namespace EduNetworkBuilder
if (tNic.GetNicType == NicType.lo) continue; //Don't check loopback nics if (tNic.GetNicType == NicType.lo) continue; //Don't check loopback nics
if (tNic.GetNicType == NicType.port) continue; //Don't check ports if (tNic.GetNicType == NicType.port) continue; //Don't check ports
nif = tNic.LocalInterface(ip, null); nif = tNic.LocalInterface(ip, null);
if(nif != null && nif.myIP.GetIPString != NB.ZeroIPString) if(nif != null && !nif.myIP.IsUnassigned())
{ {
return nif.myIP; return nif.myIP;
} }
@ -2834,7 +2834,7 @@ namespace EduNetworkBuilder
string DHCPGW = ""; string DHCPGW = "";
//Do not ping the zero string. Should not go anywhere //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); return new NB_IPAddress(NB.ZeroIPString);
foreach ( NB_IPAddress ip in RouteTable) foreach ( NB_IPAddress ip in RouteTable)
@ -2850,7 +2850,7 @@ namespace EduNetworkBuilder
DHCPGW = nic.FirstIP().GetGateway.ToIpString(); DHCPGW = nic.FirstIP().GetGateway.ToIpString();
} }
nIF = nic.LocalInterface(dest,null); 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 DestAddr = dest; //We found it. Send it to the destination
return DestAddr; return DestAddr;
@ -2859,8 +2859,12 @@ namespace EduNetworkBuilder
if (oNic != null) if (oNic != null)
{ {
List<NB_IPAddress> tlist = oNic.IPAddressList(); List<NB_IPAddress> tlist = oNic.IPAddressList();
if(tlist.Count > 0 && tlist[0].GetGateway.ToIpString() != NB.ZeroIPString)
if(tlist.Count > 0)
{ {
//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()); return new NB_IPAddress(tlist[0].GetGateway.ToIpString());
} }
} }