Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: chromeos/network/onc/onc_translator_onc_to_shill.cc

Issue 23506040: Add ethernet to ONC validation and Shill translation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed networkingPrivate api test on non-chromeos. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9afae3259aaa0cc9bc2fef6c0e481b54f4774f89..8af78d5abdd2327d28f97e348f6301bf846bd86b 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -52,6 +52,7 @@ class LocalTranslator {
void TranslateFields();
private:
+ void TranslateEthernet();
void TranslateOpenVPN();
void TranslateVPN();
void TranslateWiFi();
@@ -86,6 +87,8 @@ class LocalTranslator {
void LocalTranslator::TranslateFields() {
if (onc_signature_ == &kNetworkConfigurationSignature)
TranslateNetworkConfiguration();
+ else if (onc_signature_ == &kEthernetSignature)
+ TranslateEthernet();
else if (onc_signature_ == &kVPNSignature)
TranslateVPN();
else if (onc_signature_ == &kOpenVPNSignature)
@@ -98,6 +101,20 @@ void LocalTranslator::TranslateFields() {
CopyFieldsAccordingToSignature();
}
+void LocalTranslator::TranslateEthernet() {
+ std::string authentication;
+ onc_object_->GetStringWithoutPathExpansion(ethernet::kAuthentication,
+ &authentication);
+
+ const char* shill_type = flimflam::kTypeEthernet;
+ if (authentication == ethernet::k8021X)
+ shill_type = shill::kTypeEthernetEap;
+ shill_dictionary_->SetStringWithoutPathExpansion(flimflam::kTypeProperty,
+ shill_type);
+
+ CopyFieldsAccordingToSignature();
+}
+
void LocalTranslator::TranslateOpenVPN() {
// Shill supports only one RemoteCertKU but ONC a list.
// Copy only the first entry if existing.
@@ -171,14 +188,17 @@ void LocalTranslator::TranslateEAP() {
void LocalTranslator::TranslateNetworkConfiguration() {
std::string type;
onc_object_->GetStringWithoutPathExpansion(network_config::kType, &type);
- TranslateWithTableAndSet(type, kNetworkTypeTable, flimflam::kTypeProperty);
+
+ // Set the type except for Ethernet which is set in TranslateEthernet.
+ if (type != network_type::kEthernet)
+ TranslateWithTableAndSet(type, kNetworkTypeTable, flimflam::kTypeProperty);
// Shill doesn't allow setting the name for non-VPN networks.
if (type == network_type::kVPN) {
std::string name;
onc_object_->GetStringWithoutPathExpansion(network_config::kName, &name);
- shill_dictionary_->SetStringWithoutPathExpansion(
- flimflam::kNameProperty, name);
+ shill_dictionary_->SetStringWithoutPathExpansion(flimflam::kNameProperty,
+ name);
}
CopyFieldsAccordingToSignature();
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698