2066 Commits

Author SHA1 Message Date
Alexander Amelkin
94f7646a8e man: Update the chassis bootparam section
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
62a04390e1 chassis: Add boot initiator mailbox support
Add `chassis bootmbox` command to set and get Boot Initiator Mailbox
boot parameter (id 7) the easy way. The command allows for getting
and setting the data both in hex and text modes, as well as properly
decodes IANA Enterprise number for block 0. It can get/set the whole
mailbox at once or operate on separate data blocks.

This commit enhances the chassis_get_boot_param() function with extra
arguments to re-use its code in handling of the added command.

Documentation update will follow.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
de1d5c9924 chassis: Use command-specific completion code parser
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>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
73d6af5782 Add support for command-specific completion codes
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>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
c9510635d7 Add a helper htoipmi24() function
The function converts a host 32-bit integer into an IPMI
24-bit value (LSB first).

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
e11f463b4e Add a helper args2buf() function
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>
2019-06-10 13:56:31 +03:00
Alexander Amelkin
619a02cf5d
man: Cleanup the manpage formatting tags
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>
2019-06-04 12:17:44 +03:00
Vernon Mauery
e65a96b38d create_pen_list: only print if values are set
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 resolves ipmitool/ipmitool#11

Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2019-05-29 15:56:11 +03:00
Alexander Amelkin
9fa01f1a54
chassis: Refactor to reduce code duplication
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>
2019-05-28 16:54:52 +03:00
Alexander Amelkin
432ea31804
chassis: Refactor to reduce code duplication
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>
2019-05-28 14:49:43 +03:00
Alexander Amelkin
12e2f5da63 sdr: Fix segfault on invalid unit types
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").

Resolves ipmitool/ipmitool#118

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-05-27 15:38:23 +03:00
Alexander Amelkin
d818c2ff85
vendor: Add YADRO TATLIN Storage Controller ID
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-04-17 16:01:11 +03:00
Charles Rose
cdd9d51c5f exchange-bmc-os-info: Remove dependency on ipmi.service
Resolves ipmitool/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>
2019-04-16 11:41:51 +03:00
Vernon Mauery
95038ba01b Add mechanism to configure to set the default interface
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>
2019-04-16 11:31:18 +03:00
Alexander Amelkin
b0d84e0f15 ci: Update INSTALL to reflect recent changes
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-04-15 20:50:17 +03:00
Alexander Amelkin
1b636434a6 ci: Set up matrix builds with Travis CI
Enable CI building for Xenial and Trusty,
as well as for MacOS X 10.14 (Xcode 10.2).

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-04-15 20:50:17 +03:00
Vernon Mauery
400622760f Enable Travis build of D-Bus interface
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>
2019-04-15 18:41:47 +03:00
Vernon Mauery
b7b455a38c add OpenBMC D-Bus interface
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>
2019-04-15 18:41:47 +03:00
Vaclav Dolezal
fa8e2ced19 Fix "ipmitool pef {status,info}" not printing final newline
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2019-04-01 18:00:31 +03:00
Alexander Amelkin
55ec2df41f
Remove unused include
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.

Resolves ipmitool/ipmitool#101
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-03-04 12:22:23 +03:00
George Keishing
48f4fba39a Fix IPMI DCMI message typo
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
2019-02-21 13:58:18 +03:00
Patrick Venture
df076b9547 open: swap free() calls for free_n()
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>
2019-02-20 18:29:09 +03:00
Patrick Venture
51634fd77c open: checking received msg id against expectation
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>
2019-02-20 18:29:09 +03:00
Patrick Venture
3bfa1da201 open: fix whitespace
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>
2019-02-20 18:29:09 +03:00
Alexander Amelkin
08348f1b72
Refactor free_n() function
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>
2019-02-20 14:56:37 +03:00
Patrick Venture
a8b3b6282b fru: swap free() calls for free_n()
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>
2019-02-13 21:28:14 +03:00
Patrick Venture
eb5f26060a fru: Fix write chunk reduction code
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>
2019-02-13 21:28:14 +03:00
Patrick Venture
feecd2bbf4 fru: add macro FRU_AREA macros
Use two macros defining the FRU block sizes instead of hard-coded magic
values.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
be3d57c013 fru: replace magic return codes with macros
Use the return code macros instead of magic numbers.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
f64044a3de fru header: add return error codes specific to fru
Add two special return codes specific to the IPMI
FRU commands.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
3737b035e8 fru: fix ipmi_fru_picmg_ext_edit as bool
Fix ipmi_fru_picmg_ext_edit to use bools instead
of an int treated as a boolean.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
6b003c3852 fru: use bool with ipmi_fru_oemkontron_edit
Convert ipmi_fru_oemkontron_edit to return a bool
type instead of an int used as a bool.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
8991f5a9a0 fru: change ipmi_fru_query_new_value to return bool
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>
2019-02-13 21:28:14 +03:00
Patrick Venture
49384e47be fru: mark ipmi_fru_query_new_value as static
Mark ipmi_fru_query_new_value as static as it's only
used internally in this object.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
6dcb168442 fru: add fru_cc_rq2big helper method for code checks
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>
2019-02-13 21:28:14 +03:00
Patrick Venture
1c4a00d26b fru: cleanup ipmi_fru_upg_ekeying
Cleanup ipmi_fru_upg_ekeying such that it exits from
one place that handles cleanup.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
aef8a1ccb4 fru: use ipmi_cc defined maros for return codes
Use the macros defined in ipmi_cc for IPMI return
codes instead of magic numbers.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
81761e6f60 fru: drop extraneous parentheses on negative returns
Drop extraneous parentheses when returning a
negative value.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
715c7b8a1f fru: delete unused variable matchInstance
Delete unused variable matchInstance.  The variable is repeatedly
assigned, but nothing reads it.

Signed-off-by: Patrick Venture <venture@google.com>
2019-02-13 21:28:14 +03:00
Patrick Venture
92ee477cde fru: cleanup ipmi_fru_oemkontron_get
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>
2019-02-13 21:28:14 +03:00
Patrick Venture
6d515dd06b fru: fixup array bounds checking
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>
2019-02-13 21:28:14 +03:00
Josef Moellers
7941806a9b hpm: Adhere to centralized exiting
Replace `return`s with `goto`s to appropriate labels
(with or without closing the file).
2019-01-24 15:22:21 +03:00
Josef Moellers
4631d3f942 hpm: Minor refactoring
Remove an `if()` with a condition that is always true.
Merge two calls to time() into one.
2019-01-24 15:22:21 +03:00
Josef Moellers
272d9d0d9b hpm: Fix resource leak
fclose(pImageFile) was missing before returning from
HpmfwupgGetBufferFromFile()
2019-01-24 15:22:21 +03:00
Alexander Amelkin
0ca9c66b84
sol: Make interface timeout obey the -N option
For `sol activate` the timeout on lanplus interface was hard-coded
to 1 second, overriding the value set with the `-N` option.

Resolves ipmitool/ipmitool#87

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-12-28 16:33:18 +03:00
Patrick Venture
8b6d127bb1 helper: add free_n method to handle clearing pointers
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>
2018-12-24 19:17:48 +03:00
Jörg Krause
34fc86bd75
cygwin: imb: Fix build error (wchar_t)
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>
2018-12-07 18:46:55 +03:00
pjdhpe
9ec2232321 lanplus: Fix segfault for truncated dcmi response
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.

Resolves ipmitool/ipmitool#72
2018-12-06 12:41:22 +03:00
Alexander Amelkin
64727f59c4
lanplus: Cleanup. Refix 6dec83ff, fix be2c0c4b
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>
2018-11-29 13:19:29 +03:00
Alexander Amelkin
5183b2c288 Move led color static array to source file
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 resolves ipmitool/ipmitool#13

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-23 16:41:06 +03:00