bmcweb: Fix a bunch of warnings
bmcweb classically has not taken a strong opinion on warnings. With
this commit, that policy is changing, and bmcweb will invoke the best
warnings we are able to enable, and turn on -Werror for all builds.
This is intended to reduce the likelihood of hard-to-debug situations
that the compiler coulve caught early on.
Change-Id: I57474410821e82666b3a108cfd0db7d070e8900a
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 476e03a..b992018 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -302,7 +302,8 @@
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4_config.insert(
- {objpath.first.str.substr(ipv4PathStart.size())});
+ {objpath.first.str.substr(ipv4PathStart.size()), "",
+ "", "", "", "", LinkType::Local});
IPv4AddressData &ipv4_address = *it.first;
for (auto &property : interface.second)
{
@@ -478,45 +479,6 @@
}
/**
- * @brief Changes IPv4 address type property (Address, Gateway)
- *
- * @param[in] ifaceId Id of interface whose IP should be modified
- * @param[in] ipIdx Index of IP in input array that should be modified
- * @param[in] ipHash DBus Hash id of modified IP
- * @param[in] name Name of field in JSON representation
- * @param[in] newValue New value that should be written
- * @param[io] asyncResp Response object that will be returned to client
- *
- * @return true if give IP is valid and has been sent do D-Bus, false
- * otherwise
- */
-inline void changeIPv4AddressProperty(
- const std::string &ifaceId, int ipIdx, const std::string &ipHash,
- const std::string &name, const std::string &newValue,
- const std::shared_ptr<AsyncResp> asyncResp)
-{
- auto callback = [asyncResp, ipIdx, name{std::string(name)},
- newValue{std::move(newValue)}](
- const boost::system::error_code ec) {
- if (ec)
- {
- messages::internalError(asyncResp->res);
- }
- else
- {
- asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
- }
- };
-
- crow::connections::systemBus->async_method_call(
- std::move(callback), "xyz.openbmc_project.Network",
- "/xyz/openbmc_project/network/" + ifaceId + "/ipv4/" + ipHash,
- "org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Network.IP", name,
- std::variant<std::string>(newValue));
-}
-
-/**
* @brief Changes IPv4 address origin property
*
* @param[in] ifaceId Id of interface whose IP should be modified
@@ -530,7 +492,7 @@
* @return true if give IP is valid and has been sent do D-Bus, false
* otherwise
*/
-inline void changeIPv4Origin(const std::string &ifaceId, int ipIdx,
+inline void changeIPv4Origin(const std::string &ifaceId, size_t ipIdx,
const std::string &ipHash,
const std::string &newValue,
const std::string &newValueDbus,
@@ -570,7 +532,8 @@
*
* @return None
*/
-inline void changeIPv4SubnetMaskProperty(const std::string &ifaceId, int ipIdx,
+inline void changeIPv4SubnetMaskProperty(const std::string &ifaceId,
+ size_t ipIdx,
const std::string &ipHash,
const std::string &newValueStr,
uint8_t &newValue,
@@ -637,9 +600,8 @@
*
* @return None
*/
-inline void createIPv4(const std::string &ifaceId, unsigned int ipIdx,
- uint8_t subnetMask, const std::string &gateway,
- const std::string &address,
+inline void createIPv4(const std::string &ifaceId, uint8_t subnetMask,
+ const std::string &gateway, const std::string &address,
std::shared_ptr<AsyncResp> asyncResp)
{
auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
@@ -1099,6 +1061,7 @@
if (gateway)
{
if (!ipv4VerifyIpAndGetBitcount(*gateway))
+
{
messages::propertyValueFormatError(asyncResp->res, *gateway,
pathString + "/Gateway");
@@ -1198,8 +1161,7 @@
continue;
}
- createIPv4(ifaceId, entryIdx, prefixLength, *gateway, *address,
- asyncResp);
+ createIPv4(ifaceId, entryIdx, *gateway, *address, asyncResp);
nlohmann::json &ipv4AddressJson =
asyncResp->res.jsonValue["IPv4Addresses"][entryIdx];