summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Added sessionId context in host-ipmid, used by GetSessionInfoRajashekar Gade Reddy2019-11-192-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SessionId is now passed to host-ipmid context along with userid and privilege information. This will enable certain commands to know the current sessionid Added option to get current session info in get session info command. With this change, we can get the current session info by passing sessionIndex as zero in get session info command via lan interface and the same via host interface will return an error, beacuse no session will be created for host interface. Tested: ipmitool -I lanplus -U <user> -P <password> -H <lan1_ip> raw 6 0x3d <Zero> Response : gives currents session info ipmitool -I lanplus -U <user> -P <password> -H <lan2_ip> raw 6 0x3d <Zero> Response : gives currents session info //host interface ipmitool raw 6 0x3d 0 Response: 0xCC // invalid field in the request //This command shows info of all sessions, which includes current session info as well. ipmitool -I lanplus -U <user> -P <password> -H <lan1_ip> session info all session handle : 129 slot count : 45 active sessions : 1 user id : 1 privilege level : ADMINISTRATOR session type : IPMIv1.5 channel number : 0x03 console ip : 0.0.0.0 console mac : 00:00:00:00:00:00 console port : 52670 session handle : 0 slot count : 45 active sessions : 1 //This command shows info of all sessions, which includes current session info as well. ipmitool -I lanplus -U <user> -P <password> -H <lan2_ip> session info all session handle : 0 slot count : 45 active sessions : 1 session handle : 1 slot count : 45 active sessions : 1 user id : 1 privilege level : ADMINISTRATOR session type : IPMIv1.5 channel number : 0x01 console ip : 0.0.0.0 console mac : 00:00:00:00:00:00 console port : 57622 //host interface ipmitool session info all session handle : 0 slot count : 45 active sessions : 0 session handle : 0 slot count : 45 active sessions : 0 Tested other postive and negative test cases for get session info command in Lan1, Lan2 and host interfaces. All are working fine. Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com> Change-Id: I9fb1ef12693e4c0da3661ffdf21eec248b48b5b4
* Refactor ipmi::sensor::GetSensorResponse away from std::arraySui Chen2019-10-281-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors GetSensorResponse from std::array to struct. This change depends on change #23544. GetSensorResponse is an internal, intermediate structure, an unpacked form of a Get Sensor Reading response, providing direct access to its fields. Its life time is: GetReadingResponse -> GetSensorResponse -> ipmi::RspType. It is written to in 5 functions in the ipmi::sensor::get namespace, by four setter functions (setOffset, setReading, setAssertionBytes, enableScanning). It is currently read from by 1 function (ipmiSensorGetSensorReading) for transforming to an ipmi::RspType. Originally, the setter functions assumed bitwise equivalence between GetSensorResponse and GetReadingResponse, and the setter functions used reinterpret_cast to assign to a GetSensorResponse as if it were a GetReadingResponse. With this change, the reinterpret_cast's are removed, and the set functions now accept GetSensorResponse instead of GetReadingResponse, so the code gets a bit easier to read. Tested: Tested using a server with a BMC; sensor readings obtained through `ipmitool` appear to be correct (the reading might change within a small range): # ipmitool raw 0x04 0x2d 0x16 9B 40 00 00 Signed-off-by: Sui Chen <suichen@google.com> Change-Id: I5d454d6249f5431fb98169e6ef7c585c34024004
* Implemented get session info cmd in host interfaceRajashekar Gade Reddy2019-10-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command can get info of any session Tested all positive and negative test cases Tested: Get active session info by valid session handle ipmitool raw 0x6 0x3d <sesssion index = search session by handle> <valid session handle> Response : successfully gets the session info as per IPMI spec Get active session info by valid session id ipmitool raw 0x6 0x3d <sesssion index = search session by id> <valid session id> Response : successfully gets the session info as per IPMI spec Get inactive session info by valid session handle ipmitool raw 0x6 0x3d <sesssion index = search session by handle> <valid session handle> Response : successfully gets the session info as per IPMI spec Get inactive session info by valid session id ipmitool raw 0x6 0x3d <sesssion index = search session by id> <valid session id> Response : successfully gets the session info as per IPMI spec Get session info by invalid session handle ipmitool raw 0x6 0x3d <sesssion index = search session by handle> <invalid session handle> Response : 0x88 // Inavlid Session Handle Get session info by invalid session id ipmitool raw 0x6 0x3d <sesssion index = search session by id> <invalid session id> Response : 0x87 // Inavlid Session Id Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com> Change-Id: Ib36a9fe5eac58d15011cc9379ceed480ba0be96d
* transporthandler: Rewrite + New HandlerWilliam A. Kennington III2019-09-272-90/+1
| | | | | | | | | | | | | | | | | | This rewrites the old transport handler to use the new ipmi handler registration functions. It attempts to clean up the old code, by refactoring any business logic out of the code that parses the IPMI messages. This makes the code paths easier to understand and allows for better code re-use. This also gets rid of the concept of the settings change timer. Clients expect to see their settings take effect as soon as they are set, regardless of the "Set In Progress" flag. This means we no longer need a cache for our network settings that are about to be set by the daemon, and a client can hold the BMC in "Set In Progress" while it verifies settings like other BMC implementations. Change-Id: I5406a674f087600afdfc2c0b3adeacde10986abc Signed-off-by: William A. Kennington III <wak@google.com>
* Implemented close session cmd in host interfaceRajashekar Gade Reddy2019-09-253-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command can close any session via host interface. Tested: Close the existing valid session by session id ipmitool raw 0x6 0x3c <valid sesssion id > Response : 00 // success Close the existing valid session by session handle ipmitool raw 0x6 0x3c <zero session id> <valid session handle> Response : 00 // success Close the session by zero session id ipmitool raw 0x6 0x3c <zero session id> Response : 0x87 // inavlid session id Close the session by zero session handle ipmitool raw 0x6 0x3c <zero session id> <zero session handle> Response : 0x88 // inavlid session handle Close an inactive session. ipmitool raw 0x6 0x3c <valid session id> Response : 0xcc // invalid data field in request Close an inactive session. ipmitool raw 0x6 0x3c <zero session id> <valid session hnadle> Response : 0xcc // invalid data field in request Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com> Change-Id: I8af290001d8effbbcdbbe2dd93aabf1b015e7a88
* fix logic error for unpack vector of tupleVernon Mauery2019-09-161-5/+8
| | | | | | | | | | | | | | | | | | | | | Unpacking a vector of tuples is failing if the correct number of bytes does not match an integral number of bytes needed to fully unpack all the tuples. Unpacking a tuple should return an error if it does not fully unpack all the items. This will signal the vector unpack to bail and return however many items it has unpacked to that point. A vector unpack should always return success because no matter how many items it has unpacked, it is fine, because a vector can have any number of items. Tested: Unit tests updated to check for proper unpacking of vectors and tuples (and optionals) as well as new unit tests added for more targetted testing. Change-Id: I4b45198f8bc4a49913beb923d10079983179402a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Change yield from ptr to objectJames Feist2019-09-132-3/+3
| | | | | | | | | | | | The ptr makes for ugly code: i.e. *(ctx->yield) all over the place. Change it to copy as it is just 4 pointers. Tested: ipmitool mc info still works Change-Id: I30c5bc395849875cd58925fac99bb23c1804cd5b Signed-off-by: James Feist <james.feist@linux.intel.com>
* Move i2c WR api into libipmidYong Li2019-08-301-0/+11
| | | | | | | | | | | | Move the low-level i2c write-read api into libipmid, to allow provider libraries access to i2c without duplicating this code. Tested: I2c master write read command still works: ipmitool i2c bus=2 0x9c 8 0 Signed-off-by: Yong Li <yong.b.li@linux.intel.com> Change-Id: I0d5f82cf46ecf871eebb47aae25537b5da1f2e6a
* legacy handlers need a bigger bufferVernon Mauery2019-08-301-4/+3
| | | | | | | | | | | | | | | | | In the original ipmi execution queue, handlers were passed a larger buffer. The current code was only passing in the configured channel size, or 64 if no size was configured. This is too small and leads to buffer overflows for responses greater than 64 bytes. This brings the buffer sizes up to a point that matches the legacy code and to a size that is larger than any of IPMI standard transport sizes. Tested: used a bogus handler to create a large response and found that the entire response was returned. Change-Id: I91b359812247ae5fdef105c7b7a9dfe003548494 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Use boost::asio::post() instead of io->post()Vernon Mauery2019-06-211-1/+1
| | | | | | | | | | According to the documentation io->post is deprecated, saying that boost::asio::post() should be used instead. Tested: ipmid runs the same as it did before. Change-Id: I552c7cb5cb8ad8f9f6e2bcffa61ce5135e2faad2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Defining session const for multi net session mgmtSuryakanth Sekar2019-06-212-0/+48
| | | | | | | | This session const will be used in multi session management and session commands and replace the existing session const used into lowercamel case Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com> Change-Id: I76725acdf5d3d002f82a1076509ed37d668d01d3
* unpack static assert on unsupported typesVernon Mauery2019-05-302-17/+27
| | | | | | | | | | | | | | | | | Unsupported types might not cause compile time errors but can result in SIGILL errors at runtime when compiler warnings are ignored. This was found when compiling an intel-ipmi-oem handler that attempted to unpack an enum class type. The code compiles down to an empty function (no return statement or value), which can result in all sorts of undefined behavior. This change forces the unsupported types to emit a static assert and fail to compile. Tested: Created a handler that requests an enum class as an input and saw that the build fails with a static assert. Change-Id: I123da15cb001756f07761cf7a60b799469926a2a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add sdbusplus::asio::connection pointer to ipmi::ContextVernon Mauery2019-05-301-15/+21
| | | | | | | | | | | | | | | | | This adds a std::shared_ptr<sdbusplus::asio::connection> to every ipmi::Context in order to facilitate easy transition to yield_method_call over other D-Bus interfaces. This means that a getDbusObjects call could just pass in the ipmi::Context and it will get a yielding call. ipmi::Context is a natural fit because one is created for each of the boost::asio::coroutine contexts. And because a yielding call needs both an async D-Bus connection and a yield_context, this means that we now have one object to rule them all. Tested: Created a handler that uses the new shared_ptr in the context to see the API in action. Change-Id: I429a324180a38bf17845f7fd0544df2226d0300a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* 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