summaryrefslogtreecommitdiff
path: root/include/nbd_proxy.hpp
AgeCommit message (Collapse)AuthorFilesLines
2020-12-18Fix .clang-tidyEd Tanous1-5/+4
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-10-23fix include namesEd Tanous1-3/+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-06Fix includesEd Tanous1-1/+3
Lots of bad includes got put in recently, including big things, like boost/http and beast/core. These are lots of code to parse, and leads to files including things they didn't mean to. Tested: Code compiles Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I38de889fdfd9b23f66a2259bb30bf6584345e77f
2020-09-29Fix naming conventionsEd Tanous1-1/+1
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-26Fix unused param errorsVikram Bodireddy1-2/+2
Unused param errors are throwing from this sources by the recent CMake changes. Looks like CI build didn't catch these errors then. Tested: Build is verified. Signed-off-by: Vikram Bodireddy <vikram.bodireddy@linux.intel.com> Change-Id: I139c01a78babc1c370c0c5de787291726ea42b53
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>
2020-07-23Add 'reason' message to websocket close methodWludzik, Jozef1-129/+128
Now websocket client receives a proper reason from a server. Removed filling asyncResp from onopen() method from nbdproxy.h because it was redundant. Websocket does not response to client using asyncResp. Removed close from NbdProxyServer destructor because it is always called in onclose() method. Tested: - Mounted and unmounted virtual media using proxy mode few times as administrator with success. - Mounted virtual media using proxy mode as operator and receives proper reason on client side. - Verify if errors are received properly on client side when mounting operation fails. Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Change-Id: If3b1cc9782de71a0975416872bc2fe8e3824148a
2020-06-11Remove include experimental/filesystemGunnar Mills1-1/+0
This include is no longer needed. Tested: bmcweb built. Change-Id: Id754779cc8340678f03b8841abee807c90b959ff Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-4/+4
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-03-05Permission check for virtual media proxy modePrzemyslaw Czarnowski1-63/+133
This patch enables checking of user permission for proxy mode, as start of this kind service is not triggered by redfish (which has permission check by default). Permission check is done in .onopen handler of websocket. For this reason another dbus call for user privileges is added to verify if user has "ConfigureManager" privilege. I have chosen this approach, as generic privilege check for all websockets introduces significant changes in connection upgrade flow which makes implementaion vague and caused some memory issues difficult to track down. It is worth noting that other websockets (eg. kvm) uses .required() function to set privilege but this information is lost during connection upgrade and is not checked anywhere in upgrade flow. Tested: Manual tests with opening websockets via web browser and dedicated nbd proxy utility. For users with/without appropriate permissions. Single request and burst of requests has been tested as well. Change-Id: I2a56bec606fa0e5f3d4232e48794c9055bf6095e Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2020-01-02nbd-proxy closing fixesIwona Winiarska1-18/+22
This commit fixes: - handling of virtual media unmount method - cancels unix socket async accept upon early websocket closing (reproduction with rapid start/stop button pressing or closing websocket just after negotation msg from NBD server) Tested: - unmount method via WebUI - unix socket accept cancellation - modified NBD server to close websocket after sending negotation message & rapid start/stop button pressing Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Signed-off-by: Jan Sowinski <jan.sowinski@intel.com> Change-Id: Ibcbb87a7e35cfbee8c8b4686f64c9090c66f0c17
2019-11-21Implement nbd-proxy as a part of bmcwebIwona Klimaszewska1-0/+381
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>