From 87651333c451cfa8090273366be5ec62bd1a9eea Mon Sep 17 00:00:00 2001 From: Xo Wang Date: Fri, 11 Aug 2017 10:17:59 -0700 Subject: apphandler: Add "System Name" System Info parameter Use the BMC's hostname to respond to requests for the "System Name" parameter. Signed-off-by: Xo Wang Change-Id: I23845aab6091a0d003b6f8370d2b67fc11e580e8 Signed-off-by: Patrick Venture --- apphandler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apphandler.cpp b/apphandler.cpp index 7f16b1f..4a2f2da 100644 --- a/apphandler.cpp +++ b/apphandler.cpp @@ -10,10 +10,12 @@ #include "utils.hpp" #include +#include #include #include #include #include +#include #include "host-ipmid/ipmid-api.h" @@ -635,6 +637,17 @@ ipmi_ret_t ipmi_app_get_sys_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd, static std::unique_ptr sysInfoParamStore; +static std::string sysInfoReadSystemName() +{ + // Use the BMC hostname as the "System Name." + char hostname[HOST_NAME_MAX + 1] = {}; + if (gethostname(hostname, HOST_NAME_MAX) != 0) + { + perror("System info parameter: system name"); + } + return hostname; +} + struct IpmiSysInfoResp { uint8_t paramRevision; @@ -764,6 +777,8 @@ ipmi_ret_t ipmi_app_get_system_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd, if (sysInfoParamStore == nullptr) { sysInfoParamStore = std::make_unique(); + sysInfoParamStore->update(IPMI_SYSINFO_SYSTEM_NAME, + sysInfoReadSystemName); } // Parameters other than Set In Progress are assumed to be strings. -- cgit v1.2.1