Able to change gateway if device has both DHCP and ethernet, but the ethernet is the one plugged in.
This commit is contained in:
parent
2b92fea4cb
commit
facd5d1ea1
@ -487,7 +487,7 @@ namespace EduNetworkBuilder
|
||||
if (NB.GetComponentType(ClonedItem) == GeneralComponentType.device)
|
||||
{
|
||||
NetworkDevice nd = (NetworkDevice)ClonedItem;
|
||||
if (nd.HasDHCPNic())
|
||||
if (!nd.HasNonDHCPConnected() && nd.HasDHCPNic())
|
||||
{
|
||||
MessageBox.Show(NB.Translate("DC_CannotEditGateway_DHCP"));
|
||||
}
|
||||
|
@ -378,9 +378,8 @@ namespace EduNetworkBuilder
|
||||
|
||||
public NB_IPAddress GetGateway()
|
||||
{
|
||||
if(CanUseDHCP)
|
||||
{
|
||||
|
||||
if(!HasNonDHCPConnected() && CanUseDHCP)
|
||||
{
|
||||
foreach(NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.UsesDHCP)
|
||||
@ -3364,6 +3363,20 @@ namespace EduNetworkBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if this device has at least one nic that can be configured from DHCP
|
||||
/// </summary>
|
||||
/// <returns>True if the device has a nic that can be configured with DHCP</returns>
|
||||
public bool HasNonDHCPConnected()
|
||||
{
|
||||
foreach (NetworkCard card in NICs)
|
||||
{
|
||||
if (!card.UsesDHCP && card.ConnectedTo() != null)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasLocalNic(NB_IPAddress dest)
|
||||
{
|
||||
foreach(NetworkCard nic in NICs)
|
||||
|
Loading…
Reference in New Issue
Block a user