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 0bd82ea341762d57e36c2240135732297aaaf317..80e00bab58c969ccfeb3b9c3e7d5cc386a5e04b0 100644 |
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc |
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc |
@@ -58,6 +58,7 @@ class ShillToONCTranslator { |
scoped_ptr<base::DictionaryValue> CreateTranslatedONCObject(); |
private: |
+ void TranslateEthernet(); |
void TranslateOpenVPN(); |
void TranslateVPN(); |
void TranslateWiFiWithState(); |
@@ -109,6 +110,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() { |
onc_object_.reset(new base::DictionaryValue); |
if (onc_signature_ == &kNetworkWithStateSignature) { |
TranslateNetworkWithState(); |
+ } else if (onc_signature_ == &kEthernetSignature) { |
+ TranslateEthernet(); |
} else if (onc_signature_ == &kVPNSignature) { |
TranslateVPN(); |
} else if (onc_signature_ == &kOpenVPNSignature) { |
@@ -123,6 +126,17 @@ ShillToONCTranslator::CreateTranslatedONCObject() { |
return onc_object_.Pass(); |
} |
+void ShillToONCTranslator::TranslateEthernet() { |
+ std::string shill_network_type; |
+ shill_dictionary_->GetStringWithoutPathExpansion(flimflam::kTypeProperty, |
+ &shill_network_type); |
+ const char* onc_auth = ethernet::kNone; |
+ if (shill_network_type == shill::kTypeEthernetEap) |
+ onc_auth = ethernet::k8021X; |
+ onc_object_->SetStringWithoutPathExpansion(ethernet::kAuthentication, |
+ onc_auth); |
+} |
+ |
void ShillToONCTranslator::TranslateOpenVPN() { |
// Shill supports only one RemoteCertKU but ONC requires a list. If existing, |
// wraps the value into a list. |
@@ -219,14 +233,21 @@ void ShillToONCTranslator::TranslateCellularWithState() { |
} |
void ShillToONCTranslator::TranslateNetworkWithState() { |
- TranslateWithTableAndSet(flimflam::kTypeProperty, kNetworkTypeTable, |
- network_config::kType); |
CopyPropertiesAccordingToSignature(); |
- std::string network_type; |
- if (onc_object_->GetStringWithoutPathExpansion(network_config::kType, |
- &network_type)) { |
- TranslateAndAddNestedObject(network_type); |
+ std::string shill_network_type; |
+ shill_dictionary_->GetStringWithoutPathExpansion(flimflam::kTypeProperty, |
+ &shill_network_type); |
+ std::string onc_network_type = network_type::kEthernet; |
+ if (shill_network_type != flimflam::kTypeEthernet && |
+ shill_network_type != shill::kTypeEthernetEap) { |
+ TranslateStringToONC( |
+ kNetworkTypeTable, shill_network_type, &onc_network_type); |
+ } |
+ if (!onc_network_type.empty()) { |
+ onc_object_->SetStringWithoutPathExpansion(network_config::kType, |
+ onc_network_type); |
+ TranslateAndAddNestedObject(onc_network_type); |
} |
// Since Name is a read only field in Shill unless it's a VPN, it is copied |