From 5d06cc6dfee3aa0c42bb181dd7e050f4f8f8dd1e Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 25 Apr 2019 02:10:55 -0700 Subject: handler: Fix request passing for legacy commands 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 --- include/ipmid/handler.hpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'include/ipmid/handler.hpp') diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp index c84bffd..53b0bb8 100644 --- a/include/ipmid/handler.hpp +++ b/include/ipmid/handler.hpp @@ -310,17 +310,18 @@ class IpmiHandler final : public HandlerBase executeCallback(message::Request::ptr request) override { message::Response::ptr response = request->makeResponse(); - size_t len = request->payload.size(); // allocate a big response buffer here response->payload.resize( getChannelMaxTransferSize(request->ctx->channel)); + size_t len = request->payload.size() - request->payload.rawIndex; Cc ccRet{ccSuccess}; try { - ccRet = handler_(request->ctx->netFn, request->ctx->cmd, - request->payload.data(), response->payload.data(), - &len, handlerCtx); + ccRet = + handler_(request->ctx->netFn, request->ctx->cmd, + request->payload.data() + request->payload.rawIndex, + response->payload.data(), &len, handlerCtx); } catch (const std::exception& e) { @@ -399,16 +400,18 @@ class IpmiHandler final : public HandlerBase executeCallback(message::Request::ptr request) override { message::Response::ptr response = request->makeResponse(); - size_t len = request->payload.size(); // allocate a big response buffer here response->payload.resize( getChannelMaxTransferSize(request->ctx->channel)); + size_t len = request->payload.size() - request->payload.rawIndex; Cc ccRet{ccSuccess}; try { - ccRet = handler_(request->ctx->cmd, request->payload.data(), - response->payload.data(), &len); + ccRet = + handler_(request->ctx->cmd, + request->payload.data() + request->payload.rawIndex, + response->payload.data(), &len); } catch (const std::exception& e) { -- cgit v1.2.1