summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-04-09Rework logger to create compile time errorsEd Tanous4-51/+80
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>
2024-04-07Fix moves/forwardEd Tanous18-57/+39
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>
2024-04-07Make flush explicitEd Tanous1-1/+2
A more in depth explanation of this is here[1], but being explicit flushing the buffer (using std::flush) captures intent better here, which we intend a newline, then a flush. Keeping those as separate captures the intended behavior. Tested: Launching bmcweb shows logging statements still function. [1] https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html Change-Id: I6aa427f4e4134ce30ce552cbfdd5d7be3df56c47 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-07Fix minor error in Request::methodEd Tanous1-1/+1
Minor syntax error injected in: 1873a04f Reduce multi-level calls of req.req members Tested: Code compiles. Change-Id: Iec26273349df6063eb425e4a75b1250c17bc6f3f Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-07Remove redundant static modifierEd Tanous2-17/+15
"inline static void func()" Doesn't make sense when put in a header file. Find all instances, and make them inline like we do everywhere else. Tested: Code compiles. Change-Id: I7da5821b1e372941680f82939627af39fdc2a4eb Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-07Fix undefined behavior in getUniqueEntryIDEd Tanous1-33/+30
Changing static bool getUniqueEntryID to inline bool getUniqueEntryID Exposes the fact that there's some undefined behavior here, and unit tests start failing, likely due to stack being reused where it previously wasn't. This commit cleans up the code to simplify it, and remove the problem. Tested: Unit tests pass. Good coverage. Change-Id: I5b9b8e8bb83c656560193e680d246c8513ed6c02 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-04Remove redfish-health-populateGunnar Mills12-387/+3
The redfish-health-populate option was scheduled to be removed in 1Q 2024. It is now 2Q, so remove the option. No upstream layers enabled it and did not find a downstream layer that did either. This was always limited to a few resources. Overall this design was only half done. A future "HealthRollup" can be proposed. Some discord discussion: [1]: https://discord.com/channels/775381525260664832/855566794994221117/1110728560819327069 Commit disabling this (merged 10 months ago): [2]: https://github.com/openbmc/bmcweb/commit/6f8273e49cffdd347c223b9538558edfb05e818a Tested: Code compiles Change-Id: I4d33c1e674ecdb0fd256df62f3795073454ae7a1 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-04Clean up Ethernet to use readJsonEd Tanous1-102/+74
Today, patching ethernet ip address arrays can use several styles. IpAddresses: [{}, {value: value}, null] All 3 of those elements are legal. Today, we unpack values like that with nlohmann::json, then iterate and unpack further. This leads to problems where: IpAddresses: [{}, {value: value}, 1.0] would have the same behavior as the prior, given that we check for "is_object()" to determine the null state. This is messy at best, and not typesafe at worst. Changing this code to use the new class NullOr<> allows the readJson parser to fail the second example. Change-Id: Id91f48bb64271dd568041a7c0b1ad285b59d5674 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-04Clean up Account Service to use readJsonEd Tanous1-151/+78
Use multiple level direct read. Tested: Visual only. Need help if anyone wants to test. Change-Id: I67c77bdd42a05a42f9cd1b40dc74517dceebdaad Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-04Clean up hypervisor to use readJsonEd Tanous1-116/+69
Use multiple level direct read. Tested: Visual only. Need help if anyone wants to test. Change-Id: Ifcf716a2ba93fd565bbf134d4132532e60e3b4f0 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-04Allow parsing null or value classesEd Tanous2-1/+106
In Redfish schema, just about all values can be a type (string, EDM.Numeric, etc) or null. Most APIs don't allow explicitly setting null, but there are a few cases where it is useful, namely in lists, where an an empty object {} keeps the value the same, and null deletes the value from the list. Previously we handled this by unpacking as nlohmann::json, but this allowed things like [1.0, {}] to pass the check for an array of string values. We'd ideally like to reject the 1.0 at the first stage, as well as reduce the number of tiered readJson calls that we make. This commit introducess support for unpacking std::variant types, that allows unpacking a known type, or explicitly allowing null, by unpacking std::nullptr_t. Tested: Unit tests pass. Change-Id: Ic7451877c824ac743faf1951cc2b5d9f8df8019c Signed-off-by: Ed Tanous <edtanous@google.com>
2024-04-04Fix http2 payloadsEd Tanous1-3/+3
d547d8d2c30a7d00852855da8ecc15c0cc424b0e caused a minor regression in a poorly executed merge conflict. The reqReader instance never gets initialized, so all payloads now fail. Tested: Redfish service validator modified to use http2 now succeeds when using http/2. Change-Id: If00f5bc1d1a70396171eddd6a643fbd860e8508c Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-03Call dump() lessEd Tanous2-19/+10
nlohmann::json::dump() is not an easy function to get the call parameters correct on. We should limit the places we use it. Luckily, both logging and redfish::messages support printing json values directly. Use them where appropriate. Tested: Error logging and out of range calls only of heavily used messages and logging calls. Inspection only. Change-Id: I57521d8791dd95250c93e8e3b2d4a959740ac713 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-03meson: Disable tests build for tinyxml2 dependencyKonstantin Aladyshev1-0/+1
Currently local meson build breaks on tinyxml2 since the code from this package produces a warning and all warnings are treated as errors: """ ../subprojects/tinyxml2-9.0.0/xmltest.cpp:711:38: error: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] """ The warning above comes from the compilation of the tinyxml2 unit tests. Since we don't really need them, disable 'tests' option for tinyxml2 dependency to fix the meson build. Tested: Locally executed "meson setup build && cd build && meson compile" now finishes successfully. Change-Id: I7148856a3eebbda22d03c9715955b6ab78a933fe Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2024-04-03log_services: Move to setProperty dbus util methodAsmitha Karunanithi1-12/+4
This commit changes sdbusplus setProperty calls in log_services.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Change-Id: Icd9b0f0326c75a1421756d515408b303bdd738e3 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-04-02Create TemporaryFileHandle classEd Tanous3-67/+72
TemporaryFileHandle class is used to create temp files in the filesystem, and hold a handle to them until the class goes out of scope, at which time they can be removed. It replaces makeFile(), which was not RAII safe if an exception gets thrown, and could potentially leave files in the filesystem if the tests fail. Tested: Unit tests pass Change-Id: I03eb0d342a6cd7b78115a8c42be9175f30c4ccd0 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-02Remove redfish-enable-proccessor-memory-statusGunnar Mills4-102/+4
The redfish-enable-proccessor-memory-status option was scheduled to be removed in 1Q 2024. It is now 2Q, so remove the option. No upstream layers enabled it and I could not find a downstream layer that did either. Redfish deprecated the Processor/Memory Summary Status (state, health, healthrollup) attributes. Discussion on discord, when disabling: [1]: https://discord.com/channels/775381525260664832/855566794994221117/1093939076710793296 Commit disabling this (merged 10 months ago): [2]: https://github.com/openbmc/bmcweb/commit/5fd0aafb0f14fb3011970e8575647bb608688c7c Tested: Code builds. Change-Id: I539cd5f384633afa7badf1cecfc6c7a87062f672 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-02Reduce multi-level calls of req.req membersMyung Bae5-11/+21
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>
2024-04-02Remove unused headerEd Tanous1-2/+0
Change-Id: I147664c3d181ba8ec535c7cddcb5c714e05616ea Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Up the max connectionCount to 200Gunnar Mills1-1/+1
Have seen defects where hitting the max connection limit with multiple server managers attached. Although not common to exceed 100, can hit this when using 2 or 3 webui-vue GUIs and a server manager attached. webui-vue can use ~30 of these on its own; this isn't that hard to hit. Nginx by default sets 512 connections[1] , so 200 for an embedded target doesn't seem that unreasonable: Apache sets 256 by default [2] lighttpd sets 1024 [3] We're in line for the defaults for other webservers. Tested: Sent 180 basic auth requests seen bmcweb memory at 2189 2178 root R 29080 4% 49% ./bmcweb This was on a AST2600 (p10bmc) The connections open got to: [DEBUG "http_connection.hpp":79] 0x19bb5c8 Connection open, total 161 Came back down as expected: [DEBUG "http_connection.hpp":89] 0x1a41440 Connection closed, total 1 Didn't see this with multiple webui-vues / server managers. [1] https://nginx.org/en/docs/ngx_core_module.html#worker_connections [2] https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers [3] https://redmine.lighttpd.net/projects/1/wiki/Server_max-connectionsDetails Change-Id: I807302e32e61e31212850a480d721d89d484593f Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-01Update nghttp2 1.54->1.60Ed Tanous1-4/+4
This is the same version Yocto uses. [1] https://github.com/openbmc/openbmc/blob/8c1713b6664523ff7a5bc300ca00c9cde8e5b2c1/poky/meta/recipes-support/nghttp2/nghttp2_1.60.0.bb Change-Id: I71485c559f37dc21cabeab6b95e38c8a30073af5 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Delete old testsEd Tanous1-54/+0
These tests are commented out, and have been for a very long time. Clearly they don't matter. Change-Id: I084378ee9bc43bb64bd6e134398bbf2173d263ff Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Move where appropriateEd Tanous3-2/+4
Clang-tidy-18 has new checks that can find more cases where we've missed an opportunity to std::move. Fix them. Tested: Logging works, unit tests pass. Change-Id: I0cf58204ce7265828693b787a7b3a16484c3d5e5 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Enable readability checkEd Tanous2-3/+12
readability-avoid-nested-conditional-operator With one exception, we already pass this check. Update the log services code to make it pass, and update it to use the generated enums. Tested: Code inspection only. Change-Id: Ic80a7382beb0f541de4916d7b51e42ed5d5dc542 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01hypervisor: Move to setProperty dbus util methodAsmitha Karunanithi1-81/+39
This commit changes sdbusplus setProperty calls in hypervisor_system.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Change-Id: Iebca5eb4e28159d61cd4b13c0343b78efd0f1f39 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-04-01Remove duplicated includeEd Tanous1-1/+0
This include exists above. Tested: code compiles. Change-Id: I8e5d7bce292486d2f534da1b539212113c1e8d56 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Make boost/nghttp2 cmake build static librariesEd Tanous1-2/+4
When running compiling from local dependencies, it's nice to be able to move binaries around wherever they're needed. When we moved to the cmake version of boost, we started building shared libraries on accident. nghttp2 has always pulled shared libraries since introduction. Go back to building static libraries. Tested: Binary build from desktop launches directly without a "missing boost_url.so" error. Change-Id: I9858f27f21841097bd03a6bbcac953b08caa4b14 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Fix redundant inline operatorsEd Tanous4-3/+4
inline is not required on member methods. Clang-tidy has a check for this. Enable the check and fix the two bad usages. Tested: Code compiles. Change-Id: I3115b7c0c4005e1082e0005b818fbe6569511f49 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Use no-switch-default on clangEd Tanous7-4/+9
clang-18 improves this check so that we can actually use it. Enable it and fix all violations. Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Fix SSE socketsEd Tanous4-9/+15
Redfish protocol validatator has SSE tests that expose some bad coding practies in SSE handlers, namely, that there are several cases where we don't check for nullptr. Fix them. This appears to have been introduced in: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/41319 Tested: Redfish service validator passes more tests. Change-Id: Id980725f007d044b7d120dbe0f4b625865cab6ba Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Fix regression in http_file_bodyEd Tanous2-0/+2
The commit: b5f288d Make use of filebody for dump offload Caused a minor failure in clearing responses, where open file handles wouldn't be closed in between queries, resulting in the next read to return empty content. This caused redfish protocol validator to fail. boost::beast::http::response::clear() documentation shows that it only clears the headers, not the file body. Now normally, this doesn't matter, because bmcweb completely replaces the response body when a new response is driven, but not in the case of files. Add response.body().clear() during the clear to ensure the response is cleared. In addition, add encodingType to the clear() call, to ensure that it is reset as well. This is a bug, but I don't know the reproduction steps. Tested: Redfish protocol validator now completes (with SSE failures) Change-Id: Ice6d5085003034a1bed48397ddc6316e9cd0536f Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Cable: Fix Logging Level ErrorGunnar Mills1-1/+1
When we have an internal error, having the D-Bus response is really helpful. Follow our guide and have these be a Logging Level Error. Tested: None. Inspection only. Change-Id: Ie1d9f364c3af7f2a8839d878d68c82c10ddc0429 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-03-29Remove old uses of cout/cerrEd Tanous2-19/+21
Most of this code was written before bmcweb had a logger, and therefore used cout/cerr. This commit greps the codebase and finds all places where we still use cout/cerr, and moves them to logging. Tested: Inspection only. No functional changes. Change-Id: I5ce1883c9941e80203ec29decb3a0206fd118506 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28ethernet: Move to setProperty dbus utility methodAsmitha Karunanithi1-35/+16
This commit changes sdbusplus setProperty calls in ethernet.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Tested By: Tested a few PATCH operations on the redfish endpoints defined in this file and verified that bmcweb returns appropriate Redfish errors. Change-Id: Ie456db75d59dc247cdce5dd5cc0b2f6894f5265f Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-03-28Create Redfish specific setProperty callEd Tanous10-558/+328
There are currently 78 sdbusplus::asio::setProperty calls in redfish-core. The error handler for nearly all of them looks something like: ``` if (ec) { const sd_bus_error* dbusError = msg.get_error(); if ((dbusError != nullptr) && (dbusError->name == std::string_view( "xyz.openbmc_project.Common.Error.InvalidArgument"))) { BMCWEB_LOG_WARNING("DBUS response error: {}", ec); messages::propertyValueIncorrect(asyncResp->res, "<PropertyName>", <PropertyValue>); return; } messages::internalError(asyncResp->res); return; } messages::success(asyncResp->res); ``` In some cases there are more errors handled that translate to more error messages, but the vast majority only handle InvalidArgument. Many of these, like the ones in account_service.hpp, do the error handling in a lambda, which causes readability problems. This commit starts to make things more consistent, and easier for trivial property sets. This commit invents a setDbusProperty method in the redfish namespace that tries to handle all DBus errors in a consistent manner. Looking for input on whether this will work before changing over the other 73 calls. Overall this is less code, fewer inline lambdas, and defaults that should work for MOST use cases of calling an OpenBMC daemon, and fall back to more generic errors when calling a "normal" dbus daemon. As part of this, I've ported over several examples. Some things that might be up in the air: 1. Do we always return 204 no_content on property sets? Today there's a mix of 200, with a Base::Success message, and 204, with an empty body. 2. Do all DBus response codes map to the same error? A majority are covered by xyz.openbmc_project.Common.Error.InvalidArgument, but there are likely differences. If we allow any daemon to return any return code, does that cause compatibility problems later? Tested: ``` curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"HostName":"openbmc@#"}' https://192.168.7.2/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 ``` Returns the appropriate error in the response Base.1.16.0.PropertyValueIncorrect Change-Id: If033a1112ba516792c9386c997d090c8f9094f3a Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Add misc-include-cleanerEd Tanous41-46/+157
And fix the includes that are wrong. Note, there is a very large ignore list included in the .clang-tidy configcfile. These are things that clang-tidy doesn't yet handle well, like knowing about a details include. Change-Id: Ie3744f2c8cba68a8700b406449d6c2018a736952 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Fix clang-formatting in ethernetEd Tanous1-4/+4
Current code has //clang-format on When it should have // clang-format on The difference is subtle, but disables formatting for this whole file. Re-enable and fix the couple of problems. Tested: Whitespace only. Change-Id: Ia155226327d4d611eb2c0f5232274459866e81cc Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Rename http2 unpackerEd Tanous2-9/+16
These classes accidentally overlapped in naming with the nghttp2 classes. This is because this class, unlike most nghttp2 classes doesn't end in _ptr for a type. This changes the class name to add a _ex to differentiate the two classes, and avoid a warning in clang. Tested: Unit tests pass. Code only used in unit test. Change-Id: I91a6982264df69bc65166ab38feddc21f72cd223 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Enable clang-tidy-18 misc checksEd Tanous1-1/+8
Enable the checks we pass already. This also removes the commented out misc-no-recursion, considering we don't pass it. Tested: Clang-tidy passes. Change-Id: Ibaed95677aed85188bff483d2cd53605faaf7cc6 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Add clang-tidy-18 bugprone checksEd Tanous1-0/+13
Another clang version, another set of checks we can enable. bmcweb passes all these checks today, so enable them to help folks write better code. Change-Id: Ied6a364ee92d8d634edea717cfa2fb5245d534f9 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Check optionals in tidyEd Tanous5-45/+53
clang-tidy-18 makes this feature stable enough for us to use in general. Enable the check, and fix the couple of regressions that have snuck in since we last ran the check. Tidy seems to not be able to understand that ASSERT will not continue, so if we ASSERT a std::optional, it's not a bug. Add explicit checks to keep tidy happy. Tested: clang-tidy passes. Change-Id: I0986453851da5471056a7b47b8ad57a9801df259 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Fix unused variable warning in LDAPEd Tanous1-19/+28
It's not clear how this came to be the way it is, but tidy now warns that this variable is unused (which it is). Refactor the LDAP code to not use the variable, and to use concrete object_t and array_t Tested: Redfish service validator passes. Change-Id: I0c106d10594a396d506bf9865cb29d4a10a372a1 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Update indicator LED verificationGeorge Liu1-2/+4
Extend the hasIndicatorLed array and add xyz.openbmc_project.Inventory.Item.Chassis interface. Tested: ``` curl -k https://$bmc/redfish/v1/Chassis/chassis { "@odata.id": "/redfish/v1/Chassis/chassis", "@odata.type": "#Chassis.v1_22_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo", "target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset" } }, "ChassisType": "RackMount", "Id": "chassis", "Links": { "ComputerSystems": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS004K" } }, "IndicatorLED": "Off", "LocationIndicatorActive": false, "Manufacturer": "", "Model": "23", "Name": "chassis", "PCIeDevices": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices" }, "PartNumber": "", "Power": { "@odata.id": "/redfish/v1/Chassis/chassis/Power" }, "PowerState": "Off", "Sensors": { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors" }, "SerialNumber": "", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "StandbyOffline" }, "Thermal": { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal" } } ``` Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I02e77d56e555f9aee3f76015baeebbf1f4a292ab
2024-03-25Remove unused variableEd Tanous2-2/+0
These variables aren't used, and clang-tidy-18 flags it. Remove Tested: Code compiles. Change-Id: I414c4614a5f789aecab7700a4ec805e98c09cade Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-25Enable bugprone clang checkEd Tanous2-1/+5
bugprone-multi-level-implicit-pointer-conversion is something that we pass currently, with one exception in the deprecated rest API. Ignore the one exception, as it's not clear how to fix it, and enable the check. Tested: Clang tidy passes. Change-Id: Idc10e0bb7b876e1c70afa28f9c27cc7bef1db0d7 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-25Fix redundant init issuesEd Tanous6-23/+34
clang-tidy-18 must've fixed their checking for these in headers. Resolve as the robot commands. Tested: Noop changes made by tidy. Code compiles. Change-Id: I1de7686c597deffb0df91c30dae1a29f9ba7900e Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-25Add nolint for naming violationsEd Tanous1-0/+3
Change-Id: I0133bbd0a7573bd3d1e3c3c99382442b286696f6 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-25Require specific compiler versionsEd Tanous1-32/+26
Quite often do I compile this project, and see an error message that makes no sense. Multiple times I've seen posted about compiler errors that amount to using an old version of clang or gcc. Explicitly require clang-17 and gcc-13 in the meson config, and give better errors if they're not present. This also allows simplifying our warning flags (which probably need a review soon) by making two sets of flags, one for each compiler. Note, clang has the -Weverything flag, which we use, so explicitly enabling warnings isn't really required, only disabling the ones that we don't use. Tested: Code compiles. Change-Id: I09fa74e6d36feaf05710a4bb7d266f80ff1cc592 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-25Don't use switch for single conditional http2Ed Tanous1-40/+38
This code was copied from one of the nghttp2 examples, and makes things more complicated than they should be. We only handle one case here, so a pattern of returning early is easier. Also, this resolves a possible clang-tidy bugprone warning (that we don't yet enable). Tested: Http2 unit tests pass (good coverage for this case). Change-Id: Ie8606872f3a96f1bb0329bf22a4f7429f431bbef Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-22Fix content-security-policy disableEd Tanous1-1/+1
If one sets the XSS policy disable, and tries to load the webui, they're met with the following error message: ``` chunk-vendors.6cfb4b74.js:36 Refused to load the image 'data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5'%3E%3Cpath fill='%233f3f3f' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E' because it violates the following Content Security Policy directive: "img-src *". Note that '*' matches only URLs with network schemes ('http', 'https', 'ws', 'wss'), or URLs whose scheme matches `self`'s scheme. The scheme 'data:' must be added explicitly. ``` Do as it asks, and add data: to the content security policy. Tested: Browser console no longer shows error when XSS is enabled. Change-Id: I17f70d7c87a284b33ef6eb5a01a01c23a14898c9 Signed-off-by: Ed Tanous <ed@tanous.net>