Index: chromeos/network/onc/onc_translator_onc_to_shill.cc |
diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc |
index 8e30af55446f6889b6c35922c488bf602039aae8..e58f86db3e53eece20e86a81f0169bb640f2adab 100644 |
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc |
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc |
@@ -257,6 +257,28 @@ void LocalTranslator::TranslateNetworkConfiguration() { |
if (type == ::onc::network_type::kVPN) |
CopyFieldFromONCToShill(::onc::network_config::kName, shill::kNameProperty); |
+ std::string ip_address_config_type, name_servers_config_type; |
+ onc_object_->GetStringWithoutPathExpansion( |
+ ::onc::network_config::kIPAddressConfigType, &ip_address_config_type); |
+ onc_object_->GetStringWithoutPathExpansion( |
+ ::onc::network_config::kNameServersConfigType, &name_servers_config_type); |
+ if ((ip_address_config_type == ::onc::network_config::kIPConfigTypeDHCP) && |
pneubeck (no reviews)
2015/01/07 09:23:48
I looked into the current version of network_confi
stevenjb
2015/01/07 17:28:03
Bah, you're right. I think I need the NULL support
|
+ (name_servers_config_type == ::onc::network_config::kIPConfigTypeDHCP)) { |
+ // If both IPAddressConfigType and NameServersConfigType are set to DHCP, |
+ // provide an empty StaticIPConfig property so that all existing properties |
+ // will be cleared. |
+ shill_dictionary_->SetWithoutPathExpansion(shill::kStaticIPConfigProperty, |
+ base::Value::CreateNullValue()); |
+ } else if ( |
+ (ip_address_config_type == ::onc::network_config::kIPConfigTypeDHCP) || |
+ (name_servers_config_type == ::onc::network_config::kIPConfigTypeDHCP)) { |
+ // Otherwise, if either type is set to DHCP, provide an empty dictionary to |
+ // ensure that any unset properties are cleared. Note: if either type is |
+ // specifed, the other type defaults to DHCP if not specified. |
+ shill_dictionary_->SetWithoutPathExpansion(shill::kStaticIPConfigProperty, |
+ new base::DictionaryValue); |
+ } |
+ |
CopyFieldsAccordingToSignature(); |
} |