Skip to content

Commit c4cf8e7

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 c4cf8e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

redfish-core/lib/log_services.hpp

Lines changed: 4 additions & 4 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;
@@ -1698,7 +1700,6 @@ inline bool isAllowedIP(const crow::Request& req)
16981700

16991701
inline void requestRoutesJournalEventLogEntryPost(App& app)
17001702
{
1701-
BMCWEB_LOG_ERROR("Entred: requestRoutesEventLogEntriesPost");
17021703
BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog")
17031704
.privileges(redfish::privileges::postLogEntry)
17041705
.methods(boost::beast::http::verb::post)(
@@ -1752,7 +1753,6 @@ inline void requestRoutesJournalEventLogEntryPost(App& app)
17521753

17531754
inline void requestRoutesDBusEventLogEntryPost(App& app)
17541755
{
1755-
BMCWEB_LOG_ERROR("Entred: requestRoutesEventLogEntriesPost");
17561756
BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog")
17571757
.privileges(redfish::privileges::postLogEntry)
17581758
.methods(boost::beast::http::verb::post)(

0 commit comments

Comments
 (0)