More switching to functions on the IP address.

This commit is contained in:
Tim Young 2020-12-08 08:32:24 -07:00
parent 635736b035
commit f34b9a405e

View File

@ -2927,10 +2927,10 @@ namespace EduNetworkBuilder
tPacket.MyStatus = PacketStatus.finished; //we have replaced it with other ones tPacket.MyStatus = PacketStatus.finished; //we have replaced it with other ones
return false; return false;
} }
if (tPacket.OutboundIP == null || tPacket.OutboundIP.GetIP.ToIpString() == NB.ZeroIPString && tPacket.MyType != PacketType.dhcp_request) if (tPacket.OutboundIP == null || tPacket.OutboundIP.IsZeroString() && tPacket.MyType != PacketType.dhcp_request)
{ {
tPacket.OutboundIP = DestinationFromIP(dest,tPacket.OutboundNic); tPacket.OutboundIP = DestinationFromIP(dest,tPacket.OutboundNic);
if (tPacket.OutboundIP.GetIP.ToIpString() == NB.ZeroIPString) if (tPacket.OutboundIP.IsZeroString())
{ {
if (tPacket.MyType == PacketType.dhcp_answer) if (tPacket.MyType == PacketType.dhcp_answer)
{ {
@ -3017,7 +3017,7 @@ namespace EduNetworkBuilder
{ {
nIF = nic.LocalInterface(toFind, null); nIF = nic.LocalInterface(toFind, null);
if (nIF != null) { if (nIF != null) {
if (nIF.myIP.GetIPString == NB.ZeroIPString) if (nIF.myIP.IsZeroString())
continue; continue;
return nic; return nic;
} }
@ -3066,7 +3066,7 @@ namespace EduNetworkBuilder
{ {
foreach(NB_IPAddress ip in nic.IPAddressList()) foreach(NB_IPAddress ip in nic.IPAddressList())
{ {
if (ip.GetIPString != NB.ZeroIPString && ip.GetIPString != NB.LoopbackIPString) if (!ip.IsZeroString() && !ip.IsLoopback())
return ip; return ip;
} }
} }
@ -3093,7 +3093,7 @@ namespace EduNetworkBuilder
if(Source != null) if(Source != null)
{ {
answer = LocalDeviceIP(Source); answer = LocalDeviceIP(Source);
if (answer != null && answer.GetIPString != NB.ZeroIPString) if (answer != null && !answer.IsZeroString())
return answer; return answer;
} }
//If we have a WAN Nic, use that first //If we have a WAN Nic, use that first
@ -3506,7 +3506,7 @@ namespace EduNetworkBuilder
List<string> theStrings = new List<string>(); List<string> theStrings = new List<string>();
foreach(NB_IPAddress ip in DHCPRanges) foreach(NB_IPAddress ip in DHCPRanges)
{ {
if (ip.GetIP.ToIpString() != "127.0.0.1") if (!ip.IsLoopback())
{ {
if (WithAdditionalInfo) if (WithAdditionalInfo)
{ {
@ -3527,7 +3527,7 @@ namespace EduNetworkBuilder
if (InterfaceIP == null) return null; if (InterfaceIP == null) return null;
foreach (NB_IPAddress ip in DHCPRanges) foreach (NB_IPAddress ip in DHCPRanges)
{ {
if (ip.GetIP.ToIpString() != "127.0.0.1" && InterfaceIP.IsLocal(ip)) if (!ip.IsLoopback() && InterfaceIP.IsLocal(ip))
return ip; return ip;
} }
return null; return null;