summaryrefslogtreecommitdiff
path: root/include/obmc_console.hpp
AgeCommit message (Collapse)AuthorFilesLines
2020-12-18Fix .clang-tidyEd Tanous1-4/+3
camelLower is not a type, camelBack is. Changes were made automatically with clang-tidy --fix-errors To be able to apply changes automatically, the only way I've found that works was to build the version of clang/clang-tidy that yocto has, and run the fix script within bitbake -c devshell bmcweb. Unfortunately, yocto has clang-tidy 11, which can apparently find a couple extra errors in tests we already had enabled. As such, a couple of those are also included. Tested: Ran clang-tidy-11 and got a clean result. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
2020-11-17fix bmcweb crash during sol communicationAppaRao Puli1-0/+14
After establishing the obmc_console socket communication, If client closes the connection abruptly, async read/write operation fails with asio.ssl.stream error. To handle the error, it calls closeHandler call back function and cleans the session and socket. Any ongoing async read operation should be discarded by checking socket handle. Read/Write the message from stream via async_read_some()/async_write without checking socket handle, causes the crash. Added socket handle validation before performing any read/write operation to avoid crash. Tested: - Without fix, when sol connection closes abruptly, at times saw the crash with below logs. Nov 13 11:32:51 intel-obmc bmcweb[20169]: doRead error asio.ssl.stream:1 Nov 13 11:32:51 intel-obmc systemd[1]: bmcweb.service: Main process exited, code=dumped, status=11/SEGV Nov 13 11:32:51 intel-obmc systemd[1]: bmcweb.service: Failed with result 'core-dump'. - With fix, verified the case and no crashes seen. Nov 13 12:55:04 intel-obmc bmcweb[24426]: (2020-11-13 12:55:04) [ERROR "websocket.h":207] doRead error asio.ssl.stream:1 Nov 13 12:55:04 intel-obmc bmcweb[24426]: (2020-11-13 12:55:04) [ERROR "obmc_console.hpp":67] doread() - Socket closed Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: I2afda509ca77a561651a8682e042c45ca7366642
2020-10-23fix include namesEd Tanous1-2/+2
cppcheck isn't smart enough to recognize these are c++ headers, not c headers. Considering we're already inconsistent about our naming, it's easier to just be consistent, and move the last few files to use .hpp instead of .h. Tested: Code builds, no changes. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ic348d695f8527fa4a0ded53f433e1558c319db40
2020-10-15Lots of performance improvementsEd Tanous1-1/+1
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-09-29Fix naming conventionsEd Tanous1-8/+8
Lots of code has been checked in that doesn't match the naming conventions. Lets fix that. Tested: Code compiles. Variable/function renames only. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I6bd107811d0b724f1fad990016113cdf035b604b
2020-08-24Prep for boost 1.74.0Ed Tanous1-0/+1
Boost 1.74.0 got released the yesterday and deprecated some more stuff that we use. This patchset prepares us so we will build for it when meta-oe picks it up. Tested: Code builds under boost 1.74.0 Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Icc6c54da6705098fc76e3ee6dbdc6c3b5c57fbda
2020-08-17Enable unused variable warnings and resolveEd Tanous1-13/+14
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Enable clang warningsEd Tanous1-5/+5
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-08-17Remove middlewaresEd Tanous1-2/+1
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2019-11-21Implement nbd-proxy as a part of bmcwebIwona Klimaszewska1-1/+3
Nbd-proxy is responsible for exposing websocket endpoint in bmcweb. It matches WS endpoints with unix socket paths using configuration exposed on D-Bus by Virtual-Media. Virtual-Media is then notified about unix socket availability through mount/unmount D-Bus methods. Currently, this feature is disabled by default. Tested: Integrated with initial version of Virtual-Media. Change-Id: I9c572e9841b16785727e5676fea1bb63b0311c63 Signed-off-by: Iwona Klimaszewska <iwona.klimaszewska@intel.com> Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2019-10-21Add "requires" handlers to all non-trivial routesEd Tanous1-0/+1
This commit is the result of an audit to add user levels to the various components that need them. As written: KVM requires admin privilege Virtual media requires admin privilege image upload requires admin privilege /subscribe API requies Login privilege Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I6384f23769a5ac23f653519656721da7373f088f
2019-10-18Make references to crow less obviousEd Tanous1-2/+2
Recently, a number of people in the community have made the (admittedly easy) mistake that we use a significant portion of crow. Today, we use crow for the router, and the "app" structure, and even those have been significantly modified to meet the bmc needs. All other components have been replaced with Boost beast. This commit removes the crow mentions from the Readme, and moves the crow folder to "http" to camouflage it a little. No code content has changed. Tested: Code compiles. No functional change made to any executable code. Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: Iceb57b26306cc8bdcfc77f3874246338864fd118
2019-10-11Fix a bunch of warningsEd Tanous1-4/+4
using the list of warnings from here: https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100 Seems like a good place to start, and would improve things a bit type-wise. This patchset attempts to correct all the issues in one shot. Tested: It builds. Will test various subsystems that have been touched Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
2019-05-02bmcweb: /s/boost::beast::string_view/std::string_view/gAdriana Kobylak1-1/+1
Follow-on to https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/18891 Tested: Checked that the host console and virtual media endpoints still worked as expected. Change-Id: Ifdc5f21f3668bdf9bd24189504aaeb17b232c921 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
2019-02-04Delete socket adaptersEd Tanous1-1/+1
Boost beast, ASIO, and networking TS already have mechanisms for injecting unit tests, using template parameters. We already use this to some extent, although we pass through socket_adapters. Now that we have constexpr if, we have the ability to simplify this code quite a bit. Tested by: Pulled down phosphor-webui, ran redfish service validator. Observed no errors. Change-Id: Ib8734aeb4c9139b56705060f6196e8ae16458fe9 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2019-01-10Fix disconnection problem for HTML5 SOLCheng C Yang1-1/+1
When using Legacy Boot Mode in Intel platforms, HTML5 SOL console will be disconnected when host start. When host start, BIOS will send some non UTF-8 data to SOL console, then SOL console will be disconnected. Changing to binary format can make WSS protocol work correctly with non UTF-8 data. Change-Id: I9a440220f16eb07d800dc291897ab3106cd40c32 Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com>
2019-01-09bmcweb: remove boost::asio::local::stream_protocol::endpoint hackVernon Mauery1-17/+0
With the obmc-console-server binding to the correct socket, this is not needed. Abstract unix sockets start with the nul-charater, but are not nul terminated. In fact, the nul-character has no meaning in the path. According to the man page unix(7), abstract: an abstract socket address is distinguished (from a pathname socket) by the fact that sun_path[0] is a null byte ('\0'). The socket's address in this namespace is given by the additional bytes in sun_path that are covered by the specified length of the address structure. (Null bytes in the name have no special significance.) This means that when calling bind/connect, the size of the sockaddr structure is not sizeof(sockaddr_un), it is sizeof(sockaddr_un) - sizeof(sun_path) + (path_len) Change-Id: I2b19d0b9aa8e8ded9162890503c46cad95a6c7b6 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
2018-09-05Implement /console0 websocketEd Tanous1-0/+157
This commit ipmlements the serial console websocket in a way that is compatible with phosphor-rest. This allows the webui serial console to function. Latency doesn't appear improved, but I suspect that the obmc-console server has issues. Tested By: Booted phosphor-webui serial console. Serial console works as expected. Also implemented a serial console in python using python websocket, and it appears to send and receive data correctly. Change-Id: I0e571beb70a51923d6d7d148779a1154432c45c9 Signed-off-by: Ed Tanous <ed.tanous@intel.com>