Update filter to allowlist instead of whitelist
Remove racist terminology in favor of descriptive terminology.
Tested: builds and runs with no change in behavior.
Change-Id: Ic7ab6f4b316043da67f079cd92cd6f070ddcf108
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/.gitignore b/.gitignore
index ea7b437..0662a7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,5 +19,5 @@
phosphor-ipmi-host-src/
prefix/
runSensorTests
-ipmi-whitelist.hpp
+ipmi-allowlist.hpp
check-code-coverage*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0f56ca..59114a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,11 +94,11 @@
include_directories (SYSTEM ${OPENSSL_INCLUDE_DIR})
include_directories (SYSTEM ${CMAKE_BINARY_DIR})
-add_custom_command(OUTPUT include/ipmi-whitelist.hpp
- COMMAND ./generate-whitelist.py
- ARGS ipmi-whitelist.conf ${CMAKE_BINARY_DIR}/ipmi-whitelist.hpp
- MAIN_DEPENDENCY ipmi-whitelist.conf
- DEPENDS generate-whitelist.py
+add_custom_command(OUTPUT include/ipmi-allowlist.hpp
+ COMMAND ./generate-allowlist.py
+ ARGS ipmi-allowlist.conf ${CMAKE_BINARY_DIR}/ipmi-allowlist.hpp
+ MAIN_DEPENDENCY ipmi-allowlist.conf
+ DEPENDS generate-allowlist.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_library (zinteloemcmds
@@ -108,8 +108,8 @@
src/smbiosmdrv2handler.cpp src/manufacturingcommands.cpp
src/bmccontrolservices.cpp src/bridgingcommands.cpp
src/ipmi_to_redfish_hooks.cpp src/me_to_redfish_hooks.cpp
- src/chassiscommands.cpp src/whitelist-filter.cpp
- include/ipmi-whitelist.hpp)
+ src/chassiscommands.cpp src/allowlist-filter.cpp
+ include/ipmi-allowlist.hpp)
set_target_properties (zinteloemcmds PROPERTIES VERSION "0.1.0")
set_target_properties (zinteloemcmds PROPERTIES SOVERSION "0")
target_link_libraries (zinteloemcmds stdc++fs)
diff --git a/generate-whitelist.py b/generate-allowlist.py
similarity index 93%
rename from generate-whitelist.py
rename to generate-allowlist.py
index c732726..dc23781 100755
--- a/generate-whitelist.py
+++ b/generate-allowlist.py
@@ -3,8 +3,8 @@
import re, sys, os.path
def usage():
- sys.stderr.write("Usage: $0 whitelist-config-in whitelist-header-out\n")
- sys.stderr.write(" Reads in whitelist config, sorting the contents\n")
+ sys.stderr.write("Usage: $0 allowlist-config-in allowlist-header-out\n")
+ sys.stderr.write(" Reads in allowlist config, sorting the contents\n")
sys.stderr.write(" and outputs a header file\n")
sys.exit(-1)
@@ -87,7 +87,7 @@
"",
"using netfncmd_tuple = std::tuple<unsigned char, unsigned char, unsigned short>;",
"",
- "constexpr const std::array<netfncmd_tuple, {}> whitelist = ".format(
+ "constexpr const std::array<netfncmd_tuple, {}> allowlist = ".format(
len(entries)),
"{{"
]
diff --git a/ipmi-whitelist.conf b/ipmi-allowlist.conf
similarity index 100%
rename from ipmi-whitelist.conf
rename to ipmi-allowlist.conf
diff --git a/src/whitelist-filter.cpp b/src/allowlist-filter.cpp
similarity index 90%
rename from src/whitelist-filter.cpp
rename to src/allowlist-filter.cpp
index 0d26258..fa9eb26 100644
--- a/src/whitelist-filter.cpp
+++ b/src/allowlist-filter.cpp
@@ -1,4 +1,4 @@
-#include <ipmi-whitelist.hpp>
+#include <ipmi-allowlist.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
@@ -19,21 +19,21 @@
namespace
{
-/** @class WhitelistFilter
+/** @class AllowlistFilter
*
* Class that implements an IPMI message filter based
* on incoming interface and a restriction mode setting
*/
-class WhitelistFilter
+class AllowlistFilter
{
public:
- WhitelistFilter();
- ~WhitelistFilter() = default;
- WhitelistFilter(WhitelistFilter const&) = delete;
- WhitelistFilter(WhitelistFilter&&) = delete;
- WhitelistFilter& operator=(WhitelistFilter const&) = delete;
- WhitelistFilter& operator=(WhitelistFilter&&) = delete;
+ AllowlistFilter();
+ ~AllowlistFilter() = default;
+ AllowlistFilter(AllowlistFilter const&) = delete;
+ AllowlistFilter(AllowlistFilter&&) = delete;
+ AllowlistFilter& operator=(AllowlistFilter const&) = delete;
+ AllowlistFilter& operator=(AllowlistFilter&&) = delete;
private:
void postInit();
@@ -103,11 +103,11 @@
return -1;
}
-WhitelistFilter::WhitelistFilter()
+AllowlistFilter::AllowlistFilter()
{
bus = getSdBus();
- log<level::INFO>("Loading whitelist filter");
+ log<level::INFO>("Loading Allowlist filter");
ipmi::registerFilter(ipmi::prioOpenBmcBase,
[this](ipmi::message::Request::ptr request) {
@@ -119,7 +119,7 @@
post_work([this]() { postInit(); });
}
-void WhitelistFilter::cacheRestrictedAndPostCompleteMode()
+void AllowlistFilter::cacheRestrictedAndPostCompleteMode()
{
try
{
@@ -159,14 +159,14 @@
}
}
-void WhitelistFilter::updateRestrictionMode(const std::string& value)
+void AllowlistFilter::updateRestrictionMode(const std::string& value)
{
restrictionMode = RestrictionMode::convertModesFromString(value);
log<level::INFO>("Updated restriction mode",
entry("VALUE=%d", static_cast<int>(restrictionMode)));
}
-void WhitelistFilter::handleRestrictedModeChange(sdbusplus::message_t& m)
+void AllowlistFilter::handleRestrictedModeChange(sdbusplus::message_t& m)
{
std::string signal = m.get_member();
if (signal == "PropertiesChanged")
@@ -202,7 +202,7 @@
}
}
-void WhitelistFilter::updatePostComplete(const std::string& value)
+void AllowlistFilter::updatePostComplete(const std::string& value)
{
// The short string "Standby" is deprecated in favor of the full enum string
// Support for the short string will be removed in the future.
@@ -213,7 +213,7 @@
: "Updated to !POST Complete");
}
-void WhitelistFilter::handlePostCompleteChange(sdbusplus::message_t& m)
+void AllowlistFilter::handlePostCompleteChange(sdbusplus::message_t& m)
{
std::string signal = m.get_member();
if (signal == "PropertiesChanged")
@@ -249,7 +249,7 @@
}
}
-void WhitelistFilter::cacheCoreBiosDone()
+void AllowlistFilter::cacheCoreBiosDone()
{
std::string coreBiosDonePath;
std::string coreBiosDoneService;
@@ -284,7 +284,7 @@
"org.freedesktop.DBus.Properties", "Get", hostMiscIntf, "CoreBiosDone");
}
-void WhitelistFilter::handleCoreBiosDoneChange(sdbusplus::message_t& msg)
+void AllowlistFilter::handleCoreBiosDoneChange(sdbusplus::message_t& msg)
{
std::string signal = msg.get_member();
if (signal == "PropertiesChanged")
@@ -327,7 +327,7 @@
}
}
-void WhitelistFilter::postInit()
+void AllowlistFilter::postInit()
{
// Wait for changes on Restricted mode
namespace rules = sdbusplus::bus::match::rules;
@@ -388,11 +388,11 @@
cacheCoreBiosDone();
}
-ipmi::Cc WhitelistFilter::filterMessage(ipmi::message::Request::ptr request)
+ipmi::Cc AllowlistFilter::filterMessage(ipmi::message::Request::ptr request)
{
auto channelMask = static_cast<unsigned short>(1 << request->ctx->channel);
- bool whitelisted = std::binary_search(
- whitelist.cbegin(), whitelist.cend(),
+ bool Allowlisted = std::binary_search(
+ allowlist.cbegin(), allowlist.cend(),
std::make_tuple(request->ctx->netFn, request->ctx->cmd, channelMask),
[](const netfncmd_tuple& first, const netfncmd_tuple& value) {
return (std::get<2>(first) & std::get<2>(value))
@@ -406,9 +406,9 @@
if (!(request->ctx->channel == ipmi::channelSystemIface ||
request->ctx->channel == channelSMM))
{
- if (!whitelisted)
+ if (!Allowlisted)
{
- log<level::INFO>("Channel/NetFn/Cmd not whitelisted",
+ log<level::INFO>("Channel/NetFn/Cmd not Allowlisted",
entry("CHANNEL=0x%X", request->ctx->channel),
entry("NETFN=0x%X", int(request->ctx->netFn)),
entry("CMD=0x%X", int(request->ctx->cmd)));
@@ -420,7 +420,7 @@
// for system interface, filtering is done as follows:
// Allow All: preboot ? ccSuccess : ccSuccess
// Restricted: preboot ? ccSuccess :
- // ( whitelist ? ccSuccess : ccInsufficientPrivilege )
+ // ( Allowlist ? ccSuccess : ccInsufficientPrivilege )
// Deny All: preboot ? ccSuccess : ccInsufficientPrivilege
if (!(postCompleted || coreBIOSDone))
@@ -440,22 +440,22 @@
}
case restrictionModeRestricted:
{
- // Restricted - follow whitelist
+ // Restricted - follow Allowlist
break;
}
case restrictionModeDenyAll:
{
// Deny All
- whitelisted = false;
+ Allowlisted = false;
break;
}
- default: // for whitelist and blacklist
+ default: // for Allowlist and blacklist
return ipmi::ccInsufficientPrivilege;
}
- if (!whitelisted)
+ if (!Allowlisted)
{
- log<level::INFO>("Channel/NetFn/Cmd not whitelisted",
+ log<level::INFO>("Channel/NetFn/Cmd not allowlisted",
entry("CHANNEL=0x%X", request->ctx->channel),
entry("NETFN=0x%X", int(request->ctx->netFn)),
entry("CMD=0x%X", int(request->ctx->cmd)));
@@ -464,8 +464,8 @@
return ipmi::ccSuccess;
} // namespace
-// instantiate the WhitelistFilter when this shared object is loaded
-WhitelistFilter whitelistFilter;
+// instantiate the AllowlistFilter when this shared object is loaded
+AllowlistFilter allowlistFilter;
} // namespace