2004 Commits

Author SHA1 Message Date
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
Patrick Venture
83fee27624 drop unused static arrays
Originally marked unused, now dropped.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture <venture@google.com>
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
Patrick Venture
9a55136bfb implement __UNUSED__ macro for marking unused
Implement __UNUSED__ macro for marking symbols unused safely.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture <venture@google.com>
2018-11-23 16:41:06 +03:00
Patrick Venture
4ac93853a6 Add .dirstamp to .gitignore
Add the .dirstamp path to .gitignore.  .dirstamp is automatically
generated by some build systems.

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