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

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

Issue 285233008: Add MacAddress to ONC and networkingPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Rebase Created 6 years, 7 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') | components/onc/docs/onc_spec.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11b802fadeeba7edef3f215161b13ec07c768306..5b4cde40140889a33679f6b94329c97f562e98a6 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/values.h"
#include "chromeos/network/network_state.h"
+#include "chromeos/network/network_util.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translation_tables.h"
#include "chromeos/network/shill_property_util.h"
@@ -290,6 +291,7 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
onc_object_->SetStringWithoutPathExpansion(::onc::network_config::kName,
name);
+ // Limit ONC state to "NotConnected", "Connected", or "Connecting".
std::string state;
if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kStateProperty,
&state)) {
@@ -303,8 +305,19 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
::onc::network_config::kConnectionState, onc_state);
}
- // Shill's Service has an IPConfig property (note the singular, and not a
- // IPConfigs property). However, we require the caller of the translation to
+ // Use a human-readable aa:bb format for any hardware MAC address. Note:
+ // this property is provided by the caller but is not part of the Shill
+ // Service properties (it is copied from the Device properties).
+ std::string address;
+ if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kAddressProperty,
+ &address)) {
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::network_config::kMacAddress,
+ network_util::FormattedMacAddress(address));
+ }
+
+ // Shill's Service has an IPConfig property (note the singular), not an
+ // IPConfigs property. However, we require the caller of the translation to
// patch the Shill dictionary before passing it to the translator.
const base::ListValue* shill_ipconfigs = NULL;
if (shill_dictionary_->GetListWithoutPathExpansion(shill::kIPConfigsProperty,
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | components/onc/docs/onc_spec.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698