| Index: chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| index cfce26a3f5ce272033273e9ec667db0804dac24f..9ef19e9f0aa934e59a94abce4453c52e695049aa 100644
|
| --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| @@ -486,11 +486,30 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
|
| *saved_ipconfig);
|
| }
|
|
|
| + // Translate the StaticIPConfig object and set the IP config types.
|
| const base::DictionaryValue* static_ipconfig = nullptr;
|
| if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
|
| - shill::kStaticIPConfigProperty, &static_ipconfig)) {
|
| - TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig,
|
| - *static_ipconfig);
|
| + shill::kStaticIPConfigProperty, &static_ipconfig)) {
|
| + std::string ip_address;
|
| + if (static_ipconfig->GetStringWithoutPathExpansion(shill::kAddressProperty,
|
| + &ip_address) &&
|
| + !ip_address.empty()) {
|
| + onc_object_->SetStringWithoutPathExpansion(
|
| + ::onc::network_config::kIPAddressConfigType,
|
| + ::onc::network_config::kIPConfigTypeStatic);
|
| + }
|
| + const base::ListValue* name_servers = nullptr;
|
| + if (static_ipconfig->GetListWithoutPathExpansion(
|
| + shill::kNameServersProperty, &name_servers) &&
|
| + !name_servers->empty()) {
|
| + onc_object_->SetStringWithoutPathExpansion(
|
| + ::onc::network_config::kNameServersConfigType,
|
| + ::onc::network_config::kIPConfigTypeStatic);
|
| + }
|
| + if (!ip_address.empty() || (name_servers && !name_servers->empty())) {
|
| + TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig,
|
| + *static_ipconfig);
|
| + }
|
| }
|
| }
|
|
|
|
|