Do a better job with network interfaces when faced with vlans

This commit is contained in:
Tim Young 2019-03-17 14:26:51 +03:00
parent 073cba135e
commit cecd14a901

View File

@ -1393,10 +1393,19 @@ namespace EduNetworkBuilder
//If we are doing vlans, the vlan should match if we are doing management interface
//
//right now, just do it.
nic.PrimaryInterface().myIP = new NB_IPAddress(newip, gateway._mask.ToIpString(), IPAddressType.ip);
NetworkInterface nif = nic.PrimaryInterface();
if(nif == null)
{ //There are multiple interfaces, or there are no interfaces.
//If multiple interfaces, try one with the specified vlan.
nif = nic.InterfaceFromVlanTag(vlan);
}
if (nif != null)
{
nif.myIP = new NB_IPAddress(newip, gateway._mask.ToIpString(), IPAddressType.ip);
return true;
}
}
}
return false;
}