#
40e9b92e |
| 10-Sep-2024 |
Ed Tanous <etanous@nvidia.com> |
Use SPDX identifiers
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow.
This pa
Use SPDX identifiers
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow.
This patchset does not intend to modify any intent on any existing copyrights or licenses, only to standardize their inclusion.
[1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
Change-Id: I935c7c0156caa78fc368c929cebd0f068031e830 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
ad6dd39b |
| 12-Sep-2024 |
Lei YU <yulei.sh@bytedance.com> |
websocket: Handle eof and truncated stream
When doRead() fails, the code was checking the `closed` error code and print the error log if it's other error codes. In field we noticed that the error co
websocket: Handle eof and truncated stream
When doRead() fails, the code was checking the `closed` error code and print the error log if it's other error codes. In field we noticed that the error code could be `eof` or `stream_truncated` if the websocket gets closed. Add the above error codes as well so that it does not print error log on closed websocket.
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Id25f9750521d67643a125d7641eb73c75c328a85
show more ...
|
#
bd79bce8 |
| 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
724985ff |
| 05-Jun-2024 |
Ed Tanous <ed@tanous.net> |
Break out SSL key handler into a compile unit
This commit allows for no code to have to pull in openssl headers directly. All openssl code is now included in compile units, or transitively from boo
Break out SSL key handler into a compile unit
This commit allows for no code to have to pull in openssl headers directly. All openssl code is now included in compile units, or transitively from boost.
Because http2 is optional, no-unneeded-internal-declaration is needed to prevent clang from marking the functions as unused. Chromium has disabled this as well[1]
Tested: Redfish service validator passes.
[1] https://issues.chromium.org/issues/40340369
Change-Id: I327e8ffa45941c2282db804d0be56cf64155e67d Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
83328316 |
| 09-May-2024 |
Ed Tanous <ed@tanous.net> |
Fix lesser used options
25b54dba775b31021a3a4677eb79e9771bcb97f7 missed several cases where we had ifndef instead of ifdef. because these weren't the defaults, these don't show up as failures when
Fix lesser used options
25b54dba775b31021a3a4677eb79e9771bcb97f7 missed several cases where we had ifndef instead of ifdef. because these weren't the defaults, these don't show up as failures when testing.
Tested: Redfish service validator passes. Inspection primarily. Mechanical change.
Change-Id: I3f6915a97eb44d071795aed76476c6bee7e8ed27 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
8db83747 |
| 13-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Clean up BMCWEB_ENABLE_SSL
This macro came originally from CROW_ENABLE_SSL, and was used as a macro to optionally compile without openssl being required.
OpenSSL has been pulled into many other dep
Clean up BMCWEB_ENABLE_SSL
This macro came originally from CROW_ENABLE_SSL, and was used as a macro to optionally compile without openssl being required.
OpenSSL has been pulled into many other dependencies, and has been functionally required to be included for a long time, so there's no reason to hold onto this macro.
Remove most uses of the macro, and for the couple functional places the macro is used, transition to a constexpr if to enable the TLS paths.
This allows a large simplification of code in some places.
Tested: Redfish service validator passes.
Change-Id: Iebd46a68e5e417b6031479e24be3c21bef782f4c Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
8cb2c024 |
| 27-Mar-2024 |
Ed Tanous <ed@tanous.net> |
Fix moves/forward
Clang has new checks for std::move/std::forward correctness, which catches quite a few "wrong" things where we were making copies of callback handlers.
Unfortunately, the lambda s
Fix moves/forward
Clang has new checks for std::move/std::forward correctness, which catches quite a few "wrong" things where we were making copies of callback handlers.
Unfortunately, the lambda syntax of
callback{std::forward<Callback>(callback)}
in a capture confuses it, so change usages to callback = std::forward<Callback>(callback)
to be consistent.
Tested: Redfish service validator passes.
Change-Id: I7a111ec00cf78ecb7d5f5b102c786c1c14d74384 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
1873a04f |
| 01-Apr-2024 |
Myung Bae <myungbae@us.ibm.com> |
Reduce multi-level calls of req.req members
Several places access the members of `req` indirectly like `req.req.method()`. This can be simplified as `req.method()` .
This would also make the code
Reduce multi-level calls of req.req members
Several places access the members of `req` indirectly like `req.req.method()`. This can be simplified as `req.method()` .
This would also make the code clearer.
Tested: - Compiles - Redfish service validator passes
Change-Id: Ie129564ff907cdea7ac224b1e3d80cc0dedfbd7b Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
#
b2896149 |
| 31-Jan-2024 |
Ed Tanous <ed@tanous.net> |
Rename FileBody to HttpBody
Now that our custom body type does things more than files, it makes sense to rename it. This commit renames the header itself, then all instances of the class.
Tested:
Rename FileBody to HttpBody
Now that our custom body type does things more than files, it makes sense to rename it. This commit renames the header itself, then all instances of the class.
Tested: Basic GET requests succeed. Change-Id: If4361ac8992fc7c268f48a336707f96e68d3576c Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
52e31629 |
| 23-Jan-2024 |
Ed Tanous <ed@tanous.net> |
Simplify body
Now that we have a custom boost http body class, we can use it in more cases. There's some significant overhead and code when switching to a file body, namely removing all the headers
Simplify body
Now that we have a custom boost http body class, we can use it in more cases. There's some significant overhead and code when switching to a file body, namely removing all the headers. Making the body class support strings would allow us to completely avoid that inefficiency. At the same time, it would mean that we can now use that class for all cases, including HttpClient, and http::Request. This leads to some code reduction overall, and means we're reliant on fewer beast structures.
As an added benefit, we no longer have to take a dependency on boost::variant2.
Tested: Redfish service validator passes, with the exception of badNamespaceInclude, which is showing warnings prior to this commit.
Change-Id: I061883a73230d6085d951c15891465c2c8445969 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
a8894201 |
| 22-Dec-2023 |
zhaogang.0108 <zhaogang.0108@bytedance.com> |
bmcweb: Add nullptr check for weakptr
When we call a null weakptr, it will cause a crash. Add nullptr check for weakptr can avoid this situation.
Tested: bmcweb.service did not experience core-dump
bmcweb: Add nullptr check for weakptr
When we call a null weakptr, it will cause a crash. Add nullptr check for weakptr can avoid this situation.
Tested: bmcweb.service did not experience core-dump.
Change-Id: I4490d68c70ea5d43681f4fb18b3859afb01ed70a Signed-off-by: Zhao Gang <zhaogang.0108@bytedance.com>
show more ...
|
#
5a39f77a |
| 20-Oct-2023 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest
clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository.
Change-Id: I2f9540cf0d545a2da4d6289fc87b754f684bc9a7 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
5ebb9d33 |
| 27-Feb-2023 |
Ed Tanous <edtanous@google.com> |
Remove extra variables in websockets
These variables don't need propagated to handlers. Any usage of them is incorrect.
This makes Websocket once again a pure virtual class, which is desired.
Sig
Remove extra variables in websockets
These variables don't need propagated to handlers. Any usage of them is incorrect.
This makes Websocket once again a pure virtual class, which is desired.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id1ecc3911fc502d436a3e6aa29024628fc51aff4
show more ...
|
#
62598e31 |
| 17-Jul-2023 |
Ed Tanous <ed@tanous.net> |
Replace logging with std::format
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging.
Unfortunately, given its level
Replace logging with std::format
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging.
Unfortunately, given its level of compile time checks, it needs to be a method, instead of the stream style logging we had before. This requires a pretty substantial change. Fortunately, this change can be largely automated, via the script included in this commit under scripts/replace_logs.py. This is to aid people in moving their patchsets over to the new form in the short period where old patches will be based on the old logging. The intention is that this script eventually goes away.
The old style logging (stream based) looked like.
BMCWEB_LOG_DEBUG << "Foo " << foo;
The new equivalent of the above would be: BMCWEB_LOG_DEBUG("Foo {}", foo);
In the course of doing this, this also cleans up several ignored linter errors, including macro usage, and array to pointer deconstruction.
Note, This patchset does remove the timestamp from the log message. In practice, this was duplicated between journald and bmcweb, and there's no need for both to exist.
One design decision of note is the addition of logPtr. Because the compiler can't disambiguate between const char* and const MyThing*, it's necessary to add an explicit cast to void*. This is identical to how fmt handled it.
Tested: compiled with logging meson_option enabled, and launched bmcweb
Saw the usual logging, similar to what was present before: ``` [Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled [Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800 [Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist [Info src/webserver_main.cpp:59] Starting webserver on port 18080 [Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file. [Info src/webserver_main.cpp:137] Start Hostname Monitor Service... ``` Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
show more ...
|
#
7e9c08ed |
| 16-Jun-2023 |
Ed Tanous <edtanous@google.com> |
Revert "Fix websocket csrf checking"
This reverts commit e628df8658c57f6943b6d3612e1077618e5a168a.
This appears to cause problems with non-cookie login of the console websocket. This appears to be
Revert "Fix websocket csrf checking"
This reverts commit e628df8658c57f6943b6d3612e1077618e5a168a.
This appears to cause problems with non-cookie login of the console websocket. This appears to be a gap in both our testing, and things that we have scripting to do, but clearly it's a change in behavior, so if we want to change the behavior, we should do it intentionally, and clearly, ideally with a path to make clients work, or an explicit documentation that the webui is the only supported client.
Change-Id: I334257e1355a5b8431cb7ecfe58ef8a942f4981c Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
#
052bcbf4 |
| 30-May-2023 |
Ninad Palsule <ninad@linux.ibm.com> |
Add support for multiple consoles
This drop adds support for multiple consoles. The following changes are made to achieve this. - Kept the "/console0" route for backward compatibility - Added a new
Add support for multiple consoles
This drop adds support for multiple consoles. The following changes are made to achieve this. - Kept the "/console0" route for backward compatibility - Added a new route "/console/<str>" to support multiple consoles. All new consoles must use this route string.
Testing: - Make sure that old console path /console0 is working. [INFO "http_connection.hpp":209] Request: 0x1bc2e60 HTTP/1.1 GET /console0 ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console0' 1 / 2 [DEBUG "obmc_console.hpp":212] Connection 0x1bdb67c opened [DEBUG "obmc_console.hpp":241] Console Object path = /xyz/openbmc_project/console/default service = xyz.openbmc_project.Console.default Request target = /console0 [DEBUG "obmc_console.hpp":198] Console web socket path: /console0 Console unix FD: 12 duped FD: 13 [DEBUG "obmc_console.hpp":82] Reading from socket [DEBUG "obmc_console.hpp":162] Remove connection 0x1bdb67c from obmc console
- Make sure that new path for default console working [INFO "http_connection.hpp":209] Request: 0x1bd76a8 HTTP/1.1 GET /console/default ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console/<str>' 1 / 2 [DEBUG "obmc_console.hpp":212] Connection 0x1baf82c opened [DEBUG "obmc_console.hpp":241] Console Object path = /xyz/openbmc_project/console/default service = xyz.openbmc_project.Console.default Request target = /console/default [DEBUG "obmc_console.hpp":198] Console web socket path: /console/default Console unix FD: 12 duped FD: 13 [DEBUG "obmc_console.hpp":82] Reading from socket [INFO "obmc_console.hpp":154] Closing websocket. Reason: [DEBUG "obmc_console.hpp":162] Remove connection 0x1baf82c from obmc console
- Make sure that path for hypervisor console is working. [INFO "http_connection.hpp":209] Request: 0x1bc2e60 HTTP/1.1 GET /console/hypervisor ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console/<str>' 1 / 2 [DEBUG "obmc_console.hpp":212] Connection 0x1bc5234 opened [DEBUG "obmc_console.hpp":241] Console Object path = /xyz/openbmc_project/console/hypervisor service = xyz.openbmc_project.Console.hypervisor Request target = /console/hypervisor [DEBUG "obmc_console.hpp":198] Console web socket path: /console/hypervisor Console unix FD: 12 duped FD: 13 [DEBUG "obmc_console.hpp":82] Reading from socket [INFO "obmc_console.hpp":154] Closing websocket. Reason: [DEBUG "obmc_console.hpp":162] Remove connection 0x1bc5234 from obmc console
- Make sure that bad console path is failing properly due to DBUS error. [INFO "http_connection.hpp":209] Request: 0x1bd76a8 HTTP/1.1 GET /console/badconsoleid ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console/<str>' 1 / 2 [DEBUG "obmc_console.hpp":212] Connection 0x1bdb67c opened [DEBUG "obmc_console.hpp":241] Console Object path = /xyz/openbmc_project/console/badconsoleid service = xyz.openbmc_project.Console.badconsoleid Request target = /console/badconsoleid [ERROR "obmc_console.hpp":174] Failed to call console Connect() method DBUS error: No route to host
Change-Id: I9b617bc51e3ddc605dd7f4d213c805d05d2cfead Signed-off-by: Ninad Palsule <ninad@linux.ibm.com> Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
#
89492a15 |
| 10-May-2023 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository.
Change-Id: I75f89d2959b0f1338c20d72ad669fbdc1d720835 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
e628df86 |
| 04-Apr-2023 |
Gunnar Mills <gmills@us.ibm.com> |
Fix websocket csrf checking
https://github.com/openbmc/bmcweb/commit/f8aa3d2704d3897eb724dab9ac596af8b1f0e33e (4/15/20) added CSRF check into websockets but later setting cookieAuth to true was remo
Fix websocket csrf checking
https://github.com/openbmc/bmcweb/commit/f8aa3d2704d3897eb724dab9ac596af8b1f0e33e (4/15/20) added CSRF check into websockets but later setting cookieAuth to true was removed so this session->cookieAuth is always false. https://github.com/openbmc/bmcweb/commit/3909dc82a003893812f598434d6c4558107afa28 (7/15/20).
2 choices here add back this cookieAuth=true when cookie auth is used or remove this "if cookieAuth" and do this check anytime BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION isn't enabled.
Really we shouldn't support any other auth on websockets so maybe if (!session->cookieAuth){ unauthorized; } if go with the first choice. Went with the 2nd choice because cleaner.
This checking is a bit weird because it uses protocol for csrf checking. https://github.com/openbmc/webui-vue/blob/b63e9d9a70dabc4c9a7038f7727fca6bd17d940a/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue#L98
Tested: Before could log in to webui-vue, delete the XSRF-TOKEN but still connect to the host console. After if deleted the XSRF-TOKEN (browser dev tools), the websocket does not connect. Don't have a system with KVM, VM enabled so wasn't able to check those but the webui-vue code for them looks to pass the token. The webui-vue host console works the same as before if you aren't messing with the XSRF-TOKEN.
Change-Id: Ibd5910587648f68809c7fd518bcf5a0bcf8cf329 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
show more ...
|
#
863c1c2e |
| 21-Feb-2022 |
Ed Tanous <edtanous@google.com> |
nbd proxy and websocket cleanups
As-written, the nbd (and all websocket daemons) suffer from a problem where there is no way to apply socket backpressure, so in certain conditions, it's trivial to r
nbd proxy and websocket cleanups
As-written, the nbd (and all websocket daemons) suffer from a problem where there is no way to apply socket backpressure, so in certain conditions, it's trivial to run the BMC out of memory on a given message. This is a problem.
This commit implements the idea of an incremental callback handler, that accepts a callback function to be run when the processing of the message is complete. This allows applying backpressure on the socket, which in turn, should provide pressure back to the client, and prevent buffering crashes on slow connections, or connections with high latency.
Tested: NBD proxy not upstream, no way to test. No changes made to normal websocket flow.
Signed-off-by: Michal Orzel <michalx.orzel@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3f116cc91eeadc949579deacbeb2d9f5e0f4fa53
show more ...
|
#
e551b5fa |
| 27-Feb-2023 |
Ed Tanous <edtanous@google.com> |
Remove authorization checks in nbd_proxy
nbd proxy should not have its own authorization checks, as these are now handled in the core as of 7e9093e625961f533250a6c193c1a474e98007c4
Signed-off-by: E
Remove authorization checks in nbd_proxy
nbd proxy should not have its own authorization checks, as these are now handled in the core as of 7e9093e625961f533250a6c193c1a474e98007c4
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8874d8a09278ba21d2acfdf076cb76dee718ecf4
show more ...
|
#
5e7e2dc5 |
| 16-Feb-2023 |
Ed Tanous <edtanous@google.com> |
Take boost error_code by reference
By convention, we should be following boost here, and passing error_code by reference, not by value. This makes our code consistent, and removes the need for a co
Take boost error_code by reference
By convention, we should be following boost here, and passing error_code by reference, not by value. This makes our code consistent, and removes the need for a copy in some cases.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id42ea4a90b6685a84818b87d1506c11256b3b9ae
show more ...
|
#
26ccae32 |
| 16-Feb-2023 |
Ed Tanous <edtanous@google.com> |
Pass string views by value
string_view should always be passed by value; This commit is a sed replace of the code to make all string_views pass by value, per general coding guidelines[1].
[1] http
Pass string views by value
string_view should always be passed by value; This commit is a sed replace of the code to make all string_views pass by value, per general coding guidelines[1].
[1] https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I55b342a29a0fbfce0a4ed9ea63db6014d03b134c
show more ...
|
#
3ccb3adb |
| 13-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Fix a boatload of #includes
Most of these missing includes were found by running clang-tidy on all files, including headers. The existing scripts just run clang-tidy on source files, which doesn't
Fix a boatload of #includes
Most of these missing includes were found by running clang-tidy on all files, including headers. The existing scripts just run clang-tidy on source files, which doesn't catch most of these.
Tested: Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic741fbb2cc9e5e92955fd5a1b778a482830e80e8
show more ...
|
#
079360ae |
| 29-Jun-2022 |
Ed Tanous <edtanous@google.com> |
Prepare for boost::url upgrade
The new boost URL now interops properly with std::string_view, which is great, and cleans up a bunch of mediocre code to convert one to another. It has also been pulle
Prepare for boost::url upgrade
The new boost URL now interops properly with std::string_view, which is great, and cleans up a bunch of mediocre code to convert one to another. It has also been pulled into boost-proper, so we no longer need a boost-url dependency that's separate.
Unfortunately, boost url makes these improvements by changing boost::string_view for boost::urls::const_string, which causes us to have some compile errors on the missing type.
The bulk of these changes fall into a couple categories, and have to be executed in one commit. string() is replaced with buffer() on the url and url_view types boost::string_view is replaced by std::string_view for many times, in many cases removing a temporary that we had in the code previously.
Tested: Code compiles with boost 1.81.0 beta. Redfish service validator passes. Pretty good unit test coverage for URL-specific use cases.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8d3dc89b53d1cc390887fe53605d4867f75f76fd
show more ...
|
#
11ba3979 |
| 11-Jul-2022 |
Ed Tanous <edtanous@google.com> |
Remove usages of boost::starts/ends_with
Per the coding standard, now that C++ supports std::string::starts_with and std::string::ends_with, we should be using them over the boost alternatives. Thi
Remove usages of boost::starts/ends_with
Per the coding standard, now that C++ supports std::string::starts_with and std::string::ends_with, we should be using them over the boost alternatives. This commit goes through and updates all usages.
Arguably some of these are incorrect, and instances of common error 13, but because this is mostly a mechanical it intentionally doesn't try to handle it.
Tested: Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic4c6e5d0da90f7442693199dc691a47d2240fa4f
show more ...
|