summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redfish-core/lib/ethernet.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 5ccc25fe39..0469f74098 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1123,10 +1123,25 @@ inline void
const std::string& macAddress,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
+ static constexpr std::string_view dbusNotAllowedError =
+ "xyz.openbmc_project.Common.Error.NotAllowed";
+
crow::connections::systemBus->async_method_call(
- [asyncResp, macAddress](const boost::system::error_code ec) {
+ [asyncResp, macAddress](const boost::system::error_code ec,
+ const sdbusplus::message::message& msg) {
if (ec)
{
+ const sd_bus_error* err = msg.get_error();
+ if (err == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (err->name == dbusNotAllowedError)
+ {
+ messages::propertyNotWritable(asyncResp->res, "MACAddress");
+ return;
+ }
messages::internalError(asyncResp->res);
return;
}