Index: chromeos/network/onc/onc_validator.cc |
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc |
index d84d2556cb174bbc54e22ddff9c47c69a0027a11..41605f8a5018aa3ff782692dad451fc33076e964 100644 |
--- a/chromeos/network/onc/onc_validator.cc |
+++ b/chromeos/network/onc/onc_validator.cc |
@@ -471,7 +471,13 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { |
::onc::network_type::kEthernet, ::onc::network_type::kVPN, |
::onc::network_type::kWiFi, ::onc::network_type::kCellular}; |
const std::vector<const char*> valid_types(toVector(kValidTypes)); |
+ const char* const kValidIPConfigTypes[] = {kIPConfigTypeDHCP, |
+ kIPConfigTypeStatic}; |
+ const std::vector<const char*> valid_ipconfig_types( |
+ toVector(kValidIPConfigTypes)); |
if (FieldExistsAndHasNoValidValue(*result, kType, valid_types) || |
+ FieldExistsAndHasNoValidValue(*result, kIPConfigType, |
+ valid_ipconfig_types) || |
FieldExistsAndIsEmpty(*result, kGUID)) { |
return false; |
} |
@@ -487,6 +493,11 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { |
all_required_exist &= |
RequireField(*result, kName) && RequireField(*result, kType); |
+ std::string ipconfig_type; |
+ result->GetStringWithoutPathExpansion(kIPConfigType, &ipconfig_type); |
+ if (ipconfig_type == kIPConfigTypeStatic) |
+ all_required_exist &= RequireField(*result, kStaticIPConfig); |
+ |
std::string type; |
result->GetStringWithoutPathExpansion(kType, &type); |