summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Various cleanupsHEADmasterKun Yi2019-11-252-97/+110
| | | | | | | | | | * Move functions to private as appropriate * Reorder functions to match declaration order * Declare arguments as const when appropriate * Rename to getActionHandler() to match previous method name Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I7d3b5bbb07c218c6c2d6277a1f19d8a0299bd6e6
* cleanup: remove getPathKun Yi2019-11-252-27/+13
| | | | | | | | The getPath call is only used once. Getting rid of it makes it easier to understand. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ifc8859f5fc68bb594003a6db7f7e80b1c1dfed28
* Fix openFiles refcountKun Yi2019-11-252-1/+26
| | | | | | | | | The old code deletes session from the session map before doing a lookup of the path. Fix the order and add a unit test to catch the error case. (The unit test would fail without this fix). Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: If043d6aad7bbaafa19ae3b63a6d9cc7a836d25b5
* cleanup: Use scoped initializers; move implementation to source fileKun Yi2019-11-212-15/+17
| | | | | | | | | | | | | | | Simplify code and address comments from http://gerrit.openbmc-project.xyz/c/openbmc/phosphor-ipmi-blobs/+/27399: * Use C++17 syntax of intializers in conditionals to simplify code. * Move getActionHandle() implementation to .cpp * return false explicitly Tested: Unit tests still pass. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I08a78125206f284d8c748822912e11828fb39968
* cleanup: Operate on members directly and allow empty paths in the lookup tableKun Yi2019-11-212-50/+9
| | | | | | | | | | | | | Instead of using private methods to change data, directly operate on it. Currently no test depends on these methods. There is also a minor bug fix: the previous code will not increment or decrement the open session count if the blobId is an empty string, however there is no check on the manager side. If empty blobIds are disallowed they should be checked earlier. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I8d97e098bed2d5c27a204a86ed688d0d9a98f0a2
* test: Add unit tests for session expirationKun Yi2019-11-212-0/+63
| | | | | | | | Add simple tests to ensure the session expire method is called when the timeout is set to zero. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ic6e973ede760a6a6f15726d5b6c93a892d858c8b
* Implement session expirationKun Yi2019-11-192-3/+68
| | | | | | | | | | | | | | | If the caller opens sessions but doesn't close them, either intentionally or unintentionally, session IDs will leak. Once the maximum number of sessions are reached, no new session can be opened. Implement a cleanup procedure to automatically remove stale sessions. If a session hasn't seen activity for a while, call the expire() functions on the handler, and remove the session from tracking table. For handlers that haven't implemented the expire() call this change will be a no-op. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I895ae19b4003d2d6f7a0b2e73370fe5aa664adee
* Store the last action time in session infoKun Yi2019-11-191-0/+8
| | | | | | | | | Add a timestamp member in SessionStat to capture when the session sees activity last, and update it with every action. The timestamp will be used to check when the session should expire. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ic781d54173099bff76b3c37dd296521680fe7986
* Refactor various methods to get session or blob handlerKun Yi2019-11-192-107/+44
| | | | | | | | Use a single method to fetch the handler, if it can be found using session ID. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I648cbc48ebfae479f63d34e8f2465d2c8cbe9d64
* blobs: s/struct BlobMeta/BlobMeta/gPatrick Venture2019-06-1712-38/+38
| | | | | | | | | | | | | | Because this structure is not anything special, simply use the cpp idiomatic way of referencing the object. Consistently, structures that are packed still have "struct" used in declarations. However, this distinction is only clear through its usage and nothing in the language. Perhaps a better approach would be notational naming struct PackedXYZ {};. However, that can get out of control quickly. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I3b7e48e4b6687ef2e15e9d07c0eeba96eb5d2552
* README: add delete blob contract notePatrick Venture2019-06-171-0/+2
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Iac2768eebcf1ab28e28cdba601574dbede4fc9ec
* README: add calling contract detailsPatrick Venture2019-05-311-8/+19
| | | | | | | | | | Provide contract details for what handlers can expect from the blob manager. This saves extra checks within the handler. Incidental markdown cleanup. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I572fdfb9e726d9f4d1ba89bb92b38c67cd7f07e2
* blobs-ipmid: use enum class for BlobOEMCommandsPatrick Venture2019-05-2013-34/+35
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ic5aa3e38b4df33a2cfa29c575f17097e38d06605
* blobs-ipmid: blobs: add equality operator for BlobMetaPatrick Venture2019-05-171-0/+6
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I22ac3b8c5ad49e2fa3424ef6d9f03a3d5dc7bf51
* build: split object to enable coveragePatrick Venture2019-03-192-33/+51
| | | | | | | | | Split the object into two pieces so we can pass part of it to the unit-tests. Tested: Verified the coverage output processed the files. Change-Id: Idf1bdf9d21eb1324395eb9a2c09ff8f1b4ecad6b Signed-off-by: Patrick Venture <venture@google.com>
* autotools: Fix for autoconf-archive 2019.01.19William A. Kennington III2019-03-194-3/+14
| | | | | | | | | The code coverage macros from the archive changed in a backward incompatible way. This adds a workaround to autodetect either version and do the right thing. Change-Id: I09b88e6b4792c99140a73a4ceb11d2896ee13562 Signed-off-by: William A. Kennington III <wak@google.com>
* use ipmiblob library from ipmi-blob-toolPatrick Venture2019-03-0810-303/+77
| | | | | | | | | | Drop all code that is now handled by the ipmiblob library provided by the new ipmi-blob-tool. This is a library that can be included on the BMC if necessary, but relies on nothing that is strictly meant for the BMC. Change-Id: I2b02ae0d432e84c08e598d27eef85b57c06a70fc Signed-off-by: Patrick Venture <venture@google.com>
* build: add dependency on ipmiblobPatrick Venture2019-03-081-0/+8
| | | | | | | ipmiblob is the library provided by ipmi-blob-tool. Change-Id: Ic58065eb280e8628f36764bd40f973be10f114ca Signed-off-by: Patrick Venture <venture@google.com>
* use filesystem instead of experimentalPatrick Venture2019-03-083-9/+4
| | | | | | | | Use filesystem now that it should be available instead of experimental::filesystem. Change-Id: Ia9b17f33ced70fe2f1f12f11d8708d15ff422bfa Signed-off-by: Patrick Venture <venture@google.com>
* build: enable valgrindPatrick Venture2019-03-072-0/+11
| | | | | | | Enable valgrind tests. Change-Id: Ib5ec22a19c043ef45f5274e4716e2abbae9c19da Signed-off-by: Patrick Venture <venture@google.com>
* build: enable code coveragePatrick Venture2019-03-075-2/+69
| | | | | | | | Enable code coverage for the project. Valgrind not enabled in this step. Change-Id: I439d58b23d2bc29d6f602600319074c8fd8c04d6 Signed-off-by: Patrick Venture <venture@google.com>
* build: rework gtest checksPatrick Venture2019-03-062-7/+71
| | | | | | | Rework gtest checks to be modeled after openbmc/gpioplus. Change-Id: I263bf12c0323ebee5d95b569ce28da2042bd3c1d Signed-off-by: Patrick Venture <venture@google.com>
* build: pkg anti-pattern: use defaultsPatrick Venture2019-02-131-6/+1
| | | | | | | | Use the defaults in the pkg check where the default error message is sufficient to identify which package is missing. Change-Id: I420f4702c9cf78af58854fba06e731e49e1ec5f2 Signed-off-by: Patrick Venture <venture@google.com>
* readme: add the OEN usedPatrick Venture2019-02-131-0/+3
| | | | | | | | The openbmc oem number is used within the code, but not specified in the readme. Add this number to the readme. Change-Id: I3db669fb347cee6596bd973a09910a962eb03570 Signed-off-by: Patrick Venture <venture@google.com>
* Convert host-ipmid -> libipmidWilliam A. Kennington III2019-02-126-10/+14
| | | | | | | | | phosphor-host-ipmid now exposes a library along with headers for interfacing with the ipmi daemon. Compile and link against the new library. Change-Id: I663e6607f711bc8bae0a2127db524868f6d4cc32 Signed-off-by: William A. Kennington III <wak@google.com>
* move blob command enum to installed headerPatrick Venture2019-02-112-15/+16
| | | | | | | Move the blob command enum to an installed header to improve cross-use. Change-Id: I2093bf993f76a2b87f8e7fdbdfcbaf2dfc012af9 Signed-off-by: Patrick Venture <venture@google.com>
* manager: add hard-coded read checksPatrick Venture2019-02-013-2/+59
| | | | | | | | | | | | | The host-client cannot try to read back more than this number of bytes without hitting a memory overflow in phosphor-host-ipmid. The method we can call to dynamically receive that number isn't currently linking out of the userlayer library. Note: Once the configure_ac can find and provide the userlayer library from phosphor-host-ipmid, we can remove the hard-coded 64 and 0xe. Change-Id: I08f6bb59ce44279f76a494dccaa477ae75d532c4 Signed-off-by: Patrick Venture <venture@google.com>
* blobs-ipmid: blobs header: add prototype all handlers needPatrick Venture2019-01-151-0/+17
| | | | | | | | All blob handlers need to implement this prototype. It's called by the blob manager when it's loading the various blob handler objects. Change-Id: I62329baeb536a624abeb17995bb778ec1c11ca8f Signed-off-by: Patrick Venture <venture@google.com>
* stop installing manager headerPatrick Venture2019-01-1536-48/+51
| | | | | | | | Stop installing the manager header as it is no longer meant to be exported, but rather used only internally within this repository. Change-Id: I2ab21a31fd745e1b3e36fc39ffea5e26d373ff51 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: process: can be only crcPatrick Venture2019-01-142-5/+7
| | | | | | | | | The read command, if returning 0 bytes of data, does return the CRC. Tested: Verified via a client implementation that it now behaves as expected on returning 0 bytes from a read (returns only the CRC). Change-Id: I84200c0fbe8400cc9234b55991fee750cb84faa2 Signed-off-by: Patrick Venture <venture@google.com>
* manager: typo fix availablePatrick Venture2019-01-101-1/+1
| | | | | | | Typo fix in manager_cpp for word "available" Change-Id: I0c4382023fef63f332d4cd677d82ad30e0a44b26 Signed-off-by: Patrick Venture <venture@google.com>
* build: cleanup configure script PKG_CHECK_MODULESPatrick Venture2018-12-171-4/+17
| | | | | | | | | | Cleanup the configure script package include lines. There isn't a set style for this yet, but this is an attempt to improve readability whereas it's often one long line per library. The CI will fail if there aren't backslashes on lines for the AC_CHECK_HEADER. Change-Id: I07be3e9c4ac7cd70a9e0d03299d25dcce6910cef Signed-off-by: Patrick Venture <venture@google.com>
* gitignore: add m4 directoryPatrick Venture2018-12-031-0/+1
| | | | | | | New autotools directory: m4, add to .gitignore. Change-Id: Idc6d0f7c53927c62602a5caa16010941d5a75b33 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: ipmi: set dataLen to zero when appropriatePatrick Venture2018-12-032-3/+10
| | | | | | | | On failures (or some silent success), set the return buffer length to 0. Change-Id: I118788ffddd2bfc031b3392db4cf13ab04b49287 Signed-off-by: Patrick Venture <venture@google.com>
* main: receive blob handler path from configurePatrick Venture2018-11-282-4/+5
| | | | | | | | Add blob handler path to configure_ac and use this path for searching. Change-Id: Ie0e33e93822bc6e95ace2fed5abe66f42dae5ca5 Signed-off-by: Patrick Venture <venture@google.com>
* build: apply autoconf suggestionsPatrick Venture2018-11-282-0/+2
| | | | | | | | add -I m4 to Makefile for ACLOCAL_AMFLAGS add macro dirs to configure_ac Change-Id: Ied5ca518fedab65c63d0c89bcd0f21c3d32265e1 Signed-off-by: Patrick Venture <venture@google.com>
* add dynamic library interface to enable testingPatrick Venture2018-11-2811-31/+339
| | | | | | | | Add interface defining the methods for dynamic linking to enable testing. Change-Id: If4d090d3cedc019b426435a1f651191803bfc1a9 Signed-off-by: Patrick Venture <venture@google.com>
* main: add missing header: blobs-ipmid/manager.hppPatrick Venture2018-11-211-0/+1
| | | | | | | | | Add missing header: blobs-ipmid/manager.hpp. The code receives this header through another header. However, it should declare this inclusion requirement itself. Change-Id: Ib82909681a45a18489f65ec42b74a1824285efa1 Signed-off-by: Patrick Venture <venture@google.com>
* copyright: add missing copyright headersPatrick Venture2018-11-211-0/+16
| | | | | | | | Add missing copyright headers to the source files. Originally, left off. Reviewing other new sources acted as a reminder. Change-Id: I7ac612fbea731885b93cb13346afcddda54bdec3 Signed-off-by: Patrick Venture <venture@google.com>
* drop explicit command entryPatrick Venture2018-11-151-8/+3
| | | | | | | | | The command entry for blobTransferCmd was accepted into phosphor-host-ipmid's oem header. Therefore, no longer specify it locally. Change-Id: Ib5879cb31f855c5b5662e659d71c21e5fd6c50a3 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: load handlers and use factory symbolPatrick Venture2018-11-144-7/+59
| | | | | | | | Use a predefined factory symbol to build each handler after loading the library. Change-Id: I0369c6e46a57c2e8533409d8b06eb74a3962434c Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: add -export-dynamic to Makefile linker flagsPatrick Venture2018-11-141-0/+1
| | | | | | | | | | Add -export-dynamic to Makefile linker flags so that blob handlers can access getBlobManager() when they're loaded. Tested: The symbols are now exported, however, blob handlers still cannot resolve blobs::getBlobManager(). Change-Id: I025fdbd701133fc59356e3a0ed8881b2cdd0f2a0 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: flip library search logicPatrick Venture2018-11-131-1/+6
| | | | | | | | | | Fix library search logic to load libraries installed of the format: libname.so.? versus libname.so because the recipe creates a symlink of the form libname.so.? only. Tested: Now it finds and loads the handlers. Change-Id: Ie7280f41a678bf78db226bb458c02396e352da56 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: skip 0'd crc bytes on reply computationPatrick Venture2018-11-132-4/+3
| | | | | | | | | | Skip the 0'd CRC bytes on reply computation, mirroring the skipping during request validation. Tested: Verified via client the CRC for the reply now matches expectations. Change-Id: I18da28604a388fb4210c55f3e54410a067b9f10a Signed-off-by: Patrick Venture <venture@google.com>
* process: add IPMI error return mechanism and update errorsPatrick Venture2018-11-1314-40/+79
| | | | | | | | | | | The IPMI packet validation code must return specific IPMI errors corresponding to what error has occurred instead of the invalid command error. Update all IPMI handler pieces to return more specific errors. Change-Id: I8d21e92015d84cc0880e3b83991aed7288e19eab Signed-off-by: Patrick Venture <venture@google.com>
* build: Add -flto to CXXFLAGSPatrick Venture2018-11-091-1/+2
| | | | | | | Add -flto to CXXFLAGS to allow build optimization. Change-Id: Icc7bd996bd512a0d84a35b6a0449f69611a69de1 Signed-off-by: Patrick Venture <venture@google.com>
* build: cleanup MakefilePatrick Venture2018-11-091-17/+22
| | | | | | | | Cleanup spaces from the Makefile. Automake is ok with spaces, but for a cleaner file, use tabs. Change-Id: Ie18f80a5e65a05611472e61801b669e1564b17e1 Signed-off-by: Patrick Venture <venture@google.com>
* main: s/blobs-ipmid/blob-ipmid/ for library pathPatrick Venture2018-11-081-1/+1
| | | | | | | | | Fixup a typo in the library path. The library path will be specified in a later patchset from the configure.ac by default, but that typo would have just lived there instead. Change-Id: Ia9f95fc46e3835781e4dbe3b3fdb2d9d36b7e565 Signed-off-by: Patrick Venture <venture@google.com>
* manager: fixup to use find_ifPatrick Venture2018-10-241-9/+7
| | | | | | | | | | | [manager.cpp:150]: (style) Consider using std::find_if algorithm instead of a raw loop. Note: Amusingly switching to a const iterator allowed cppcheck to find this cleanup. Change-Id: I16d87d4dde165fbb226259d1abc8deaa51569af1 Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: apply const to read-only iteratorsPatrick Venture2018-10-241-2/+2
| | | | | | | Apply const to read-only iterators. Change-Id: Ib58f98596cb9f185d3b16a0b1fbd895dd37d3fd6 Signed-off-by: Patrick Venture <venture@google.com>
OpenPOWER on IntegriCloud