381 Commits

Author SHA1 Message Date
Alexander Amelkin
bd0475ce4a Load IANA PEN registry from a file
Previously, the OEM names dictionary was compiled in and
updating it required rebuilding of `ipmitool`, thus taking a
long time for newly registered OEMs to get supported by the tool.

Building also required a direct internet connection to succeed.

With this commit, the OEM enterprise dictionary is now loaded from
either ${HOME}/.local/usr/share/misc/enterprise-numbers or from
/usr/share/misc/enterprise-numbers (in that precedence).

Those files can be downloaded from iana.org at
http://www.iana.org/assignments/enterprise-numbers

Partially resolves ipmitool/ipmitool#11

Fixes: 9d41136c9b7c7d392f1a3f3adeb6d7fe3bd3135e
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-06-18 16:43:41 +03:00
dan mcgee
8071cf7389 oem: name change from Newisys to Viking Enterprise Solutions
Renamed the oem strings containing Newisys to Viking Enterprise Solutions.
IANA 9237
Built and tested with AMI's IPMI stack LTS 12.01.

Resolves ipmitool/ipmitool#124

Signed-off-by: dan mcgee <dan.mcgee@vikingenterprise.com>
Signed-off-by: dan mcgee <dan.mcgee@sanmina.com>
2019-06-11 17:58:29 +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
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
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
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
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
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
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
Patrick Venture
3e0ecc5edc move static objects to source file
Move static objects declared in headers to the source files where
they're used.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture <venture@google.com>
2018-11-23 16:41:06 +03:00
Patrick Venture
8ea6094118 cleanup all unused-parameter warnings
Cleanup all unused-parameter warnings.  Each warning was examined to
verify it wasn't simply a case of a build macro difference.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture <venture@google.com>
2018-11-23 16:41:06 +03:00
Patrick Venture
d6d9c85139 use __UNUSED__ macro instead of gcc specific attribute
Use __UNUSED__ macro defined in helper.h instead of the gcc-specific
attribute unused macro.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture <venture@google.com>
2018-11-23 16:41:06 +03:00
Alexander Amelkin
a4c1040420
fru: Fix processing of unspecified board mfg. date
FRU board mfg. date uses a different value for 'unspecified'
timestamp than the general IPMI specification.

This commit makes ekanalyzer and fru commands process unspecified
FRU dates properly, displaying 'Unspecified' instead of
'Mon Jan  1 03:00:00 1996'.

Resolves ipmitool/ipmitool#57

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-16 22:25:27 +03:00
Vernon Mauery
576d4855d9 [compiler-warnings-fixes] use correct fall through comment
In some of the SDR calculating code, there were switch statements that
had cases that would fall through deliberately into the next case. But
the compiler didn't like the comment and would complain about the fall
through anyway. This changes to a comment that the compiler recognizes.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2018-11-11 14:55:43 +03:00
Vernon Mauery
f2780c5d86 [compiler-warnings-fixes] ipmi_start_daemon: check return values
Some return values were being ignored in ipmi_start_daemon. This adds
checks to the values and changes some hard-coded numbers into named
values.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2018-11-11 14:55:43 +03:00
Vernon Mauery
dc9b4ebfc9 [compiler-warnings-fixes] ipmi_sdr.c: remove unused function parameters
Several functions were passed a struct ipmi_intf* even though it was
unused. This removes the unused parameters and changes calls and
signatures.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2018-11-11 14:55:43 +03:00
Alexander Amelkin
6e2b688e24
lan: Fix processing disabled VLAN
Before this fix `ipmitool` would complain that VLAN ID
is out of range when trying to disable an already disabled VLAN
on a lan channel. With this fix it will properly report that
VLAN is already disabled.

Resolves ipmitool/ipmitool#55

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-11 11:57:12 +03:00
Alexander Amelkin
6c3d4b56c9
Make ipmitool respect system locale settings
Dates, times and floating point numbers from now on
will be displayed using system locale settings.

Resolves ipmitoo/ipmitool#23

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-08 21:26:32 +03:00
Alexander Amelkin
4f05b95f6c
Fix strftime() non-literal argument warning
There is a bug in gcc since 4.3.2 and still not fixed in 8.1.0.
Even if __attribute__((format(strftime... is specified for a
wrapper function around strftime, gcc still complains about strftime
being called from the wrapper with a "non-literal" format argument.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438

This commit adds 'ugly hacks' from that discussion to call strftime()
from strftime-formatted wrappers and silence the warnings.

Partially resolves ipmitool/ipmitool#23

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-07 18:50:10 +03:00
Alexander Amelkin
f0d5c17ea7
Refactor timestamp handling
Handle all date/time stamps uniformly, taking in account the host
endianness. Respect the local time zone and the '-Z' option for
all ipmitool commands. Unify the date and time formatting.
Add correct handling of IPMI timestamps 'since system startup'
and for 'unspecified' timestamps.

Partially resolves ipmitool/ipmitool#23

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-07 18:11:58 +03:00
Alexander Amelkin
65a2c548d8 lanplus: Refactoring
Some minor formatting corrections.
Also introduced a new helper function to reduce nesting level.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-01 19:29:45 +03:00
Alexander Amelkin
1283382e82 lanplus: Fix -C option processing
Cipher suite ID is a byte as per IPMI spec.
Use the appropriate function and consider target endianness
(so write to a temporary variable).

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2018-11-01 19:29:45 +03:00
Vernon Mauery
7772254b62 lanplus: Auto-select 'best' cipher suite available
Based on current crypto alogrithms, one could rank cipher suites along
these lines:

17 > 3 >> all the rest

17 and 3 are the only cipher suites that implement any sort of
confidentiality alogorithm that is secure. In addition, any hmac-md5 or
md5 integrity algorithm used in integrity is weak at best and dangerous
for authentication.

This could possibly be enabled in a simpler mechanism by simply checking
for 17 and then choosing it before falling back to 3, but the way this
is implemented, it makes it easy to change the list of acceptable
algorithms from two to three or more items.

Resolves ipmitool/ipmitool#29

Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2018-11-01 19:29:45 +03:00
eyjhbb@gmail.com
6f336d04f1 sensor: Refactor ipmi_sensor_print_fc_threshold()
Break the function into smaller pieces to reduce
complexity.
2018-09-25 14:32:46 +03:00
eyjhbb@gmail.com
9d49a6edfe sensor: Add support for csv output 2018-09-25 14:32:46 +03:00