diff options
author | Alexandr Ilenko <AIlenko@IBS.RU> | 2022-08-12 16:29:05 +0300 |
---|---|---|
committer | Alexandr Ilenko <AIlenko@IBS.RU> | 2022-08-15 10:52:08 +0300 |
commit | 576aa27adf6a75631c78e12153fe05765a870e10 (patch) | |
tree | 16d879df088f391358db495dd89ddf6970c49eb2 /meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces | |
parent | 12867c86df8dc7715ffcd33b5fb6dacaccaaac23 (diff) | |
download | openbmc-576aa27adf6a75631c78e12153fe05765a870e10.tar.xz |
bmcweb: Fix: keep and re-send initial negotiation data from Web=>Unix sockets
Diffstat (limited to 'meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces')
2 files changed, 80 insertions, 0 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0005-Fix-keep-and-re-send-initial-negotiation-data-from-W.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0005-Fix-keep-and-re-send-initial-negotiation-data-from-W.patch new file mode 100644 index 0000000000..08aa794766 --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0005-Fix-keep-and-re-send-initial-negotiation-data-from-W.patch @@ -0,0 +1,79 @@ +From 27eb5e4ca40401cbaa1801d419d89d3cd50942db Mon Sep 17 00:00:00 2001 +From: Alexandr Ilenko <AIlenko@IBS.RU> +Date: Tue, 9 Aug 2022 13:19:25 +0300 +Subject: [PATCH] Fix: keep and re-send initial negotiation data from Web=>Unix + sockets + +--- + include/nbd_proxy.hpp | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp +index ac3a8113..66235e07 100644 +--- a/include/nbd_proxy.hpp ++++ b/include/nbd_proxy.hpp +@@ -62,8 +62,12 @@ struct NbdProxyServer : std::enable_shared_from_this<NbdProxyServer> + return endpointId; + } + +- void run() ++ void run(const std::string& initialWsData) + { ++ boost::asio::buffer_copy(ws2uxBuf.prepare(initialWsData.size()), ++ boost::asio::buffer(initialWsData)); ++ ws2uxBuf.commit(initialWsData.size()); ++ + acceptor.async_accept( + [this, self(shared_from_this())](boost::system::error_code ec, + stream_protocol::socket socket) { +@@ -250,12 +254,17 @@ struct NbdProxyServer : std::enable_shared_from_this<NbdProxyServer> + static boost::container::flat_map<crow::websocket::Connection*, + std::shared_ptr<NbdProxyServer>> + sessions; ++static boost::container::flat_map<crow::websocket::Connection*, ++ std::string> ++ sessionInitialWsDatas; + + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/nbd/<str>") + .websocket() + .onopen([](crow::websocket::Connection& conn) { ++ sessionInitialWsDatas.try_emplace(&conn); ++ + BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")"; + + auto getUserInfoHandler = +@@ -384,7 +393,9 @@ inline void requestRoutes(App& app) + sessions[&conn] = std::make_shared<NbdProxyServer>( + conn, *socketValue, *endpointValue, *endpointObjectPath); + +- sessions[&conn]->run(); ++ auto& initialWsData = sessionInitialWsDatas[&conn]; ++ sessions[&conn]->run(initialWsData); ++ initialWsData.clear(); + }; + crow::connections::systemBus->async_method_call( + std::move(openHandler), "xyz.openbmc_project.VirtualMedia", +@@ -410,6 +421,7 @@ inline void requestRoutes(App& app) + session->second->close(); + // Remove reference to session in global map + sessions.erase(session); ++ sessionInitialWsDatas.erase(&conn); + }) + .onmessage([](crow::websocket::Connection& conn, + const std::string& data, bool) { +@@ -425,6 +437,10 @@ inline void requestRoutes(App& app) + return; + } + } ++ else ++ { ++ sessionInitialWsDatas[&conn].append(data); ++ } + }); + } + } // namespace nbd_proxy +-- +2.35.1 + diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend index d984430c60..e888b304b0 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -5,6 +5,7 @@ SRC_URI += "\ file://0002-add-new-cpu-fields.patch \ file://0003-add-new-dimm-fields.patch \ file://0004-configure-telemetry.patch \ + file://0005-Fix-keep-and-re-send-initial-negotiation-data-from-W.patch \ " EXTRA_OEMESON += "\ |