summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* remove usage of sdbusplus::message::variantVernon Mauery2019-05-141-3/+3
| | | | | | | | | | | sdbusplus has had its alias of std::variant in place for long enough. This changes all ipmid references to use std::variant directly instead of the sdbusplus alias. Tested-by: building and running ipmid Change-Id: Id5b4136d4589aa598815edd3ef4202e64a7698e2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Return invalid data length (0xc7) for commands not properly unpackedVernon Mauery2019-05-081-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | The correct value for commands that unpacked but did not consume all the data was already returned (0xc7), but if all the expected data was not present, the return code was the response of the unpack command, which is not an IPMI value. This changes the unpack response to always return 0xc7 if it is too short or too long for the command. Tested-by: run ipmitool with correct and incorrect byte counts (get channel access command expects 2 bytes of data) # ipmitool raw 6 0x41 Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x41 rsp=0xc7): Request data length invalid # ipmitool raw 6 0x41 1 Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x41 rsp=0xc7): Request data length invalid # ipmitool raw 6 0x41 1 0x80 40 40 # ipmitool raw 6 0x41 1 0x80 1 Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x41 rsp=0xc7): Request data length invalid Change-Id: Ic72c1f2050f7bdcdcc8a5b808d11f80fac4e9813 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* handler: Fix request passing for legacy commandsWilliam A. Kennington III2019-04-291-7/+10
| | | | | | | | | | | | | | | | Legacy OEM commands didn't handle the IANA numbers themselves as part of their handler body, and expect the request buffer to not contain them. We can't pass the raw buffer without removing the already extracted prefixes. This should make legacy OEM commands work again. Also reworks group handling to become consistent with OEM handling. This happens to fix cases where groupIds were not being returned with error codes. Change-Id: I10efe8004f2c2b262f48980852b46317035ca367 Signed-off-by: William A. Kennington III <wak@google.com>
* message: Support prepending payloadsWilliam A. Kennington III2019-04-291-0/+36
| | | | | | | | | Needed solely so that we can support adding the necessary bits for oem and group commands. We shouldn't be using this anywhere else, which is why it is not generalized to non-payload types. Change-Id: I6573f981fbe68cebb89abcdfb3de5de5d139e1e0 Signed-off-by: William A. Kennington III <wak@google.com>
* message/pack: Allow packing payloadsWilliam A. Kennington III2019-04-291-0/+16
| | | | | | | | | Some IPMI handlers need the ability to support variable return types. The easiest way to do that is to be able to return payloads and pack them into the final payload. Change-Id: I5098a1ab0998ada712096929eae40a3c88a6dea0 Signed-off-by: William A. Kennington III <wak@google.com>
* message/pack: Support packing string_viewsWilliam A. Kennington III2019-04-291-0/+17
| | | | | | | | Now we don't need to make an intermediate copy of our data into an array before packing it into a payload. Change-Id: Iac79a79e0ae95835cb67d617a966a92ce8dcd5f8 Signed-off-by: William A. Kennington III <wak@google.com>
* message/pack: Check for outstanding bitsWilliam A. Kennington III2019-04-291-0/+4
| | | | | | | | | | Currently, if you pack a non-byte aligned member into a message and then pack an array, it will do the wrong thing and treat the unaligned data as being appended to the end of the message. Allowing for this behavior is convoluted and probably not useful, so just return an error. Change-Id: I6f200dbea96c41f49a110ba7536ccfd37115d277 Signed-off-by: William A. Kennington III <wak@google.com>
* message/payload: Ignore unchecked unpack warning during unwindWilliam A. Kennington III2019-04-292-34/+38
| | | | | | | | | | | If we are caught in an exception unwind we don't care that the payload is not be fully checked. Otherwise, this encourages the pattern of wrapping all handler code in try catch blocks that set trailingOk as it is not required to read the entire payload when throwing an exception. Change-Id: I35149eedd33bd9fd41968e89d5a8614df7436872 Signed-off-by: William A. Kennington III <wak@google.com>
* message/payload: Clean up check / trailing stateWilliam A. Kennington III2019-04-293-11/+6
| | | | | | | | | | | | | | | | We want to be able to trivially re-use payloads for marshalling data from a buffer into other formats. This change tries to make the meaning of trailingOk and unpackCheck consistent, since the meanings didn't seem clear in the previous code. Now, unpackCheck is only used to determine if unpacking was checked, and trailingOk determines if unpackCheck is required. This also fixes lots of spurious warnings being printed for commands which were checking their output correctly, or were legacy and unable to check output. Change-Id: Id7aa9266693b4e3f896027acf6b3e5d757fdf981 Signed-off-by: William A. Kennington III <wak@google.com>
* add rqSA ipmb request source addressVernon Mauery2019-04-291-2/+6
| | | | | | | | | | Platform Event Message Command requires that if the message comes in over IPMB, the generator ID is the rqSA of the message. IPMB bridge is now responsible for passing this in via the options map so it can be passed in the context to the command. Change-Id: I52b7c9ef23896a4efcceeebf12559bbdf897d1c2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Fix compilation warning regarding std::variantAlexander Amelkin2019-04-161-0/+1
| | | | | | | | | | | | When building with SDK, the compiler complains about ’variant’ being not a member of ’std’: .../pack.hpp:249:24: error: ‘variant’ is not a member of ‘std’ This commit adds appropriate #include to fix that. Change-Id: I99d6b7c17cbe1f49d706821797cf3fa03ca8c26a Signed-off-by: Alexander Amelkin <a.amelkin@yadro.com>
* message/unpack: Fix undefined behaviorWilliam A. Kennington III2019-04-111-1/+3
| | | | | | | | | | | | | It's UB to shift an integer by the size of that integer. More specifically, if you disable compiler optimization and try and unpack a 32 bit bitset you will end up with a 0x0 mask. Avoid UB by replacing shift subtract with a negate shift. Tested: Unit tests pass now. Change-Id: I03a6f866a51c955b57787d641da9180841747e4c Signed-off-by: William A. Kennington III <wak@google.com>
* Add a tuple type for packingVernon Mauery2019-04-092-18/+11
| | | | | | | | | | | | | At the top level, payload had the ability to pack a tuple, but it did it by splitting it into its parts and packing those individually. But if one of those parts was a tuple, it would fail. This moves the tuple packing code into the packing templates so that it is possible to pack a nested tuple of tuples. Tested-by: newly written tuple unit tests pass Change-Id: Icd80926314072df78b0083a823dcfb46e944e365 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add error message to build to make packing type errors clearVernon Mauery2019-04-091-0/+2
| | | | | | | | | | | | | Because the base template actually handles things (all integer types), it needs to ward off non-integer types in a clear way, rather than relying on the user seeing that a tuple doesn't have an operator <<(), for example. This provides a clear message if a specialized pack operation was not hit. Tested-by: attempted to build with a non-supported pack type Change-Id: I66280831e88b4eac903b89f523e5f1a56a53cf9d Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add helper functions to simplify error responsesVernon Mauery2019-04-081-3/+100
| | | | | | | | | | | | | | | Most IPMI commands have some error response. This makes it more intuitive what is happening, changing return ipmi::response(cc::CommandNotAvailable); to return ipmi::responseCommandNotAvailable(); which is parallel to the success respones of: return ipmi::responseSuccess(); Change-Id: Ibbd401c4007a02e91ab4983814b920d6d7f02404 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Only include ipmid/api.hpp for the new APIVernon Mauery2019-04-086-367/+363
| | | | | | | | | | | | | | After some feedback from users of the new IPMI API, they wanted to see two things: 1) don't require ipmid/api.hpp and ipmid/registration.hpp to be able to write new handlers 2) only require including ipmid/api.hpp (instead of ipmid/api.h) So now, by simply including ipmid/api.hpp instead of ipmid/api.h (deprecated), handlers incorporating the new IPMI API can be written. Change-Id: I446dcce70cff03d4ecc28c658292d052485f77fc Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Fix utility.hpp to use correct types for Request and ContextVernon Mauery2019-04-051-1/+10
| | | | | | | | | | | When requesting a Request or Context object as part of the handler signature, it should be a std::shared_ptr<ipmi::Context> or std::shared_ptr<ipmi:message::Request>. There was a bug that made it so it was not possible to have either of those in the signature. This commit enables both. Change-Id: Ib52000f643d7b5f21bc4022629e7d7b03a524dc1 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add support for returning optional valuesVernon Mauery2019-04-051-0/+16
| | | | | | | | | | | Some commands have optional return values. This allows the handlers to be defined as returning an optional<T> value and then in the body of the handler set the value in the optional or not. Tested-by: unit test runs successfully Change-Id: Ib38a4589609fb1eb192106e511c9ee3a507ac42f Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* message: pack: add variant supportJames Feist2019-04-041-10/+24
| | | | | | | | | | | Add variant support to allow return of mutliple specific types. Also change types to const as this is required by the visitor and these could have been const all along. Tested: Added unit test and used in oem provider Change-Id: I5cb056c15d4813b9eee58eecb707664477d019d9 Signed-off-by: James Feist <james.feist@linux.intel.com>
* remove legacy ipmid.cpp and ipmid.hppVernon Mauery2019-04-011-0/+4
| | | | | | | These two files have now been replaced with newer APIs and can be removed. Change-Id: If60227b24188c6796211ca43379169f9a95c9cb3 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* move types.hpp to ipmid/types.hpp for exportVernon Mauery2019-03-253-1/+249
| | | | | | | | | | types.hpp is required by utility.hpp, which is exported, so it needs to be exported as well. This moves it to the include/libipmid directory, changes the Makefile to export it, and changes all the files that include it so it can be found in the right place. Change-Id: I30ec365446e4de466c266ec4faa327478460ec05 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Move util.cpp/util.hpp to libipmidVernon Mauery2019-03-252-0/+309
| | | | | | | | | | | | | | | | These are functions that are used widely by ipmid providers, so it makes sense to put them in libipmi.so (the library that all providers must link against). Tested-by: use nm to inspect the binaries to see that the symbols are in the expected library. arm-openbmc-linux-gnueabi-nm libipmid.so.0.0.0 \ | grep getDbusObject 0001063c T _ZN4ipmi13getDbusObjectERN9sdbusplus.... Change-Id: I1221f807f2711c5301c5574623564ea1ae48a437 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add user context parameter to legacy ipmi handler registrationVernon Mauery2019-03-211-4/+7
| | | | | | | | | This part was originally omitted, but needed by some external provider libraries. This will more closely mimic the behavior of ipmid prior to the architecture update. Change-Id: I5db35222e268a117480285c700d88206d6505d92 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add generic signal handling API to work with boost::asioVernon Mauery2019-03-201-0/+35
| | | | | | | | | | | | This allows providers or the main application to handle POSIX signals using a callback chain. Each handler can return continueExecution or breakExecution to stop the signal handling chain or allow it to continue. Each handler is registered with a priority and upon reciept of a signal, each handler is executed in priority order until the end of the list is reached or one returns with breakExecution. Change-Id: Idd83625eb1a2d3bdafc92bdd839e0d6386177ff2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* make utility.hpp available for external things that include ipmid/api.hppVernon Mauery2019-03-191-0/+1
| | | | | Change-Id: Iafe6827fa545d72666994bb68b5972cde4d0a1ff Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Change linkage of ipmid_get_sdbus_plus_handler() to libipmid.soVernon Mauery2019-03-191-3/+3
| | | | | | | | | | | | | | ipmid_get_sdbus_plus_handler() was re-added to be a part of systemintfcmds where it was used. This moves it to libipmid.so because that is where symbols used by both ipmid and the providers should be. Because ipmid_get_sdbus_plus_handler() relies on the io service and the main sdbus::asio::connection is also right there, this moves those symbols to libipmid as well to keep coherent. Change-Id: Ib125a0c217c8bcf47a8a4bd0c557eb69e928245b Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* errorResponse must not pack completion code in data payloadVernon Mauery2019-03-151-3/+3
| | | | | | | | | | | | | Until the response goes back out onto D-Bus, the completion code is held in a separate part of the Response object. The D-Bus response has a separate field for the completion code as well, reserving a byte array for response data only. This fixes the ipmitool error message 'Bad response length, len=1' when it attempts to query the PICMG capabilities. Change-Id: Iff0c3cb2e46a20e52229265eebb0995878a41714 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add back an interface used by an external providerVernon Mauery2019-02-271-1/+3
| | | | | | | | | The move to the new API removed the ipmid_get_sdbus_plus_handler interface because it looked like it was self-contained in the executable, not realizing it was needed by an external provider. Change-Id: I75bb898294cc59cae7d291f7a6a6ed1e61d62903 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* ipmid: Add command filter mechanismVernon Mauery2019-02-253-0/+131
| | | | | | | | | | | | | | | Every ipmi command will pass through a filter prior to execution by the registered handler. The filter consists of all registered filter handlers that all must either return an IPMI error code or allow the command to be executed. If any of the filter handlers return an error code, the remaining handlers will not get a chance to run. Each handler, executed in registered priority order, can be passed the full message, or just the context (metadata describing the command, netfn, cmd, etc.) Change-Id: I3c48f19ebae0d24344b15fbcd2b940a32f8511d7 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* ipmid: Add in Native OEM and Group OEM supportVernon Mauery2019-02-252-0/+185
| | | | | | | | | | Add full support for the IPMI OEM NetFn and the Group OEM support as defined in the IPMI 2.0 specification. For now the legacy OEM router mechanism is still supported. Change-Id: I8cc999489000c6e0daf5aad3579838e6f499ba47 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* ipmid: Rewrite ipmid to use the new architectureVernon Mauery2019-02-251-4/+0
| | | | | | | | | | | | | New architecture highlights: * The new registration detects handler type for argument unpacking. * Upon completion the response is automatically packed. * Handlers can make use of the new async/yield sdbusplus mechanism. * The queue exports a new dbus interface for method-based IPMI calls. * The legacy handler registration is still supported for now. * The legacy dbus interface is still supported for now. Change-Id: Iae8342d9771ccebd3a0834e35597c14be4cc39cf Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* ipmid: Compiler-generated unpacking and packing of messagesVernon Mauery2019-02-259-0/+2488
| | | | | | | | | | | | | handler.hpp has the templated wrapping bits for ipmi command handler callbacks implemented. message.hpp has the serialization/deserialization of the ipmi data stream into packed tuples for functions. message/pack.hpp and message/unpack.hpp contain the actual serialization and deserialization of types. Change-Id: If997f8768c8488ab6ac022526a5ef9a1bce57fcb Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* include: Makefile_am: force symlink creationPatrick Venture2019-02-201-6/+6
| | | | | | | | | Force symlink creation. In the event, the daemon is being built and installed when already present, should force creation of symlinks and not fail on this case. Change-Id: Ic2cf84c36422a3be208a18a07daacfc6c587162b Signed-off-by: Patrick Venture <venture@google.com>
* Create libipmid and libipmid-hostWilliam A. Kennington III2019-02-077-0/+359
This starts a transition to common ipmid libraries that providers can link against. It will allow for a cleaner separation between common ipmid functionality and daemon type specific code. This is needed so we can resolve all of the symbols in the providers at link time instead of discovering bad linkage by building and running a full ipmi daemon. In future commits libraries will be packaged for libipmid and libipmid-host which provide all of the symbols used by the current set of ipmid providers. This is the first step, it just separates and renames the headers. Legacy symlinks are still kept around for compatability. It also adds stub libraries so that external users can start linking as intended. Change-Id: I6bbd7a146362012d26812a7b039d1c4075862cbd Signed-off-by: William A. Kennington III <wak@google.com>
OpenPOWER on IntegriCloud