Get/set system boot option commands have some command-specific
completion codes that are now reported as "Unknown (0080)", etc.
Use the previously introduced specific_val2str() to convert those
specific error codes to human-readable strings.
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Some commands may return command-specific completion codes.
Now they are all reported as 'Unknown'.
Add helper functions to support such command-specific codes.
Command handlers will need to define their own valstr arrays
with completion code descriptions and then use specific_val2str()
instead of generic val2str() to convert the completion code into
a string.
Also reduce code duplication in helper.c
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
The function converts a set of command line arguments representing
byte values into a byte buffer and verifies each individual value
to be a valid data byte.
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
The manpage contained a lot of redundant .RS/.RE tag pairs
with no content between the tags. This commits removes those.
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
On a failed download of the PEN list, the create_pen_list script
improperly printed an invalid entry of { , "" } causing the build to
fail. The last line print must check that it has something to print or
it will print the wrong thing.
Partially resolvesipmitool/ipmitool#11
Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
Move boot information acknowledgement clearing code into
a helper funcion, call it instead of copy-pasted code.
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Get rid of repeated code that sets the set-in-progress parameter.
Introduce chassis_bootparam_set_in_progress() function to do
the job.
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
The program would crash if the BMC returned an out of range (>90)
unit type for a full sensor record. This commit adds a range check
and also add support for IPMI 2.0 additional unit types 91 and 92
("fatal error" and "grams").
Resolvesipmitool/ipmitool#118
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Resolvesipmitool/ipmitool#46
Most modern systems do not require ipmi.service to load the kernel
modules. Checking for /dev/ipmi* would be sufficient.
v2: Use Assert in place of Condition to explicitly fail based on
AlexanderAmelkin's feedback.
Signed-off-by: Charles Rose <charles.rose@dell.com>
In some cases, the user may want to have a different default interface
without the need to always specify it on the command line. Add a
configure option that sets the default interface without the need to
patch the code.
Configure as: ./configure DEFAULT_INTF=name
where name is an interface name that might be enabled with
--enable-intf-<name>.
The configure will enforce that the selected default interface is
enabled.
Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
By default the D-Bus interface is not enabled, so in order to get it to
build in Travis, it must be enabled explicitly. This installs the
packages needed and sets the configure flag.
Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
OpenBMC runs a D-Bus interface internally and has the option of
compiling ipmitool so it can run natively on the BMC. This adds the
D-Bus interface to ipmitool so it can be used with the OpenBMC project.
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
The endian.h header is not used for anything and was earlier
added by mistake. It however hampers building on some systems
where it doesn't exist.
Resolvesipmitool/ipmitool#101
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Swap calls to free() with calls to free_n() to leverage helper method
and handle clearing pointers after freeing in one step.
Signed-off-by: Patrick Venture <venture@google.com>
Check the received IPMI response message id against
the id expected given the IPMI request. They need to
match. It is possible that request A times out,
request B is sent, and then request A responds to the
request B. The value for request B may be behind it
in the queue.
Note: This may only be possible if the file is kept
open between multiple IPMI messages (a common
occurrence).
Resolves: #82
Signed-off-by: Patrick Venture <venture@google.com>
Apply whitespace fixes via clang-format-6.0 to src/plugins/open/open.c
to cleanup spaces and fixup line lengths, etc.
Signed-off-by: Patrick Venture <venture@google.com>
Make the argument to free_n() compatible with any pointers,
thus reducing the number of compilation warnings.
End-user-impact: None
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Swap calls to free() with calls to free_n() to leverage helper method
and handle clearing pointers after freeing in one step.
Signed-off-by: Patrick Venture <venture@google.com>
Check against FRU_AREA_MAXIMUM_BLOCK_SZ instead of FRU_BLOCK_SZ
when checking if the write chunk needs to be reduced.
Apparently, that was the original intention, and then there
was just a typo. In other places the same check is done properly.
Signed-off-by: Patrick Venture <venture@google.com>
Change ipmi_fru_query_new_value to return the bool type
instead of an int that's being used as a boolean value.
Signed-off-by: Patrick Venture <venture@google.com>
Add fru_cc_rq2big helper method to reduce duplicate
code checking for specific size-based IPMI response
codes.
Signed-off-by: Patrick Venture <venture@google.com>
Cleanup style in method ipmi_fru_oemkontron_get as well as add inverted
logic checks to reduce indentation.
Signed-off-by: Patrick Venture <venture@google.com>
Fixup the following array bounds checking bugs:
[lib/ipmi_fru.c:1003]: (style) Array index 'i' is
used before limits check.
[lib/ipmi_fru.c:1127]: (style) Array index 'i' is
used before limits check.
[lib/ipmi_fru.c:1262]: (style) Array index 'i' is
used before limits check.
Signed-off-by: Patrick Venture <venture@google.com>
For `sol activate` the timeout on lanplus interface was hard-coded
to 1 second, overriding the value set with the `-N` option.
Resolvesipmitool/ipmitool#87
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
free_n() will free the memory and clear the pointer, which will reduce
the probability a developer will forget to clear the pointer after
freeing.
Resolves: #79
Signed-off-by: Patrick Venture <venture@google.com>
For Win32/Cygwin, the imb plugin was failing to build with
the following message:
imbapi.h:140:9: error: unknown type name 'wchar_t'
typedef wchar_t WCHAR;
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
On occasion a dcmi power reading will return error C6, and a
truncated response payload. As the decrypted payload is shorter
than the expected length, lanplus_decrypt_aes_cbc_128() adjusts
the payload_size downward by one byte. In ipmi_lan_poll_single()
the calculation to determine if the payload size has increased
erroniously sets extra_data_length to -1, with a subsequent
segv when calling a memmove to shift response data.
The fix is to check for a positive value in the extra_data_length.
Resolvesipmitool/ipmitool#72
This is a cleanup commit.
Commit 6dec83ff removed assignment of `rsp` pointer
in SOL-processing block of ipmi_lan_poll_single(),
but left the check for the pointer validity in place.
Although that has effectively fixed the bug of potentially
accessing the null `rsp` pointer in the `else` block introduced
with be2c0c4b, the resulting if/else looked suspicious and left
and impression that a NULL pointer could still be accessed.
This commit removes the check for `rsp` from the `if`
as it is checked at the start of the function where `rsp`
is initialized (and that is the only place where it is ever changed).
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Move led color static array from header to ipmi_picmg module
and introduce `picmg_led_color_str()` function for use in
ipmi_vita module.
Partially resolvesipmitool/ipmitool#13
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Move static objects declared in headers to the source files where
they're used.
Partially resolvesipmitool/ipmitool#13
Signed-off-by: Patrick Venture <venture@google.com>