#
d7857201 |
| 28-Jan-2025 |
Ed Tanous <etanous@nvidia.com> |
Fix includes
Clang-tidy misc-include-cleaner appears to now be enforcing significantly more headers than previously. That is overall a good thing, but forces us to fix some issues. This commit is
Fix includes
Clang-tidy misc-include-cleaner appears to now be enforcing significantly more headers than previously. That is overall a good thing, but forces us to fix some issues. This commit is largely just taking the clang-recommended fixes and checking them in. Subsequent patches will fix the more unique issues.
Note, that a number of new ignores are added into the .clang-tidy file. These can be cleaned up over time as they're understood. The majority are places where boost includes a impl/x.hpp and x.hpp, but expects you to use the later. include-cleaner opts for the impl, but it isn't clear why.
Change-Id: Id3fdd7ee6df6c33b2fd35626898523048dd51bfb Signed-off-by: Ed Tanous <etanous@nvidia.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
show more ...
|
#
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 ...
|
#
38afdb91 |
| 12-Dec-2024 |
Ed Tanous <etanous@nvidia.com> |
Clean up static analysis
Coverity marks some minor things as improvements we can make. Clean up the code to silence the errors.
Tested: Unit tests coverage for http core is sufficient.
Change-Id:
Clean up static analysis
Coverity marks some minor things as improvements we can make. Clean up the code to silence the errors.
Tested: Unit tests coverage for http core is sufficient.
Change-Id: If4efb359792bfdfe3866e843b4bbdb3f83fec0c5 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
a0969c70 |
| 19-Sep-2024 |
Myung Bae <myungbae@us.ibm.com> |
Remove subscription for TerminateAfterRetries policy
Redfish Data Model [1] section 6.42.5.2 and EventDestination schema [2] specify that the subscription is terminated under the following policy an
Remove subscription for TerminateAfterRetries policy
Redfish Data Model [1] section 6.42.5.2 and EventDestination schema [2] specify that the subscription is terminated under the following policy and the conditions.
DeliveryRetryPolicy: - `TerminateAfterRetries`: ``` This value shall indicate the subscription is terminated after the maximum number of retries is reached, specified by the DeliveryRetryAttempts property in the event service. ```
This implements this policy to delete subscription of the stale client connections after trying `DeliveryRetryAttempts` when `DeliveryRetryPolicy == TerminateAfterRetries`.
Tested: 1) Subscription with blocked communication between bmcweb and listener
- Run Redfish Event Listener [3] to subscribe events with `DeliveryRetryPolicy == TerminateAfterRetries`
- Check the subscription creation ``` curl -k -X GET https://${bmc}/redfish/v1/EventService/Subscriptions/ ```
- Generate an event and check the delivery to the listener. For example, ``` curl -k -X POST https://${bmc}/redfish/v1/EventService/Actions/EventService.SubmitTestEvent ```
- Block the communication between bmcweb and listener (or modify the listener not to delete the subscription at its exit, and kill the listener so that its subscription is still alive)
- If the above task is already finished, generate more events and wait for the sufficient time till `DeliveryRetryAttempts`.
- bmcweb journal log may contain the entries like ``` Sep 20 10:47:55 p10bmc bmcwebd[286]: [ERROR http_client.hpp:444] Maximum number of retries reached. https://9.3.62.209:8080/Redfish-Event-Listener Sep 20 10:47:55 p10bmc bmcwebd[286]: [ERROR event_service_manager.hpp:1459] Subscription 590587653 is deleted after MaxRetryAttempts ```
- Check the subscription again if the subscription is deleted.
2) Redfish Validator passes
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2024.3.html [2] https://github.com/openbmc/bmcweb/blob/878edd599b1706ec8ffe6c3d81ba7cb3534f6393/redfish-core/schema/dmtf/csdl/EventDestination_v1.xml#L857 [3] https://github.com/DMTF/Redfish-Event-Listener
Change-Id: I6e41288995cbb6e37e17a7ef1be093abb7ce54b9 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
#
4b712a29 |
| 02-Aug-2023 |
Ed Tanous <edtanous@google.com> |
Move UserSubscription to composition
This allows for two very important simplifying changes. First, we can use the default copy operators on the UserSubscription class, which is far less error pron
Move UserSubscription to composition
This allows for two very important simplifying changes. First, we can use the default copy operators on the UserSubscription class, which is far less error prone than writing it manually, which we have two copies of in code already.
Second, it allows the Subscription class to move to using values rather than shared_ptr everywhere, which cleans up a significant amount of code.
Tested: Ran Redfish-Event-Listener, subscription created and destroyed correctly. Calling POST SubmitTestEvent showed events propagating to server.
Change-Id: I6d258cfe3594edddf3960ae2d4559d70acca1bf8 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
6be832e2 |
| 10-Sep-2024 |
Ed Tanous <etanous@nvidia.com> |
Remove duplicated block comments
Static analysis flags that these two comments are redundant[1], which seem to be duplicated a lot in copyright headers. Although there is a larger discussion that c
Remove duplicated block comments
Static analysis flags that these two comments are redundant[1], which seem to be duplicated a lot in copyright headers. Although there is a larger discussion that can likely be had.
[1] https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=edtanous_bmcweb&open=AY9_HYjgKXKyw1ZFwgVP
Tested: Comment change only. Code compiles.
Change-Id: Ia960317761f558a87842347ca0b5f3da63f8e730 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
4ff0f1f4 |
| 04-Sep-2024 |
Ed Tanous <etanous@nvidia.com> |
static -> inline
Declaring a function static in a header makes no sense, because a header isn't a compile unit. Find all the issues and replace them with inline.
Change-Id: Icfc2b72d94b41a3a880da1
static -> inline
Declaring a function static in a header makes no sense, because a header isn't a compile unit. Find all the issues and replace them with inline.
Change-Id: Icfc2b72d94b41a3a880da1ae6975beaa30a6792b Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
cd504a94 |
| 19-Aug-2024 |
Ed Tanous <etanous@nvidia.com> |
Partial revert of http_client
4d69861f shows that after being applied, connections are no longer reused. It's unclear why, but very likely due to a use after move of the request object we've seen b
Partial revert of http_client
4d69861f shows that after being applied, connections are no longer reused. It's unclear why, but very likely due to a use after move of the request object we've seen before. This doesn't cause functional issues, only performance ones.
Considering that this was only a minor size reduction in the first place, Revert the http_client part of the patch for now.
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/69234
Tested: Aggregation through /redfish/v1/Chassis works as expected.
Change-Id: I9b56e2c90b108e41df3ba006105106adf8ced154 Signed-off-by: Ed Tanous <etanous@nvidia.com>
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 ...
|
#
19bb362b |
| 05-Jul-2024 |
Ed Tanous <etanous@nvidia.com> |
EventDestination: Implement VerifyCertificate
VerifyCertificate is a property on the Redfish EventDestination schema. It specifies that this property is: ``` An indication of whether the service wil
EventDestination: Implement VerifyCertificate
VerifyCertificate is a property on the Redfish EventDestination schema. It specifies that this property is: ``` An indication of whether the service will verify the certificate of the server referenced by the `Destination` property prior to sending the event ```
To keep prior behavior, and to ensure behavior that's secure by default, if the user omits the property, it is assumed to be true. This property is also persisted and restored.
Tested: Redfish-Event-Listener succeeds with the following procedure Start Redfish-Event-Listener PATCH /redfish/v1/Subscriptions/<subid> VerifyCertificate: false POST /redfish/v1/EventService/Actions/EventService.SubmitTestEvent
Redfish-Event-Listener then hits an internal error, due to an encoding compatibility unrelated to this patch, but is documented in the receiver [1]
POST of a subscription with VerifyCertificate: false set, succeeds.
[1] https://github.com/DMTF/Redfish-Event-Listener/blob/6f3f98beafc89fa9bbf86aa4f8cac6c1987390fb/RedfishEventListener_v1.py#L61
Change-Id: I27e0a3fe87b4dbd0432bfaa22ebf593c3955db11 Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
2ecde74f |
| 01-Jun-2024 |
Abhilash Raju <abhilash.kollam@gmail.com> |
http_client: Fixing bug in retry after a close call
After a close call httpclient is not starting with fresh socket to restart the connection. Send failure is observed in cases where new connection
http_client: Fixing bug in retry after a close call
After a close call httpclient is not starting with fresh socket to restart the connection. Send failure is observed in cases where new connection is started from doResolve.Calling restartConnection instead of doResolve did fix the issue.
Tested By: Running developer test on use cases such as redfish aggregation where number of retries are smaller.
Change-Id: I12f6a73fbafd14f482807f34ffa1e02fad944fc1 Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com>
show more ...
|
#
17c47245 |
| 08-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Move logging args
Args captured by logging functions should be captured by rvalue, and use std::forward to get perfect forwarding. In addition, separate out the various std::out lines.
While we're
Move logging args
Args captured by logging functions should be captured by rvalue, and use std::forward to get perfect forwarding. In addition, separate out the various std::out lines.
While we're here, also try to optimize a little. We should ideally be writing each log line to the output once, and ideally not use iostreams, which induce a lot of overhead.
Similar to spdlog[1] (which at one point this codebase used), construct the string, then call fwrite and fflush once, rather than calling std::cout repeatedly.
Now that we don't have a dependency on iostreams anymore, we can remove it from the places where it has snuck in.
Tested: Logging still functions as before. Logs present.
[1] https://github.com/gabime/spdlog/blob/27cb4c76708608465c413f6d0e6b8d99a4d84302/include/spdlog/sinks/stdout_sinks-inl.h#L70C7-L70C13
Change-Id: I1dd4739e06eb506d68989a066d122109b71b92cd Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
25b54dba |
| 17-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Bring consistency to config options
The configuration options that exist in bmcweb are an amalgimation of CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms and meson options usi
Bring consistency to config options
The configuration options that exist in bmcweb are an amalgimation of CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms and meson options using a config file. This history has led to a lot of different ways to configure code in the codebase itself, which has led to problems, and issues in consistency.
ifdef options do no compile time checking of code not within the branch. This is good when you have optional dependencies, but not great when you're trying to ensure both options compile.
This commit moves all internal configuration options to: 1. A namespace called bmcweb 2. A naming scheme matching the meson option. hyphens are replaced with underscores, and the option is uppercased. This consistent transform allows matching up option keys with their code counterparts, without naming changes. 3. All options are bool true = enabled, and any options with _ENABLED or _DISABLED postfixes have those postfixes removed. (note, there are still some options with disable in the name, those are left as-is) 4. All options are now constexpr booleans, without an explicit compare.
To accomplish this, unfortunately an option list in config/meson.build is required, given that meson doesn't provide a way to dump all options, as is a manual entry in bmcweb_config.h.in, in addition to the meson_options. This obsoletes the map in the main meson.build, which helps some of the complexity.
Now that we've done this, we have some rules that will be documented. 1. Runtime behavior changes should be added as a constexpr bool to bmcweb_config.h 2. Options that require optionally pulling in a dependency shall use an ifdef, defined in the primary meson.build. (note, there are no options that currently meet this class, but it's included for completeness.)
Note, that this consolidation means that at configure time, all options are printed. This is a good thing and allows direct comparison of configs in log files.
Tested: Code compiles Server boots, and shows options configured in the default build. (HTTPS, log level, etc)
Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
003301a2 |
| 16-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Change ssl stream implementations
Boost beast ssl_stream is just a wrapper around asio ssl_stream, and aims to optimize the case where we're writing small payloads (one or two bytes.) which needs to
Change ssl stream implementations
Boost beast ssl_stream is just a wrapper around asio ssl_stream, and aims to optimize the case where we're writing small payloads (one or two bytes.) which needs to be optimized in SSL.
bmcweb never writes one or two bytes, we almost always write the full payload of what we received, so there's no reason to take the binary size overhead, and additional boost headers that this implementation requires.
Tested: This drops the on-target binary size by 2.6%
Redfish service validator passes.
Change-Id: Ie1ae6f197f8e5ed70cf4abc6be9b1b382c42d64d Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
5b90429a |
| 16-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Add missing headers
Most of these were found by breaking every redfish class handler into its own compile unit:
When that's done, these missing headers become compile errors. We should just fix the
Add missing headers
Most of these were found by breaking every redfish class handler into its own compile unit:
When that's done, these missing headers become compile errors. We should just fix them.
In addition, this allows us to enable automatic header checking in clang-tidy using misc-header-cleaner. Because the compiler can now "see" all the defines, it no longer tries to remove headers that it thinks are unused.
[1] https://github.com/openbmc/bmcweb/commit/4fdee9e39e9f03122ee16a6fb251a380681f56ac
Tested: Code compiles.
Change-Id: Ifa27ac4a512362b7ded7cc3068648dc4aea6ad7b Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
4d69861f |
| 06-Feb-2024 |
Ed Tanous <ed@tanous.net> |
Use beast message_generator
Beast 331 added the message_generator class, which allows deduplicating some templated code for the HTTP parser. When we use it, we can drop our binary size, and ensure
Use beast message_generator
Beast 331 added the message_generator class, which allows deduplicating some templated code for the HTTP parser. When we use it, we can drop our binary size, and ensure that we have code reuse.
This saves 2.2% on the compressed binary size.
Tested: Redfish service validator passes.
Change-Id: I5540d52dc256adfb62507c67ea642a9ea86d27ee Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
4a7fbefd |
| 06-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Fix large copies with url_view and segments_view
Despite these objects being called "view" they are still relatively large, as clang-tidy correctly flags, and we ignore.
Change all function uses to
Fix large copies with url_view and segments_view
Despite these objects being called "view" they are still relatively large, as clang-tidy correctly flags, and we ignore.
Change all function uses to capture by: const boost::urls::url_view_base&
Which is the base class of all boost URL types, and any class (url, url_view, etc) is convertible to that base.
Change-Id: I8ee2ea3f4cfba38331303a7e4eb520a2b6f8ba92 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
6ea90760 |
| 07-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Rework logger to create compile time errors
The logger changes to move to std::format incidentally caused format errors to no longer be flagged at compile time.
The example here[1] shows that the l
Rework logger to create compile time errors
The logger changes to move to std::format incidentally caused format errors to no longer be flagged at compile time.
The example here[1] shows that the latest gcc/c++ gave us a way to solve this, using std::format_string.
This incidentally shows two places where we got the format arguments wrong, so fix them.
[1] https://stackoverflow.com/questions/72795189/how-can-i-wrap-stdformat-with-my-own-template-function
Change-Id: Id884200e2c98eeaf5ef8db6c1d6362ede2ffb858 Signed-off-by: Ed Tanous <ed@tanous.net>
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 ...
|
#
8ece0e45 |
| 02-Jan-2024 |
Ed Tanous <ed@tanous.net> |
Fix spelling mistakes
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")
At some point in the future, we might want to get this enabled in CI.
Change-Id: Iccb57b2adfd06a2
Fix spelling mistakes
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")
At some point in the future, we might want to get this enabled in CI.
Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
f3cb5df9 |
| 30-Nov-2023 |
Abhilash Raju <abhilash.kollam@gmail.com> |
http_client: fix for broken connection
http_client is not handling connection termination by server due to keep alive timeout. At present client is not aware of connection termination from server.
http_client: fix for broken connection
http_client is not handling connection termination by server due to keep alive timeout. At present client is not aware of connection termination from server. So whenever next redfish is event ready to be sent, the client will try send/receives data over broken connection. After failed operation the client will try to restart the connection by closing the current connection.
Problems: 1) Restart is not attempted on all failure paths. Eg: stream_truncated error was ignored, which usually happens when try to read from broken connection, due to which retry is never performed.
2) Ssl shutdown over broken connection often fails to call the shutdown callback
3) ssl session was reused for new connection attempt. Which is wrong
Solution:
This patch will try to reattempt the connection in all failure cases.
It uses new socket object and new ssl session for the retries
Tested by:
Test normal event flow between redfish-event clients and the BMC Test failure event flow between redfish-event clients and the BMC Tested the bad path by keeping the setup idle for 3 hours on the above two setups. Verified the events flow after this idle time
Change-Id: I3d725b9d77bea22e2e8860e01ee0dfc971789008 Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com> Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
27b0cf90 |
| 07-Aug-2023 |
Ed Tanous <ed@tanous.net> |
Move to file_body in boost
As is, it reads the whole file into memory before sending it. While fairly fast for the user, this wastes ram, and makes bmcweb less useful on less capable systems.
This
Move to file_body in boost
As is, it reads the whole file into memory before sending it. While fairly fast for the user, this wastes ram, and makes bmcweb less useful on less capable systems.
This patch enables using the boost::beast::http::file_body type, which has more efficient serialization semantics than using a std::string. To do this, it adds a openFile() handler to http::Response, which can be used to properly open a file. Once the file is opened, the existing string body is ignored, and the file payload is sent instead. openFile() also returns success or failure, to allow users to properly handle 404s and other errors.
To prove that it works, I moved over every instance of direct use of the body() method over to using this, including the webasset handler. The webasset handler specifically should help with system load when doing an initial page load of the webui.
Tested: Redfish service validator passes.
Change-Id: Ic7ea9ffefdbc81eb985de7edc0fac114822994ad Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
e7c2991e |
| 31-Jul-2023 |
Ravi Teja <raviteja28031990@gmail.com> |
Avoid setting SNI hostname for IP addresses
ssl_handshake fails while establishing connection to IPv6 destination address, as IPv6 addresses considered as invalid value for SNI hostname due to speci
Avoid setting SNI hostname for IP addresses
ssl_handshake fails while establishing connection to IPv6 destination address, as IPv6 addresses considered as invalid value for SNI hostname due to special characters.
SNI allows valid HostName which allows characters are only {alphabetic characters (A-Z), numeric characters (0-9), the minus sign
This commit adds check to avoid setting SNI hostname if its an IP address
Tested By: Verified redfish events 1. Subscribing Destination with IPv6 address. 2. Subscribing Destination with IPv4 address.
Change-Id: I32d30292bbc29c753f1c1815c66fcc93e8074eaa Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
show more ...
|
#
a716aa74 |
| 01-Aug-2023 |
Ed Tanous <edtanous@google.com> |
Move http client to URL
Type safety is a good thing. In: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/65606
It was found that splitting out the URI into encoded pieces in the early phase removed
Move http client to URL
Type safety is a good thing. In: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/65606
It was found that splitting out the URI into encoded pieces in the early phase removed some information we needed, namely whether or not a URI was ipv6. This commit changes http client such that it passes all the information through, with the correct type, rather than passing in hostname, port, path, and ssl separately.
Opportunistically, because a number of log lines are changing, this uses the opportunity to remove a number of calls to std::to_string, and rely on std::format instead.
Now that we no longer use custom URI splitting code, the ValidateAndSplitUrl() method can be removed, given that our validation now happens in the URI class.
Tested: Aggregation works properly when satellite URIs are queried.
Change-Id: I9f605863179af54c5af2719bc5ce9d29cbfffab7 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|