diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2019-04-04 00:53:44 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-04-26 20:23:27 +0300 |
commit | fa5053a6b1f1cc821e97a84b49a4f82adf580594 (patch) | |
tree | accf4b2134df60a79fcabcae51caf7ac0c9394ae /redfish-core/lib/ethernet.hpp | |
parent | b97b9c36007f21628159905f95faff7a1baa5a54 (diff) | |
download | bmcweb-fa5053a6b1f1cc821e97a84b49a4f82adf580594.tar.xz |
Fix empty IPV4 gateway error
If an IPV4 gateway is empty use "0.0.0.0".
The RedfishServiceValidator throws the following error on
a Witherspoon system:
"IPv4Addresses[0].Gateway: String '' does not match pattern
''^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$''"
Tested: Ran RedfishServiceValidator and no longer observe the
error. IPV4 addresses with gateways are untouched.
Change-Id: I423aeeb0bec46fa5cc0c8cf5a017c16d20314984
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index a6ba562271..71ad624f90 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -1232,10 +1232,17 @@ class EthernetInterface : public Node ipv4_array = nlohmann::json::array(); for (auto &ipv4_config : ipv4Data) { + + std::string gatewayStr = ipv4_config.gateway; + if (gatewayStr.empty()) + { + gatewayStr = "0.0.0.0"; + } + ipv4_array.push_back({{"AddressOrigin", ipv4_config.origin}, {"SubnetMask", ipv4_config.netmask}, {"Address", ipv4_config.address}, - {"Gateway", ipv4_config.gateway}}); + {"Gateway", gatewayStr}}); } } } |