Skip to content

Commit 56735f0

Browse files
committed
Enhance IP filtering to allow multiple USB vNIC IPs
Updated `isAllowedIP()` to support both 192.168.31.1 and 192.168.31.2 as valid USB vNIC IP addresses. Clean up: Removed redundant error log Tests: Redfish event gereration from USB vNIC ip "192.168.31.2" is success Able to view the redfish event in bmcweb. Signed-off-by: Raja Sekhar Reddy Gade <[email protected]>
1 parent 554426d commit 56735f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

redfish-core/lib/log_services.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,10 +1685,12 @@ inline bool isAllowedIP(const crow::Request& req)
16851685
{
16861686
std::string ipStr = req.ipAddress.to_string();
16871687
// IP of the USB vNIC
1688-
constexpr std::string_view allowedIp = "192.168.31.2";
1688+
constexpr std::string_view allowedIp1 = "192.168.31.1";
1689+
constexpr std::string_view allowedIp2 = "192.168.31.2";
16891690

16901691
// Check if the IP string contains the allowed IP
1691-
if (ipStr.find(allowedIp) == std::string::npos)
1692+
if (ipStr.find(allowedIp1) == std::string::npos &&
1693+
ipStr.find(allowedIp2) == std::string::npos)
16921694
{
16931695
BMCWEB_LOG_ERROR("Unmatched IP: {} ", ipStr);
16941696
return false;

0 commit comments

Comments
 (0)