Small fixes for net ipmi handler
Host ipmid handler will not re-register commands,
so make the net handler follow this by skipping later registrations.
Also pass size of command to handlers for length checks to work.
Host ipmi handler passes this parameter correctly.
Change-Id: I8eb1d645eff405b91e471433085025b6835f0bd2
Signed-off-by: Feist, James <james.feist@linux.intel.com>
diff --git a/command_table.cpp b/command_table.cpp
index f0a8f17..7a6e2df 100644
--- a/command_table.cpp
+++ b/command_table.cpp
@@ -12,10 +12,19 @@
void Table::registerCommand(CommandID inCommand, std::unique_ptr<Entry>&& entry)
{
+ auto& command = commandTable[inCommand.command];
+
+ if (command)
+ {
+ std::cout << "I> Already Registered, Skipping " << std::hex
+ << inCommand.command << "\n";
+ return;
+ }
+
std::cout << "I> Registering Command" << std::hex
<< inCommand.command << "\n";
- commandTable[inCommand.command] = std::move(entry);
+ command = std::move(entry);
}
std::vector<uint8_t> Table::executeCommand(uint32_t inCommand,
@@ -82,7 +91,7 @@
const message::Handler& handler)
{
std::vector<uint8_t> response(message::parser::MAX_PAYLOAD_SIZE - 1);
- size_t respSize {};
+ size_t respSize = commandData.size();
ipmi_ret_t ipmiRC = functor(0, 0,
reinterpret_cast<void*>(commandData.data()),