Compare commits

...

370 Commits

Author SHA1 Message Date
be7917f9f5 Changes Integrated since 1.8.14RC2 2014-05-05 07:26:36 -06:00
a7d3bda08d ID: 311 man page update for new sunoem commands 2014-05-05 06:58:08 -06:00
d531785a23 ID: 280 - man page cleanup 2014-04-29 09:38:11 -06:00
eeeb973e39 Make comment about 'source offset' explicit 2014-04-26 14:43:30 +02:00
166ae1da23 ID: 308 - "fru edit" no longer works for non-zero fields
1. Warnings about "FRU Area Length" based on uninitialized (malloc'd) memory
contents (due to fru->max_read_size not being initialized, left at 0) and
fru_data not being zeroed after malloc() in ipmi_fru_set_field_string().

2. "fru edit" commands for any field index other than 0 would fail (with "Field
not found !" error) due to a couple offset and length calculation errors (for
all the supported "area" types) in ipmi_fru_set_field_string().

3. "fru edit" commands would corrupt the FRU Inventory Area due to incorrect
"source offset" value being specified in write_fru_area() call in
impi_fru_set_field_string().

Commit for Rob Swindell
2014-04-25 20:48:40 +02:00
4f0967779e ID: 310 - lanplus retry regression
The lanplus driver for has a bug in ipmi_lanplus_open_session(). There is
an extra and undesired check for a null response (timeout). As a result, it
returns 1 to the caller. The result of this is an occasional assertion. Commit
mends this.

Commit for Pat Donlin
2014-04-25 20:40:36 +02:00
9d88837ef3 Add ticket IDs, if we have one 2014-04-18 06:39:09 +02:00
824c0ed4a0 Add hpm2.h to list of distributed include files 2014-04-17 14:01:22 -06:00
7ea04d8f77 Update ChangeLog for 1.8.14RC2 changes 2014-04-17 13:28:54 -06:00
8d5e8fcf7a Incorrect byteswap in SOL maximum payload code
max_inbound_payload_size, max_outbound_payload_size and port are
assembled byte by byte using shifts. This works correctly in both
little and big endian and doing a subsequent byte swap is wrong.

To highlight this issue I dumped the values on a big endian machine:

max_inbound_payload_size 51200
max_outbound_payload_size 51200
port 28418

And after this fix:

max_inbound_payload_size 200
max_outbound_payload_size 200
port 623

Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-12 15:13:25 +02:00
2c7526be6b Fix build error in HPM.2 code
lib/hpm2.c uses BSWAP_16 without including ipmitool/bswap.h.

Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-12 15:08:39 +02:00
a88db0d181 ID: 300 - new sunoem functionality
Main changes include:

 * direct connection to ILOM command line interface
 * ability to add/delete ssh keys fot ILOM users
 * ability to set ILOM properties
 * ability to retrieve various logs from SP
 * removal of obsolete/non-functioning code and other misc changes

Commit for Martin Hovorka of Oracle
2014-04-09 21:24:05 +02:00
42aba7eb4f ID: 144 - Fix 'dcmi power set_limit action <value>'
From the ticket:
(v1.8.12) "dcmi power set_limit action <value>" (where <value> is either
"sel_logging" or "power_off") does not actually send the "Set Power Limit"
command (so no change to the power limit policy is made).

This was caused by all atoi(), strtol(), strtoul() calls being replaced. This
patch should fix it.

Commit for Holger Liebig
2014-04-08 15:24:55 +02:00
23e9340b49 ID:302 - HPM.2 long message support
This patch adds basic long message support for PICMG-based systems according to
the HPM.2 specification.
It also introduces APIs for setting inbound and outbound messages sizes per
selected interface.
This APIs are used in LAN and LAN+ interfaces to set autonomously detected
inbound and outbound message sizes.
The newly introduced APIs also replace the existing message size detection code
in several ipmitool commands in order to leverage the advantages of long message
support (HPM.1 upgrade, SDR acquring, FRU inventory read and write).
The Kontron-specific long message support is moved under a OEM option.

Commit for Dmitry Bazhenov
2014-04-08 15:18:50 +02:00
707d77ffbc Add new SEL entries for ipmi 2.0 rev 1.1
Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-05 11:38:08 +02:00
7584b96c1d Update ipmtool version to 1.8.14-cvs 2014-03-28 07:35:25 -06:00
cc85ce1333 Update For 1.8.14 Release 2014-03-28 07:24:06 -06:00
2c7a5f91ef ID: 299 - openipmi plugin writes zero to wrong byte
The intent is to zero the byte that no longer contains valid data (because the
data was shifted one byte to the left). However, the wrong byte is being zeroed.
One way this shows up is when displaying the descriptions with hpm compprop.
2014-03-27 20:29:44 +01:00
9e3dba7e97 ID: 301 - Add OS/Hypervisor installation status events
Add OS/Hypervisor installation status event types to SEL as noted in table-24 in
section 42.2.

Commit-for: Charles Rose
2014-03-27 19:57:30 +01:00
176774cf9f ID: 298 - fix LANplus retry
``I had submitted a patch back on Nov 19, 2013 regarding a fix to lanplus retry.
This had resolved a problem whereby a retry of a payload type of
IPMI_PAYLOAD_TYPE_IPMI first removed the request from the queue before going
back for a retry of the message. I have been able to determine why this fix
works correctly. More importantly I have been able to resolve other retry
problems in lanplus where assertion panics were hitting on certain retry
operations. A new, replacement patch for resolving both of these types of retry
bugs follows.

The first bug,where the ipmi_lanplus_send_payload() is sending a payload type of
IPMI_PAYLOAD_TYPE_IPMI is retryable, however I found in testing that it did not
remove the previous request entry from the list of requests chain. If the
original message had timed out, a second message sent, the second reply would
not match up to the right entry on the list as the req command and sequence
numbers are the same. By first removing the first request from the chain this
resolves it. The consequence of not removing the stale entry was random errors.

The second bug is when waiting for a message response times out during the
ipmi_lanplus_send_payload types IPMI_PAYLOAD_TYPE(s) RCMP_OPEN_REQUEST, RAKP1,
RAKP_3. In various testing where the message timed out on either of these three
payload types, ipmitool would assertion panic upon retry as the session_state
was wrong. The timeout could be due to the message never getting to the BMC, the
BMC never acting/responding to the message, or the reply message packet dropped
(it is UDP after all). If the BMC had acted on the message but the reply was not
received, the BMC state would had advanced, and a retry of any of these three
commands would error. It is not knowable at retry time if the BMC had acted on
the message or not. The solution is upon message timeout failure, retry all
three commands in the sequence. This has shown to be reliable and does not
result in assertions or any unexpected BMC behaviors. Should the original
message response eventually arrive very late, it is just discarded.

The testing for these problems was elusive until we found a moderately slow BMC
and had separate sessions direct a fusillade of nmap operations on the BMC, then
run simple ipmitool commands. This caused sufficient loading of the network and
BMC to cause lengthy delays and outright packet drops. The general approach on
the second fix is to return a timeout error code back through ipmi_lanplus_open
where the sequence can be retried.''

Patch-by: Pat Donlin
2014-03-23 08:15:51 +01:00
cab450a052 ID: 295 - inform user if SOL session disconnected
Currently if we are connected to ipmitool sol session and if service processor
goes down due to reset/reload, then user has no way to know that sol session has
been disconnected. Commit aims to fix such case.

Patch-by: Mamatha Inamdar
2014-03-23 07:58:11 +01:00
250eb15f92 ID: 297 - don't print-out SEL entry if ID not present
Don't print-out SEL log entry if SEL Record ID isn't present.

Patch-by: Mamatha Inamdar
2014-03-23 07:51:05 +01:00
02e4a0361c ID:296 - Fix PSD size decoding
Commit replaces size decoding code with code ported from "decode-dimms" Perl
script found in i2c-tools 3.0.3. Former code has reported incorrect size of DDR2
modules.

Patch-by: Alexander Amelkin
2014-03-23 07:37:58 +01:00
ca5cc560f6 Add options to chassis bootparam set bootflag 2014-03-11 10:26:43 -06:00
b4a9d2f9a2 ID: 293 - Use of uninitialized variable in ipmi_main()
The variable addr is used uninitialized on line 918 of ipmi_main(). Commit
ensures it is initialized to 0 before being used.

Reported-by: NUXI
2014-02-27 08:56:28 +01:00
8d44c55feb Properly handle plugin non-zero target adddress with -t specification Bug 292 2014-02-10 06:05:49 -07:00
c18ec02f33 Move all files one level up in the file hierarcy, to avoid the useless ipmitool directory. 2014-02-05 17:30:32 +01:00
b0aad15d67 Add myself to AUTHORS to test git commit emails. 2014-01-31 11:58:47 +01:00
adbf585bd4 Add link to commit archive to test git commit emails. 2014-01-31 11:51:59 +01:00
9393bf0133 Typo, missing semicolon. 2014-01-31 06:13:58 +00:00
2c2844ac03 Use TIOCFLUSH if TCFLSH is missing to get the serial plugin building on Hurd. 2014-01-30 18:55:46 +00:00
c186e2a681 Disable imb and open plugins by default on Hurd. The platform lack the required kernel support. 2014-01-30 18:33:47 +00:00
e02ed2ca2c Change serial plugin to only try to disable the IUCLC serial line flag on platforms supporting it. Fixes build problem on Hurd and FreeBSD. 2014-01-30 18:17:45 +00:00
a06f8a26d4 Add missing break; in switch block (Coverity CID 1149010). 2014-01-15 08:58:04 +00:00
a324db391c Add missing format string placeholder (Coverity CID 1149038). 2014-01-15 08:55:38 +00:00
b086e876d7 Add missing format string placeholder (Coverity CID 1149037). 2014-01-15 08:54:00 +00:00
555a08ece0 Add missing format string placeholder (Coverity CID 1149036). 2014-01-15 08:52:23 +00:00
696ccb0787 Set pointer to NULL just after free() two other places too. 2014-01-11 07:58:50 +00:00
86cb5ee175 Make sure to set free()ed pointer to NULL immediately, as specified by
<URL: http://sourceforge.net/p/ipmitool/wiki/coding_standards/ >.
2014-01-11 07:43:12 +00:00
99fff91f9d Make sure blockId buffer is never overflown (Coverity CID 1149058). 2014-01-11 07:22:46 +00:00
df3e3c7969 Fix incorrect printf() arguments (Coverity CID 1149035). 2014-01-11 07:11:41 +00:00
135977a497 Make sure to release malloc()-ed data when fread() fail to read board
type data (Coverity CID 1149052).
2014-01-11 06:50:57 +00:00
4e220bebb0 Check return value from open() in ipmi_start_daemon() (Coverity CID CID 1148983). 2014-01-11 06:45:44 +00:00
4698e667f5 Make sure input_file is not used if it is NULL (Coverity CID 1149055). 2014-01-11 06:29:01 +00:00
ff1dbe3d5b ID: 278 - Error in sol looptest
Commit fixes use of uninitialized variable in SOL "looptest".
2013-12-17 05:17:55 +00:00
d42890ef17 ID: 290 - ipmi_sol.c needs a clean-up
ipmi_sol_payload_access() - change formatting and simplify.
2013-12-17 05:05:43 +00:00
2d7fe32687 ID: 85 - Supermicro memory ecc error display
Commit adds memory ECC error display for Supermicro boards and adds a
Supermicro oem sensor type for SEL.
2013-12-17 04:56:18 +00:00
3a852a8849 ID: 85 - Supermicro memory ECC error display
Commit adds ipmi_get_oem_id() function.
2013-12-17 04:53:20 +00:00
c9e047c334 ID: 290 - ipmi_sol.c needs a clean-up
Clean up code formatting in ipmi_sol_main().
2013-12-08 20:45:17 +00:00
6cf6b4b845 ID: 286 - Open session retries hit assert in ipmi_lanplus_send_payload
If we have to retry an open session request, we hit an assert
that assumes we can only be in LANPLUS_STATE_PRESESSION state.

Add LANPLUS_STATE_OPEN_SESSION_SENT so we don't abort if
we retry.

Commit for Anton Blanchard
2013-12-08 19:12:21 +00:00
36c11f6033 ID: 285 - Fix SEGV in ipmi_lanplus_open_session
If ipmi_lanplus_send_payload fails we get a NULL pointer
returned. Error out straight away instead of continuing on
and getting a SEGV when we dereference rsp.

Commit for Anton Blanchard
2013-12-08 19:06:13 +00:00
5dc9585e77 ID: 284 - Fix SEGV in ipmi_main
Check the return code of ipmi_main_intf->open(), and take the
error path if it fails. Right now we continue on blindly which
results in a SEGV.

Commit for Anton Blanchard
2013-12-08 18:59:28 +00:00
0b97d32c25 ID: 283 - ipmi_intf_socket_connect fails with IPv4 hosts
A recent IPv6 patch broke IPv4 connections. Fix the incorrect
conditional to get it going again.

Commit for Anton Blanchard
2013-12-08 18:54:18 +00:00
5949b19d44 Fix code formatting, at least a bit. 2013-12-08 18:46:53 +00:00
0cd8f46c42 Reverting commit ``Add support for enabling/disabling PEF policy entries'' as
there is no ticket/ticket number missing and no code review.
2013-11-26 04:25:46 +00:00
2ff745286b Add support for enabling/disabling PEF policy entries 2013-11-25 21:38:04 +00:00
f6cabfb089 PA: 83 - Revised IPv6 patch
Author: Holger Liebig
Deduplicated socket connection shared among lan and lanplus.
Allows IPv6 address and tries to pick correct scope ID.
2013-11-14 12:56:49 +00:00
d3ca7cb090 FR: 24 - Exchange OS Name Hostname BMC URL during startup
Correct sysconfig defaults in comment. Systemd dependencies.
2013-11-05 13:01:36 +00:00
6871fe1c8e FR: 24 - Exchange OS Name Hostname BMC URL during startup
Add service, systemd unit, sysconfig in contrib
2013-11-05 12:27:00 +00:00
b9a0c5a091 ID: 46 - ipmi_fwum needs some re-work
Commit changes to 'include/ipmitool/ipmi_fwum.h'.
2013-10-28 05:21:46 +00:00
1cc4ba699d ID: 46 - ipmi_fwum needs some re-work
Move 'struct' and 'enum' into header file
2013-10-26 19:31:44 +00:00
b779439ad0 ID: 46 - ipmi_fwum needs some re-work
Replace tKFWUM_Status with int

Commit replaces tKFWUM_Status with int. tKFWUM_Status is all nice and neat, but
if int can do, why would you use something that makes your lines unnecessarily
longer?
2013-10-26 19:30:15 +00:00
63ef18e6e0 ID: 46 - ipmi_fwum needs some re-work
Remove keyword 'static'

Commit removes ``static'' as I see no point, no point at all to have it here.
2013-10-26 19:29:49 +00:00
935b215514 ID: 46 - ipmi_fwum needs some re-work
Rename saveFirmwareInfo -> save_fw_nfo
2013-10-26 19:29:29 +00:00
cd524c2d25 ID: 46 - ipmi_fwum needs some re-work
File name is no longer ``uchar *'' - remove casts

File name is no longer ``unsigned char *'', therefore remove pointless casts to
``char *''.
2013-10-26 19:29:05 +00:00
e24c7f75f2 ID: 46 - ipmi_fwum needs some re-work
Remove duplicate Kontron IANA number

Commit removes/replaces duplicate Kontron IANA number which can be found in
'include/ipmitool/ipmi.h' as well. Therefore there is no need to have it here.
2013-10-26 19:28:40 +00:00
da4b779adf ID: 46 - ipmi_fwum needs some re-work
Group together and order[a-z] function prototypes
2013-10-26 19:27:43 +00:00
aca8d6ad7b ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - download/upgrade fw

Commit removes KfwumMain() and creates ipmi_fwum_fwupgrade() instead.
2013-10-26 19:27:15 +00:00
5416af78a5 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - start fw upgrade

Commit moves start-fw-upgrade out of KfwumMain(). It also changes return type of
KfwumStartFirmwareUpgrade().
2013-10-26 19:26:38 +00:00
770e61663f ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - tracelog

Commit moves tracelog out of KfwumMain() and changes return type of
KfwumGetTraceLog().
2013-10-26 19:26:16 +00:00
22f294fc27 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - status

Commit moves status out of KfwumMain().
2013-10-26 19:25:16 +00:00
a675601da4 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - info

Commit moves 'info' out of KfwumMain().
2013-10-26 19:24:02 +00:00
645120f545 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - rollback

Commit moves 'rollback' out of KfwumMain() and changes return value of
KfwumManualRollback().
2013-10-26 19:23:37 +00:00
2df9ca914f ID: 46 - ipmi_fwum needs some re-work
KfwumMain() - return value void -> int

KfwumMain() returns int instead of void now in order to report success or
failure of given task.
2013-10-26 19:23:16 +00:00
a5d55b5d51 ID: 46 - ipmi_fwum needs some re-work
Move #define into header file
2013-10-26 19:20:50 +00:00
f2ba7fcd60 ID: 46 - ipmi_fwum needs some re-work
Rename VERSION_MAJ and VERSION_MIN

Commit renames VERSION_MAJ to VER_MAJOR and VERSION_MIN to VER_MINOR.
2013-10-26 19:18:34 +00:00
24923222f6 ID: 46 - ipmi_fwum needs some re-work
Finish off formatting, remove useless comments

Commit finishes off formatting changes and removes useless, out-of-date,
comments.
2013-10-26 19:18:01 +00:00
5bf68a4769 ID: 46 - ipmi_fwum needs some re-work
KfwumGetInfoFromFirmware() - code formatting, simplify
2013-10-26 19:16:36 +00:00
4e2ac7d097 ID: 46 - ipmi_fwum needs some re-work
KfwumOutputInfo() -> printf_kfwum_info() + code formatting
2013-10-26 19:15:15 +00:00
d5d86d4dcb ID: 46 - ipmi_fwum needs some re-work
KfwumGetTraceLog() - code formatting, simplification
2013-10-26 19:14:43 +00:00
0a4a5cafbc ID: 46 - ipmi_fwum needs some re-work
KfwumStartFirmwareUpgrade() - code formatting
2013-10-26 19:13:43 +00:00
043c42160e ID: 46 - ipmi_fwum needs some re-work
KfwumGetStatus() - formatting, simplify, documentation
2013-10-26 19:12:44 +00:00
49879b387c ID: 46 - ipmi_fwum needs some re-work
KfwumShowProgress() - code formatting, fix

Commit fixes code formatting in KfwumShowProgress() and replaces ``unsigned
char'', which didn't make any sense, with a ``signed char'', resp. ``char''.
2013-10-26 19:11:33 +00:00
38121041c1 ID: 46 - ipmi_fwum needs some re-work
KfwumUploadFirmware() - code formatting
2013-10-26 19:10:16 +00:00
d8f27165d1 ID: 46 - ipmi_fwum needs some re-work
KfwumFinishFirmareImage() - code formatting
2013-10-26 19:09:15 +00:00
5a1e81a948 ID: 46 - ipmi_fwum needs some re-work
KfwumSaveFirmwareImage() - formatting, clean-up

Commit cleans up formatting, code and, hopefully, simplifies
KfwumSaveFirmwareImage().
2013-10-26 19:08:12 +00:00
f12b976ebc ID: 46 - ipmi_fwum needs some re-work
KfwumStartFirmwareImage() - code formatting, simplify
2013-10-26 19:07:04 +00:00
0dddcfe450 ID: 46 - ipmi_fwum needs some re-work
KfwumManualRollback() - code formatting, simplify
2013-10-26 19:06:28 +00:00
700658e91e ID: 46 - ipmi_fwum needs some re-work
KfwumGetDeviceInfo() - simplify, code formatting
2013-10-26 19:04:42 +00:00
3df72b68bc ID: 46 - ipmi_fwum needs some re-work
KfwumGetInfo() - simplify logic, code formatting
2013-10-26 19:03:54 +00:00
068bcb02e4 ID: 46 - ipmi_fwum needs some re-work
Rename KfwumValidFirmwareForBoard(), document

Commit renames KfwumValidFirmwareForBoard() to ipmi_kfwum_checkfwcompat() and
adds a bit of documentation about this function.
Code formatting of this function changed as well.
2013-10-26 18:38:24 +00:00
52634a708f ID: 46 - ipmi_fwum needs some re-work
KfwumGetFileSize() - small re-work
2013-10-26 18:37:45 +00:00
2b08fd405e ID: 46 - ipmi_fwum needs some re-work
KfwumMain() - change code formatting

Commit changes code formatting of KfwumMain() into readable form and to make
sense out of it.
2013-10-26 18:37:00 +00:00
fb3c6f292e ID: 46 - ipmi_fwum needs some re-work
Rename KfwumOutputHelp() to printf_kfwum_help()
2013-10-26 18:35:44 +00:00
d02492f1c7 ID: 46 - ipmi_fwum needs some re-work
Remove trailing tabs and white spaces.
2013-10-26 17:12:29 +00:00
9517cb332b ID: 46 - ipmi_fwum needs some re-work
ipmi_fwum_main() re-work.
2013-10-26 17:10:14 +00:00
ae96dd3229 ID: 50 - ipmi_hpmfwupg needs a clean up
I really don't believe you meant 'static' + function(), seriously.
2013-10-26 14:40:05 +00:00
968f5d6552 ID: 50 - ipmi_hpmfwupg needs a clean up
Rather major re-work of internal logic in HpmfwupgPreparationStage().
2013-10-26 14:18:48 +00:00
f4730e1f67 ID: 50 - ipmi_hpmfwupg needs a clean up
ComponentId has its own declaration now.
2013-10-26 07:08:13 +00:00
b782311e10 ID: 50 - ipmi_hpmfwupg needs a clean up
* print error if not enough parameters given, return code 1
* recognize 'help' as a valid parameter
* print error if a invalid parameter is given, return code 1
2013-10-26 06:55:18 +00:00
45d0a4255a ID: #279 ipmitool sdr list broken
Restoration of the interface target address and channel after a bridged
request was incorrectly tied to a non-zero saved target address.  This does
not work for the Openipmi interface because the default interface target address
for the Openipmi interface is zero by default.
2013-10-23 20:32:40 +00:00
ac9513025c ID: 50 - ipmi_hpmfwupg needs a clean up
Remove "changelog". That's why we have tickets, SCM, ChangeLog etc.
2013-10-11 04:45:55 +00:00
60a3e63429 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgQuerySelftestResult() - kill one level of indentation.
2013-10-11 04:14:59 +00:00
f19ed0a90b ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgUpgradeStage() - kill one level of indentation by changing one if().
2013-10-10 12:26:46 +00:00
7a0b451fd7 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgValidateImageIntegrity() - re-write a bit to make it more compact.
2013-10-10 12:17:22 +00:00
a8119d13a8 ID: 50 - ipmi_hpmfwupg needs a clean up
Add missing ``rsp == NULL'' comp.
2013-10-10 12:06:00 +00:00
f56cea1253 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgQueryRollbackStatus() - kill one level of indentation.
2013-10-10 12:04:52 +00:00
7b5683d85d ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgManualFirmwareRollback() - kill one level of indentation.
2013-10-10 11:56:04 +00:00
80c03570ac ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgActivateFirmware(), HpmfwupgGetUpgradeStatus() - kill one level of
indentation.
2013-10-10 11:49:53 +00:00
6de0796079 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgUploadFirmwareBlock() - kill a bit of indent by re-writing one if().
2013-10-10 11:42:32 +00:00
18aadc30d0 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgInitiateUpgradeAction() - kill unnecessary indent.
2013-10-10 11:33:27 +00:00
08f50ad301 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgAbortUpgrade() - simplify function.
2013-10-10 11:29:40 +00:00
b803224398 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetComponentProperties() - kill indent by rewriting two if() conditions.
2013-10-10 11:23:35 +00:00
5d3c64f028 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetTargetUpgCapabilities() - remove unnecessary if() and kill indent.
2013-10-10 11:13:44 +00:00
942dcb71d8 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetDeviceId() - simplify function.
2013-10-10 10:37:46 +00:00
29af592773 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetBuffersFromFile() - simplify function in order to kill unnecessary
indent. Also, notify user about malloc failure and exit early.
2013-10-10 10:17:33 +00:00
ada4b48baf ID: 50 - ipmi_hpmfwupg needs a clean up
Move struct and #define into header file where they belong.
2013-10-10 09:48:58 +00:00
47831b3c15 ID: 50 - ipmi_hpmfwupg needs a clean up
Commit changes code formatting only. No functionality changes have been made.
2013-10-10 09:14:50 +00:00
efdeb12724 ID: 44 - dummy interface support - fake-ipmistack project
Commit adds support for a 'dummy' interface in order to communicate with
fake-ipmistack.
2013-10-04 05:03:33 +00:00
c7412e5815 ID: 48 - Remove hard-coded FRU inventory access length restriction
The patch removes hard-coded 16-byte length restriction onf FRU inventory
transactions. Instead, it adds an optional command-line argument for devices
which need such restriction.
For other devices, 32 bytes cap length is used.
Also, the patch contains several code optimizations as well as several bug-fixes
in API implementations where absolute FRU device offsets were used instead on
relative.

Commit for Dmitry Bazhenov
2013-10-04 04:57:20 +00:00
041d8e4bf8 ID: 276 - HPM.1 upgrade combined patch
This patch does the following:
- Fixes percentage visualization for short upgrade images
- Resolves ambiguity for action record checksum calculation
- Skips the activation stage when all components are skipped
- Partially fixes formatting
- Adds several code optimizations

Commit for Dmitry Bazhenov
2013-10-04 03:49:58 +00:00
6a02cccb70 Updated for final 1.8.13 release 2013-09-09 15:45:53 +00:00
3d9c5ae746 ID: 273 - SOL Input buffer size. Reduce max_inbound_payload_size by the SOL
header size.  Committed for Liebig, Holger
2013-09-09 15:38:46 +00:00
49350157fe ID: 274 - bmc-snmp-proxy does not enable PEF alterting 2013-09-05 08:58:18 +00:00
c6f6550f27 update version string for rc1-cvs 2013-08-26 17:01:30 +00:00
ad86adac54 Update ChangeLog for ipmitool-1.8.13
Commit updates list of bugs fixed in 1.8.13
2013-08-23 18:47:38 +00:00
f04ccaf79e ID: 222 - 'lib/ipmi_sdr.c' - a typo 'Not Reading' -> 'No Reading'
Commit replaces spurious/confusing text 'Not Reading' wiht 'No Reading'
in 'lib/ipmi_sdr.c'.
2013-08-23 18:45:54 +00:00
fa74f3bf3a ID: 99 - 'lib/ipmi_sel.c' - possible int *flow
Commit handles possible int *flow via user input. atol()/make_int() calls
got replaced and, at least, 'errno' is being checked after strtol() calls
while reading data from file.

Reported-by: Duncan Idaho
2013-08-23 15:37:11 +00:00
8e95964938 ID: 242 - Incorrect DCMI Power Reading "IPMI timestamp" interpretation
The "IPMI timestamp" is being interpretted as a UTC time, when IPMI timestamps
are actually in localtime (to the BMC).

Commit for Rob Swindell
2013-08-23 15:23:13 +00:00
558bf55c41 ID: 229 - 'lib/ipmi_ekanalyzer.c' - a typo ``Too few argument!''
Commit replaces text in question and prints error text on STDERR.
2013-08-23 14:45:30 +00:00
393ae97425 ID: 266 - file descriptor leak in ipmi_fwum and ipmi_ekanalyzer
Commit fixes fd leaks in 'lib/ipmi_ekananlyzer.c' and 'lib/ipmi_fwum.c'.

Commit fixes file descriptor leaks in ipmi_ekanalyzer_fru_file2structure(),
source 'lib/ipmi_ekanalyzer.c', and in KfwumGetFileSize(),
source 'lib/ipmi_fwum.c'.

Reported-by: dcb
2013-08-23 14:39:52 +00:00
ee6c9be382 ID: 41 - ipmi_sel_interpret() - clean up formatting and kill indentation
Commit cleans up formatting and indentation in ipmi_sel_interpret()
in 'lib/ipmi_sel.c'.
2013-08-16 09:56:15 +00:00
5177966867 ID: 267 - Corruption in "lan alert print" output
Commit fixes corruption in 'lan alert print' output. This bug comes from two
consecutive calls to get_lan_param_select() which returns pointer to struct. In
the end, the second call would over-write data from the first one, as 'ptype'
and 'paddr' were pointing at the same address.

Thanks to Rob Swindell for logging this bug and testing the patch.
2013-08-16 09:36:17 +00:00
f6dbaf231b Added -cvs to the revision string so that cvs built version can be
differentiated from release built versions.
2013-08-15 16:43:17 +00:00
8cd3acb188 Commit adds ``ID: 269 - Fixes for configure.in for cross compilation''
to ChangeLog
2013-08-14 13:20:14 +00:00
2c6ca03f8a ID: 269 - Fixes for configure.in for cross compilation
Commit removes '-Wno-unused-result' from configure.in

This used to be tracked under ID#65.
2013-08-14 12:24:12 +00:00
aebc7d3616 ID: 65 - Fixes for configure.in for cross compilation
Check return values of scanf() in order to get rid off compiler warnings.

Commit for Dan Gora
2013-08-14 12:12:13 +00:00
157132be8c FR: 35 - Script to setup redirection of SNMP to/from BMC
Provides configuration script, systemd unit and sysconfig defaults.
On hosts running net-snmp and PEF alerting on BMC:
1. Redirect SNMP get requests to BMC (Service Processor).
2. Redirect SNMP Traps from BMC (Service Processor) to the Hosts' configured Trap sink.
2013-08-13 13:44:50 +00:00
8525fdd2a3 Added ``ID#264 - incorrect array index in get_lan_param_select()'' to ChangeLog 2013-08-13 05:20:49 +00:00
f8cecaa71a ID: 264 - incorrect array index in get_lan_param_select()
Commit fixes incorrect array index in get_lan_param_select(). The param value
matches the cmd in the lan_param struct, but it's not the same as the
ipmi_lan_params[] array index. Here is an example of what I mean. This problem
becomes apparent with the OEM extensions which use values 192+.

Commit for Jeff Bastian
2013-08-13 04:28:43 +00:00
a771107c47 Added ``ID#212 - 'lib/ipmi_dcmi.c' - possible int *flow'' to ChangeLog 2013-08-12 18:06:19 +00:00
afd015709b ID: 212 - 'lib/ipmi_dcmi.c' - possible int *flow
Commit replaces strtol() calls with appropriate str2*() ones in order to prevent
possible integer *flow via user input.
2013-08-12 18:03:10 +00:00
bfba2f83f5 ID: 3528308 - 'lib/ipmi_hpmfwupg.c' - possible int *flow
Commit replaces atoi() call with str2int() and puts a limit on accepted values
for Component ID to <0..7>.
2013-08-12 17:49:07 +00:00
8e94374cf1 Make date format YYYY-MM-DD 2013-08-09 18:04:22 +00:00
ced5794e48 Revision should be 1.8.13rc0 at this point 2013-08-08 17:28:01 +00:00
a298d2e704 Documentation, version, and admin changes in prep for 1.8.13 release 2013-08-08 16:46:52 +00:00
2d71d428f3 ID: 65 - Fixes for configure.in for cross compilation
Check return value of fread() in 'lib/ipmi_hpmfwupg.c'.

Commit for Dan Gora
2013-07-25 11:56:54 +00:00
2e5fbc878b ID: 65 - Fixes for configure.in for cross compilation
Fixed some printf() formatting warnings in 'lib/ipmi_fru.c'.

Commit for Dan Gora
2013-07-24 06:42:02 +00:00
8b7969a46f ID: 65 - Fixes for configure.in for cross compilation
Changes to ipmi_ekanalyzer_fru_file2structure() in order to get rid off
warnings.

Commit for Dan Gora
2013-07-24 05:47:11 +00:00
04ba23bc5d ID: 65 - Fixes for configure.in for cross compilation
Changes to ipmi_ek_display_board_info_area() in order to get rid off warnings.

Commit for Dan Gora
2013-07-24 05:42:23 +00:00
977c587fde ID: 65 - Fixes for configure.in for cross compilation
Commit makes small changes to ipmi_ek_display_product_info_area() in order to
get rid off warnings.
2013-07-24 05:37:12 +00:00
dd377108ee ID: 65 - Fixes for configure.in for cross compilation
Commit is a small re-work of ipmi_ek_display_chassis_info_area() (not limited)
to get rid off warnings.
2013-07-24 05:32:42 +00:00
4aea72e46f ID: 65 - Fixes for configure.in for cross compilation
Commit is a re-work of ipmi_ek_display_fru_header_detail() (not limited to) to
get rid off warnings.
2013-07-24 05:28:53 +00:00
39bcb37d14 ID: 104 'src/ipmishell.c' - possible int *flow
Commit replaces atoi() and strtol() calls in 'src/ipmishell.c' in order to
properly handle user input.
2013-07-24 04:32:14 +00:00
7770739372 ID: 65 - Fixes for configure.in for cross compilation
'src/plugins/imb/imbapi.c' - don't cast NULL to int, ever!!!
2013-07-22 08:35:23 +00:00
2ac947f6e1 ID: 65 - Fixes for configure.in for cross compilation
'lib/ipmi_dcmi.c' - return (-1) as the rest of the function does and don't
return NULL.
2013-07-22 08:34:09 +00:00
c94c7a5c86 ID: 65 - Fixes for configure.in for cross compilation
Fixed silly error where the return from fseek was compared to (unsigned
int) NULL, which makes no sense at all.

Commit for Dan Gora
2013-07-21 19:31:57 +00:00
4fdbe5bbd0 ID: 263 - ipmi_ek_display_fru_header() - file descriptor leak
Commit fixes small file descriptor leak which happens when error occurs.
2013-07-21 16:05:30 +00:00
c49bc06c39 ID: 65 - Fixes for configure.in for cross compilation
Commit is practically a re-work of ipmi_ek_display_fru_header() in order to
eliminate warnings.
Check those return values!

Commit for Dan Gora
2013-07-21 11:36:22 +00:00
55524327ce ID: 65 - Fixes for configure.in for cross compilation
NULL should never be cast to an int.

Commit for Dan Gora
2013-07-21 11:33:57 +00:00
85ff7dc46a ID: 262 - 'set' segfaults when no IPMI inf present
Commit fixes segfault in 'set' sub-command when no IPMI interface is
present/available. This is caused by 'intf->session' being used without check
whether it's NULL or not which leads to NULL reference in printf().
2013-07-18 03:20:10 +00:00
8c5013b0ba ID: 101 - 'lib/ipmi_sol.c' - possible int *flow
Fix function name - str2uint() -> str2uchar().
2013-07-18 03:10:55 +00:00
ea8ce15131 ID: 70 - Fixes and updates for ipmitool hpm
Fixed the hpm upgstatus command to print the results of the command
without having to specify -v to enable verbose operation.

It's not clear that this command is even useful to the user at all.
Perhaps it should be removed entirely.

Commit for Dan Gora
2013-07-17 10:45:56 +00:00
6d89531096 ID: 70 - Fixes and updates for ipmitool hpm
We now will print the decoded strings as well as the error value for
error response codes from the target.

Commit for Dan Gora
2013-07-17 10:42:19 +00:00
e56e914866 ID: 70 - Fixes and updates for ipmitool hpm
Update the help menu for the ipmitool hpm command.  Fix the formatting
and explain better the options.

Changed the option 'upgrade <file> all' to 'upgrade <file> force'.
This makes it clearer that the user is overriding the version check
that 'upgrade <file>' performs.

Commit for Dan Gora
2013-07-17 10:38:48 +00:00
cee8fc659a ID: 70 - Fixes and updates for ipmitool hpm
Added a new field to show the Deferred firmware version value as part
of the 'hpm check' subcommand.

The deferred firmware version is the version of the firmware which has
been loaded with the 'hpm upgrade' command, but not yet activated.

Commit for Dan Gora
2013-07-17 10:36:07 +00:00
25fa0f80ae ID: 70 - Fixes and updates for ipmitool hpm
There is no point in putting the size of things in hex.

Commit for Dan Gora
2013-07-17 10:32:56 +00:00
22e38bc46f ID: 70 - Fixes and updates for ipmitool hpm
Fixed a bug where the rolling percentage display could corrupt the
version line if the first call to HpmDisplayUpgrade resulted in a
non-zero percentage.

This was produced by performing:

ipmitool hpm upgrade hpm1fru.img

where hpm1fru.img is a small (820 byte) file.

We now call HpmDisplayUpgrade before we transfer any data to ensure
that we get 0% printed before the transfer starts.

Commit for Dan Gora
2013-07-17 10:30:23 +00:00
3bd53a2f78 ID: 70 - Fixes and updates for ipmitool hpm
Add two additional chars to the component name string.  For the
default Pigeon Point firmware names we need a couple of extra chars
to actually be able to tell what component is which.

Before:
-----------------------------------------------------
|ID | Name      |             Versions              |
|   |           |     Active      |     Backup      |
-----------------------------------------------------
|*0 |H8S-AMCc F/|   2.00 10000000 |   2.00 0F000000 |
| 1 |H8S-AMCc B/|   2.00 00000000 | ---.-- -------- |
| 2 |H8S-AMCc F/|   2.00 10000000 | ---.-- -------- |
-----------------------------------------------------

After:
--------------------------------------------------------
|ID  | Name        |             Versions              |
|    |             |     Active      |     Backup      |
--------------------------------------------------------
|*  0|H8S-AMCc F/W |   2.00 10000000 |   2.00 0F000000 |
|   1|H8S-AMCc B/L |   2.00 00000000 | ---.-- -------- |
|   2|H8S-AMCc F/I |   2.00 10000000 | ---.-- -------- |
--------------------------------------------------------

Commit for Dan Gora
2013-07-17 10:25:28 +00:00
30e4efe8a4 ID: 70 - Fixes and updates for ipmitool hpm
Added a '^' character to the ID field which will be set if the
component can be upgraded with the specified file with the 'hpm check
<file>' subcommand.

Commit for Dan Gora
2013-07-17 10:22:37 +00:00
bf8acad458 ID: 70 - Fixes and updates for ipmitool hpm
Update HpmfwupgPreUpgradeCheck to check if the Aux version is also
different when it compares the Image version to the active and
rollback versions.

Fixed the indenting and style of HpmfwupgPreUpgradeCheck to make it
more readable.

Commit for Dan Gora
2013-07-17 10:19:43 +00:00
2db7f5f6b9 ID: 259 - small memory leak in ipmi_user.c
Commit fixes a small memory leak in 'lib/ipmi_user.c' via strdup().
One typo got fixed in the process.
2013-07-16 17:41:19 +00:00
71dea69efc Squash white spaces in 'lib/ipmi_dcmi.c'
Commit squashes white spaces in 'lib/ipmi_dcmi.c'. Tabulators are used for
indentation now. I've tried to clean up comments, long lines, trailing white
spaces and tabs, code formatting. However, more work is needed especially in
ipmi_dcmi_main() where indentation level is reaching one too many.

No functional changes.
2013-07-16 11:07:24 +00:00
9f51d8f188 ID: 256 - ipmitool could crash when IPv6 address is returned
gethostbyname() can't handle IPv6. Despite this fact it seems worth of
nothing to check whether gethostbyname() really returned AF_INET or
not. And that's what attached patch does, resp. in case IPv6 is
returned then ipmitool shoud/will terminate.
2013-07-16 04:17:39 +00:00
8a40297308 ID: 257 ipmitool exec segfaults if invalid input given
Commit mitigates segfault in 'exec'/ipmishell when
invalid input is given. Code expects another _'_ or _"_ to come, but
if it doesn't, it ends up r/w unallocated memory.
2013-07-16 04:12:09 +00:00
fb5d8559e6 ID: 101 - 'lib/ipmi_sol.c' - possible int *flow
Don't make ref out of ref -> segfault.
2013-07-13 03:51:49 +00:00
2a260d32e9 ID: 260 - ipmi_user.c - replace atoi() call
Commit replaces deprecated atoi() call.
2013-07-12 12:35:19 +00:00
94c0bd0a6c ID: 101 - 'lib/ipmi_sol.c' - possible int *flow
Commit replaces unhandled strtol() calls with appropriate str2*() functions and
wrappers.

Reported-by: Duncan Idaho
2013-07-12 12:06:08 +00:00
3cb937f15e Use tabs instead of white spaces for indentation in 'lib/ipmi_chassis.c'. 2013-07-10 04:22:12 +00:00
edc700ed9a Added code to support sensors on other luns (On behalf of Kontron Germany) 2013-07-09 12:25:12 +00:00
287b313e26 ID: 113 - delloem exec file won't handle more than one command
Commit fixes issue with 'delloem' subcommands being executed via 'exec'. State
of variable 'current_arg' is kept between calls which leads to incorrect argv
parsing.
Set variable 'current_arg' every time ipmi_delloem_main() is called.
2013-07-09 11:10:03 +00:00
47d53000ce ID: 211 - 'lib/ipmi_dcmi.c' - typo & error printed on STDOUT
Commit fixes couple typos and replaces incorrect printf() calls with appropriate
lprintf() ones.
2013-07-09 05:00:42 +00:00
66399810f0 ID: 153 - 'lib/ipmi_firewall.c' - printf() used instead of lprintf()
Commit adds printf_firewall_info_usage().
2013-07-09 04:32:33 +00:00
0ab78dbf02 ID: 153 - 'lib/ipmi_firewall.c' - printf() used instead of lprintf()
Use lprintf() for error/help messages.
2013-07-09 04:20:17 +00:00
c048c9f311 ID: 93 - 'lib/ipmi_firewall.c' - str-to-int conversion is weak
Commit does:
* adds is_ipmi_channel_num() in 'lib/helper.c' for IPMI Channel validation
* replaces unhandled strtol() calls in 'lib/ipmi_firewall.c'
2013-07-09 03:42:37 +00:00
c32228d7c1 ID: 226 - 'lib/ipmi_sdradd.c' - typo
Fix I2c -> I2C.
2013-07-08 09:55:29 +00:00
a855c37619 ID: 258 - ipmi_sdradd.c - error printed on STDOUT
Commit changes printf("...") -> lprintf(LOG_ERR, "...");
2013-07-08 09:54:08 +00:00
6a66405177 ID: 226 - 'lib/ipmi_sdradd.c' - redundant newline
Commit removes redundant new-lines from error messages in 'lib/ipmi_sdradd.c'.
2013-07-08 09:51:03 +00:00
4a4331ef6d ID: 255 Fix some typos in ipmitool.1 (Debian Bug #554348)
Commit fixes couple typos in ipmitool's man page.

Commit for Stéphane Aulery
2013-07-08 08:42:55 +00:00
41288eb5e4 ID: 161 - documentation
Commit contains following documentation changes and related code usage changes:
* sorted arguments
* sorted command line commands
* adds missing arguments
* adds hidden aliases arguments with note of deprecation (feel free to remove if
  not deprecated)
* fixes incomplete synopsis
* restructures synopsis to logical blocks
* conditional argument and command combination overrides to fixed defaults

Commit for Ales Ledvinka
2013-07-08 08:29:20 +00:00
dbd2db71f2 ID: 253 - Fix lanplus retransmission
Retransmission of lanplus request is broken. ipmi_lanplus_send_payload() keeps
current timeout in local variable 'timeout' and increases it by one with each
retransmission. But ipmi_lan_poll_recv() waits for response for session->timeout
seconds, which is not incremented -> the request is retransmitted only once,
when timeout and session->timeout equals. No other retransmissions are ever
sent.

In addition, the time is measured in seconds, therefore 'time(NULL) - ltime'
often equals 'timeout' and retransmission should be sent in this case (i.e.
'xmit' should be set).

Commit for Jan Safranek
2013-07-07 15:28:13 +00:00
a472c382f4 ID: 254 - Fix retry of authentication capabilities retrieval
When lan or lanplus session is being opened, ipmi_get_auth_capabilities_cmd() is
called twice. Now that we have -R and -N options it's not necessary to have such
weird code, especially with comment ``I'm not sure why we accept a failure for
the first call''.

Commit for Jan Safranek
2013-07-07 15:22:10 +00:00
e8125c2405 ID: 244 - "0.0" displayed for unspecified threshold values
Not all SEL entries have a "threshold value" specified, yet ipmitool sel elist
always displays a threshold value (as "0.0"), even when one is not specified.

Commit for Rob Swindell
2013-07-07 12:42:42 +00:00
c0f41fa647 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_macinfo() - return (-1) on error
2013-07-07 12:07:21 +00:00
5c74d2935e ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_delloem_lan_main() - return (-1) on error.
2013-07-07 12:06:21 +00:00
cd6b7039f0 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_powermgmt_clear - remove pointless if-else
Set clearType to 1 by default, so there is no need for if-else anymore.
2013-07-07 12:05:11 +00:00
b4cb02a4d9 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Remove `` )'' - white space.
2013-07-07 12:03:42 +00:00
91fdb17260 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Don't ``function ()'' - remove white space.
2013-07-07 12:02:05 +00:00
2302e83db5 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_lcd_set_single_line_text - invalid retval - Return (-1) on error as
specified instead of 1.
2013-07-07 11:58:13 +00:00
b0294b96fd ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
pmi_macinfo_drac_idrac_mac - simplify - Return immediately if NicNum doesn't
meet expectations or UseVirtualMacAddress isn't 0.
2013-07-07 11:56:47 +00:00
f1f2cbb18b ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_macinfo_drac_virtual_mac - simplify - Return immediately if NicNum doesn't
meet expectations.
2013-07-07 11:54:36 +00:00
eb65a625a2 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_lcd_get_info - simplify - Remove pointless ``if () { } else { }'' and
return immediately on error.
2013-07-07 11:52:06 +00:00
516fe51505 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_lcd_get_info_wh - simplify - Remove pointless ``if () { } else { }'' and
return immediately on error.
2013-07-07 11:49:19 +00:00
5d5251f7da ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_get_power_consumption_data - simplify - If rsp is NULL or ccode is not 0,
then return immediately.
2013-07-07 11:47:49 +00:00
5819b314af ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Remove unnecessary if() from ipmi_print_power_cnsmpt_history().
2013-07-07 11:43:10 +00:00
630934cb89 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_get_sd_card_info - return (-1) if no SD card is present.
2013-07-07 11:41:27 +00:00
d44be6e5f5 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Don't prefix error message with extra white space(s).
2013-07-07 11:39:15 +00:00
078ff3a04e ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
lprintf() doesn't need '\n', so don't give it one.
2013-07-07 11:34:59 +00:00
865c435b4c ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_delloem_vFlash_process() - use two lprintf() calls instead of one combined.
2013-07-07 11:29:23 +00:00
1d9dd4e2de ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Re-format all usage functions.
2013-07-07 11:28:00 +00:00
e95a4cf998 ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Don't ``printf (...)'' -> ``printf(...)''.
2013-07-07 11:26:45 +00:00
38f89a449d ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
Use lprintf() instead of printf() for error messages.
2013-07-07 11:24:45 +00:00
64e0b9ab64 ID: 239 - typo in 'mc selftest', add details
Commit fixes a typo and adds details to 'mc selftest' command.

Commit for Rob Swindell
2013-06-10 04:14:21 +00:00
e30f3726a6 ID: 143 - Reversed 'channel authcap' capabilities
Commit fixes reversed IPMIv1.5/2.0 'channel authcap' capabilities
in 'include/ipmitool/ipmi_channel.h'.

Commit for Rob Swindell
2013-06-10 04:05:54 +00:00
63ba1cc610 ID: 3587318 - "dcmi discover" is not DCMI 1.5 compatible
Command "dcmi discover" fails with ``ERROR! This command is not available on this
platform'' unless the DCMI implementation advertises DCMI 1.0 or 1.1 conformance.
This means command will fail DCMI 1.5 capable hardware. Commit fixes this issue.

Commit for Rob Swindell
2013-06-02 13:19:57 +00:00
384618d1bc ID: 3612237 - If DCMI command fails, incorrect completion code is printed
If any DCMI command fails, the function chk_rsp() in ipmi_dcmi.c displays the
incorrect byte as the completion code.

$ ipmitool dcmi power activate
DCMI request failed because: Unspecified error (dc)

The "dc" value printed is actually the "Group extension identification" byte
which *always* has the value 0xdc for DCMI responses.

Commit for Rob Swindell
2013-06-02 12:58:47 +00:00
b0020e0bae ID: 3612382 - Typos in 'dcmi' help output
Commit fixes typos in DCMI help output.

Commit for Rob Swindell
2013-06-02 12:51:05 +00:00
7a861ffba6 ID: 3612371 - Typo in impi_sel debug output
IANA is decimal, so don't prefix it with '0x'.

Commit for Rob Swindell
2013-06-02 12:45:01 +00:00
811da1307a ID: 3612372 - Recognize Broadcom IANA number and BCM5725 product
Commit adds BCM IANA and BCM5725 product number.

Commit for Rob Swindell
2013-06-02 12:38:23 +00:00
8489426a63 ID: 3608003 - 'lib/ipmi_fru.c' - atol() should be replaced with str2*()
Commit replaces atol() calls with str2int() ones in 'lib/ipmi_fru.c'.
2013-06-02 12:27:41 +00:00
dbe514a558 ID: 3613042 - add missing Entity IDs
Commit adds missing Entity IDs as defined by 43.14 Entity IDs, IPMI
Specification, V2.0, Markup for Addendum, Rev. 4.

Reported-by: Ulrich Windl
2013-06-02 12:24:36 +00:00
d5ab51f2cd ID: 3611905 - Direct Serial Basic/Terminal Mode Interface drivers
The patch adds support for direct serial interface drivers (Terminal and Basic
mode).
Despite both drivers implement single and double bridging, it doesn't work at
the moment. Making this functionality to work depends on outcome of
ID#3611226(?).

Commit for Dmitry Bazhenov
2013-05-28 07:38:55 +00:00
0cea01e42f ID: 3611254 - OEM handle for Intel 82751 in SPT mode
Intel 82751 MAC has several deviations in its RMCP+ implementation while working
in the super pass-through mode.
This patch adds a OEM handle which allows IPMItool succesfully interract with
boards equipped with this NIC.

Commit for Dmitry Bazhenov
2013-05-28 04:18:22 +00:00
38d71179e9 ID: 3613575 - memory leak - ipmi_password_file_read()
Commit fixes memory leak in ipmi_password_file_read() in 'lib/ipmi_main.c'.
2013-05-23 03:34:14 +00:00
cc48c433fd ID: 3522740 - reading password from file is limited to 16byte passwords
Commit fixes switched values(const<->size) passed to memset().
2013-05-22 13:51:40 +00:00
51dd9cf1f0 ID: 3613605 - 'lib/ipmi_main.c' - call free() on pointer to static data
getpass() and getpassphrase() library functions return pointer to a static
data array. When free() is called on such pointer, it abnormally terminates
application.

Commit for Dmitry Bazhenov
2013-05-22 10:16:59 +00:00
44247a8743 ID: 3522740 - reading password from file is limited to 16byte passwords
Reading password from file is no longer limited to 16bytes.

Reported-by: Dune Idaho
2013-05-22 10:05:06 +00:00
d82a29d813 ID: 3528308 - 'lib/ipmi_hpmfwupg.c' - possible int *flow
Commit replaces strtol() calls with str2uchar() ones in order to mitigate
possible *flow via user input.
Also, limits are applied to 'Component ID' and 'Properties selector' now.

Reported-by: Dune Idaho
2013-05-22 09:50:10 +00:00
c5324e879c ID: 3528371 - 'lib/ipmi_sensor.c' - possible int *flow
Commit replaces strtod() calls with str2double() ones in order to mitigate
possible *flow via user input.

Reported-by: Dune Idaho
2013-05-22 09:45:30 +00:00
a8f6341728 ID: 3528310 - 'lib/ipmi_picmg.c' - possible int *flow
Commit replaces atoi() and strtoul() calls with wrappers in order to prevent
possible int *flow via user input.
Also, limits on user provided values are applied wherever possible.

Reported-by: Dune Idaho
2013-05-18 06:31:02 +00:00
7472986e1c ID: 3528310 - add str2char(), move is_fru_id() into 'lib/helper.c'
Commit adds new function str2char() into 'lib/helper.c'. Also, function
is_fru_id() moves from 'lib/ipmi_fru.c' into 'lib/helper.c' in order to be
utilized by other modules.
2013-05-18 06:08:13 +00:00
72dd3edde4 "Bridging fixes for PICMG Platforms. Interface is always opened prior to
first IPMI request.  Addition of macro to determine necessity of sensor
bridging and PICMG target address discover.   See ID: 3611226"
2013-05-06 14:08:56 +00:00
cf6740b3f6 Add missing newlines when cvs output is specified see ID 3611912 for details 2013-04-26 20:52:43 +00:00
14e26ac8a0 ID: 3611253 - configure.in - do not override OS-default values for interfaces
Commit fixes bug where OS default values were over-ridden if the corresponding
enable/disable arguments weren't provided via command-line parameters.
Commit also changes IPMI shell default configuration setting from 'yes' to
'auto'.

Commit for Dmitry Bazhenov
2013-04-26 19:16:31 +00:00
cee211da31 ID: 3611253 - configure.in - fixed build for the newer autotool releases
Commit for Dmitry Bazhenov
2013-04-25 08:50:53 +00:00
3818c0d296 ID: 3611253 - Don't print AUX info if IPMC returns 12byte Get Device ID response
Commit for Dmitry Bazhenov
2013-04-25 08:40:56 +00:00
ae05861b62 ID: 3611253 - 'lib/ipmi_sel.c' - avoid reading of uninitialized data
Zero data before making request in order to avoid reading of uninitialized data
in ipmi_sel_add_entry().

Commit for Dmitry Bazhenov
2013-04-25 08:29:45 +00:00
c29cf4bcd3 ID: 3611303 - 'src/plugins/lan/lan.c' - error check is missing braces
Fixed a bug where connecting to a remote shelf manager via the lan
interface would always fail with:

``Activate Session error: Session sequence out of range Error: Unable
to establish LAN session''

This is due to a bug introduced in get_random() by fix for ID#3600963 where
braces were missing from an error check.

Commit for Dan Gora
2013-04-25 07:50:45 +00:00
723e3da037 ID: 3611306 - 'lib/ipmi_tsol.c' - fix always fail in case of error
Commit fixes bug introduced by fix for ID#3600946 where
an error case was missing braces, so it would always fail.

Commit for Dan Gora
2013-04-25 07:43:07 +00:00
c72afa37ee ID: 3608760 - Add bswap.h to ipmi_chassis.c and ipmi_pef.c
ID: 3564701 - ipmitool 1.8.12 doesn't build on big endian architectures

Compilation would fail on big endian architecture because BSWAP_32 was not
defined in 'ipmi_chassis.c' and 'ipmi_pef.c'.

The problem was '#include <ipmitool/bswap.h>' depended on WORDS_BIGENDIAN which
comes from '<config.h>'. However, none of the previous header files
would include '<config.h>', so it remained undefined.

'bswap.h' gets included unconditionally now.

Commit for Dan Gora
2013-04-25 07:34:44 +00:00
fa5bdb2f3d ID: 3608765 - improve debug output in ipmi_ekanalyzer_fru_file2structure()
Format the records a little more clearly by adding offsets.

Commit for Dan Gora
2013-04-23 07:28:53 +00:00
49784a9ec8 ID: 3608765 - Fix indentation of ipmi_ek_create_amc_p2p_record()
Commit changes indentation and formatting in ipmi_ek_create_amc_p2p_record().

Commit for Dan Gora
2013-04-22 11:12:11 +00:00
d1d404fef4 ID: 3608765 - Fix signed offset in ipmi_ekanalyzer_fru_file2structure
If the offset was greater than 127, then the multi_offset would end
up being a negative value, which is not what we want.

Commit for Dan Gora
2013-04-22 10:31:50 +00:00
de1dee44bd ID: 3608765 - ipmi_ekanalyzer_fru_file2structure would return error
ipmi_ekanalyzer_fru_file2structure would return ERROR_STATUS even if
it finished sucessfully.

Commit for Dan Gora
2013-04-22 10:18:11 +00:00
e1728327f6 ID: 3608765 - Fix printing in ipmi_ek_display_amc_p2p_record()
Change the amc channel descriptor ports to be displayed in decimal
instead of hex. This matches the 'fru -v' output in ipmitool.

Add decimal value of Link Asymetric Match values. So people don't have to
look up the value in the source or in the PIGMG spec.

Commit for Dan Gora
2013-04-22 10:05:53 +00:00
3b77db9a86 ID: 3608765 - ipmi_ekanalyzer.c - fix reading amc channel and link descriptors
Due to a bug in gcc where unaligned bit fields were not packed correctly
before gcc 4.4, we changed the fru_picmgext_amc_channel_desc_record
and fru_picmgext_amc_link_desc_record structures to use
larger types to be packed correctly. This then requires
us to use the FRU_PICMGEXT_AMC_CHANNEL_DESC_RECORD_SIZE and
FRU_PICMGEXT_AMC_LINK_DESC_RECORD_SIZE defines instead of sizeof for
these structures.

Updated ipmi_ek_create_amc_p2p_record() and
ipmi_ek_display_amc_p2p_record() to read data in the correct byte order
on both big and little endian machines.

Commit for Dan Gora
2013-04-22 09:50:53 +00:00
2abad0e504 ID: 3608757 - ipmi_fru.h/ipmi_fru.c - various fixes
Fixed several bugs with printing out the Carrier and AMC connectivity
information with 'ipmitool -v fru'

There were several bugs that were caused due to using bitfields with
char types in ipmi_fru.h. GCC versions before v4.4 had a bug where
they did not pack the bitfields correctly if the bitfields were not
cleanly aligned with the underlying char type.

Fixed and cleaned up all other PICMG FRU records.

Commit for Dan Gora
2013-04-22 08:37:13 +00:00
0411186443 ID: 3608765 - Fixed big endian bug in ipmi_ek_display_carrier_connectivity.
Fixed a bug where the carrier connectivity point to point descriptor
was not being displayed properly when compiled on big endian machines.

Commit for Dan Gora
2013-04-18 08:45:50 +00:00
1e96d20277 ID: 3608765 - Fixed bug reading length in fru info on big endian machines
Fixed bugs in ipmi_ek_display_chassis_info_area(),
ipmi_ek_display_product_info_area(), and
ipmi_ekanalyzer_fru_file2structure() where fread was being called to
read one byte of data into a int or long data type. This would result
in the value being byte swapped since the byte was read into the most
significant byte of the int (ie byte 0) on big endian machines.

Commit for Dan Gora
2013-04-18 08:27:33 +00:00
de4de4fc96 ID: 3608765 - Fixed bug in ipmi_ek_display_board_info_area()
Previous versions were not setting the file_offset properly if a Custom
board type was found, which would prevent subsequent dissectors from
operating properly and terminating the output of 'ipmitool ekanalyze
frushow oc=<atca carrier fruinfo>' early.

Rewrote ipmi_ek_display_board_info_area() to fix indentation and
to properly set the file_offset and end the while loop if a Custom
board_type was found.

Previous versions were also abusing the board_length variable,
treating it as an int and using it to break out of the loop.

Commit for Dan Gora
2013-04-18 07:57:26 +00:00
4299cfa385 ID: 3608765 - 'lib/ipmi_ekanalyzer.c' - reverse checks to reduce indentation
Rewrote ipmi_ek_display_chassis_info_area,
ipmi_ek_display_product_info_area, and
ipmi_ekanalyzer_fru_file2structure to reverse the checks of error
conditions to reduce the amount of indentation required.

Commit for Dan Gora
2013-04-15 11:33:17 +00:00
184994586e ID: 3608763 - 'lib/ipmi_sdr.c' - update main help
Commit updates main help of 'lib/ipmi_sdr.c'. Changes:
* LOG_ERR -> LOG_NOTICE
* add error messages, eg. Invalid command, Not enough parameters etc.
* handle 'sdr fill INV_PARAM'
* return codes on error
* general fixes and changes of SDR help output

Reported-by: Dan Gora
2013-04-15 08:24:13 +00:00
692861f292 ID: 3608763 - 'lib/ipmi_sdr.c' - fix 'nosats' -> 'nosat'
I forgot to modify size of compared string passed to strncmp() while changing
'nosats' to 'nosat'.
2013-04-12 14:52:14 +00:00
39408ea589 ID: 3608763 - ipmi_sdr_print_type() print error if sensor not found
'sdr type <TYPE_OF_SENSOR>' - print error message if sensor of given type
was not found.

Commit for Dan Gora
2013-04-12 13:11:26 +00:00
1602e0a7a2 ID: 3608763 - 'lib/ipmi_sdr.c' - fix 'nosats' -> 'nosat'
Commit fixes typo in strncmp() comparison of argv and changes 'nosats'
to 'nosat'.

Commit for Dan Gora
2013-04-12 13:01:07 +00:00
f074f76620 ID: 3608765 - 'lib/ipmi_ekanalyzer.c' - multiple increments in args to printf()
Performing prefix or postfix increments, eg. ++var or var++, in the
arguments to printf is inherently non-portable and may give different
results on different platforms.
Commit mends this issue.

Commit for Dan Gora
2013-04-09 10:20:02 +00:00
87e6c7279d ID: 3608765 - Remove unused variables from ipmi_ekanalyzer_ekeying_match().
Commit removes unused local variables from ipmi_ekanalyzer_ekeying_match().

Commit for Dan Gora
2013-04-09 10:00:40 +00:00
1f1dc806fe ID: 3608765 - Fix spelling of ipmi_ek_diplay_carrier_connectivity()
Commit corrects spelling of function ipmi_ek_display_carrier_connectivity().

Commit for Dan Gora
2013-04-09 09:55:03 +00:00
8afb3c315b ID: 3608763 - 'lib/ipmi_sdr.c' - display hex values of Sensors
Commit adds the hex value for the sensor type to displays so that the user
can correlate sensor type values with their hex values without having to
look them up in the IPMI spec.

Commit for Dan Gora
2013-04-09 08:38:31 +00:00
4aae41904d ID: 3608763 - Update sensor_type_desc values to differentiate watchdogs
Previous versions had two values for "Watchdog" in the list which
means that users could not perform # ipmitool sdr type "Watchdog";
and get the IPMI v1.0 and later version of the watchdog sensor,
eg. 0x23 instead of 0x11.

Commit for Dan Gora
2013-04-09 08:08:20 +00:00
41a44b037f ID: 3608759 - Remove '-Wno-packed-bitfield-compat' from CFLAGS
Commit removes -Wno-packed-bitfield-compat from 'configure.in'. This was hiding
an important bug in ipmi_fru.h and is not a valid flag for older versions of
gcc.

Commit for Dan Gora
2013-04-09 07:38:35 +00:00
49a7ceee70 ID: 3608761 - 'lib/ipmi_main.c' - PICMG Get Device Locator was never run
This code was moved to ipmi_main.c from open.c and in the change a bug
was introduced where the PICMG Get Device Locator command would not
be run unless the user explicitly set my_addr to 0 with the -m command.

The more sensible thing to do is to run this unless the user explictly
overrides it with the -m option.

Commit for Dan Gora
2013-04-08 17:46:17 +00:00
3687a6cbb8 ID: 3608762 - 'lib/ipm_hpmfwup.c' - Fixed help messages for hpm command
Commit cleans up the formatting of help output a bit to fit on an 80 column
screen.

Commit for Dan Gora
2013-04-08 17:36:33 +00:00
627cadaa39 ID: 3608759 - Fix bug in configure.in when cross compiling
The previous test to see if we need pragma pack(1) was failing if we
cross compile because there was no way to run the test.

We now use AC_TRY_COMPILE and add the pragma pack(1) to the test code.
If it compiles, it must be good, so add the define.

Commit for Dan Gora
2013-04-08 17:29:24 +00:00
eb63058bc3 ID: 2871903 - ipmitool user priv incorrectly sets Link Auth
Commit fixes issue in 'user priv' sub-command which turns off LinkAuth whenever
user's privilege is changed. This was caused by not setting apropriate bits.
However, fix leverages Set User Access Command(IPMI spec. v2 PDF, p.320) and
sets 7th bit of 1st byte to 0. This tells BMC not to change IPMI messaging,
LinkAuth and Callback for given user.

As a consequence, ipmitool no longer turns 'IPMI messaging' on by default when
user's privilege is being set. IPMI messaging can be turned on/off via 'channel
setaccess' sub-command.

Reported-by: Kipp Glover
2013-04-08 17:21:38 +00:00
15f1255237 ID: 3610286 - 'lib/ipmi_sdr.c' - ipmi_sdr_print_type - incorrect eval
Commit fixes incorrect evaluation of str2uchar() return value in
ipmi_sdr_print_type(). Prior to this fix, practically no user input was accepted
as a valid one in # ipmitool sdr type HEX_SENSOR_TYPE ;

This bug was introduced by ID#3528368 - 'lib/ipmi_sdr.c' - possible int *flow
2013-04-08 17:04:34 +00:00
2dfa02ba24 Fix "help" command line processing in fru command defect (ID: 3610117)
introduced by the following changes:

ID: 3582307 - 'lib/ipmi_fru.c' - ipmi_fru_main() return codes
ID: 3582310 - 'lib/ipmi_fru.c' - ipmi_fru_main() - misuse of printf()
2013-04-08 13:22:34 +00:00
9d6a201911 ID: 3608758 - 'include/ipmitool/ipmi.h' - add IPMI_NETFN_OEM
Commit adds IPMI_NETFN_OEM code 0x2E for completeness.

Commit for Dan Gora
2013-04-04 11:54:00 +00:00
ad01921281 ID: 3609985 - delloem : Wrong MAC returned when flex addressing is enabled
Commit fixes problem in 'lib/ipmi_delloem.c'. Command % ipmitool delloem mac;
returns wrong MAC when flex addressing is enabled on the blade chassis.

Commit for Krishnaprasad K
2013-04-04 07:27:11 +00:00
d27d2f7ae3 ID: 3016359 - Get SEL Alloc Information is incorrect
The Information given by the command SEL was incorrect in "Get SEL Allocation"
command. According to the specification "byte 10" in response denotes the
"Maximum record size in allocation units". This information is given as "Max
Record Size : " in sel command. However, ipmitool was getting "byte 9" instead
of "byte 10".

Commit for Gokulakannan
2013-04-02 10:37:15 +00:00
26c17eeb91 ID: 3600933 - 'lib/ipmi_sol.c' - use of deprecated bzero()
Commit replaces deprecated bzero() call with memset().

Commit for Ales Ledvinka
2013-03-30 06:37:51 +00:00
fdbef84866 ID: 3609472 - Add the instance to the SOL commands
The SOL protocol supports multiple serial ports using the "instance",
allow this to be passed in to ipmitool.

Commit for Corey Minyard
2013-03-29 21:01:10 +00:00
3a383608dd ID: 3609473 - Add assertion/deassertion to threshold events
The event data and SDRs support assertions and deassertions for threshold events
as well as discrete events. So print out assertion and deassertion on all
events.

Commit for Corey Minyard
2013-03-29 18:45:16 +00:00
66fcf484a4 ID: 3600911 - 'lib/ipmi_fru.c' - fix multiple increments in args to printf
Commit fixes multiple increments in arguments of printf() which leads to
undefined/inconsistent behaviour and results.

Reported-by: Ales Ledvinka
2013-03-29 14:52:59 +00:00
52c07d61f9 ID: 3608149 - ipmitool - set pointer to NULL after free()
Commit is a response(and fix) to double-free bug in 'lib/ipmi_main.c' via
username. Now, pointers should be set to NULL after calling free().

Reported-by: Ales Ledvinka
2013-03-29 14:40:21 +00:00
fd752420ec ID: 3608261 - 'lib/ipmi_delloem.c' - code formatting
Commit changes code formatting in 'lib/ipmi_delloem.c' to be more consistent
with the rest of ipmitool's code. No functional changes are intended.
Clean up isn't perfect, but it's one of steps in long term effort.
2013-03-21 14:07:50 +00:00
7a74ab32a8 ID: 3608022 - 'lib/ipmi_fru.c' - unsigned errors
Commit removes 'size' check from ipmi_fru_get_multirec_from_file() as
an unsigned value can't be less than zero(0).
This error has been introduced by ID#3600911.

Reported-by: Ales Ledvinka
2013-03-21 11:32:09 +00:00
3ea41bda4b ID: 3607981 - 'lib/ipmi_lanp.c' - replace atoi() calls
Commit replaces atoi() calls with str2uchar() ones to eliminate possible int
*flow via user input.
2013-03-21 09:37:57 +00:00
992b42ceee ID: 3607320 - 'lib/ipmi_lanp.c' - possible NULL reference
Commit fixes possible NULL reference in 'lib/ipmi_lanp.c' which is caused by not
checking return value of get_lan_param(), resp. get_lan_param_select(). This
function can return NULL in certain situations.
2013-03-19 19:53:52 +00:00
002c8becf4 REVERT - ID: 3608261 - FReq - 'lib/ipmi_delloem.c' - clean up the code
I'm reverting previous commit. I'm not sure what happened, but there is a huge
difference between what got committed, what came as a diff in e-mail and what
should have been committed in the first place.
2013-03-16 21:15:21 +00:00
6f1bd51f1e ID: 3608261 - FReq - 'lib/ipmi_delloem.c' - clean up the code
Commit removes trailing white spaces and tabs in 'lib/ipmi_delloem.c'.
2013-03-16 20:15:07 +00:00
4719d371b7 ID: 3608007 - 'lib/ipmi_session.c' - typo in error message
Commit fixes typo in error mesage in ipmi_session_main().
2013-03-14 12:41:48 +00:00
ba9a313911 ID: 3600926 - 'lib/ipmi_lanp.c'
Commit replaces condition ``if (p == NULL)'' in get_lan_param_select(). This
condition is never met, because structure is on heap.
Condition is replaced by for() control structure which goes through structure
ipmi_lan_params and checks whether requested LAN parameter is defined in
structure or not.

Reported-by: Ales Ledvinka
2013-03-14 08:38:32 +00:00
4a9af33734 ID: 3528247 - 'lib/ipmi_delloem.c' - fix possible *int flows
Commit fixes possible integer *flows in 'lib/ipmi_delloem.c'. Function
make_int() is removed and replaced with calls to appropriate str2*() function
calls from 'lib/helper.c'.

Reported-by: Duncan Idaho
2013-03-14 05:33:37 +00:00
e320e266b1 ID: 3576212 - 'lib/ipmi_event.c' - better rsp handling
Commit changes handling of response in ipmi_event_fromsensor(). If ccode doesn't
equal to 0, then error message is printed and function returns.

Reported-by: Duncan Idaho
2013-03-14 05:29:50 +00:00
95df7b2499 ID: 3607393 - 'lib/ipmi_event.c' - redundant '\n' in error message
Commit removes redundant '\n' in error message.
2013-03-11 14:09:33 +00:00
665f2f7ee9 revert back to the 1.8.11 default cipher suite of 3, ID: #3571371, #3576112 2013-03-11 13:10:23 +00:00
e99e525a53 ID: 3600911 - 'lib/ipmi_fru.c' - rewrite of ipmi_fru_get_multirec_from_file()
Commit is a rewrite of function ipmi_fru_get_multirec_from_file() in
'lib/ipmi_fru.c'.
Changes:
* argument size is checked; size must be greater than 0
* argument pFileName is checked
* return value of seek() is checked
* error messages are printed on STDERR
* code flow got a re-work
2013-03-08 20:32:07 +00:00
39ad0d62cc ID: 3603419 - 'lib/ipmi_dcmi.c' - waste of resources
Commit moves one #ifdef upwards in the code, so resources are not wasted
pointlessly. There is no need to allocate memory for variables/structs and open
interface, if we're about to quit immediately because LAN+ support is not
enabled.
Error message got changed as well and it gets printed on STDERR where it
belongs!
2013-03-08 06:39:54 +00:00
db56cc3f86 Do not bridge in-band ipmi requests when -m <local_addr> is specified without -t <target_address> on the command line. Prior to this change -m <local_addr> would always attempt to bride the request becaues the default target_address was being set to 0x20 instead of zero. ID: 3605313 2013-03-05 18:49:09 +00:00
108dc8aa0b ID: 3600911 - 'lib/ipmi_fru.c' - retval ipmi_fru_get_adjust_size_from_buffer()
Commit changes return value of ipmi_fru_get_adjust_size_from_buffer() from void
to int in order to determine whether call was successful or wasn't.
ipmi_fru_upg_ekeying() got re-work as well.

Changes to ipmi_fru_get_adjust_size_from_buffer():
* CHUNK_SIZE removed
* code formatting
* return value void -> int

Changes to ipmi_fru_upg_ekeying():
* check whether pFilename is NULL
* check return values of called functions
* re-work code - return early on error instead of nested if()
* added (error) messages
2013-03-05 05:00:32 +00:00
b6c97d8318 compile fix. see previous revision diff and comment for code change reason 2013-02-20 14:35:07 +00:00
fd2ab0b7bb ID: 3600911 - 'lib/ipmi_fru.c' memory leaks
Commit fixes memory leanks in functions ipmi_fru_set_field_string() and
ipmi_fru_set_field_string_rebuild() in 'lib/ipmi_fru.c'.

Note: it seems to me like these for() cycles do nothing.

Reported-by: Ales Ledvinka
2013-02-20 13:14:37 +00:00
8c91abfa19 ID: 3600910 - make ipmi_lcd_get_platform_model_name() to return int
Commit changes function ipmi_lcd_get_platform_model_name() to return integer
instead of void to signal potentional problems/issues.

Reported-by: Ales Ledvinka
2013-02-20 12:17:58 +00:00
4c009309eb ID: 3600928 - 'lib/ipmi_pef.c' handle unrecognized event trigger
Commit adds code to handle unrecognized event trigger in
ipmi_pef_print_event_info().

Reported-by: Ales Ledvinka
2013-02-13 11:46:15 +00:00
ed1865da0a ID: 3600928 - 'lib/ipmi_pef.c' use 'else if ()' instead of 'if ()'
Commit trades 'if ()' for 'else if ()' and removes one pointless 'if ()' since
rsp isn't NULL at this point.
2013-02-13 11:35:21 +00:00
c726a09482 ID: 3600928 - 'lib/ipmi_pef.c' memory leaks
Commit fixes memory leaks in 'lib/ipmi_pef.c'.

Reported-by: Ales Ledvinka
2013-02-13 11:28:58 +00:00
a70de993cf ID: 3600910 - 'lib/ipmi_delloem.c' use 'else if' instead of 'if', use 'rc'
Commit changes are related to ipmi_ldc_set_lock() in 'lib/ipmi_delloem.c':
* use 'else if' instead of 'if' since it's the same given the context and
probably better
* use 'rc' variable, since it's there, rather than 'return'

Note: ipmi_lcd_set_lock() would use some re-write.

Reported-by: Ales Ledvinka
2013-02-12 12:23:11 +00:00
c53a3cbb8e ID: 3600910 - 'lib/ipmi_delloem.c' remove unused variable
Commit removes unused variable 'dte' in ipmi_powermgmt() in
'lib/ipmi_delloem.c'.
2013-02-12 12:15:28 +00:00
69e43dc87f ID: 3600927 - change eval order of input param in ipmi_oem_setup()
Commit changes evaluation order of 'oemtype' which is an input parameter to
ipmi_oem_setup() in 'lib/ipmi_oem.c'. Make the check whether 'oemtype' is NULL
or not one of the first things we do rather than blindly use 'oemtype' in
strncmp() and then check if it isn't NULL. Yes, this is a potential crash
waiting to happen.

Reported-by: Ales Ledvinka
2013-02-12 12:01:32 +00:00
5fa202f7d3 ID: 3600930 - dead code in 'lib/ipmi_sdr.c'
Commit adds comment for dead code in 'lib/ipmi_sdr.c'. This part of code has
been purposefully turned off.
2013-02-07 06:14:56 +00:00
c070fc00d6 ID: 3600930 - 'lib/ipmi_sdr.c' - NULL dereference
Commit fixes NULL dereference in 'lib/ipmi_sdr.c' by checking whether Sensor is
type of 'full' or 'compact'.

Fix by: Jim Mank
Reported by: Ales Ledvinka
2013-02-05 06:57:44 +00:00
bd4f34b035 ID: 3602439 - 'lib/ipmi_sdr.c' - memory leaks
Commit fixes memory leaks in 'lib/ipmi_sdr.c'. This is based on ticket #3600930.

Reported by: Ales Ledvinka
2013-02-05 06:51:43 +00:00
6e87e423eb ID: 3601265 - # ipmitool sensor get; leaks memory
ID: 3601106 - # ipmitool sensor get NACname; output incorrect/inconsistent

After a lengthy discussion with Jim, I'm removing free() of sdr_record_list in
ipmi_sensor_get() as this is freed in 'lib/ipmi_main.c' on/prior to ipmitool's
exit.
2013-01-23 11:24:05 +00:00
37861d60e4 3600962 descriptor leaks 2013-01-18 12:46:52 +00:00
bd5ffa4756 3600914 no more crash on no response. allow more send/recv loops of waiting. 2013-01-18 12:43:19 +00:00
c958de2870 3600929 additional ticket request. 2013-01-18 12:37:27 +00:00
86805c2146 ID: 3601265 - # ipmitool sensor get; leaks memory
Commit fixes memory leak in ipmi_sensor_get() caused by not free()-ing
sdr_record_list.
2013-01-17 15:45:25 +00:00
c97d9d5b85 ID: 3601106 - # ipmitool sensor get NACname; output incorrect/inconsistent
Commit re-works output of # ipmitool sensor get; command. It removes calls to
sensor specific functions with call to ipmi_sdr_print_listentry(). This way,
output is unified with the output of '-v sdr list' and actually has corrent
information. Well, at least errors are gone and no information seems to be
missing.
Commit fixes help and return codes as well.
2013-01-17 14:36:13 +00:00
76ed820e03 ID: 3600908 - 'lib/ipmi_dcmi.c' - crash in ipmi_print_sensor_info(), NULL ref
Commit fixes crash in ipmi_print_sensor_info() in 'lib/ipmi_dcmi.c' due to NULL
reference. 'rec' is correctly checked whether NULL or not, but it's used
immediately despite of the outcome of the NULL test.
Also, ipmi_sdr_print_rawentry() is used instead of specific print function.
2013-01-17 06:54:07 +00:00
091ba2ea58 3600907 defined value for "Chassis may not support Force Identify" 2013-01-16 14:28:39 +00:00
3f53760062 3600929 error keyword 2013-01-16 13:32:41 +00:00
83794843b5 3600921 similar code as hpmfwupg reading negative length from failed ftell 2013-01-16 12:33:13 +00:00
4a12bdebd6 3600922 sizeof of incorrect value, bzero deprecated 2013-01-16 12:29:21 +00:00
8a4139e1b8 3600931 leaks 2013-01-16 12:27:29 +00:00
15d683d86d 3600942 check return code 2013-01-16 12:24:13 +00:00
6eda3b5482 3600946 check for failed bind on send, leaks 2013-01-16 12:20:52 +00:00
6a82e95988 3600960 check the copy of password exists 2013-01-16 12:17:06 +00:00
28f93df807 3600963 leak and failed random future note 2013-01-16 12:15:10 +00:00
3f9b728e57 3600964 leak 2013-01-16 12:12:21 +00:00
9a8a8b7dad 3600965 move the initialization past the null intf check 2013-01-16 12:08:50 +00:00
75d6c72c5d ID: 3595188 - minor leaks via options. revert prev, this cleaner naming, changes by Zdenek Styblik 2013-01-11 11:21:26 +00:00
8882955891 fixes minor leaks on command line argument parsing 2013-01-11 10:57:44 +00:00
22b283b210 ID: 3598203 - 'mc getsysinfo|setsysinfo' needs a bit of re-work
ID: 3597782 - 'lib/ipmi_mc' - sysinfo_param() has two consecutive returns
ID: 3597781 - 'mc getsysinfo|setsysinfo' help has typos

Commit changes/fixes issues described in tickets #3598203, #3597782 and
#3597781.
Typos in help text of 'getsysinfo'/'setsysinfo' got fixed and function
printf_sysinfo_usage() has been created.
Consecutive return in function sysinfo_param() has been removed.
Some code has been re-worked:
* ipmi_getsysinfo() -> ipmi_mc_getsysinfo(),
* ipmi_setsysinfo() -> ipmi_mc_setsysinfo();
* ipmi_sysinfo_main() extended for 'is_set' parameter to signal whether it's
a get/set operation
* return codes changed
* code styling clean-up
* a bit of code clean-up in ipmi_sysinfo_main(), ipmi_mc_getsysinfo(),
ipmi_mc_setsysinfo()
2013-01-09 11:17:42 +00:00
2bb3100395 ID: 3597471 - 'lib/ipmi_mc.c' - needs a bit of re-work - rc, inv. options
Commit fixes 'help' and return codes(help =~ 0, invalid > 1). Indentation of
file as well as some formatting changes were made as well.
2012-12-20 14:25:18 +00:00
5dbb6b69de ID: 3577154 - 'lib/ipmi_mc.c' - return value of 'mc reset'
Commit adds response handling for 'mc reset' commands according to IPMI
specification.

Reported by: Duncan Idaho
2012-12-20 08:53:05 +00:00
791268a61c ID: 3597468 - 'lib/ipmi_mc.c' - print_mc_usage() prints to STDOUT
Commit replaces printf() with lprintf(LOG_NOTICE,...) to print help text on
STDERR as other ipmitool's sub-commands do.
2012-12-20 04:54:44 +00:00
970c5ff8b6 ID: 3597469 - 'mc watchdog off' prints on STDERR, should be STDOUT
Commit fixes/replaces lprintf(LOG_ERR,...) with printf() to print info message
on STDOUT instead of STDERR in 'mc watchdog off'.
2012-12-20 04:41:50 +00:00
4728863d5b ID: 3597470 - 'mc watchdog reset' prints on STDERR, should be STDOUT
Commit fixes/replaces lprintf(LOG_ERR,...) with printf() to print info message
on STDOUT instead of STDERR in 'mc watchdog reset'.
2012-12-20 04:36:06 +00:00
a3d872c73d ID: 3595199 - Add support for # ipmitool sdr <list|elist> help;
Commit adds suppor for # ipmitool sdr <list|elist> help; command.
2012-12-12 13:12:14 +00:00
9b3000e329 'lib/helper.c', 'include/ipmitool/helper.h' - add str2double()
Commit adds function to handle conversion from string to double. Function has
the same concept as other str2*() functions.
2012-12-12 05:39:35 +00:00
bd851bab8f ID: 3594835 - NULL reference possible in str2*() functions
Commit fixes possible NULL reference in str2*() functions in 'lib/helper.c'.
Although it's less likely to happen in ipmitool's daily life, it's still
possible.
Let's make sure it doesn't happen.
2012-12-11 20:59:58 +00:00
b4754b5edb ID: 3592773 - # ipmitool sdr info; prints incorrect info
Commit fixes output printed by # ipmitool sdr info; about 'SDR Repository Alloc
info supported' due to incorrect member name; probably because of copy-paste
error.
2012-12-05 11:02:38 +00:00
99e4ac0399 ID: 3592770 - # ipmitool sdr list|elist INV_INPUT; return code
Commit fixes return code of # ipmitool sdr list|elist; when invalid
input/unknown command is given.
Return code is > 0 now and error message is printed.
2012-12-05 10:39:46 +00:00
6733b66a9c ID: 3592732 - 'lib/ipmi_picmg.c' - printf() misuse
Commit replaces printf() with appropriate lprintf() calls. Some error messages
got changed as well.
2012-12-05 07:22:55 +00:00
daf4c4831f ID: 3528310 - 'lib/ipmi_picmg.c' - NULL reference
Commit fixes reference to rsp which can be NULL if there is no response from
BMC, eg. KCS driver is not loaded.
2012-12-04 19:33:26 +00:00
d2d2f4789d 'lib/helper.c' - clean-up - remove standalone tabs('\t')
Commit removes standalone tabs - code clean-up.
2012-11-26 05:11:16 +00:00
cce3f84896 ID: 3528347 - 'lib/ipmi_raw.c' - possible int *flow
Commit fixes missing return in function is_valid_param() which slipped in code
review.
2012-11-25 05:39:27 +00:00
3018b229b1 ID: 3588726 - % ipmitool sol payload status ...; segfaults on no rsp
Commit fixes segafult in ipmi_sol_payload_access_status in 'lib/ipmi_sol.c' when
no response is received. This is caused by passing NULL to lprintf() as
parameter, resp. accessing response data that aren't there.

Reported by: Ales Ledvinka
2012-11-21 09:07:30 +00:00
fc62075b76 ID: 3582307 - 'lib/ipmi_fru.c' - ipmi_fru_main() return codes
ID: 3582310 - 'lib/ipmi_fru.c' - ipmi_fru_main() - misuse of printf()

Commit is a major re-work of ipmi_fru_main().
* Help print-outs moved into functions.
* Proper return codes on error/help, although some TODOs remain.
* "discovery" 'fru get'
* hopefully less bloat in ipmi_fru_main()
2012-11-17 11:50:24 +00:00
a5384fa12e ID: 3587913 - Command % ipmitool raw help; returns 1
Commit fixes % ipmitool raw help; return code which should be 0.
2012-11-16 19:23:59 +00:00
7973f44304 ID: 3528347 - 'lib/ipmi_raw.c' - possible int *flow
Commit fixes int *flows via user input parameters in 'lib/ipmi_raw.c'.
2012-11-16 14:28:10 +00:00
8d9b434b5a ID: 3577159 - 'lib/ipmi_sdr.c' - uint32_t cast to uint8_t and back
Commit removes pointless(?) and unhandled cast from uint32_t to uint8_t and
back. intf->target_addr is uint32_t, don't try to "squeeze" it into uint8_t
then.

Reported by: Duncan Idaho
2012-11-11 18:59:36 +00:00
5b90f68407 ID: 3528368 - 'lib/ipmi_sdr.c' - possible int *flow
Commit fixes possible int *flow in ipmi_sdr_print_type() in 'lib/ipmi_sdr.c'.
str2uchar() is used instead of strtol() which wasn't being checked for errors.

Reported by: Duncan Idaho
2012-11-11 18:26:36 +00:00
2edc474cef ID: 3586228 - 'lib/ipmi_ekanalyzer.c' - ipmi_ekanalyzer_usage() rework
Commit gets rid of huge array of chars and replaces it with couple lprintf()
functions in 'lib/ipmi_ekanalyzer.c' - ipmi_ekanalyzer_usage()
2012-11-11 18:09:43 +00:00
472d8ab1b3 ID: 3576213 - 'lib/ipmi_fru.c' - unused variable
Commit removes two unused variables, rsp and req, from
ipmi_fru_set_field_string_rebuild() in 'lib/ipmi_fru.c'.

Reported by: Dune Idaho
2012-11-02 06:35:51 +00:00
4af83567b0 ID: 3528271 - 'lib/ipmi_fru.c' - possible *flow via FRUID
Commit fixes *flow via atoi() and not checking strtol() properly. is_fru_id()
wrapper has been added to mitigate code repetition.

Reported by: Dune Idaho
2012-11-02 06:11:06 +00:00
66bdb86f04 ID: 3528388 - 'lib/ipmi_ekanalyzer.c' - a typo in error message
Commit fixes a typo in error message in 'lib/ipmi_ekanalyzer.c'.

Reported by: Dune Idaho
2012-11-01 18:52:11 +00:00
9ef6162f3c ID: 3576211 - 'lib/ipmi_delloem.c' - unused variable
Commit removes unused variables in ipmi_led_get_platform_model_name() in
'lib/ipmi_delloem.c'.

Reported by: Dune Idaho
2012-11-01 18:45:31 +00:00
629a96d9c3 ID: 3576210 - 'lib/ipmi_dcmi.c' - unused variable
Commit removes unused variable in ipmi_dcmi_prnt_oobDiscover() in
'lib/ipmi_dcmi.c'.

Reported by: Dune Idaho
2012-11-01 18:44:05 +00:00
122e11a2e8 ID: 3522731 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0
PROPER - Commit fixes ipmi_get_sol_info()'s return value, so (-1) is returned on
error, eg. response is NULL. It doesn't matter whether it is first or last
response, we bail out immediately.
Commit also fixes missing argument to one lprintf() and
indentation(spaces->tabs).

This bug is connected with ``ID: 1835038 - 'lib/ipmi_sol.c' -
ipmi_get_sol_info() returns always 0''.

Reported by: Duncan Idaho
2012-10-22 16:50:34 +00:00
a974ab2c69 REVERT - ID: 3522731 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0
I'm reverting to previous revision, because I've realized these
``if (rsp != NULL)'' became redundant.
I'm sorry about that.
2012-10-22 06:09:49 +00:00
f8f6d51fd2 ID: 3522731 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0
Commit fixes ipmi_get_sol_info()'s return value, so (-1) is returned on error,
eg. response is NULL. It doesn't matter whether it is first or last response, we
bail out immediately.
Commit also fixes missing argument to one lprintf() and
indentation(spaces->tabs).

This bug is connected with ``ID: 1835038 - 'lib/ipmi_sol.c' -
ipmi_get_sol_info() returns always 0''.

Reported by: Duncan Idaho
2012-10-21 11:46:17 +00:00
8d828f6c72 ID: 3564701 - ipmitool 1.8.12 doesn't build on big endian architectures
ipmitool doesn't build on big endian architectures, because of missing include
of <bswap.h>.

Submitted by: Dan Horak
2012-10-21 04:28:08 +00:00
d54e20c545 ID: 3578022 - 'lib/ipmi_delloem.c' fix typos
This is a patch for building on big endian platforms that fixes the typos
introduced by rev 1.17 of ipmi_delloem.c

Submitted by: Dan Horak
2012-10-21 04:14:38 +00:00
44310bd898 ID: 3578276 - 'lib/ipmi_fru.c' - free() on freed memory possible
ID: 3578275 - 'lib/ipmi_fru.c' - memory leaks

Commit fixes several memory leaks and possible call of free() on memory that has
been already freed.
Despite 'goto' should be avoided as much as possible, its use seemed to be quite
reasonable in this case.
2012-10-20 19:57:17 +00:00
a9f7a7b92e ID: 3578277 - 'lib/ipmi_fru.c' - possible NULL pointer
Commit fixes possible NULL pointer by adding check whether fru_bloc, returned
from build_fru_bloc(), is NULL or not. If it is, print an error message and
return (-1).
2012-10-19 07:01:40 +00:00
d65cccc32a ID: 3577155 - 'lib/ipmi_main.c' - memory leaks
Commit fixes two memory leaks in 'lib/ipmi_main.c'. They were caused by not
freeing memory allocated by strdup() which uses malloc() underneath.

Reported by Duncan Idaho.
2012-10-17 05:03:45 +00:00
131846fb40 ID: 3577766 - configure's knobs and switches don't work
Some of configure's knobs and switches, eg. --disable-intf-open, don't work.
This is caused by poor choice of variable names, resp. using the same variable
names Autoconf is using. And Autoconf doesn't like it, resp. gets confused.

Variable names prefixed with an 'x' in order to make them 'unique'.
2012-10-17 04:45:14 +00:00
c62359bd79 lib/ipmi_fru.c - pointless/wrong cast loop
Commit removes pointless(?) and unhandled cast from uint32_t to uint8_t and
back. intf->target_addr is uint32_t, don't try to "squeeze" it into uint8_t
then.
2012-10-04 07:46:27 +00:00
1e83f7c88a ID: 3568976 - 'sel set time' behaviour is inconsistent
Commit fixes missing '*'. Without it, not only the previous commit breaks more
than it fixes, but it may (eventually) lead to segfault.
2012-10-02 18:55:41 +00:00
4a4b2e3b59 configure.in - remove Solaris+SPARC -> no BMC
Commit removes false presumption there is no BMC driver for SPARC platform in
Solaris. Also, this makes BMC driver default to yes, being built, on Solaris.
2012-09-29 08:51:53 +00:00
c88b139452 configure.in - replace leading spaces with tab
Commit replaces leading spaces with single tabulator in solaris section.
Somebody probably mistaken tabs for the spaces.
No functional change.
2012-09-29 08:33:45 +00:00
6011359cb3 ID: 3571153 - OpenIPMI/ipmievd fails to compile on Solaris
Commit fixes compilation problems on Solaris. These were caused by missing
header file, <sys/ioccom.h>, which defines _IO* macros.
2012-09-28 18:47:01 +00:00
23a5477d6e ID: 3568976 - 'sel set time' behaviour is inconsistent
Commit fixes inconsistent behaviour of 'sel set time' command. This was caused
by random init values of tm structures.
Also, the state of DST should be looked up now.
2012-09-28 17:50:56 +00:00
700ee7d27d Author: Jan Safranek <jsafrane@redhat.com>
Date:   Mon Aug 13 14:35:28 2012 +0200
    Fixed ipmievd start under systemd.

    Systemd init system starts services with parent PID=1. Still, it is expected
    that the daemon forks and exits with nozero exit status, if its initialization
    fails.
2012-09-05 20:46:16 +00:00
2d725c2cd6 ipmitool should document also -b, -B, -l and -T options, which are
currently missing. The description is taken from ipmitool -h output.

Original author: J.H.M. Dassen, rdassen at redhat.com.
2012-09-05 14:22:36 +00:00
5c9addb8c4 Fix offset for LCD_STATUS with new sysinfo interface 2012-08-14 17:54:08 +00:00
c0290ef09a Add support for getsysinfo/setsysinfo commands to ipmi mc
Cleanup Dell OEM code to use new sysinfo interface
2012-08-14 17:32:04 +00:00
6c1e3e2ecc lib/Makefile.am - fix build without LAN interfaces
Signed-off-by: Duncan Idaho <dune.idaho@gmail.com>

Commit fixes case when ipmitool is built without any LAN interface support,
resp. without LAN and LAN+ support. In such case, build would fail because
md5.c and md5.h are not being linked.
Commit adds 'src/plugins/lan/md5.c' and 'src/plugins/lan/md5.c' to
'lib/Makefile.am'.
2012-08-09 20:13:06 +00:00
182 changed files with 27360 additions and 19782 deletions

View File

@ -2,3 +2,4 @@ Duncan Laurie <duncan@iceblink.org>
Fredrik Öhrn <ohrn@chl.chalmers.se>
Jon Cassorla <jon.cassorla@newisys.com>
Jeremy Ellington <jeremy@jeremye.net>
Petter Reinholdtsen <pere@hungry.com>

View File

@ -1,3 +1,176 @@
version 1.8.14 2014-05-05
* ID: 299 - openipmi plugin writes zero to wrong byte
* ID: 301 - Add OS/Hypervisor installation status events
* ID: 298 - fix LANplus retry
* ID: 295 - inform user if SOL session disconnected
* ID: 297 - don't print-out SEL entry if ID not present
* ID: 296 - Fix PSD size decoding
* ID: 293 - Use of uninitialized variable in ipmi_main()
* ID: 278 - Error in sol looptest
* ID: 290 - ipmi_sol.c needs a clean-up
* ID: 85 - Supermicro memory ECC error display
* ID: 290 - ipmi_sol.c needs a clean-up
* ID: 286 - Open session retries hit assert in ipmi_lanplus_send_payload
* ID: 285 - Fix SEGV in ipmi_lanplus_open_session
* ID: 284 - Fix SEGV in ipmi_main
* ID: 283 - ipmi_intf_socket_connect fails with IPv4 hosts
* ID: 46 - ipmi_fwum needs some re-work
* ID: 50 - ipmi_hpmfwupg needs a clean up
* ID: 279 - ipmitool sdr list broken
* ID: 44 - dummy interface support - fake-ipmistack project
* ID: 48 - Remove hard-coded FRU inventory access length restriction
* ID: 276 - HPM.1 upgrade combined patch
* ID: 90 - Add options to chassis bootparam set bootflag
* ID: 292 -Properly handle plugin non-zero target adddress with -t
* Numerous Fixes based on running Coverity
* Use TIOCFLUSH if TCFLSH is missing to get the serial plugin building on
Hurd.
* Disable imb and open plugins by default on Hurd. The platform lack
the required kernel support.
* Change serial plugin to only try to disable the IUCLC serial line flag on
platforms supporting it. Fixes build problem on Hurd and FreeBSD.
* PA: 83 - Revised IPv6 patch
* FR: 24 - Exchange OS Name Hostname BMC URL during startup
* ID: 304 - Incorect byteswap in SOL maximum payload
* ID: 303 - Fix build error in HPM.2 code
* ID: 300 - new sunoem functionality
* ID: 144 - Fix 'dcmi power set_limit action <value>'
* ID: 302 - HPM.2 long message support
* ID: 309 - Add new SEL entries for ipmi 2.0 rev 1.1
* ID: 280 - man page cleanup
* ID: 311 - man page update for new sunoem commands
version 1.8.13 2013-09-09
* ID: 3611905 - Direct Serial Basic/Terminal Mode Interface drivers
* ID: 3577766 - configure's knobs and switches don't work
* ID: 3611253 - do not override OS-default values for interfaces
* ID: 65 - Fixes for configure.in for cross compilation
* ID: 3571153 - OpenIPMI/ipmievd fails to compile on Solaris
* numerous ipmitool man page updates
* ID: 3611226 - Bridging support for PICMG Platforms
* Add support for getsysinfo/setsysinfo commands to ipmi mc
* Cleanup Dell OEM code to use new sysinfo interface
* ID: 93 - str-to-int conversion is weak
* ID: 3582307 - ipmi_fru - ipmi_fru_main() return codes
* ID: 3582310 - ipmi_fru - ipmi_fru_main() - misuse of printf()
* ID: 3576213 - ipmi_fru - unused variable
* ID: 3578276 - ipmi_fru - free() on freed memory possible
* ID: 3578275 - ipmi_fru - memory leaks
* ID: 3528271 - ipmi_fru - possible *flow via FRUID
* ID: 3578277 - ipmi_fru - possible NULL pointer
* ID: 3612372 - Recognize Broadcom IANA number and BCM5725 product
* ID: 3608758 - add IPMI_NETFN_OEM
* ID: 143 - Reversed 'channel authcap' capabilities
Fixes reversed IPMIv1.5/2.0 'channel authcap' capabilities
* ID: 3587318 - "dcmi discover" is not DCMI 1.5 compatible
* ID: 3608757 - ipmi_fru - various fixes
* ID: 3598203 - 'mc getsysinfo|setsysinfo' needs a bit of re-work
* ID: 3597782 - ipmi_mc - sysinfo_param() has two consecutive returns
* ID: 3597781 - 'mc getsysinfo|setsysinfo' help has typos
* ID: 3608763 - ipmi_sdr - code cleanup & output display cleanup
* ID: 3610286 - ipmi_sdr - ipmi_sdr_print_type - incorrect eval
* ID: 3600930 - ipmi_sdr - code cleanup
* ID: 3602439 - ipmi_sdr - memory leaks
* ID: 3595199 - ipmi_sdr - Add support for 'ipmitool sdr <list|elist> help'
* ID: 3592773 - 'ipmitool sdr info'; prints incorrect info
* ID: 3592770 - 'ipmitool sdr list|elist INV_INPUT' return code
* ID: 3577159 - ipmi_sdr - uint32_t cast to uint8_t and back
* ID: 3528368 - ipmi_sdr - possible int *flow
* ID: 226 - ipmi_sdradd - typo
* ID: 258 - ipmi_sdradd - error printed on STDOUT
* Fixed ipmievd start under systemd.
* ID: 3608760 - Add bswap.h to ipmi_chassis.c and ipmi_pef.c
* ID: 3564701 - ipmitool 1.8.12 doesn't build on big endian architectures
* ID: 3600907 - defined value for "Chassis may not support Force Identify"
* ID: 256 - ipmitool could crash when IPv6 address is returned
* ID: 211 - 'lib/ipmi_dcmi.c' - typo & error printed on STDOUT
* ID: 3612237 - If DCMI command fails, incorrect completion code is printed
* ID: 3608149 - ipmitool - set pointer to NULL after free()
* ID: 3603419 - DCMI - waste of resources
* ID: 3600908 - DMCI - crash in ipmi_print_sensor_info(), NULL ref
* ID: 3609985 - delloem : Wrong MAC returned when flex addressing is enabled
* ID: 113 - delloem exec file won't handle more than one command
* ID: 28 - delloem - clean up the code
* ID: 3608261 - delloem - code formatting
* ID: 3528247 - delloem - fix possible *int flows
* ID: 3600910 - delloem - code cleanup
* ID: 3576211 - delloem - unused variable
* ID: 3578022 - delloem - fix typos
* ID: 263 - ipmi_ek* - cleanup
* ID: 3308765 - ipmi_ek* - cleanup
* ID: 3586228 - ipmi_ek* - ipmi_ekanalyzer_usage() rework
* ID: 3528388 - ipmi_ek* - a typo in error message
* ID: 3576212 - ipmi_event - better rsp handling
* ID: 3607393 - ipmi_event - redundant '\n' in error message
* ID: 153 - ipmi_firewall - printf() used instead of lprintf()
* ID: 3608003 - ipmi_fru - atol() should be replaced with str2*()
* ID: 3600911 - ipmi_fru - fix multiple increments in args to printf
* ID: 3600914 - no more crash on no response. allow more send/recv loops of waiting.
* ID: 70 - Fixes and updates for ipmitool hpm
* ID: 3528308 - ipmi_hpmfwupg - possible int *flow
* ID: 3608762 - ipmi_hpmfwup - Fixed help messages for hpm command
* ID: 3607981 - ipmi_lanp - replace atoi() calls
* ID: 3607320 - ipmi_lanp - possible NULL reference
* ID: 3600926 - ipmi_lanp - code cleanup
* ID: 3613575 - memory leak - ipmi_password_file_read()
* ID: 3522740 - reading password from file is limited to 16byte passwords
* ID: 3613605 - ipmi_main - call free() on pointer to static data
* ID: 3608761 - ipmi_main - PICMG Get Device Locator was never run
* ID: 3577155 - ipmi_main' - memory leaks
* ID: 239 - typo in 'mc selftest', add details
* ID: 3597471 - ipmi_mc - needs a bit of re-work - rc, inv. options
* ID: 3597468 - ipmi_mc - print_mc_usage() prints to STDOUT
* ID: 3597469 - 'mc watchdog off' prints on STDERR, should be STDOUT
* ID: 3597470 - 'mc watchdog reset' prints on STDERR, should be STDOUT
* ID: 3611254 - OEM handle for Intel 82751 in SPT mode
* ID: 3600927 - change eval order of input param in ipmi_oem_setup()
* ID: 3600928 - ipmi_pef - code cleanup
* ID: 3592732 - ipmi_picmg.c - printf() misuse
* ID: 3528310 - ipmi_picmg.c - NULL reference
* ID: 3528347 - ipmi_raw.c - possible int *flow
* ID: 3587913 - Command % ipmitool raw help; returns 1
* Added code to support sensors on other luns (On behalf of Kontron Germany)
* ID: 3611912 - Add missing newlines when cvs output is specified
* ID: 244 - ipmi_sel - "0.0" displayed for unspecified threshold values
* ID: 3612371 - Typo in impi_sel debug output
* ID: 3016359 - ipmi_sel - Get SEL Alloc Information is incorrect
* ID: 3568976 - 'sel set time' behaviour is inconsistent
* ID: 3528371 - ipmi_sensor - possible int *flow
* ID: 3601265 - 'ipmitool sensor get' leaks memory
* ID: 3601106 - 'ipmitool sensor get NACname' output incorrect/inconsistent
* ID: 3608007 - ipmi_session - typo in error message
* ID: 101 - ipmi_sol - possible int *flow
* ID: 3600933 - ipmi_sol - use of deprecated bzero()
* ID: 3609472 - ipmi_sol - Add the instance to the SOL commands
* ID: 3588726 - 'ipmitool sol payload status ...;'segfaults on no rsp
* ID: 3522731 - ipmi_sol - ipmi_get_sol_info() returns always 0
* ID: 3613042 - add missing Entity IDs
* ID: 3611306 - ipmi_tsol - fix always fail in case of error
* ID: 259 - ipmi_user - memory leak
* ID: 260 - ipmi_user - replace atoi() call
* ID: 2871903 - ipmitool user priv incorrectly sets Link Auth
* ID: 3600960 - check the copy of password exists
* ID: 3609473 - Add assertion/deassertion to threshold events
* ID: 104 - ipmishell - possible int *flow
* ID: 262 - 'set' segfaults when no IPMI inf present
* ID: 257 ipmitool exec segfaults if invalid input given
* ID: 254 - Fix retry of authentication capabilities retrieval
* ID: 3611303 - lan - error check is missing braces
* ID: 253 - Fix lanplus retransmission
* ID: 212 - 'lib/ipmi_dcmi.c' - possible int *flow
* ID: 264 - incorrect array index in get_lan_param_select()
* ID: 269 - Fixes for configure.in for cross compilation
* ID: 267 - Corruption in "lan alert print" output
* ID: 41 - ipmi_sel_interpret() - clean up formatting, indentation
* ID: 242 - Incorrect DCMI Power Reading "IPMI timestamp" interpretation
* ID: 229 - 'lib/ipmi_ekanalyzer.c' - a typo ``Too few argument!''
* ID: 266 - file descriptor leak in ipmi_fwum and ipmi_ekanalyzer
* ID: 99 - 'lib/ipmi_sel.c' - possible int *flow
* ID: 222 - 'lib/ipmi_sdr.c' - a typo 'Not Reading' -> 'No Reading'
* ID: 35 - Script to setup redirection of SNMP to/from BMC
* ID: 273 - Reduce SOL Input buffer size by SOL header size
version 1.8.12 released 2012-08-09
* Added IPMB dual bridge support (no need for driver support)
* Enable compiler warnings and resolve all compiler warning so that

View File

@ -410,3 +410,5 @@ http://www.intel.com/design/servers/ipmi/spec.htm
OpenIPMI project: Linux IPMI kernel driver and userland library
http://openipmi.sourceforge.net
IPMItool commit archive
https://lists.sourceforge.net/lists/listinfo/ipmitool-cvs

View File

@ -3,7 +3,7 @@ dnl autoconf for ipmitool
dnl
AC_INIT([src/ipmitool.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([ipmitool], [1.8.12])
AM_INIT_AUTOMAKE([ipmitool], [1.8.14-cvs])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_PREREQ(2.50)
@ -29,29 +29,42 @@ AC_C_BIGENDIAN
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRTOD
AC_CHECK_FUNCS([alarm gethostbyname socket select])
AC_CHECK_FUNCS([alarm gethostbyname getaddrinfo getifaddrs socket select])
AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
AC_CHECK_FUNCS([getpassphrase])
CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type -Wno-unused-result -Wno-packed-bitfield-compat"
CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type"
AM_PROG_LIBTOOL
LIBTOOL="$LIBTOOL --silent"
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([getaddrinfo], [nsl])
AC_SEARCH_LIBS([getifaddrs], [nsl])
AC_SEARCH_LIBS([socket], [socket], [],
[AC_CHECK_LIB([nsl], [socket],
[LIBS="$LIBS -lsocket -lnsl"], [], [-lsocket])])
if test "x$prefix" = "xNONE"; then
prefix="$ac_default_prefix"
prefix="$ac_default_prefix"
fi
if test "x$exec_prefix" = "xNONE"; then
exec_prefix="$prefix"
exec_prefix="$prefix"
fi
enable_all_options=yes
dnl
dnl set default option values
dnl
xenable_intf_bmc=no
xenable_intf_imb=yes
xenable_intf_open=yes
xenable_intf_lipmi=yes
#xenable_intf_serial=yes
xenable_intf_dummy=no
xenable_all_options=yes
xenable_ipmishell=yes
dnl set some things so we build with GNU tools on Solaris
case "$host_os" in
@ -61,46 +74,45 @@ solaris*)
LD=gld
AR=gar
# openssl libs are in /usr/sfw/lib on solaris 10
LIBS="$LIBS -R/usr/sfw/lib"
LIBS="$LIBS -R/usr/sfw/lib"
# disable the linux-specific interfaces
# and bmc on SPARC (there is no bmc driver for SPARC)
if [[ `mach -p` = sparc ]]; then
enable_intf_bmc=no
else
enable_intf_bmc=yes
fi
enable_intf_imb=no
enable_intf_open=no
enable_intf_lipmi=no
enable_ipmishell=no
enable_all_options=no
xenable_intf_bmc=yes
xenable_intf_imb=no
xenable_intf_open=no
xenable_intf_lipmi=no
xenable_ipmishell=no
xenable_all_options=no
;;
*cygwin*)
# disable the linux and solaris-specific interfaces
enable_intf_imb=no
enable_intf_open=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_ipmishell=no
xenable_intf_imb=no
xenable_intf_open=no
xenable_intf_lipmi=no
xenable_intf_bmc=no
;;
*darwin*|aix*)
# disable the linux and solaris-specific interfaces
enable_intf_imb=no
enable_intf_open=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_ipmishell=no
xenable_intf_imb=no
xenable_intf_open=no
xenable_intf_lipmi=no
xenable_intf_bmc=no
xenable_ipmishell=no
;;
*freebsd*)
enable_intf_imb=no
enable_intf_lipmi=no
enable_intf_bmc=no
xenable_intf_imb=no
xenable_intf_lipmi=no
xenable_intf_bmc=no
;;
*netbsd*)
enable_intf_imb=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_intf_open=no
xenable_intf_imb=no
xenable_intf_lipmi=no
xenable_intf_bmc=no
xenable_intf_open=no
;;
gnu*)
# disable the linux and solaris-specific interfaces on Hurd
xenable_intf_imb=no
xenable_intf_open=no
;;
esac
@ -113,78 +125,102 @@ dnl allow solaris builds to include all options
AC_ARG_ENABLE([solaris-opt],
[AC_HELP_STRING([--enable-solaris-opt],
[enable all options for Solaris [default=no]])],
[], [enable_solaris_opt=no])
if test "x$enable_all_options" = "xyes" || test "x$enable_solaris_opt" = "xyes"; then
AC_DEFINE(ENABLE_ALL_OPTIONS, [1], [Define to 1 to enable all command line options.])
[xenable_solaris_opt=$enableval],
[xenable_solaris_opt=no])
if test "x$xenable_all_options" = "xyes" || test "x$xenable_solaris_opt" = "xyes"; then
AC_DEFINE(ENABLE_ALL_OPTIONS, [1], [Define to 1 to enable all command line options.])
fi
dnl check for OpenSSL functionality
AC_ARG_ENABLE([internal-md5],
[AC_HELP_STRING([--enable-internal-md5],
[enable internal MD5 library [default=no]])],
[], [enable_internal_md5=no])
[xenable_internal_md5=$enableval],
[xenable_internal_md5=no])
AC_CHECK_LIB([crypto], [EVP_aes_128_cbc],
[if test "x$enable_internal_md5" != "xyes"; then
[if test "x$xenable_internal_md5" != "xyes"; then
have_crypto=yes; LIBS="$LIBS -lcrypto"
fi], [have_crypto=no], [-lcrypto])
fi],
[have_crypto=no], [-lcrypto])
AC_CHECK_LIB([crypto], [MD5_Init],
[if test "x$enable_internal_md5" != "xyes"; then
[if test "x$xenable_internal_md5" != "xyes"; then
if test "x$have_crypto" != "xyes"; then
LIBS="$LIBS -lcrypto"
have_md5=yes
LIBS="$LIBS -lcrypto"
have_md5=yes
fi
AC_DEFINE(HAVE_CRYPTO_MD5, [1], [Define to 1 if libcrypto supports MD5.])
fi], [], [-lcrypto])
fi],
[], [-lcrypto])
AC_CHECK_LIB([crypto], [MD2_Init],
[if test "x$enable_internal_md5" != "xyes"; then
[if test "x$xenable_internal_md5" != "xyes"; then
if test "x$have_crypto" != "xyes" && test "x$have_md5" != "xyes"; then
LIBS="$LIBS -lcrypto"
have_md2=yes
fi
AC_DEFINE(HAVE_CRYPTO_MD2, [1], [Define to 1 if libcrypto supports MD2.])
fi], [], [-lcrypto])
fi],
[], [-lcrypto])
dnl enable IPMIv1.5 LAN interface
AC_ARG_ENABLE([intf-lan],
[AC_HELP_STRING([--enable-intf-lan],
[enable IPMIv1.5 LAN interface [default=yes]])],
[], [enable_intf_lan=yes])
if test "x$enable_intf_lan" = "xstatic" || test "x$enable_intf_lan" = "xplugin"; then
enable_intf_lan=yes
[xenable_intf_lan=$enableval],
[xenable_intf_lan=yes])
if test "x$xenable_intf_lan" = "xstatic" || test "x$xenable_intf_lan" = "xplugin"; then
xenable_intf_lan=yes
fi
if test "x$enable_intf_lan" = "xyes"; then
AC_DEFINE(IPMI_INTF_LAN, [1], [Define to 1 to enable LAN IPMIv1.5 interface.])
AC_SUBST(INTF_LAN, [lan])
AC_SUBST(INTF_LAN_LIB, [libintf_lan.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lan/libintf_lan.la"
if test "x$xenable_intf_lan" = "xyes"; then
AC_DEFINE(IPMI_INTF_LAN, [1], [Define to 1 to enable LAN IPMIv1.5 interface.])
AC_SUBST(INTF_LAN, [lan])
AC_SUBST(INTF_LAN_LIB, [libintf_lan.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lan/libintf_lan.la"
fi
dnl enable IPMIv2.0 RMCP+ LAN interface
AC_ARG_ENABLE([intf-lanplus],
[AC_HELP_STRING([--enable-intf-lanplus],
[enable IPMIv2.0 RMCP+ LAN interface [default=auto]])],
[if test "x$enable_intf_lanplus" != "xno" && test "x$have_crypto" != "xyes"; then
echo "** The lanplus interface requires an SSL library with EVP_aes_128_cbc defined."
enable_intf_lanplus=no
fi],
[enable_intf_lanplus=$have_crypto])
if test "x$enable_intf_lanplus" = "xstatic" || test "x$enable_intf_lanplus" = "xplugin"; then
enable_intf_lanplus=yes
[xenable_intf_lanplus=$enableval],
[xenable_intf_lanplus=$have_crypto])
if test "x$xenable_intf_lanplus" = "xstatic" || test "x$xenable_intf_lanplus" = "xplugin"; then
xenable_intf_lanplus=yes
fi
if test "x$enable_intf_lanplus" = "xyes"; then
AC_DEFINE(IPMI_INTF_LANPLUS, [1], [Define to 1 to enable LAN+ IPMIv2 interface.])
AC_SUBST(INTF_LANPLUS, [lanplus])
AC_SUBST(INTF_LANPLUS_LIB, [libintf_lanplus.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lanplus/libintf_lanplus.la"
if test "x$xenable_intf_lanplus" != "xno" && test "x$have_crypto" != "xyes"; then
echo "** The lanplus interface requires an SSL library with EVP_aes_128_cbc defined."
xenable_intf_lanplus=no
fi
if test "x$xenable_intf_lanplus" = "xyes"; then
AC_DEFINE(IPMI_INTF_LANPLUS, [1], [Define to 1 to enable LAN+ IPMIv2 interface.])
AC_SUBST(INTF_LANPLUS, [lanplus])
AC_SUBST(INTF_LANPLUS_LIB, [libintf_lanplus.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lanplus/libintf_lanplus.la"
else
enable_intf_lanplus=no
xenable_intf_lanplus=no
fi
ORIG_CPPFLAGS=$CPPFLAGS
dnl enable serial interface
AC_ARG_ENABLE([intf-serial],
[AC_HELP_STRING([--enable-intf-serial],
[enable direct Serial Basic/Terminal mode interface [default=yes]])],
[xenable_intf_serial=$enableval], [xenable_intf_serial=yes])
if test "x$enable_intf_serial" = "xstatic" || test "x$enable_intf_serial" = "xplugin"; then
xenable_intf_serial=yes
fi
if test "x$xenable_intf_serial" = "xyes"; then
AC_DEFINE(IPMI_INTF_SERIAL, [1], [Define to 1 to enable serial interface.])
AC_SUBST(INTF_SERIAL, [serial])
AC_SUBST(INTF_SERIAL_LIB, [libintf_serial.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB serial/libintf_serial.la"
else
xenable_intf_serial=no
fi
dnl look for OpenIPMI header files
AC_ARG_WITH([kerneldir],
[AC_HELP_STRING([--with-kerneldir=DIR],
@ -200,22 +236,33 @@ AC_ARG_WITH([kerneldir],
kernelver=`grep UTS_RELEASE ${with_kerneldir}/include/linux/version.h | \
sed 's/^\#define UTS_RELEASE \"\(2\.[0-9]\)\..*/\1/'`
if test "x$kernelver" = "x2.6"; then
CPPFLAGS="$CPPFLAGS -D__user="
AC_SUBST(CPPFLAGS)
CPPFLAGS="$CPPFLAGS -D__user="
AC_SUBST(CPPFLAGS)
fi
fi])
AH_TEMPLATE([HAVE_LINUX_COMPILER_H], [])
AC_MSG_CHECKING([for linux/compiler.h])
AC_PREPROC_IFELSE([#include <linux/compiler.h>],
[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
[Define to 1 if you have the <linux/compiler.h> header file.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
m4_version_prereq([2.68],
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <linux/compiler.h>]])],
[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
[Define to 1 if you have the <linux/compiler.h> header file.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])],
[AC_PREPROC_IFELSE([#include <linux/compiler.h>],
[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
[Define to 1 if you have the <linux/compiler.h> header file.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])])
CPPFLAGS=$ORIG_CPPFLAGS
AC_SUBST(CPPFLAGS)
AC_CHECK_HEADER([sys/ioccom.h],
[AC_DEFINE(HAVE_SYS_IOCCOM_H, [1],
[Define to 1 if you have the <sys/ioccom.h> header file.])])
AC_CHECK_HEADER([linux/ipmi.h],
[AC_DEFINE(HAVE_OPENIPMI_H, [1],
[Define to 1 if you have the <linux/ipmi.h> header file.])],
@ -227,20 +274,21 @@ AC_CHECK_HEADER([linux/ipmi.h],
dnl look for FreeIPMI files
AC_CHECK_LIB(freeipmi, ipmi_open_inband, [have_free=yes], [have_free=no])
if test "x$have_free" != "xyes"; then
AC_CHECK_LIB(freeipmi, ipmi_ctx_open_inband, [have_free=yes], [have_free=no])
AC_CHECK_LIB(freeipmi, ipmi_ctx_open_inband, [have_free=yes], [have_free=no])
fi
AC_ARG_ENABLE([intf-free],
[AC_HELP_STRING([--enable-intf-free],
[enable FreeIPMI IPMI interface [default=auto]])],
[if test "x$enable_intf_free" != "xno" && test "x$have_free" != "xyes"; then
echo "** Unable to build FreeIPMI interface support!"
enable_intf_free=no
fi],
[enable_intf_free=$have_free])
if test "x$enable_intf_free" = "xstatic" || test "x$enable_intf_free" = "xplugin"; then
enable_intf_free=yes
[AC_HELP_STRING([--enable-intf-free],
[enable FreeIPMI IPMI interface [default=auto]])],
[xenable_intf_free=$enableval],
[xenable_intf_free=$have_free])
if test "x$xenable_intf_free" = "xstatic" || test "x$xenable_intf_free" = "xplugin"; then
xenable_intf_free=yes
fi
if test "x$enable_intf_free" = "xyes"; then
if test "x$xenable_intf_free" != "xno" && test "x$have_free" != "xyes"; then
echo "** Unable to build FreeIPMI interface support!"
xenable_intf_free=no
fi
if test "x$xenable_intf_free" = "xyes"; then
dnl Determine if you got the right FreeIPMI version
AC_MSG_CHECKING([for libfreeipmi version 0.3.0])
AC_TRY_COMPILE([
@ -338,12 +386,13 @@ dnl Determine if you got the right FreeIPMI version
AC_DEFINE(IPMI_INTF_FREE_0_6_0, [1], [Define to 1 for FreeIPMI 0.6.0.])
fi
else
enable_intf_free=no
xenable_intf_free=no
fi
AC_CHECK_LIB(freeipmi,
ipmi_cmd_raw_ipmb,
AC_DEFINE(IPMI_INTF_FREE_BRIDGING, [1], [Define to 1 to enable FreeIPMI Bridging Support.]))
ipmi_cmd_raw_ipmb,
AC_DEFINE(IPMI_INTF_FREE_BRIDGING, [1],
[Define to 1 to enable FreeIPMI Bridging Support.]))
fi
dnl look for termios header file
@ -370,15 +419,16 @@ dnl enable Linux OpenIPMI interface
AC_ARG_ENABLE([intf-open],
[AC_HELP_STRING([--enable-intf-open],
[enable Linux OpenIPMI interface [default=auto]])],
[], [enable_intf_open=yes])
if test "x$enable_intf_open" = "xstatic" || test "x$enable_intf_open" = "xplugin"; then
enable_intf_open=yes
[xenable_intf_open=$enableval],
[])
if test "x$xenable_intf_open" = "xstatic" || test "x$xenable_intf_open" = "xplugin"; then
xenable_intf_open=yes
fi
if test "x$enable_intf_open" = "xyes"; then
AC_DEFINE(IPMI_INTF_OPEN, [1], [Define to 1 to enable Linux OpenIPMI interface.])
AC_SUBST(INTF_OPEN, [open])
AC_SUBST(INTF_OPEN_LIB, [libintf_open.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB open/libintf_open.la"
if test "x$xenable_intf_open" = "xyes"; then
AC_DEFINE(IPMI_INTF_OPEN, [1], [Define to 1 to enable Linux OpenIPMI interface.])
AC_SUBST(INTF_OPEN, [open])
AC_SUBST(INTF_OPEN_LIB, [libintf_open.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB open/libintf_open.la"
dnl Check for dual bridge support in OpenIPMI
AC_MSG_CHECKING([for OpenIPMI dual bridge support])
@ -412,15 +462,16 @@ dnl enable Intel IMB interface
AC_ARG_ENABLE([intf-imb],
[AC_HELP_STRING([--enable-intf-imb],
[enable Intel IMB driver interface [default=auto]])],
[], [enable_intf_imb=yes])
if test "x$enable_intf_imb" = "xstatic" || test "x$enable_intf_imb" = "xplugin"; then
enable_intf_imb=yes
[xenable_intf_imb=$enableval],
[])
if test "x$xenable_intf_imb" = "xstatic" || test "x$xenable_intf_imb" = "xplugin"; then
xenable_intf_imb=yes
fi
if test "x$enable_intf_imb" = "xyes"; then
AC_DEFINE(IPMI_INTF_IMB, [1], [Define to 1 to enable Intel IMB interface.])
AC_SUBST(INTF_IMB, [imb])
AC_SUBST(INTF_IMB_LIB, [libintf_imb.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB imb/libintf_imb.la"
if test "x$xenable_intf_imb" = "xyes"; then
AC_DEFINE(IPMI_INTF_IMB, [1], [Define to 1 to enable Intel IMB interface.])
AC_SUBST(INTF_IMB, [imb])
AC_SUBST(INTF_IMB_LIB, [libintf_imb.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB imb/libintf_imb.la"
fi
dnl enable Solaris LIPMI interface
@ -428,44 +479,68 @@ AC_CHECK_HEADER([sys/lipmi/lipmi_intf.h], [have_lipmi=yes], [have_lipmi=no])
AC_ARG_ENABLE([intf-lipmi],
[AC_HELP_STRING([--enable-intf-lipmi],
[enable Solaris 9 x86 IPMI interface [default=no]])],
[if test "x$enable_intf_lipmi" != "xno" && test "x$have_lipmi" != "xyes"; then
echo "** Unable to build Solaris 9 x86 IPMI interface support!"
enable_intf_lipmi=no
fi],
[enable_intf_lipmi=no])
if test "x$enable_intf_lipmi" = "xstatic" || test "x$enable_intf_lipmi" = "xplugin"; then
enable_intf_lipmi=yes
[xenable_intf_lipmi=$enableval],
[])
if test "x$xenable_intf_lipmi" = "xstatic" || test "x$xenable_intf_lipmi" = "xplugin"; then
xenable_intf_lipmi=yes
fi
if test "x$enable_intf_lipmi" = "xyes"; then
AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris 9 LIPMI interface.])
AC_SUBST(INTF_LIPMI, [lipmi])
AC_SUBST(INTF_LIPMI_LIB, [libintf_lipmi.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lipmi/libintf_lipmi.la"
if test "x$xenable_intf_lipmi" != "xno" && test "x$have_lipmi" != "xyes"; then
echo "** Unable to build Solaris 9 x86 IPMI interface support!"
xenable_intf_lipmi=no
fi
if test "x$xenable_intf_lipmi" = "xyes"; then
AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris 9 LIPMI interface.])
AC_SUBST(INTF_LIPMI, [lipmi])
AC_SUBST(INTF_LIPMI_LIB, [libintf_lipmi.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lipmi/libintf_lipmi.la"
fi
dnl enable Solaris BMC interface
AC_ARG_ENABLE([intf-bmc],
[AC_HELP_STRING([--enable-intf-bmc],
[enable Solaris 10 x86 IPMI interface [default=auto]])],,
[enable_intf_bmc=no])
if test "x$enable_intf_bmc" = "xstatic" || test "x$enable_intf_bmc" = "xplugin"; then
enable_intf_bmc=yes
[enable Solaris 10 x86 IPMI interface [default=auto]])],
[xenable_intf_bmc=$enableval],
[xenable_intf_bmc=no])
if test "x$xenable_intf_bmc" = "xstatic" || test "x$xenable_intf_bmc" = "xplugin"; then
xenable_intf_bmc=yes
fi
if test "x$enable_intf_bmc" = "xyes"; then
AC_DEFINE(IPMI_INTF_BMC, [1], [Define to 1 to enable Solaris 10 BMC interface.])
AC_SUBST(INTF_BMC, [bmc])
AC_SUBST(INTF_BMC_LIB, [libintf_bmc.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
if test "x$xenable_intf_bmc" = "xyes"; then
AC_DEFINE(IPMI_INTF_BMC, [1], [Define to 1 to enable Solaris 10 BMC interface.])
AC_SUBST(INTF_BMC, [bmc])
AC_SUBST(INTF_BMC_LIB, [libintf_bmc.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
fi
dnl enable Dummy interface for testing
AC_ARG_ENABLE([intf-dummy],
[AC_HELP_STRING([--enable-intf-dummy],
[enable Dummy(test) interface [default=no]])],
[xenable_intf_dummy=$enableval], [xenable_intf_dummy=no])
if test "x$xenable_intf_dummy" = "xyes"; then
AC_DEFINE(IPMI_INTF_DUMMY, [1], [Define to 1 to enable Dummy interface.])
AC_SUBST(INTF_DUMMY, [dummy])
AC_SUBST(INTF_DUMMY_LIB, [libintf_dummy.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB dummy/libintf_dummy.la"
fi
AC_SUBST(IPMITOOL_INTF_LIB)
if test "x$xenable_ipmishell" = "xyes"; then
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
if test "x$have_curses" != "xyes" || test "x$have_readline" != "xyes"; then
xenable_ipmishell=no
fi
fi
dnl check for readline library to enable ipmi shell
AC_ARG_ENABLE([ipmishell],
[AC_HELP_STRING([--enable-ipmishell],
[enable IPMI shell interface [default=yes]])],
[], [enable_ipmishell=yes])
if test "x$enable_ipmishell" = "xyes"; then
[enable IPMI shell interface [default=auto]])],
[xenable_ipmishell=$enableval],
[])
if test "x$xenable_ipmishell" = "xyes"; then
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
@ -482,22 +557,25 @@ dnl Enable -Wall -Werror
AC_ARG_ENABLE([buildcheck],
[AC_HELP_STRING([--enable-buildcheck],
[enable -Wall -Werror for build testing [default=no]])],
[if test "x$enable_buildcheck" != "xno"; then
CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes"
fi], [])
[xenable_buildcheck=$enableval],
[xenable_buildcheck=no])
if test "x$xenable_buildcheck" != "xno"; then
CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes"
fi
AC_SUBST(CFLAGS)
dnl Enable extra file security paranoia
AC_ARG_ENABLE([file-security],
[AC_HELP_STRING([--enable-file-security],
[enable extra security checks on files opened for read [default=no]])],
[if test "x$enable_file_security" != "xno"; then
AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
fi], [])
[xenable_file_security=$enableval],
[xenable_file_security=no])
if test "x$xenable_file_security" != "xno"; then
AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
fi
AC_TRY_RUN([
AC_TRY_COMPILE([],[
#include <stdio.h>
struct packstruct {
@ -516,7 +594,10 @@ AC_TRY_RUN([
else
return(0);
}
],[],[AC_DEFINE(HAVE_PRAGMA_PACK,[1],[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
],
[],
[AC_DEFINE(HAVE_PRAGMA_PACK,[1],
[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
)
@ -535,12 +616,14 @@ AC_CONFIG_FILES([Makefile
src/Makefile
src/plugins/Makefile
src/plugins/lan/Makefile
src/plugins/lanplus/Makefile
src/plugins/lanplus/Makefile
src/plugins/open/Makefile
src/plugins/free/Makefile
src/plugins/free/Makefile
src/plugins/imb/Makefile
src/plugins/bmc/Makefile
src/plugins/lipmi/Makefile])
src/plugins/lipmi/Makefile
src/plugins/serial/Makefile
src/plugins/dummy/Makefile])
AC_OUTPUT
@ -548,16 +631,18 @@ AC_MSG_RESULT([])
AC_MSG_RESULT([ipmitool $VERSION])
AC_MSG_RESULT([])
AC_MSG_RESULT([Interfaces])
AC_MSG_RESULT([ lan : $enable_intf_lan])
AC_MSG_RESULT([ lanplus : $enable_intf_lanplus])
AC_MSG_RESULT([ open : $enable_intf_open])
AC_MSG_RESULT([ free : $enable_intf_free])
AC_MSG_RESULT([ imb : $enable_intf_imb])
AC_MSG_RESULT([ bmc : $enable_intf_bmc])
AC_MSG_RESULT([ lipmi : $enable_intf_lipmi])
AC_MSG_RESULT([ lan : $xenable_intf_lan])
AC_MSG_RESULT([ lanplus : $xenable_intf_lanplus])
AC_MSG_RESULT([ open : $xenable_intf_open])
AC_MSG_RESULT([ free : $xenable_intf_free])
AC_MSG_RESULT([ imb : $xenable_intf_imb])
AC_MSG_RESULT([ bmc : $xenable_intf_bmc])
AC_MSG_RESULT([ lipmi : $xenable_intf_lipmi])
AC_MSG_RESULT([ serial : $xenable_intf_serial])
AC_MSG_RESULT([ dummy : $xenable_intf_dummy])
AC_MSG_RESULT([])
AC_MSG_RESULT([Extra tools])
AC_MSG_RESULT([ ipmievd : yes])
AC_MSG_RESULT([ ipmishell : $enable_ipmishell])
AC_MSG_RESULT([ ipmishell : $xenable_ipmishell])
AC_MSG_RESULT([])

View File

@ -34,6 +34,8 @@ dist_pkgdata_DATA = oem_ibm_sel_map
EXTRA_DIST = README \
bmclanconf ipmi.init.basic ipmi.init.redhat \
exchange-bmc-os-info.init.redhat exchange-bmc-os-info.service.redhat \
exchange-bmc-os-info.sysconf \
ipmievd.init.redhat ipmievd.init.suse ipmievd.init.debian \
collect_data.sh create_rrds.sh create_webpage_compact.sh create_webpage.sh
collect_data.sh create_rrds.sh create_webpage_compact.sh create_webpage.sh \
bmc-snmp-proxy bmc-snmp-proxy.service bmc-snmp-proxy.sysconf

381
contrib/bmc-snmp-proxy Normal file
View File

@ -0,0 +1,381 @@
#!/bin/sh
#############################################################################
#
# bmc-snmp-proxy: Set SNMP proxy to BMC (Baseboard Management Controller)
#
# version: 0.6
#
# Authors: Charles Rose <charles_rose@dell.com>
# Jordan Hargrave <jordan_hargrave@dell.com>
#
# Description: Script to set snmp proxy to the BMC for certain OID
# See here for details:
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
#
# Assumptions: This script will work only when /etc/snmp/ is writable.
#
#############################################################################
# GLOBALS
#############################################################################
SYSCONF_DIR="/etc/sysconfig"
CONFIG="${SYSCONF_DIR}/bmc-snmp-proxy"
SNMPD_LOCAL_CONF_DIR="/etc/snmp/bmc"
SNMPD_LOCAL_CONF="${SNMPD_LOCAL_CONF_DIR}/snmpd.local.conf"
TRAPD_LOCAL_CONF="${SNMPD_LOCAL_CONF_DIR}/snmptrapd.local.conf"
TRAPD_CONF="/etc/snmp/snmptrapd.conf"
LOCKFILE="/var/lock/subsys/bmc-snmp-proxy"
BMC_INFO="/var/run/bmc-info"
IPMITOOL=`which ipmitool`
#Default config
BMC_COMMUNITY="public"
BMC_OID=".1.3.6.1.4.1.674.10892.2" # Dell iDRAC
TRAP_FORWARD="no"
RELOAD_SERVICES="yes"
#############################################################################
#TODO: Use inotify and daemonize when $BMC_INFO changes
# source config
[ -r ${CONFIG} ] && . ${CONFIG}
. gettext.sh
SCRIPT_NAME=$(basename $0)
RETVAL=0
# Check if bmc-info created by exchange-bmc-os-info
bmc_info_exists()
{
if [ -r "${BMC_INFO}" ]; then
. ${BMC_INFO}
else
RETVAL=2
fi
return $RETVAL
}
check_snmp()
{
if [ ! -d /etc/snmp ] && [ ! -x /usr/sbin/snmpd ]; then
RETVAL=12
fi
return $RETVAL
}
#############################################################################
# configure SNMP proxy
#############################################################################
write_snmp_conf()
{
# SNMPv3 security: bmcview, bmc_ctx, bmc_sec, bmc_grp, bmc_cmty
printf "###############################################\n"
printf "# Automatically created by %s #\n" "${SCRIPT_NAME}"
printf "###############################################\n"
printf "view bmcview included %s 80\n" "${BMC_OID}"
printf "com2sec -Cn bmc_ctx bmc_sec default bmc_cmty\n"
printf "group bmc_grp v1 bmc_sec\n"
printf "access bmc_grp bmc_ctx any noauth exact bmcview none none\n"
printf "proxy -Cn bmc_ctx -v 1 %s\n" "${PROXY_TOKEN}"
printf "###############################################\n"
}
valid_ip()
{
#Thanks to mkyong.com
octet="([01]?[[:digit:]][[:digit:]]?|2[0-4][[:digit:]]|25[0-5])"
printf -- "%s" "${1}"| grep -Eq \
"^${octet}\\.${octet}\\.${octet}\\.${octet}$"
return $?
}
check_vars()
{
[ -z ${BMC_COMMUNITY} ] && BMC_COMMUNITY="public"
[ -z ${BMC_OID} ] && return 1
if [ -n "${BMC_IPv4}" ] && valid_ip ${BMC_IPv4}; then
return 0
else
return 1
fi
}
set_snmp_proxy()
{
if check_vars; then
PROXY_TOKEN="-c ${BMC_COMMUNITY} ${BMC_IPv4} ${BMC_OID}"
if [ ! -d ${SNMPD_LOCAL_CONF_DIR} ] && \
mkdir ${SNMPD_LOCAL_CONF_DIR}; then
write_snmp_conf > ${SNMPD_LOCAL_CONF}
[ $? -ne 0 ] && RETVAL=4
fi
else
RETVAL=3
fi
}
set_snmpd_conf_path()
{
for SYSCONF in ${SYSCONF_DIR}/snmp*d;
do
if grep -q "${SNMPD_LOCAL_CONF_DIR}" "${SYSCONF}" > \
/dev/null 2>&1; then
continue
else
printf "SNMPCONFPATH=%s\n" "${SNMPD_LOCAL_CONF_DIR}" \
>> ${SYSCONF} || RETVAL=7
fi
done
return $RETVAL
}
disable_snmp_proxy()
{
if [ -f ${SNMPD_LOCAL_CONF} ]; then
rm -f ${SNMPD_LOCAL_CONF}
[ $? -ne 0 ] && RETVAL=5
fi
}
#############################################################################
# Trap Forwarding
#############################################################################
pick_alert_dest()
{
test_ip="$1"
for ALERT_DEST in `seq 1 4`
do
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
2>/dev/null| sed -n "s#^Alert IP Address.*: ##p")
[ "${temp_ip}" = "${test_ip}" ] && return 0
done
return 1
}
set_alert_dest_ip()
{
${IPMITOOL} lan alert set ${CHANNEL} ${ALERT_DEST} ipaddr ${1} \
retry 4 type pet >/dev/null 2>&1
[ $? -ne 0 ] && RETVAL=8
}
bmc_alert_dest()
{
# Pick the first active LAN channel
for CHANNEL in `seq 1 14`
do
[ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \
| grep -q "802\.3") ] || break
done
# If TRAPD_IP is already set as an alert dest,
if pick_alert_dest "${TRAPD_IP}"; then
# reset: reset it if we are called with reset
[ "${1}" = "reset" ] && \
set_alert_dest_ip "0.0.0.0"
# else, find the next free alert dest,
elif pick_alert_dest "0.0.0.0"; then
[ "${1}" = "reset" ] && \
return $RETVAL
# set: the TRAPD_IP
set_alert_dest_ip "${TRAPD_IP}"
else
# No free alert destinations
RETVAL=9
fi
return $RETVAL
}
set_ipmi_alert()
{
${IPMITOOL} lan set ${CHANNEL} alert "${1}" >/dev/null 2>&1
[ $? -ne 0 ] && RETVAL=10
}
get_host_ip()
{
# Get host's IP that the BMC can reach.
IFACE=$(/usr/sbin/ip -o -f inet address |awk '!/: lo/ {print $2}')
for dev in ${IFACE}
do
ping -c 1 -I ${dev} ${BMC_IPv4} > /dev/null 2>&1
done
}
config_bmc_alert()
{
# Get Host's IP that the BMC can send traps to
TRAPD_IP=$(get_host_ip)
# Set Host's IP as the alert destination in the BMC
valid_ip ${TRAPD_IP} && bmc_alert_dest "${ACTION}"
# Enable alerting on the LAN channel
[ $RETVAL -eq 0 ] && set_ipmi_alert "${ACTION}"
}
write_trapd_conf()
{
printf "###############################################\n"
printf "# Automatically created by %s #\n" "${SCRIPT_NAME}"
printf "forward %s %s\n" "${BMC_OID}*" "${FORWARD_HOST}"
printf "###############################################\n"
}
config_trapd()
{
# Proceed only if snmptrapd is available on the system
if [ -f ${TRAPD_CONF} ]; then
write_trapd_conf > ${TRAPD_LOCAL_CONF}
[ $? -ne 0 ] && RETVAL=11
else
return 1
fi
}
trap_sink_exists()
{
# TODO: We only set the first match. We should be able to set
# multiple
FORWARD_HOST=$(awk '/^trap.*sink/{print $2}; /^informsink/{print $2}' \
/etc/snmp/snmpd*conf | head -1)
if [ -z "${FORWARD_HOST}" ]; then
# there is no trapsink setup.
return 1
else
return 0
fi
}
# Forward SNMP traps from the BMC to trapsink.
trap_forward()
{
NO_TRAP=0
ACTION=${1} # set or reset
if [ "${ACTION}" = "set" ]; then
# Get trapd config,
if trap_sink_exists; then
config_trapd && config_bmc_alert
else
# exit silently if there is no sink
NO_TRAP=1
fi
else
if [ -f ${TRAPD_LOCAL_CONF} ]; then
rm -f ${TRAPD_LOCAL_CONF} >/dev/null 2>&1
else
NO_TRAP=1
fi
fi
}
#############################################################################
service_reload()
{
#TODO: do this in systemd
if [ ${RETVAL} -eq 0 ] && [ "${RELOAD_SERVICES}" = "yes" ]; then
service $1 reload
[ $? -ne 0 ] && RETVAL=6
fi
return
}
#############################################################################
start()
{
if bmc_info_exists && check_snmp; then
touch ${LOCKFILE}
set_snmpd_conf_path && set_snmp_proxy
[ $RETVAL -eq 0 ] && service_reload snmpd
if [ "${TRAP_FORWARD}" = "yes" ]; then
trap_forward "set"
[ $RETVAL -eq 0 ] && [ $NO_TRAP -eq 0 ] && \
service_reload snmptrapd
fi
fi
}
#############################################################################
stop()
{
[ ! -f ${LOCKFILE} ] && return
if bmc_info_exists && check_snmp; then
disable_snmp_proxy
[ $RETVAL -eq 0 ] && service_reload snmpd
if [ "${TRAP_FORWARD}" = "yes" ]; then
trap_forward "reset"
[ $RETVAL -eq 0 ] && [ $NO_TRAP -eq 0 ] && \
service_reload snmptrapd
fi
rm -f ${LOCKFILE}
fi
}
#############################################################################
status()
{
eval_gettext "${SCRIPT_NAME}: snmp proxy to BMC is "
# Checking for lockfile is better.
#if grep -q "^proxy" "${SNMPD_LOCAL_CONF}" > /dev/null 2>&1 ; then
if [ -f ${LOCKFILE} ]; then
eval_gettext "set"
else
eval_gettext "not set"
fi
echo
RETVAL=0
}
#############################################################################
usage()
{
eval_gettext "Usage: $0 {start|stop|status}"; echo 1>&2
RETVAL=1
}
#############################################################################
# MAIN
#############################################################################
case "$1" in
start) start ;;
stop) stop ;;
status) status ;;
*) usage ;;
esac
case "$RETVAL" in
0|1) ;;
2) eval_gettext "${SCRIPT_NAME}: failed to read ${BMC_INFO} " 1>&2 ;;
3) eval_gettext "${SCRIPT_NAME}: failed to get proxy config." 1>&2 ;;
4) eval_gettext "${SCRIPT_NAME}: failed to set ${SNMPD_LOCAL_CONF}." 1>&2 ;;
5) eval_gettext "${SCRIPT_NAME}: failed to disable snmp proxy." 1>&2 ;;
6) eval_gettext "${SCRIPT_NAME}: failed to reload snmpd." 1>&2 ;;
7) eval_gettext "${SCRIPT_NAME}: failed to update ${SYSCONF}." 1>&2 ;;
8) eval_gettext "${SCRIPT_NAME}: failed to set IPMI alert dest." 1>&2 ;;
9) eval_gettext "${SCRIPT_NAME}: no free IPMI alert dest." 1>&2 ;;
10) eval_gettext "${SCRIPT_NAME}: failed to set IPMI PEF." 1>&2 ;;
11) eval_gettext "${SCRIPT_NAME}: failed to write snmptrapd.conf." 1>&2 ;;
12) eval_gettext "${SCRIPT_NAME}: snmpd not found." 1>&2 ;;
*) eval_gettext "${SCRIPT_NAME}: unknown error." 1>&2 ;;
esac
if [ ${RETVAL} -gt 1 ]; then
eval_gettext " Return code: ${RETVAL}"; echo
fi
exit ${RETVAL}
#############################################################################
# end of file
#############################################################################

View File

@ -0,0 +1,18 @@
[Unit]
Description=Setup SNMP proxy to BMC
After=exchange-bmc-os-info.service
Requires=exchange-bmc-os-info.service
PartOf=exchange-bmc-os-info.service
ConditionPathExists=/var/run/bmc-info
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/bmc-snmp-proxy start
ExecStop=/usr/libexec/bmc-snmp-proxy stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,48 @@
# bmc-snmp-proxy
#
# Config file to control SNMP redirection between
# the OS and Service Processor/Baseboard Management Controller (BMC)
#
# bmc-snnmp-proxy helps redirect certain SNMP requests (to this host)
# destined to the Service Processor. We will need the Service Processor's
# SNMP community string and the OID of the Service Processor's SNMP agent.
#
# For redirecting Traps from the Service Processor to the trap sink
# configured in the host (this system), we will have to set
# TRAP_FORWARD below.
#
# See here for details
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
### Configure SNMP proxy to BMC/Service Processor ###
### Service Processor/BMC SNMP Community String.
# Name: BMC_COMMUNITY
# Description: Set community string of the Service Processor (BMC)'s
# SNMP agent.
# Default: public
#
BMC_COMMUNITY="public"
### OEM Specific OID of Service Processor
# Name: BMC_OID
# Description: SNMP OID that we would like to redirect to the Service
# Processor (BMC). This can be unique to each OEM.
# Default: ".1.3.6.1.4.1.674.10892.2"
BMC_OID=".1.3.6.1.4.1.674.10892.2" # Dell iDRAC
### Forward Traps from the Service Processor to trap sink
# Name: TRAP_FORWARD
# Description: Enabling this will allow traps from the Service Processor
# to be directed to this system and configure snmptrapd
# Note: This option will have no effect if trap sink on the system is
# not configured
# Default: "no"
TRAP_FORWARD="yes"
### Reload snmpd and snmptrapd
# Name: RELOAD_SERVICES
# Description: Reload snmpd and snmptrapd after making changes to their config
# files.
# Default: "yes"
RELOAD_SERVICES="yes"

View File

@ -0,0 +1,326 @@
#!/bin/sh
#############################################################################
#
# exchange-bmc-os-info: Set OS and BMC (Baseboard Management Controller)
# parameters during system startup.
#
# version: 0.72
#
# Authors: Charles Rose <charles_rose@dell.com>
# Jordan Hargrave <jordan_hargrave@dell.com>
#
# Description: Script to set OS information in the BMC; fetch BMC IP/URL
# and set in the OS for use by other scripts/user.
#
# BMC IP and URL are made available in /var/run/bmc-info
#
# Example to launch BMC web-interface:
# # . /var/run/bmc-info
# # xdg-open $BMC_URL
#
# See here for details:
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
#
# OEM Specific: OEM specific ipmi commands go in:
# 'oem_set_os_version' and 'oem_get_bmc_url'
#############################################################################
#
# chkconfig: 345 99 00
# description: Set OS name, hostname in BMC; make BMC IP/URL available in OS
# processname: exchange-bmc-os-info
# config: /etc/sysconfig/exchange-bmc-os-info
#
### BEGIN INIT INFO
# Provides: exchange-bmc-os-info
# Required-Start: ipmi
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
#############################################################################
# GLOBALS
#############################################################################
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
IPMI_TOOL=/usr/bin/ipmitool
BMC_INFO=/var/run/bmc-info
# BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url'
DELL="674"
#OTHER_OEM="123"
# Defaults for ${CONFIGFILE}
SET_OS_INFO="yes"
RESET_OS_INFO="no"
SET_BMC_INFO="yes"
# getsysinfo and setsysinfo commands
IPMI_SET_SYSINFO="${IPMI_TOOL} mc setsysinfo"
IPMI_GET_SYSINFO="${IPMI_TOOL} mc getsysinfo"
#############################################################################
SCRIPT_NAME=$(basename $0)
# source config
[ -r ${CONFIGFILE} ] && . ${CONFIGFILE}
RETVAL=0
if [ -f /bin/gettext.sh ]; then
GETTEXT=1
. /bin/gettext.sh
OUTPUT="eval_gettext"
else
GETTEXT=0
OUTPUT="echo"
fi
#############################################################################
# Get Vendor ID of BMC for use in 'oem_set_os_version' and 'oem_get_bmc_url'
#
get_bmc_vendor_id()
{
BMC_VENDOR=$(${IPMI_TOOL} mc info 2>/dev/null | \
sed -n "s#^Manufacturer ID.*: ##p")
[ -z "${BMC_VENDOR}" ] && RETVAL=4
}
check_ipmitool()
{
if [ -x ${IPMI_TOOL} ]; then
# v1.8.12 plus patches are required for set/getsysinfo support
# http://sourceforge.net/mailarchive/message.php?msg_id=29647222
[ ! ${IPMI_GET_SYSINFO} >/dev/null 2>&1 ] && \
RETVAL=3
else
RETVAL=2
fi
}
bmc_exists()
{
check_ipmitool
[ $RETVAL -eq 0 ] && get_bmc_vendor_id
return $RETVAL
}
#############################################################################
get_os_info()
{
OS_HOSTNAME=$(hostname)
KERNEL_VERSION=$(uname -r -m)
if [ -e /etc/lsb-release ] ; then
. /etc/lsb-release
NAME=${DISTRIB_ID}
VERSION="${DISTRIB_RELEASE} ${DISTRIB_CODENAME}"
fi
# we prefer systemd's /etc/os-release over other sources
[ -e /etc/os-release ] && . /etc/os-release
OS_NAME=${NAME}
OS_VERSION="${VERSION} kernel ${KERNEL_VERSION}"
}
oem_set_os_version()
{
# OS Version setting is not standard yet
# we need per vendor oem commands
case "${BMC_VENDOR}" in
$DELL) ${IPMI_SET_SYSINFO} delloem_os_version \
"${OS_VERSION}" > /dev/null 2>&1
return $?
;;
# Add OEM specific commands.
# Example:
# $OTHER_OEM) ${IPMI_SET_SYSINFO} otheroem_os_version \
# "${OS_VERSION}" > /dev/null 2>&1
# return $?
# ;;
*) return 0
;;
esac
}
set_os_info()
{
# Set and reset OS info in the BMC
if [ "$1" = "reset" ]; then
OS_NAME=""
OS_HOSTNAME=""
OS_VERSION=""
fi
${IPMI_SET_SYSINFO} os_name "${OS_NAME}" >/dev/null 2>&1 \
|| RETVAL=6
${IPMI_SET_SYSINFO} primary_os_name "${OS_NAME}" >/dev/null 2>&1 \
|| RETVAL=6
${IPMI_SET_SYSINFO} system_name "${OS_HOSTNAME}" >/dev/null 2>&1 \
|| RETVAL=6
oem_set_os_version || RETVAL=6
}
#############################################################################
valid_url()
{
url="(https?|http)://[a-z0-9-]+(\.[a-z0-9-]+)+([/?].*)?"
printf -- "%s" "${TMP_URL}"| grep -Eq "^${url}"
return $?
}
oem_get_bmc_url()
{
# BMC URL is not standard yet
# we need per vendor oem commands
case "$BMC_VENDOR" in
$DELL) TMP_URL=$(${IPMI_GET_SYSINFO} delloem_url 2> /dev/null)
;;
# Add OEM specific commands
# Example:
# $OTHER_OEM)
# TMP_URL=$(${IPMI_GET_SYSINFO} otheroem_url 2> /dev/null)
# ;;
*) TMP_URL="" ;;
esac
valid_url && BMC_URL=${TMP_URL} || BMC_URL=""
}
valid_ip()
{
#Thanks to mkyong.com
octet="([01]?[[:digit:]][[:digit:]]?|2[0-4][[:digit:]]|25[0-5])"
printf -- "%s" "${TMP_IPv4}"| grep -Eq "^${octet}\\.${octet}\\.${octet}\\.${octet}$"
return $?
}
get_bmc_ip()
{
#Thanks to http://ingvar.blog.redpill-linpro.com
for CHANNEL in `seq 1 14`
do
[ $(${IPMI_TOOL} lan print ${CHANNEL} 2>/dev/null \
| grep -q "^Set") ] || break
done
# Get BMC_IPv4 and BMC_URL from BMC
TMP_IPv4=$(${IPMI_TOOL} lan print ${CHANNEL} 2>/dev/null \
| sed -n "s#^IP Address .*: ##p")
valid_ip && BMC_IPv4=${TMP_IPv4} || BMC_IPv4=""
}
get_bmc_info()
{
get_bmc_ip
if [ -z "${BMC_IPv4}" ] || [ "${BMC_IPv4}" = "0.0.0.0" ]; then
BMC_IPv4=""
RETVAL=5
else
# URL makes sense only if there is an IP
oem_get_bmc_url
fi
}
set_bmc_info()
{
if [ ! $(touch "${BMC_INFO}" && chmod 600 "${BMC_INFO}") ]; then
printf "BMC_IPv4=%s\n" "${BMC_IPv4}" > "${BMC_INFO}"
[ -n "${BMC_URL}" ] && \
printf "BMC_URL=%s\n" "${BMC_URL}" >> "${BMC_INFO}"
else
RETVAL=5
fi
}
unset_bmc_info()
{
[ -f ${BMC_INFO} ] && rm -f ${BMC_INFO} > /dev/null 2>&1
}
#############################################################################
start()
{
if bmc_exists; then
[ "${SET_OS_INFO}" = "yes" ] && \
get_os_info && set_os_info
if [ "${SET_BMC_INFO}" = "yes" ]; then
get_bmc_info
if [ ${RETVAL} -eq 0 ]; then
set_bmc_info
fi
fi
fi
}
#############################################################################
stop()
{
if bmc_exists; then
# reset OS info while system reboots
# aids with debugging OS boot-up issues
if [ "${RESET_OS_INFO}" = "yes" ]; then
set_os_info reset
fi
unset_bmc_info
fi
}
#############################################################################
restart()
{
stop
[ $RETVAL -eq 0 ] && start
}
#############################################################################
status()
{
[ -r ${BMC_INFO} ] && \
grep -q "BMC_IPv4" "${BMC_INFO}" >/dev/null 1>&2 && \
BMC_STATUS="ok" || BMC_STATUS="inactive"
${OUTPUT} "${SCRIPT_NAME}: ${BMC_STATUS}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
}
#############################################################################
usage()
{
${OUTPUT} "Usage: ${SCRIPT_NAME} {start|stop|restart|status}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
RETVAL=1
}
#############################################################################
# MAIN
#############################################################################
case "$1" in
start) start ;;
stop) stop ;;
restart) restart ;;
status) status ;;
*) usage ;;
esac
case "$RETVAL" in
0|1) ;;
2) ${OUTPUT} "${SCRIPT_NAME}: ipmitool(1) not found." 1>&2 ;;
3) ${OUTPUT} "${SCRIPT_NAME}: this version of ipmitool does not support getsysinfo." 1>&2 ;;
4) ${OUTPUT} "${SCRIPT_NAME}: failed to communicate with BMC." 1>&2 ;;
5) ${OUTPUT} "${SCRIPT_NAME}: failed to set OS information in BMC." 1>&2 ;;
6) ${OUTPUT} "${SCRIPT_NAME}: failed to get BMC information." 1>&2 ;;
*) ${OUTPUT} "${SCRIPT_NAME}: unexpected error." 1>&2 ;;
esac
if [ ${RETVAL} -gt 1 ]; then
${OUTPUT} " Return code: ${RETVAL}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
fi
exit ${RETVAL}
#############################################################################
# end of file
#############################################################################

View File

@ -0,0 +1,13 @@
[Unit]
Description=Exchange Information between BMC and OS
After=ipmi.service network.target
Requires=ipmi.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/exchange-bmc-os-info start
ExecStop=/usr/libexec/exchange-bmc-os-info stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,26 @@
# exchange-bmc-os-info
#
# Config file to control Exchange of information between
# the OS and Service Processor/Baseboard Management Controller (BMC)
#
# See here for details
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
### Set OS Info in BMC/Service Processor ###
# Name: SET_OS_INFO
# Description: Set OS Name, Version and Hostname in the Service Processor (BMC)
# Default: yes
SET_OS_INFO="yes"
### Reset OS Info in BMC/Service Processor ###
# Name: RESET_OS_INFO
# Description: Reset OS Name, Version and Hostname in the Service Processor (BMC).
# Useful when the OS Name/Hostname should be empty on reboot
# Default: no
RESET_OS_INFO="no"
### Set BMC/Service Processor Info in OS ###
# Name; SET_BMC_INFO
# Description: Set IP Address and URL of Service Processor/BMC in /run/bmc-info
# Default: yes
SET_BMC_INFO="yes"

View File

@ -4,7 +4,7 @@ Version: @VERSION@
Release: @RPM_RELEASE@%{?_distro:.%{_distro}}
License: BSD
Group: Utilities
Packager: Duncan Laurie <duncan@iceblink.org>
Packager: Jim Mankovich <jmank@hp.com>
Source: %{name}-%{version}.tar.gz
Buildroot: /var/tmp/ipmitool-root

View File

@ -8,5 +8,5 @@
%_srcrpmdir %{_topdir}/SRPMS
%_distro @DISTRO@
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%packager duncan@iceblink.org
%packager jmank@hp.com
%distribution Sourceforge Build

View File

View File

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_hpmfwupg.h ipmi_lanp.h \
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \
ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \

View File

@ -50,6 +50,14 @@
#define tboolean int
#endif
/* IPMI spec. - UID 0 reserved, 63 maximum UID which can be used */
#ifndef IPMI_UID_MIN
# define IPMI_UID_MIN 1
#endif
#ifndef IPMI_UID_MAX
# define IPMI_UID_MAX 63
#endif
struct ipmi_intf;
struct valstr {
@ -65,14 +73,20 @@ struct oemvalstr {
const char * val2str(uint16_t val, const struct valstr * vs);
const char * oemval2str(uint32_t oem,uint16_t val, const struct oemvalstr * vs);
int str2double(const char * str, double * double_ptr);
int str2long(const char * str, int64_t * lng_ptr);
int str2ulong(const char * str, uint64_t * ulng_ptr);
int str2int(const char * str, int32_t * int_ptr);
int str2uint(const char * str, uint32_t * uint_ptr);
int str2short(const char * str, int16_t * shrt_ptr);
int str2ushort(const char * str, uint16_t * ushrt_ptr);
int str2char(const char * str, int8_t * chr_ptr);
int str2uchar(const char * str, uint8_t * uchr_ptr);
int is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr);
int is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr);
int is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr);
uint16_t str2val(const char * str, const struct valstr * vs);
void print_valstr(const struct valstr * vs, const char * title, int loglevel);
void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel);
@ -85,6 +99,7 @@ void printbuf(const uint8_t * buf, int len, const char * desc);
uint8_t ipmi_csum(uint8_t * d, int s);
FILE * ipmi_open_file(const char * file, int rw);
void ipmi_start_daemon(struct ipmi_intf *intf);
uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)

86
include/ipmitool/hpm2.h Normal file
View File

@ -0,0 +1,86 @@
/*
* Copyright (c) 2012 Pigeon Point Systems. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Pigeon Point Systems nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* PIGEON POINT SYSTEMS ("PPS") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* PPS OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdint.h>
#include <ipmitool/ipmi_intf.h>
/* Global HPM.2 defines */
#define HPM2_REVISION 0x01
#define HPM3_REVISION 0x01
#define HPM2_LAN_PARAMS_REV 0x01
#define HPM2_SOL_PARAMS_REV 0x01
#define HPM3_LAN_PARAMS_REV 0x01
/* HPM.2 capabilities */
#define HPM2_CAPS_SOL_EXTENSION 0x01
#define HPM2_CAPS_PACKET_TRACE 0x02
#define HPM2_CAPS_EXT_MANAGEMENT 0x04
#define HPM2_CAPS_VERSION_SENSOR 0x08
#define HPM2_CAPS_DYNAMIC_SESSIONS 0x10
#if HAVE_PRAGMA_PACK
# pragma pack(push, 1)
#endif
/* HPM.2 LAN attach capabilities */
struct hpm2_lan_attach_capabilities {
uint8_t hpm2_revision_id;
uint16_t lan_channel_mask;
uint8_t hpm2_caps;
uint8_t hpm2_lan_params_start;
uint8_t hpm2_lan_params_rev;
uint8_t hpm2_sol_params_start;
uint8_t hpm2_sol_params_rev;
} ATTRIBUTE_PACKING;
/* HPM.2 LAN channel capabilities */
struct hpm2_lan_channel_capabilities {
uint8_t capabilities;
uint8_t attach_type;
uint8_t bandwidth_class;
uint16_t max_inbound_pld_size;
uint16_t max_outbound_pld_size;
} ATTRIBUTE_PACKING;
#if HAVE_PRAGMA_PACK
# pragma pack(pop)
#endif
/* HPM.2 command assignments */
#define HPM2_GET_LAN_ATTACH_CAPABILITIES 0x3E
extern int hpm2_get_capabilities(struct ipmi_intf * intf,
struct hpm2_lan_attach_capabilities * caps);
extern int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf,
uint8_t hpm2_lan_params_start,
struct hpm2_lan_channel_capabilities * caps);
extern int hpm2_detect_max_payload_size(struct ipmi_intf * intf);

View File

@ -242,6 +242,7 @@ struct ipmi_rs {
#define IPMI_NETFN_TRANSPORT 0xc
#define IPMI_NETFN_PICMG 0x2C
#define IPMI_NETFN_DCGRP 0x2C
#define IPMI_NETFN_OEM 0x2E
#define IPMI_NETFN_ISOL 0x34
#define IPMI_NETFN_TSOL 0x30
@ -265,6 +266,7 @@ typedef enum IPMI_OEM {
IPMI_OEM_DELL = 674,
IPMI_OEM_LMC = 2168,
IPMI_OEM_RADISYS = 4337,
IPMI_OEM_BROADCOM = 4413,
IPMI_OEM_MAGNUM = 5593,
IPMI_OEM_TYAN = 6653,
IPMI_OEM_NEWISYS = 9237,
@ -279,7 +281,8 @@ typedef enum IPMI_OEM {
IPMI_OEM_KONTRON = 15000,
IPMI_OEM_PPS = 16394,
IPMI_OEM_AMI = 20974,
IPMI_OEM_NOKIA_SIEMENS_NETWORKS = 28458
IPMI_OEM_NOKIA_SIEMENS_NETWORKS = 28458,
IPMI_OEM_SUPERMICRO_47488 = 47488
} IPMI_OEM;
extern const struct valstr completion_code_vals[];

View File

@ -87,11 +87,11 @@ struct get_channel_auth_cap_rsp {
#endif
#if WORDS_BIGENDIAN
uint8_t __reserved3 : 6;
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
#else
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
uint8_t __reserved3 : 6;
#endif
uint8_t oem_id[3]; /* IANA enterprise number for auth type */

View File

@ -44,6 +44,7 @@
#define IPMI_DCMI_CONFORM 0x0001
#define IPMI_DCMI_1_1_CONFORM 0x0101
#define IPMI_DCMI_1_5_CONFORM 0x0501
#define DCMI_MAX_BYTE_SIZE 0x10
#define DCMI_MAX_BYTE_TEMP_READ_SIZE 0x08

View File

@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
#define MAX(a,b) ((a) > (b) ? (a) : (b))
/* IPMI 2.0 command for system information*/
#define IPMI_SET_SYS_INFO 0x58
#define IPMI_GET_SYS_INFO 0x59
/* Dell selector for LCD control - get and set unless specified */
#define IPMI_DELL_LCD_STRING_SELECTOR 0xC1 /* RW get/set the user string */
#define IPMI_DELL_LCD_CONFIG_SELECTOR 0xC2 /* RW set to user/default/none */
@ -139,6 +135,7 @@ typedef struct _tag_ipmi_dell_lcd_stringex
typedef struct _lcd_status
{
char parametersel;
char vKVM_status;
char lock_status;
char Resv1;
@ -156,6 +153,7 @@ typedef struct _lcd_mode
} __attribute__ ((packed)) LCD_MODE;
#define PARAM_REV_OFFSET (uint8_t)(0x1)
#define VIRTUAL_MAC_OFFSET (uint8_t)(0x1)
#define LOM_MACTYPE_ETHERNET 0
#define LOM_MACTYPE_ISCSI 1

View File

@ -63,6 +63,8 @@ enum {
struct fru_info {
uint16_t size;
uint8_t access:1;
uint8_t max_read_size;
uint8_t max_write_size;
};
#ifdef HAVE_PRAGMA_PACK
@ -70,13 +72,16 @@ struct fru_info {
#endif
struct fru_header {
uint8_t version;
struct {
uint8_t internal;
uint8_t chassis;
uint8_t board;
uint8_t product;
uint8_t multi;
} offset;
union {
struct {
uint8_t internal;
uint8_t chassis;
uint8_t board;
uint8_t product;
uint8_t multi;
} offset;
uint8_t offsets[5];
};
uint8_t pad;
uint8_t checksum;
}ATTRIBUTE_PACKING;
@ -397,20 +402,21 @@ struct fru_picmgext_amc_link_desc {
#define OEM_SWFW_NBLOCK_OFFSET 0x05
#define OEM_SWFW_FIELD_START_OFFSET 0x06
#define FRU_PICMGEXT_CHN_DESC_RECORD_SIZE 3
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
struct fru_picmgext_chn_desc {
#ifndef WORDS_BIGENDIAN
unsigned char remote_slot:8;
unsigned char remote_chn:5;
unsigned char local_chn:5;
unsigned char:6;
unsigned int remote_slot:8;
unsigned int remote_chn:5;
unsigned int local_chn:5;
unsigned int res:14;
#else
unsigned char:6;
unsigned char local_chn:5;
unsigned char remote_chn:5;
unsigned char remote_slot:8;
unsigned int res:14;
unsigned int local_chn:5;
unsigned int remote_chn:5;
unsigned int remote_slot:8;
#endif
}ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
@ -507,28 +513,30 @@ struct fru_picmgext_amc_p2p_record {
#pragma pack(0)
#endif
#define FRU_PICMGEXT_AMC_CHANNEL_DESC_RECORD_SIZE 3
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
struct fru_picmgext_amc_channel_desc_record {
#ifndef WORDS_BIGENDIAN
unsigned char lane0port :5;
unsigned char lane1port :5;
unsigned char lane2port :5;
unsigned char lane3port :5;
unsigned char /*reserved */ :4;
#else
unsigned char /*reserved */ :4;
unsigned char lane3port :5;
unsigned char lane2port :5;
unsigned char lane1port :5;
unsigned char lane0port :5;
unsigned int lane0port :5;
unsigned int lane1port :5;
unsigned int lane2port :5;
unsigned int lane3port :5;
unsigned int /* reserved */ :12;
#else
unsigned int /* reserved */ :12;
unsigned int lane3port :5;
unsigned int lane2port :5;
unsigned int lane1port :5;
unsigned int lane0port :5;
#endif
}ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
#pragma pack(0)
#endif
#define FRU_PICMGEXT_AMC_LINK_DESC_RECORD_SIZE 5
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
@ -552,27 +560,28 @@ struct fru_picmgext_amc_link_desc_record {
#define AMC_LINK_TYPE_EXT_STORAGE_SATA 0x01
#define AMC_LINK_TYPE_EXT_STORAGE_SAS 0x02
#ifndef WORDS_BIGENDIAN
unsigned short channel_id :8;
unsigned short port_flag_0 :1;
unsigned short port_flag_1 :1;
unsigned short port_flag_2 :1;
unsigned short port_flag_3 :1;
unsigned short type :8;
unsigned short type_ext :4;
unsigned short group_id :8;
unsigned char asym_match :2;
unsigned char /* reserved */ :6;
unsigned int channel_id :8;
unsigned int port_flag_0 :1;
unsigned int port_flag_1 :1;
unsigned int port_flag_2 :1;
unsigned int port_flag_3 :1;
unsigned int type :8;
unsigned int type_ext :4;
unsigned int group_id :8;
unsigned int asym_match :2;
unsigned int /* reserved */ :30;
#else
unsigned char /* reserved */ :6;
unsigned char asym_match :2;
unsigned short group_id :8;
unsigned short type_ext :4;
unsigned short type :8;
unsigned short port_flag_3 :1;
unsigned short port_flag_2 :1;
unsigned short port_flag_1 :1;
unsigned short port_flag_0 :1;
unsigned short channel_id :8;
unsigned int group_id :8;
unsigned int type_ext :4;
unsigned int type :8;
unsigned int port_flag_3 :1;
unsigned int port_flag_2 :1;
unsigned int port_flag_1 :1;
unsigned int port_flag_0 :1;
unsigned int channel_id :8;
unsigned int /* reserved */ :30;
unsigned int asym_match :2;
#endif
}ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
@ -594,6 +603,20 @@ static const char * chassis_type_desc[] __attribute__((unused)) = {
"AdvancedTCA", "Blade", "Blade Enclosure"
};
typedef struct ipmi_fru_bloc {
struct ipmi_fru_bloc * next;
uint16_t start;
uint16_t size;
uint8_t blocId[32];
} t_ipmi_fru_bloc;
static const char *section_id[4] = {
"Internal Use Section",
"Chassis Section",
"Board Section",
"Product Section"
};
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);

View File

@ -0,0 +1,243 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KFWUM_H
# define IPMI_KFWUM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
/* KFWUM Version */
# define VER_MAJOR 1
# define VER_MINOR 3
/* Minimum size (IPMB/IOL/old protocol) */
# define KFWUM_SMALL_BUFFER 32
/* Maximum size on KCS interface */
# define KFWUM_BIG_BUFFER 32
# define MAX_BUFFER_SIZE 1024*16
/* 3 address + 1 size + 1 checksum + 1 command */
# define KFWUM_OLD_CMD_OVERHEAD 6
/* 1 sequence + 1 size + 1 checksum + 1 command */
# define KFWUM_NEW_CMD_OVERHEAD 4
# define KFWUM_PAGE_SIZE 256
# define FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT 6
# define FWUM_MAX_UPLOAD_RETRY 6
# define TRACE_LOG_CHUNK_COUNT 7
# define TRACE_LOG_CHUNK_SIZE 7
# define TRACE_LOG_ATT_COUNT 3
# define IN_FIRMWARE_INFO_OFFSET_LOCATION 0x5a0
# define IN_FIRMWARE_INFO_SIZE 20
# define IN_FIRMWARE_INFO_OFFSET_FILE_SIZE 0
# define IN_FIRMWARE_INFO_OFFSET_CHECKSUM 4
# define IN_FIRMWARE_INFO_OFFSET_BOARD_ID 6
# define IN_FIRMWARE_INFO_OFFSET_DEVICE_ID 8
# define IN_FIRMWARE_INFO_OFFSET_TABLE_VERSION 9
# define IN_FIRMWARE_INFO_OFFSET_IMPLEMENT_REV 10
# define IN_FIRMWARE_INFO_OFFSET_VER_MAJOROR 11
# define IN_FIRMWARE_INFO_OFFSET_VER_MINORSUB 12
# define IN_FIRMWARE_INFO_OFFSET_SDR_REV 13
# define IN_FIRMWARE_INFO_OFFSET_IANA0 14
# define IN_FIRMWARE_INFO_OFFSET_IANA1 15
# define IN_FIRMWARE_INFO_OFFSET_IANA2 16
# define KWUM_GET_BYTE_AT_OFFSET(pBuffer,os) pBuffer[os]
int ipmi_fwum_main(struct ipmi_intf *, int, char **);
typedef enum eKFWUM_BoardList
{
KFWUM_BOARD_KONTRON_UNKNOWN = 0,
KFWUM_BOARD_KONTRON_5002 = 5002,
} tKFWUM_BoardList;
typedef struct sKFWUM_BoardInfo
{
tKFWUM_BoardList boardId;
IPMI_OEM iana;
} tKFWUM_BoardInfo;
typedef enum eKFWUM_DownloadType
{
KFWUM_DOWNLOAD_TYPE_ADDRESS = 0,
KFWUM_DOWNLOAD_TYPE_SEQUENCE,
} tKFWUM_DownloadType;
typedef enum eKFWUM_DownloadBuffferType
{
KFWUM_SMALL_BUFFER_TYPE = 0,
KFUMW_BIG_BUFFER_TYPE
} tKFWUM_DownloadBuffferType;
typedef struct sKFWUM_InFirmwareInfo
{
unsigned long fileSize;
unsigned short checksum;
unsigned short sumToRemoveFromChecksum;
/* Since the checksum is added in the bin
* after the checksum is calculated, we
* need to remove the each byte value. This
* byte will contain the addition of both bytes
*/
tKFWUM_BoardList boardId;
unsigned char deviceId;
unsigned char tableVers;
unsigned char implRev;
unsigned char versMajor;
unsigned char versMinor;
unsigned char versSubMinor;
unsigned char sdrRev;
IPMI_OEM iana;
} tKFWUM_InFirmwareInfo;
typedef struct sKFWUM_SaveFirmwareInfo
{
tKFWUM_DownloadType downloadType;
unsigned char bufferSize;
unsigned char overheadSize;
} tKFWUM_SaveFirmwareInfo;
/* COMMANDS */
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumGetInfoResp {
unsigned char protocolRevision;
unsigned char controllerDeviceId;
struct {
unsigned char mode:1;
unsigned char seqAdd:1;
unsigned char res : 6;
} byte;
unsigned char firmRev1;
unsigned char firmRev2;
unsigned char numBank;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumGetStatusResp {
unsigned char bankState;
unsigned char firmLengthLSB;
unsigned char firmLengthMid;
unsigned char firmLengthMSB;
unsigned char firmRev1;
unsigned char firmRev2;
unsigned char firmRev3;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumManualRollbackReq {
unsigned char type;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumStartFirmwareDownloadReq {
unsigned char lengthLSB;
unsigned char lengthMid;
unsigned char lengthMSB;
unsigned char paddingLSB;
unsigned char paddingMSB;
unsigned char useSequence;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumStartFirmwareDownloadResp {
unsigned char bank;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumSaveFirmwareAddressReq
{
unsigned char addressLSB;
unsigned char addressMid;
unsigned char addressMSB;
unsigned char numBytes;
unsigned char txBuf[KFWUM_SMALL_BUFFER-KFWUM_OLD_CMD_OVERHEAD];
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumSaveFirmwareSequenceReq
{
unsigned char sequenceNumber;
unsigned char txBuf[KFWUM_BIG_BUFFER];
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumFinishFirmwareDownloadReq {
unsigned char versionMaj;
unsigned char versionMinSub;
unsigned char versionSdr;
unsigned char reserved;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
#endif /* IPMI_KFWUM_H */

View File

@ -0,0 +1,808 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_HPMFWUPG_H
#define IPMI_HPMFWUPG_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
/* Agent version */
#define HPMFWUPG_VERSION_MAJOR 1
#define HPMFWUPG_VERSION_MINOR 0
#define HPMFWUPG_VERSION_SUBMINOR 9
/* HPM.1 FIRMWARE UPGRADE COMMANDS (part of PICMG) */
#define HPMFWUPG_GET_TARGET_UPG_CAPABILITIES 0x2E
#define HPMFWUPG_GET_COMPONENT_PROPERTIES 0x2F
#define HPMFWUPG_ABORT_UPGRADE 0x30
#define HPMFWUPG_INITIATE_UPGRADE_ACTION 0x31
#define HPMFWUPG_UPLOAD_FIRMWARE_BLOCK 0x32
#define HPMFWUPG_FINISH_FIRMWARE_UPLOAD 0x33
#define HPMFWUPG_GET_UPGRADE_STATUS 0x34
#define HPMFWUPG_ACTIVATE_FIRMWARE 0x35
#define HPMFWUPG_QUERY_SELFTEST_RESULT 0x36
#define HPMFWUPG_QUERY_ROLLBACK_STATUS 0x37
#define HPMFWUPG_MANUAL_FIRMWARE_ROLLBACK 0x38
/* HPM.1 SPECIFIC COMPLETION CODES */
#define HPMFWUPG_ROLLBACK_COMPLETED 0x00
#define HPMFWUPG_COMMAND_IN_PROGRESS 0x80
#define HPMFWUPG_NOT_SUPPORTED 0x81
#define HPMFWUPG_SIZE_MISMATCH 0x81
#define HPMFWUPG_ROLLBACK_FAILURE 0x81
#define HPMFWUPG_INV_COMP_MASK 0x81
#define HPMFWUPG__ABORT_FAILURE 0x81
#define HPMFWUPG_INV_COMP_ID 0x82
#define HPMFWUPG_INT_CHECKSUM_ERROR 0x82
#define HPMFWUPG_INV_UPLOAD_MODE 0x82
#define HPMFWUPG_ROLLBACK_OVERRIDE 0x82
#define HPMFWUPG_INV_COMP_PROP 0x83
#define HPMFWUPG_FW_MISMATCH 0x83
#define HPMFWUPG_ROLLBACK_DENIED 0x83
/*
* This error code is used as a temporary PATCH to
* the latest Open ipmi driver. This PATCH
* will be removed once a new Open IPMI driver is released.
* (Buggy version = 39)
*/
#define ENABLE_OPENIPMI_V39_PATCH
#ifdef ENABLE_OPENIPMI_V39_PATCH
# define RETRY_COUNT_MAX 3
static int errorCount;
# define HPMFWUPG_IS_RETRYABLE(error) \
((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE)
#else
# define HPMFWUPG_IS_RETRYABLE(error) FALSE
#endif
/* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */
#define HPMFWUPG_PICMG_IDENTIFIER 0
#define HPMFWUPG_VERSION_SIZE 6
#define HPMFWUPG_DESC_STRING_LENGTH 12
#define HPMFWUPG_DEFAULT_INACCESS_TIMEOUT 60 /* sec */
#define HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT 60 /* sec */
#define HPMFWUPG_MD5_SIGNATURE_LENGTH 16
/* Component IDs */
typedef enum eHpmfwupgComponentId {
HPMFWUPG_COMPONENT_ID_0 = 0,
HPMFWUPG_COMPONENT_ID_1,
HPMFWUPG_COMPONENT_ID_2,
HPMFWUPG_COMPONENT_ID_3,
HPMFWUPG_COMPONENT_ID_4,
HPMFWUPG_COMPONENT_ID_5,
HPMFWUPG_COMPONENT_ID_6,
HPMFWUPG_COMPONENT_ID_7,
HPMFWUPG_COMPONENT_ID_MAX
} tHpmfwupgComponentId;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgComponentBitMask {
union {
unsigned char byte;
struct {
#ifdef WORDS_BIGENDIAN
unsigned char component7 : 1;
unsigned char component6 : 1;
unsigned char component5 : 1;
unsigned char component4 : 1;
unsigned char component3 : 1;
unsigned char component2 : 1;
unsigned char component1 : 1;
unsigned char component0 : 1;
#else
unsigned char component0 : 1;
unsigned char component1 : 1;
unsigned char component2 : 1;
unsigned char component3 : 1;
unsigned char component4 : 1;
unsigned char component5 : 1;
unsigned char component6 : 1;
unsigned char component7 : 1;
#endif
} ATTRIBUTE_PACKING bitField;
} ATTRIBUTE_PACKING ComponentBits;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
static const int HPMFWUPG_SUCCESS = 0;
static const int HPMFWUPG_ERROR = -1;
/* Upload firmware specific error codes */
static const int HPMFWUPG_UPLOAD_BLOCK_LENGTH = 1;
static const int HPMFWUPG_UPLOAD_RETRY = 2;
/* TARGET UPGRADE CAPABILITIES DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesResp {
unsigned char picmgId;
unsigned char hpmVersion;
union {
unsigned char byte;
struct {
#if WORDS_BIGENDIAN
unsigned char fwUpgUndesirable : 1;
unsigned char autRollbackOverride : 1;
unsigned char ipmcDegradedDurinUpg: 1;
unsigned char deferActivation : 1;
unsigned char servAffectDuringUpg : 1;
unsigned char manualRollback : 1;
unsigned char autRollback : 1;
unsigned char ipmcSelftestCap : 1;
#else
unsigned char ipmcSelftestCap : 1;
unsigned char autRollback : 1;
unsigned char manualRollback : 1;
unsigned char servAffectDuringUpg : 1;
unsigned char deferActivation : 1;
unsigned char ipmcDegradedDurinUpg: 1;
unsigned char autRollbackOverride : 1;
unsigned char fwUpgUndesirable : 1;
#endif
} ATTRIBUTE_PACKING bitField;
} ATTRIBUTE_PACKING GlobalCapabilities;
unsigned char upgradeTimeout;
unsigned char selftestTimeout;
unsigned char rollbackTimeout;
unsigned char inaccessTimeout;
struct HpmfwupgComponentBitMask componentsPresent;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesCtx {
struct HpmfwupgGetTargetUpgCapabilitiesReq req;
struct HpmfwupgGetTargetUpgCapabilitiesResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* COMPONENT PROPERTIES DEFINITIONS */
typedef enum eHpmfwupgCompPropertiesSelect {
HPMFWUPG_COMP_GEN_PROPERTIES = 0,
HPMFWUPG_COMP_CURRENT_VERSION,
HPMFWUPG_COMP_DESCRIPTION_STRING,
HPMFWUPG_COMP_ROLLBACK_FIRMWARE_VERSION,
HPMFWUPG_COMP_DEFERRED_FIRMWARE_VERSION,
HPMFWUPG_COMP_RESERVED,
HPMFWUPG_COMP_OEM_PROPERTIES = 192
} tHpmfwupgCompPropertiesSelect;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesReq {
unsigned char picmgId;
unsigned char componentId;
unsigned char selector;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetGeneralPropResp {
unsigned char picmgId;
union {
unsigned char byte;
struct {
#if WORDS_BIGENDIAN
unsigned char reserved : 2;
unsigned char payloadColdReset : 1;
unsigned char deferredActivation : 1;
unsigned char comparisonSupport : 1;
unsigned char preparationSupport : 1;
unsigned char rollbackBackup : 2;
#else
unsigned char rollbackBackup : 2;
unsigned char preparationSupport : 1;
unsigned char comparisonSupport : 1;
unsigned char deferredActivation : 1;
unsigned char payloadColdReset : 1;
unsigned char reserved : 2;
#endif
} ATTRIBUTE_PACKING bitfield;
} ATTRIBUTE_PACKING GeneralCompProperties;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetCurrentVersionResp {
unsigned char picmgId;
unsigned char currentVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetDescStringResp {
unsigned char picmgId;
char descString[HPMFWUPG_DESC_STRING_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetRollbackFwVersionResp {
unsigned char picmgId;
unsigned char rollbackFwVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetDeferredFwVersionResp {
unsigned char picmgId;
unsigned char deferredFwVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* GetComponentProperties - OEM properties (192) */
#define HPMFWUPG_OEM_LENGTH 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetOemProperties {
unsigned char picmgId;
unsigned char oemRspData[HPMFWUPG_OEM_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesResp {
union {
struct HpmfwupgGetGeneralPropResp generalPropResp;
struct HpmfwupgGetCurrentVersionResp currentVersionResp;
struct HpmfwupgGetDescStringResp descStringResp;
struct HpmfwupgGetRollbackFwVersionResp rollbackFwVersionResp;
struct HpmfwupgGetDeferredFwVersionResp deferredFwVersionResp;
struct HpmfwupgGetOemProperties oemProperties;
} ATTRIBUTE_PACKING Response;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesCtx {
struct HpmfwupgGetComponentPropertiesReq req;
struct HpmfwupgGetComponentPropertiesResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* ABORT UPGRADE DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeCtx {
struct HpmfwupgAbortUpgradeReq req;
struct HpmfwupgAbortUpgradeResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* UPGRADE ACTIONS DEFINITIONS */
typedef enum eHpmfwupgUpgradeAction {
HPMFWUPG_UPGRADE_ACTION_BACKUP = 0,
HPMFWUPG_UPGRADE_ACTION_PREPARE,
HPMFWUPG_UPGRADE_ACTION_UPGRADE,
HPMFWUPG_UPGRADE_ACTION_COMPARE,
HPMFWUPG_UPGRADE_ACTION_INVALID = 0xff
} tHpmfwupgUpgradeAction;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionReq {
unsigned char picmgId;
struct HpmfwupgComponentBitMask componentsMask;
unsigned char upgradeAction;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionCtx {
struct HpmfwupgInitiateUpgradeActionReq req;
struct HpmfwupgInitiateUpgradeActionResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* UPLOAD FIRMWARE BLOCK DEFINITIONS */
#define HPMFWUPG_SEND_DATA_COUNT_KCS 30
#define HPMFWUPG_SEND_DATA_COUNT_LAN 25
#define HPMFWUPG_SEND_DATA_COUNT_IPMB 26
#define HPMFWUPG_SEND_DATA_COUNT_IPMBL 26
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockReq {
unsigned char picmgId;
unsigned char blockNumber;
unsigned char data[0];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockCtx {
struct HpmfwupgUploadFirmwareBlockReq * req;
struct HpmfwupgUploadFirmwareBlockResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* FINISH FIRMWARE UPLOAD DEFINITIONS */
#define HPMFWUPG_IMAGE_SIZE_BYTE_COUNT 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadReq {
unsigned char picmgId;
unsigned char componentId;
unsigned char imageLength[HPMFWUPG_IMAGE_SIZE_BYTE_COUNT];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadCtx {
struct HpmfwupgFinishFirmwareUploadReq req;
struct HpmfwupgFinishFirmwareUploadResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* ACTIVATE FW DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareReq {
unsigned char picmgId;
unsigned char rollback_override;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareCtx {
struct HpmfwupgActivateFirmwareReq req;
struct HpmfwupgActivateFirmwareResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* GET UPGRADE STATUS DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusResp {
unsigned char picmgId;
unsigned char cmdInProcess;
unsigned char lastCmdCompCode;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusCtx {
struct HpmfwupgGetUpgradeStatusReq req;
struct HpmfwupgGetUpgradeStatusResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* MANUAL FW ROLLBACK DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgManualFirmwareRollbackReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgManualFirmwareRollbackResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
struct HpmfwupgManualFirmwareRollbackCtx {
struct HpmfwupgManualFirmwareRollbackReq req;
struct HpmfwupgManualFirmwareRollbackResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* QUERY ROLLBACK STATUS DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusResp {
unsigned char picmgId;
struct HpmfwupgComponentBitMask rollbackComp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusCtx {
struct HpmfwupgQueryRollbackStatusReq req;
struct HpmfwupgQueryRollbackStatusResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* QUERY SELF TEST RESULT DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultResp {
unsigned char picmgId;
unsigned char result1;
unsigned char result2;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultCtx {
struct HpmfwupgQuerySelftestResultReq req;
struct HpmfwupgQuerySelftestResultResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* HPM.1 IMAGE DEFINITIONS */
#define HPMFWUPG_HEADER_SIGNATURE_LENGTH 8
#define HPMFWUPG_MANUFATURER_ID_LENGTH 3
#define HPMFWUPG_PRODUCT_ID_LENGTH 2
#define HPMFWUPG_TIME_LENGTH 4
#define HPMFWUPG_TIMEOUT_LENGTH 1
#define HPMFWUPG_COMP_REVISION_LENGTH 2
#define HPMFWUPG_FIRM_REVISION_LENGTH 6
#define HPMFWUPG_IMAGE_HEADER_VERSION 0
#define HPMFWUPG_IMAGE_SIGNATURE "PICMGFWU"
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
struct HpmfwupgImageHeader {
char signature[HPMFWUPG_HEADER_SIGNATURE_LENGTH];
unsigned char formatVersion;
unsigned char deviceId;
unsigned char manId[HPMFWUPG_MANUFATURER_ID_LENGTH];
unsigned char prodId[HPMFWUPG_PRODUCT_ID_LENGTH];
unsigned char time[HPMFWUPG_TIME_LENGTH];
union {
struct {
#if WORDS_BIGENDIAN
unsigned char imageSelfTest : 1;
unsigned char autRollback : 1;
unsigned char manRollback : 1;
unsigned char servAffected : 1;
unsigned char reserved : 4;
#else
unsigned char reserved : 4;
unsigned char servAffected : 1;
unsigned char manRollback : 1;
unsigned char autRollback : 1;
unsigned char imageSelfTest : 1;
#endif
} ATTRIBUTE_PACKING bitField;
unsigned char byte;
}ATTRIBUTE_PACKING imageCapabilities;
struct HpmfwupgComponentBitMask components;
unsigned char selfTestTimeout;
unsigned char rollbackTimeout;
unsigned char inaccessTimeout;
unsigned char compRevision[HPMFWUPG_COMP_REVISION_LENGTH];
unsigned char firmRevision[HPMFWUPG_FIRM_REVISION_LENGTH];
unsigned short oemDataLength;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#define HPMFWUPG_DESCRIPTION_LENGTH 21
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActionRecord {
unsigned char actionType;
struct HpmfwupgComponentBitMask components;
unsigned char checksum;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#define HPMFWUPG_FIRMWARE_SIZE_LENGTH 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFirmwareImage {
unsigned char version[HPMFWUPG_FIRM_REVISION_LENGTH];
char desc[HPMFWUPG_DESCRIPTION_LENGTH];
unsigned char length[HPMFWUPG_FIRMWARE_SIZE_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUpgradeCtx {
struct HpmfwupgComponentBitMask compUpdateMask;
unsigned int imageSize;
unsigned char* pImageData;
unsigned char componentId;
struct HpmfwupgGetTargetUpgCapabilitiesResp targetCap;
struct HpmfwupgGetGeneralPropResp genCompProp[HPMFWUPG_COMPONENT_ID_MAX];
struct ipm_devid_rsp devId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
typedef enum eHpmfwupgActionType {
HPMFWUPG_ACTION_BACKUP_COMPONENTS = 0,
HPMFWUPG_ACTION_PREPARE_COMPONENTS,
HPMFWUPG_ACTION_UPLOAD_FIRMWARE,
HPMFWUPG_ACTION_RESERVED = 0xFF
} tHpmfwupgActionType;
/* FUNCTIONS PROTOTYPES */
#define HPMFWUPG_MAJORMINOR_VERSION_SIZE 2
/* Options added for user to check the version and to view both the FILE and
* TARGET Version
*/
#define VIEW_MODE 0x01
#define DEBUG_MODE 0x02
#define FORCE_MODE 0x04
#define COMPARE_MODE 0x08
typedef struct _VERSIONINFO {
unsigned char componentId;
unsigned char targetMajor;
unsigned char targetMinor;
unsigned char targetAux[4];
unsigned char rollbackMajor;
unsigned char rollbackMinor;
unsigned char rollbackAux[4];
unsigned char deferredMajor;
unsigned char deferredMinor;
unsigned char deferredAux[4];
unsigned char imageMajor;
unsigned char imageMinor;
unsigned char imageAux[4];
unsigned char coldResetRequired;
unsigned char rollbackSupported;
char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
}VERSIONINFO, *PVERSIONINFO;
VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
#define TARGET_VER (0x01)
#define ROLLBACK_VER (0x02)
#define IMAGE_VER (0x04)
#endif /* IPMI_KFWUM_H */

View File

@ -89,8 +89,9 @@ struct ipmi_session {
uint32_t out_seq;
uint32_t timeout;
struct sockaddr_in addr;
struct sockaddr_storage addr;
socklen_t addrlen;
int ai_family; /* Protocol family for socket. */
/*
* This struct holds state data specific to IPMI v2 / RMCP+ sessions
@ -161,22 +162,26 @@ struct ipmi_intf_support {
struct ipmi_intf {
char name[16];
char desc[128];
char *devfile;
int fd;
int opened;
int abort;
int noanswer;
int picmg_avail;
IPMI_OEM manufacturer_id;
struct ipmi_session * session;
struct ipmi_oem_handle * oem;
struct ipmi_cmd * cmdlist;
uint8_t target_ipmb_addr;
uint32_t my_addr;
uint32_t target_addr;
uint8_t target_lun;
uint8_t target_channel;
uint32_t transit_addr;
uint8_t transit_channel;
uint8_t channel_buf_size;
uint16_t max_request_data_size;
uint16_t max_response_data_size;
uint8_t devnum;
@ -188,6 +193,9 @@ struct ipmi_intf {
struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf);
struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload);
int (*keepalive)(struct ipmi_intf * intf);
int (*set_my_addr)(struct ipmi_intf * intf, uint8_t addr);
void (*set_max_request_data_size)(struct ipmi_intf * intf, uint16_t size);
void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size);
};
struct ipmi_intf * ipmi_intf_load(char * name);
@ -207,4 +215,7 @@ void ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout);
void ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry);
void ipmi_cleanup(struct ipmi_intf * intf);
#if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS)
int ipmi_intf_socket_connect(struct ipmi_intf * intf);
#endif
#endif /* IPMI_INTF_H */

View File

@ -151,4 +151,20 @@ struct ipm_get_watchdog_rsp {
#define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04
#define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02
/* IPMI 2.0 command for system information*/
#define IPMI_SET_SYS_INFO 0x58
#define IPMI_GET_SYS_INFO 0x59
#define IPMI_SYSINFO_SET0_SIZE 14
#define IPMI_SYSINFO_SETN_SIZE 16
#define IPMI_SYSINFO_HOSTNAME 0x02
#define IPMI_SYSINFO_PRIMARY_OS_NAME 0x03
#define IPMI_SYSINFO_OS_NAME 0x04
#define IPMI_SYSINFO_DELL_OS_VERSION 0xe4
#define IPMI_SYSINFO_DELL_URL 0xde
int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
int len, void *buffer);
int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer);
#endif /*IPMI_MC_H */

View File

@ -205,5 +205,7 @@ struct sAmcPortState {
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
uint8_t picmg_discover(struct ipmi_intf *intf);
uint8_t ipmi_picmg_ipmb_address(struct ipmi_intf *intf);
#endif

View File

@ -809,16 +809,16 @@ static const char *sensor_type_desc[] __attribute__ ((unused)) = {
"Physical Security", "Platform Security", "Processor",
"Power Supply", "Power Unit", "Cooling Device", "Other",
"Memory", "Drive Slot / Bay", "POST Memory Resize",
"System Firmwares", "Event Logging Disabled", "Watchdog",
"System Firmwares", "Event Logging Disabled", "Watchdog1",
"System Event", "Critical Interrupt", "Button",
"Module / Board", "Microcontroller", "Add-in Card",
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect",
"Terminator", "System Boot Initiated", "Boot Error",
"OS Boot", "OS Critical Stop", "Slot / Connector",
"System ACPI Power State", "Watchdog", "Platform Alert",
"System ACPI Power State", "Watchdog2", "Platform Alert",
"Entity Presence", "Monitor ASIC", "LAN",
"Management Subsystem Health", "Battery","Session Audit",
"Version Change","FRU State" };
"Management Subsys Health", "Battery", "Session Audit",
"Version Change", "FRU State" };
struct sensor_reading {
char s_id[17]; /* name of the sensor */
@ -836,6 +836,30 @@ struct sensor_reading {
const char *s_a_units; /* analog value units string */
};
/*
* Determine if bridging is necessary to address a sensor at the given
* address (_addr) and (_chan) via the interface (_intf).
*
* If the sensor is being addressed on channel zero, it resides on
* IPMB-0. If the interface target IPMB-0 address is exactly the same as
* the sensor address then the sensor resides on the target IPMB-0
* so we don't need extra levels of bridging to address the sensor.
* Or
* If the sensor target address and channel match the interface target address
* and channel then there is no extra levels of bridging required.
*
* Note:
* The target IPMB-0 address is the address of the SDR repository that was
* accessed using the user specified bridging command line arguments.
* Access to any sensor on the target IPMB-0 can be addressed using the
* target address and transit address in the interface.
*/
#define BRIDGE_TO_SENSOR(_intf, _addr, _chan) \
( !((_chan == 0 && _intf->target_ipmb_addr && \
_intf->target_ipmb_addr == _addr) || \
(_addr == _intf->target_addr && _chan == _intf->target_channel)) )
struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf,
int use_builtin);
struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf,

View File

@ -107,6 +107,7 @@ struct standard_spec_sel_rec{
#define SENSOR_TYPE_OEM_NFATAL_ERROR 0xC2
#define SENSOR_TYPE_OEM_FATAL_ERROR 0xC3
#define SENSOR_TYPE_TXT_CMD_ERROR 0x20
#define SENSOR_TYPE_SUPERMICRO_OEM 0xD0
/* End of Macro for DELL Specific */
#define SEL_OEM_TS_DATA_LEN 6
#define SEL_OEM_NOTS_DATA_LEN 13
@ -326,6 +327,8 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" },
{ 0x07, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" },
{ 0x07, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Throttled" },
{ 0x07, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Uncorrectable machine check exception" },
{ 0x07, 0x0c, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Correctable machine check error" },
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" },
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" },
@ -336,7 +339,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x08, 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Vendor Mismatch" },
{ 0x08, 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Revision Mismatch" },
{ 0x08, 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Processor Missing" },
{ 0x08, 0x06, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Power Supply Rating Mismatch" },
{ 0x08, 0x06, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Voltage Rating Mismatch" },
{ 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error" },
{ 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply Inactive" },
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" },
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" },
@ -360,6 +366,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x0c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Configuration Error" },
{ 0x0c, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Spare" },
{ 0x0c, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Throttled" },
{ 0x0c, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Critical Overtemperature" },
{ 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Present" },
{ 0x0d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Fault" },
@ -479,6 +486,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x13, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" },
{ 0x13, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" },
{ 0x13, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Fatal Error" },
{ 0x13, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Degraded" },
{ 0x14, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" },
{ 0x14, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" },
@ -491,6 +499,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x17, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL },
{ 0x18, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL },
{ 0x19, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL },
{ 0x19, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", "Thermal Trip" },
{ 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL },
{ 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Connected" },
@ -520,6 +529,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x1f, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" },
{ 0x1f, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" },
{ 0x1f, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" },
{ 0x1f, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation started" },
{ 0x1f, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation completed" },
{ 0x1f, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation aborted" },
{ 0x1f, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation failed" },
{ 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Error during system startup" },
{ 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Run-time critical stop" },
@ -676,6 +689,56 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x00, 0x00, 0x00, 0x00, NULL, NULL },
};
static uint16_t supermicro_x9dal[] = {
0x0635
};
static uint16_t supermicro_x9db[] = {
0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637
};
static uint16_t supermicro_x9sb[] = {
0x0651
};
static uint16_t supermicro_x9[] = {
0x0635, 0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637, 0x0651
};
static uint16_t supermicro_b8[] = {
0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e
};
static uint16_t supermicro_h8[] = {
0xa111, 0x0408, 0x0811, 0x1411, 0x0911, 0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11,
0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11, 0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611,
0x2511, 0xbf11, 0x1511, 0x2211, 0x2411, 0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211,
0xa311, 0x1311, 0xba11, 0xa711, 0xd111, 0x1711, 0xcf11, 0x2011, 0x1811
};
static uint16_t supermicro_p8[] = {
0x6480, 0x7380, 0x6280, 0x7480, 0x5980
};
static uint16_t supermicro_x8[] = {
0xa880, 0x0403, 0x0100, 0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006,
0x040a, 0xf280, 0x060f, 0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614,
0x060c, 0x0003, 0x040b, 0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e,
0x061a, 0xf580, 0x062e, 0x0009
};
static uint16_t supermicro_X8[] = {
0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e, 0xa111, 0x0408, 0x0811, 0x1411, 0x0911,
0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11, 0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11,
0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611, 0x2511, 0xbf11, 0x1511, 0x2211, 0x2411,
0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211, 0xa311, 0x1311, 0xba11, 0xa711, 0xd111,
0x1711, 0xcf11, 0x2011, 0x1811, 0x6480, 0x7380, 0x6280, 0x7480, 0x5980, 0xa880, 0x0403, 0x0100,
0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006, 0x040a, 0xf280, 0x060f,
0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614, 0x060c, 0x0003, 0x040b,
0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e, 0x061a, 0xf580, 0x062e,
0x0009
};
int ipmi_sel_main(struct ipmi_intf *, int, char **);
void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -39,19 +39,35 @@
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#define IPMI_NETFN_SUNOEM 0x2e
#define IPMI_NETFN_SUNOEM 0x2e
#define IPMI_SUNOEM_SET_SSH_KEY 0x01
#define IPMI_SUNOEM_DEL_SSH_KEY 0x02
#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10
#define IPMI_SUNOEM_SET_FAN_SPEED 0x20
#define IPMI_SUNOEM_LED_GET 0x21
#define IPMI_SUNOEM_LED_SET 0x22
#define IPMI_SUNOEM_SET_SSH_KEY 0x01
#define IPMI_SUNOEM_DEL_SSH_KEY 0x02
#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10
#define IPMI_SUNOEM_CLI 0x19
#define IPMI_SUNOEM_SET_FAN_SPEED 0x20
#define IPMI_SUNOEM_LED_GET 0x21
#define IPMI_SUNOEM_LED_SET 0x22
#define IPMI_SUNOEM_ECHO 0x23
#define IPMI_SUNOEM_VERSION 0x24
#define IPMI_SUNOEM_NACNAME 0x29
#define IPMI_SUNOEM_GETVAL 0x2A
#define IPMI_SUNOEM_SETVAL 0x2C
#define IPMI_SUNOEM_SENSOR_SET 0x3A
#define IPMI_SUNOEM_SET_FAN_MODE 0x41
#define IPMI_SUNOEM_CORE_TUNNEL 0x44
/*
* Error codes of sunoem functions
*/
typedef enum {
SUNOEM_EC_SUCCESS = 0,
SUNOEM_EC_INVALID_ARG = 1,
SUNOEM_EC_BMC_NOT_RESPONDING = 2,
SUNOEM_EC_BMC_CCODE_NONZERO = 3
} sunoem_ec_t;
int ipmi_sunoem_main(struct ipmi_intf *, int, char **);
struct ipmi_rs * sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype);
struct ipmi_rs * sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype, int ledmode);
#endif /*IPMI_SUNOEM_H*/

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KFWUM_H
#define IPMI_KFWUM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_fwum_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_HPMFWUPG_H
#define IPMI_HPMFWUPG_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,855 +0,0 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_sunoem.h>
#include <ipmitool/ipmi_raw.h>
static const struct valstr sunoem_led_type_vals[] = {
{ 0, "OK2RM" },
{ 1, "SERVICE" },
{ 2, "ACT" },
{ 3, "LOCATE" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_vals[] = {
{ 0, "OFF" },
{ 1, "ON" },
{ 2, "STANDBY" },
{ 3, "SLOW" },
{ 4, "FAST" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_optvals[] = {
{ 0, "STEADY_OFF" },
{ 1, "STEADY_ON" },
{ 2, "STANDBY_BLINK" },
{ 3, "SLOW_BLINK" },
{ 4, "FAST_BLINK" },
{ 0xFF, NULL },
};
int is_sbcmd = 0;
static void
ipmi_sunoem_usage(void)
{
lprintf(LOG_NOTICE, "usage: sunoem <command> [option...]");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " fan speed <0-100>");
lprintf(LOG_NOTICE, " Set system fan speed (PWM duty cycle)");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey set <userid> <id_rsa.pub>");
lprintf(LOG_NOTICE, " Set ssh key for a userid into authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey del <userid>");
lprintf(LOG_NOTICE, " Delete ssh key for userid from authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led get <sensorid> [ledtype]");
lprintf(LOG_NOTICE,
" Read status of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE,
" Set mode of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled get <sensorid> [ledtype]");
lprintf(LOG_NOTICE,
" Read status of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE, " Set mode of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE,
" Use 'sdr list generic' command to get list of Generic");
lprintf(LOG_NOTICE, " Devices that are controllable LEDs.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Required SIS LED Mode:");
lprintf(LOG_NOTICE, " OFF Off");
lprintf(LOG_NOTICE, " ON Steady On");
lprintf(LOG_NOTICE, " STANDBY 100ms on 2900ms off blink rate");
lprintf(LOG_NOTICE, " SLOW 1HZ blink rate");
lprintf(LOG_NOTICE, " FAST 4HZ blink rate");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Optional SIS LED Type:");
lprintf(LOG_NOTICE, " OK2RM OK to Remove");
lprintf(LOG_NOTICE, " SERVICE Service Required");
lprintf(LOG_NOTICE, " ACT Activity");
lprintf(LOG_NOTICE, " LOCATE Locate");
lprintf(LOG_NOTICE, "");
}
/*
* IPMI Request Data: 1 byte
*
* [byte 0] FanSpeed Fan speed as percentage
*/
static int
ipmi_sunoem_fan_speed(struct ipmi_intf * intf, uint8_t speed)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
/*
* sunoem fan speed <percent>
*/
if (speed > 100) {
lprintf(LOG_NOTICE, "Invalid fan speed: %d", speed);
return -1;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_FAN_SPEED;
req.msg.data = &speed;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Set Fan speed to %d%%\n", speed);
return 0;
}
static void
__sdr_list_empty(struct sdr_record_list * head)
{
struct sdr_record_list * e, * f;
for (e = head; e != NULL; e = f) {
f = e->next;
free(e);
}
head = NULL;
}
static void
led_print(const char * name, uint8_t state)
{
if (csv_output)
printf("%s,%s\n", name, val2str(state, sunoem_led_mode_vals));
else
printf("%-16s | %s\n", name, val2str(state, sunoem_led_mode_vals));
}
struct ipmi_rs *
sunoem_led_get(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[7];
int rqdata_len = 5;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
if (is_sbcmd) {
rqdata[4] = dev->entity.id;
rqdata[5] = dev->entity.instance;
rqdata[6] = 0;
rqdata_len = 7;
}
else {
rqdata[4] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_GET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
struct ipmi_rs *
sunoem_led_set(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[9];
int rqdata_len = 7;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
rqdata[4] = ledmode;
if (is_sbcmd) {
rqdata[5] = dev->entity.id;
rqdata[6] = dev->entity.instance;
rqdata[7] = 0;
rqdata[8] = 0;
rqdata_len = 9;
}
else {
rqdata[5] = 0;
rqdata[6] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_SET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
static void
sunoem_led_get_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_get(intf, e->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)e->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(elist);
}
static void
sunoem_led_set_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_set(intf, e->record.genloc, ledtype, ledmode);
if (rsp && rsp->data_len == 0) {
led_print((const char *)e->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(elist);
}
/*
* IPMI Request Data: 5 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*
* The format below is for Sun Blade Modular systems only
* [byte 4] entityID The entityID field from the SDR record
* [byte 5] entityIns The entityIns field from the SDR record
* [byte 6] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*/
static int
ipmi_sunoem_led_get(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled get <id> [type]
*/
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (argc > 1) {
ledtype = str2val(argv[1], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf,
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_get(intf, a->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)a->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator record in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s", argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_get(intf, sdr->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)sdr->record.genloc->id_string, rsp->data[0]);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_1, i, ledtype);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_3, i, ledtype);
}
else {
/*
* handle entity list
*/
sunoem_led_get_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype);
}
}
__sdr_list_empty(alist);
return 0;
}
/*
* IPMI Request Data: 7 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
* [byte 5] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 6] role Used by BMC for authorization purposes
*
* The format below is for Sun Blade Modular systems only
* [byte 5] entityID The entityID field from the SDR record
* [byte 6] entityIns The entityIns field from the SDR record
* [byte 7] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 8] role Used by BMC for authorization purposes
*
*
* IPMI Response Data: 1 byte
*
* [byte 0] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
*/
static int
ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledmode;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled set <id> <mode> [type]
*/
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
ledmode = str2val(argv[1], sunoem_led_mode_vals);
if (ledmode == 0xFF) {
ledmode = str2val(argv[1], sunoem_led_mode_optvals);
if (ledmode == 0xFF) {
lprintf(LOG_NOTICE, "Invalid LED Mode: %s", argv[1]);
return -1;
}
}
if (argc > 3) {
ledtype = str2val(argv[2], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf,
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_set(intf, a->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print((const char *)a->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator records in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s",
argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_set(intf, sdr->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print(argv[0], ledmode);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_1, i, ledtype,
ledmode);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_3, i, ledtype,
ledmode);
}
else {
/*
* handle entity list
*/
sunoem_led_set_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
static int
ipmi_sunoem_sshkey_del(struct ipmi_intf * intf, uint8_t uid)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_DEL_SSH_KEY;
req.msg.data = &uid;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid);
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Deleted SSH key for user id %d\n", uid);
return 0;
}
#define SSHKEY_BLOCK_SIZE 64
static int
ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
FILE * fp;
int count;
uint16_t i_size, r, size;
uint8_t wbuf[SSHKEY_BLOCK_SIZE + 3];
if (ifile == NULL) {
lprintf(LOG_ERR, "Invalid or misisng input filename");
return -1;
}
fp = ipmi_open_file_read(ifile);
if (fp == NULL) {
lprintf(LOG_ERR, "Unable to open file %s for reading", ifile);
return -1;
}
printf("Setting SSH key for user id %d...", uid);
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_SSH_KEY;
req.msg.data = wbuf;
fseek(fp, 0, SEEK_END);
size = ftell(fp);
fseek(fp, 0, SEEK_SET);
for (r = 0; r < size; r += i_size) {
i_size = size - r;
if (i_size > SSHKEY_BLOCK_SIZE)
i_size = SSHKEY_BLOCK_SIZE;
memset(wbuf, 0, SSHKEY_BLOCK_SIZE);
fseek(fp, r, SEEK_SET);
count = fread(wbuf+3, 1, i_size, fp);
if (count != i_size) {
lprintf(LOG_ERR, "Unable to read %d bytes from file %s", i_size, ifile);
fclose(fp);
return -1;
}
printf(".");
fflush(stdout);
wbuf[0] = uid;
if ((r + SSHKEY_BLOCK_SIZE) >= size)
wbuf[1] = 0xff;
else
wbuf[1] = (uint8_t)(r / SSHKEY_BLOCK_SIZE);
wbuf[2] = i_size;
req.msg.data_len = i_size + 3;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to set ssh key for UID %d", uid);
break;
}
}
printf("done\n");
fclose(fp);
return 0;
}
int
ipmi_sunoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = (-1);
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (strncmp(argv[0], "fan", 3) == 0) {
if (argc == 3 && strncmp(argv[1], "speed", 5) == 0) {
uint8_t pct = 0;
if (str2uchar(argv[2], &pct) != 0 || pct > 100) {
lprintf(LOG_ERR, "Fan speed is limited to range <0..100>.");
return (-1);
}
rc = ipmi_sunoem_fan_speed(intf, pct);
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else if ((strncmp(argv[0], "led", 3) == 0)
|| (strncmp(argv[0], "sbled", 5) == 0)) {
if (argc < 2) {
ipmi_sunoem_usage();
return (-1);
}
if (strncmp(argv[0], "sbled", 5) == 0) {
is_sbcmd = 1;
}
if (strncmp(argv[1], "get", 3) == 0) {
if (argc < 3) {
char * arg[] = { "all" };
rc = ipmi_sunoem_led_get(intf, 1, arg);
}
else {
rc = ipmi_sunoem_led_get(intf, argc-2, &(argv[2]));
}
}
else if (strncmp(argv[1], "set", 3) == 0) {
if (argc < 4) {
ipmi_sunoem_usage();
return (-1);
}
rc = ipmi_sunoem_led_set(intf, argc-2, &(argv[2]));
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else if (strncmp(argv[0], "sshkey", 6) == 0) {
uint8_t uid = 0;
if (argc < 3) {
ipmi_sunoem_usage();
return (-1);
}
if (str2uchar(argv[2], &uid) != 0 || uid < 1 || uid > 63) {
lprintf(LOG_ERR, "User ID is limited to range <1..63>.");
return (-1);
}
if (strncmp(argv[1], "del", 3) == 0) {
rc = ipmi_sunoem_sshkey_del(intf, uid);
}
else if (argc == 4 && strncmp(argv[1], "set", 3) == 0) {
rc = ipmi_sunoem_sshkey_set(intf, uid, argv[3]);
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else {
ipmi_sunoem_usage();
return (-1);
}
return rc;
}

View File

@ -1,309 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/log.h>
#ifdef IPMI_INTF_OPEN
extern struct ipmi_intf ipmi_open_intf;
#endif
#ifdef IPMI_INTF_IMB
extern struct ipmi_intf ipmi_imb_intf;
#endif
#ifdef IPMI_INTF_LIPMI
extern struct ipmi_intf ipmi_lipmi_intf;
#endif
#ifdef IPMI_INTF_BMC
extern struct ipmi_intf ipmi_bmc_intf;
#endif
#ifdef IPMI_INTF_LAN
extern struct ipmi_intf ipmi_lan_intf;
#endif
#ifdef IPMI_INTF_LANPLUS
extern struct ipmi_intf ipmi_lanplus_intf;
#endif
#ifdef IPMI_INTF_FREE
extern struct ipmi_intf ipmi_free_intf;
#endif
struct ipmi_intf * ipmi_intf_table[] = {
#ifdef IPMI_INTF_OPEN
&ipmi_open_intf,
#endif
#ifdef IPMI_INTF_IMB
&ipmi_imb_intf,
#endif
#ifdef IPMI_INTF_LIPMI
&ipmi_lipmi_intf,
#endif
#ifdef IPMI_INTF_BMC
&ipmi_bmc_intf,
#endif
#ifdef IPMI_INTF_LAN
&ipmi_lan_intf,
#endif
#ifdef IPMI_INTF_LANPLUS
&ipmi_lanplus_intf,
#endif
#ifdef IPMI_INTF_FREE
&ipmi_free_intf,
#endif
NULL
};
/* ipmi_intf_print - Print list of interfaces
*
* no meaningful return code
*/
void ipmi_intf_print(struct ipmi_intf_support * intflist)
{
struct ipmi_intf ** intf;
struct ipmi_intf_support * sup;
int def = 1;
int found;
lprintf(LOG_NOTICE, "Interfaces:");
for (intf = ipmi_intf_table; intf && *intf; intf++) {
if (intflist != NULL) {
found = 0;
for (sup=intflist; sup->name != NULL; sup++) {
if (strncmp(sup->name, (*intf)->name, strlen(sup->name)) == 0 &&
strncmp(sup->name, (*intf)->name, strlen((*intf)->name)) == 0 &&
sup->supported == 1)
found = 1;
}
if (found == 0)
continue;
}
lprintf(LOG_NOTICE, "\t%-12s %s %s",
(*intf)->name, (*intf)->desc,
def ? "[default]" : "");
def = 0;
}
lprintf(LOG_NOTICE, "");
}
/* ipmi_intf_load - Load an interface from the interface table above
* If no interface name is given return first entry
*
* @name: interface name to try and load
*
* returns pointer to inteface structure if found
* returns NULL on error
*/
struct ipmi_intf * ipmi_intf_load(char * name)
{
struct ipmi_intf ** intf;
struct ipmi_intf * i;
if (name == NULL) {
i = ipmi_intf_table[0];
if (i->setup != NULL && (i->setup(i) < 0)) {
lprintf(LOG_ERR, "Unable to setup "
"interface %s", name);
return NULL;
}
return i;
}
for (intf = ipmi_intf_table;
((intf != NULL) && (*intf != NULL));
intf++) {
i = *intf;
if (strncmp(name, i->name, strlen(name)) == 0) {
if (i->setup != NULL && (i->setup(i) < 0)) {
lprintf(LOG_ERR, "Unable to setup "
"interface %s", name);
return NULL;
}
return i;
}
}
return NULL;
}
void
ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname)
{
if (intf->session == NULL)
return;
memset(intf->session->hostname, 0, 16);
if (hostname != NULL) {
memcpy(intf->session->hostname, hostname,
__min(strlen(hostname), 64));
}
}
void
ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username)
{
if (intf->session == NULL)
return;
memset(intf->session->username, 0, 17);
if (username == NULL)
return;
memcpy(intf->session->username, username, __min(strlen(username), 16));
}
void
ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password)
{
if (intf->session == NULL)
return;
memset(intf->session->authcode, 0, IPMI_AUTHCODE_BUFFER_SIZE);
if (password == NULL) {
intf->session->password = 0;
return;
}
intf->session->password = 1;
memcpy(intf->session->authcode, password,
__min(strlen(password), IPMI_AUTHCODE_BUFFER_SIZE));
}
void
ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t level)
{
if (intf->session == NULL)
return;
intf->session->privlvl = level;
}
void
ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit)
{
if (intf->session == NULL)
return;
intf->session->v2_data.lookupbit = lookupbit;
}
void
ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id)
{
if (intf->session == NULL)
return;
intf->session->cipher_suite_id = cipher_suite_id;
}
void
ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char)
{
if (intf->session == NULL)
return;
intf->session->sol_escape_char = sol_escape_char;
}
void
ipmi_intf_session_set_kgkey(struct ipmi_intf * intf, char * kgkey)
{
if (intf->session == NULL)
return;
memset(intf->session->v2_data.kg, 0, IPMI_KG_BUFFER_SIZE);
if (kgkey == NULL)
return;
memcpy(intf->session->v2_data.kg, kgkey,
__min(strlen(kgkey), IPMI_KG_BUFFER_SIZE));
}
void
ipmi_intf_session_set_port(struct ipmi_intf * intf, int port)
{
if (intf->session == NULL)
return;
intf->session->port = port;
}
void
ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype)
{
if (intf->session == NULL)
return;
/* clear password field if authtype NONE specified */
if (authtype == IPMI_SESSION_AUTHTYPE_NONE) {
memset(intf->session->authcode, 0, IPMI_AUTHCODE_BUFFER_SIZE);
intf->session->password = 0;
}
intf->session->authtype_set = authtype;
}
void
ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout)
{
if (intf->session == NULL)
return;
intf->session->timeout = timeout;
}
void
ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry)
{
if (intf->session == NULL)
return;
intf->session->retry = retry;
}
void
ipmi_cleanup(struct ipmi_intf * intf)
{
ipmi_sdr_list_empty(intf);
}

View File

@ -39,7 +39,8 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c \
ipmi_hpmfwupg.c ipmi_sdradd.c ipmi_ekanalyzer.c ipmi_gendev.c \
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c hpm2.c \
../src/plugins/lan/md5.c ../src/plugins/lan/md5.h
libipmitool_la_LDFLAGS = -export-dynamic
libipmitool_la_LIBADD = -lm

View File

@ -719,7 +719,8 @@ const struct valstr jedec_id5_vals[] = {
int
ipmi_spd_print(uint8_t *spd_data, int len)
{
int size;
int k = 0;
int ii = 0;
if (len < 92)
return -1; /* we need first 91 bytes to do our thing */
@ -802,8 +803,15 @@ ipmi_spd_print(uint8_t *spd_data, int len)
}
else
{
size = spd_data[5] * (spd_data[31] << 2);
printf(" Memory Size : %d MB\n", size);
ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17;
k = ((spd_data[5] & 0x7) + 1) * spd_data[17];
if(ii > 0 && ii <= 12 && k > 0) {
printf(" Memory Size : %d MB\n", ((1 << ii) * k));
} else {
printf(" Memory Size INVALID: %d, %d, %d, %d\n", spd_data[3],
spd_data[4], spd_data[5], spd_data[17]);
}
printf(" Voltage Intf : %s\n",
val2str(spd_data[8], spd_voltage_vals));
printf(" Error Detect/Cor : %s\n",

View File

@ -44,6 +44,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#if HAVE_CONFIG_H
# include <config.h>
@ -145,6 +146,33 @@ const char * oemval2str(uint32_t oem, uint16_t val,
return un_str;
}
/* str2double - safely convert string to double
*
* @str: source string to convert from
* @double_ptr: pointer where to store result
*
* returns zero on success
* returns (-1) if one of args is NULL, (-2) invalid input, (-3) for *flow
*/
int str2double(const char * str, double * double_ptr)
{
char * end_ptr = 0;
if (!str || !double_ptr)
return (-1);
*double_ptr = 0;
errno = 0;
*double_ptr = strtod(str, &end_ptr);
if (*end_ptr != '\0')
return (-2);
if (errno != 0)
return (-3);
return 0;
} /* str2double(...) */
/* str2long - safely convert string to int64_t
*
* @str: source string to convert from
@ -168,7 +196,7 @@ int str2long(const char * str, int64_t * lng_ptr)
if (errno != 0)
return (-3);
return 0;
} /* str2long(...) */
@ -211,6 +239,9 @@ int str2int(const char * str, int32_t * int_ptr)
{
int rc = 0;
int64_t arg_long = 0;
if (!str || !int_ptr)
return (-1);
if ( (rc = str2long(str, &arg_long)) != 0 ) {
*int_ptr = 0;
return rc;
@ -235,6 +266,9 @@ int str2uint(const char * str, uint32_t * uint_ptr)
{
int rc = 0;
uint64_t arg_ulong = 0;
if (!str || !uint_ptr)
return (-1);
if ( (rc = str2ulong(str, &arg_ulong)) != 0) {
*uint_ptr = 0;
return rc;
@ -259,6 +293,9 @@ int str2short(const char * str, int16_t * shrt_ptr)
{
int rc = (-3);
int64_t arg_long = 0;
if (!str || !shrt_ptr)
return (-1);
if ( (rc = str2long(str, &arg_long)) != 0 ) {
*shrt_ptr = 0;
return rc;
@ -283,6 +320,9 @@ int str2ushort(const char * str, uint16_t * ushrt_ptr)
{
int rc = (-3);
uint64_t arg_ulong = 0;
if (!str || !ushrt_ptr)
return (-1);
if ( (rc = str2ulong(str, &arg_ulong)) != 0 ) {
*ushrt_ptr = 0;
return rc;
@ -295,6 +335,31 @@ int str2ushort(const char * str, uint16_t * ushrt_ptr)
return 0;
} /* str2ushort(...) */
/* str2char - safely convert string to int8
*
* @str: source string to convert from
* @chr_ptr: pointer where to store result
*
* returns zero on success
* returns (-1) if one of args is NULL, (-2) or (-3) if conversion fails
*/
int str2char(const char *str, int8_t * chr_ptr)
{
int rc = (-3);
int64_t arg_long = 0;
if (!str || !chr_ptr) {
return (-1);
}
if ((rc = str2long(str, &arg_long)) != 0) {
*chr_ptr = 0;
return rc;
}
if (arg_long < INT8_MIN || arg_long > INT8_MAX) {
return (-3);
}
return 0;
} /* str2char(...) */
/* str2uchar - safely convert string to uint8
*
* @str: source string to convert from
@ -307,6 +372,9 @@ int str2uchar(const char * str, uint8_t * uchr_ptr)
{
int rc = (-3);
uint64_t arg_ulong = 0;
if (!str || !uchr_ptr)
return (-1);
if ( (rc = str2ulong(str, &arg_ulong)) != 0 ) {
*uchr_ptr = 0;
return rc;
@ -549,10 +617,6 @@ ipmi_start_daemon(struct ipmi_intf *intf)
sigset_t sighup;
#endif
/* if we are started from init no need to become daemon */
if (getppid() == 1)
return;
#ifdef SIGHUP
sigemptyset(&sighup);
sigaddset(&sighup, SIGHUP);
@ -576,7 +640,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
pid = (pid_t) fork();
if (pid < 0 || pid > 0)
exit(0);
#if defined(SIGTSTP) && defined(TIOCNOTTY)
if (setpgid(0, getpid()) == -1)
exit(1);
@ -600,7 +664,126 @@ ipmi_start_daemon(struct ipmi_intf *intf)
close(fd);
}
open("/dev/null", O_RDWR);
dup(0);
dup(0);
fd = open("/dev/null", O_RDWR);
assert(0 == fd);
dup(fd);
dup(fd);
}
/* is_fru_id - wrapper for str-2-int FRU ID conversion. Message is printed
* on error.
* FRU ID range: <0..255>
*
* @argv_ptr: source string to convert from; usually argv
* @fru_id_ptr: pointer where to store result
*
* returns zero on success
* returns (-1) on error and message is printed on STDERR
*/
int
is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr)
{
if (!argv_ptr || !fru_id_ptr) {
lprintf(LOG_ERR, "is_fru_id(): invalid argument(s).");
return (-1);
}
if (str2uchar(argv_ptr, fru_id_ptr) == 0) {
return 0;
}
lprintf(LOG_ERR, "FRU ID '%s' is either invalid or out of range.",
argv_ptr);
return (-1);
} /* is_fru_id(...) */
/* is_ipmi_channel_num - wrapper for str-2-int Channel conversion. Message is
* printed on error.
*
* 6.3 Channel Numbers, p. 45, IPMIv2 spec.
* Valid channel numbers are: <0..7>, <E-F>
* Reserved channel numbers: <8-D>
*
* @argv_ptr: source string to convert from; usually argv
* @channel_ptr: pointer where to store result
*
* returns zero on success
* returns (-1) on error and message is printed on STDERR
*/
int
is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr)
{
if (!argv_ptr || !channel_ptr) {
lprintf(LOG_ERR,
"is_ipmi_channel_num(): invalid argument(s).");
return (-1);
}
if ((str2uchar(argv_ptr, channel_ptr) == 0)
&& ((*channel_ptr >= 0x0 && *channel_ptr <= 0x7)
|| (*channel_ptr >= 0xE && *channel_ptr <= 0xF))) {
return 0;
}
lprintf(LOG_ERR,
"Given Channel number '%s' is either invalid or out of range.",
argv_ptr);
lprintf(LOG_ERR, "Channel number must be from ranges: <0..7>, <0xE..0xF>");
return (-1);
}
/* is_ipmi_user_id() - wrapper for str-2-uint IPMI UID conversion. Message is
* printed on error.
*
* @argv_ptr: source string to convert from; usually argv
* @ipmi_uid_ptr: pointer where to store result
*
* returns zero on success
* returns (-1) on error and message is printed on STDERR
*/
int
is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr)
{
if (!argv_ptr || !ipmi_uid_ptr) {
lprintf(LOG_ERR,
"is_ipmi_user_id(): invalid argument(s).");
return (-1);
}
if ((str2uchar(argv_ptr, ipmi_uid_ptr) == 0)
&& *ipmi_uid_ptr >= IPMI_UID_MIN
&& *ipmi_uid_ptr <= IPMI_UID_MAX) {
return 0;
}
lprintf(LOG_ERR,
"Given User ID '%s' is either invalid or out of range.",
argv_ptr);
lprintf(LOG_ERR, "User ID is limited to range <%i..%i>.",
IPMI_UID_MIN, IPMI_UID_MAX);
return (-1);
}
uint16_t
ipmi_get_oem_id(struct ipmi_intf *intf)
{
/* Execute a Get Board ID command to determine the board */
struct ipmi_rs *rsp;
struct ipmi_rq req;
uint16_t oem_id;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = 0x21;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Board ID command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
return 0;
}
oem_id = rsp->data[0] | (rsp->data[1] << 8);
lprintf(LOG_DEBUG,"Board ID: %x", oem_id);
return oem_id;
}

289
lib/hpm2.c Normal file
View File

@ -0,0 +1,289 @@
/*
* Copyright (c) 2012 Pigeon Point Systems. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Pigeon Point Systems nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* PIGEON POINT SYSTEMS ("PPS") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* PPS OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <ipmitool/hpm2.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/log.h>
#include <ipmitool/bswap.h>
#if HAVE_PRAGMA_PACK
# pragma pack(push, 1)
#endif
/* HPM.x Get Capabilities request */
struct hpmx_cmd_get_capabilities_rq {
uint8_t picmg_id;
uint8_t hpmx_id;
} ATTRIBUTE_PACKING;
/* HPM.2 Get Capabilities response */
struct hpm2_cmd_get_capabilities_rp {
uint8_t picmg_id;
struct hpm2_lan_attach_capabilities caps;
} ATTRIBUTE_PACKING;
#if HAVE_PRAGMA_PACK
# pragma pack(pop)
#endif
/* IPMI Get LAN Configuration Parameters command */
#define IPMI_LAN_GET_CONFIG 0x02
int hpm2_get_capabilities(struct ipmi_intf * intf,
struct hpm2_lan_attach_capabilities * caps)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
struct hpmx_cmd_get_capabilities_rq rq;
/* reset result */
memset(caps, 0, sizeof(struct hpm2_lan_attach_capabilities));
/* prepare request */
rq.picmg_id = 0;
rq.hpmx_id = 2;
/* prepare request */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_PICMG;
req.msg.cmd = HPM2_GET_LAN_ATTACH_CAPABILITIES;
req.msg.data = (uint8_t *)&rq;
req.msg.data_len = sizeof(rq);
/* send */
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
lprintf(LOG_NOTICE, "Error sending request.");
return -1;
}
if (rsp->ccode == 0xC1) {
lprintf(LOG_DEBUG, "IPM Controller is not HPM.2 compatible");
return rsp->ccode;
} else if (rsp->ccode) {
lprintf(LOG_NOTICE, "Get HPM.x Capabilities request failed,"
" compcode = %x", rsp->ccode);
return rsp->ccode;
}
/* check response length */
if (rsp->data_len < 2 || rsp->data_len > 10) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.x identifier */
if (rsp->data[1] != 2) {
lprintf(LOG_NOTICE, "Bad HPM.x ID, id=%d", rsp->data[1]);
return rsp->ccode;
}
/*
* this hardly can happen, since completion code is already checked.
* but check for safety
*/
if (rsp->data_len < 4) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* copy HPM.2 capabilities */
memcpy(caps, rsp->data + 2, rsp->data_len - 2);
#if WORDS_BIGENDIAN
/* swap bytes to convert from little-endian format */
caps->lan_channel_mask = BSWAP_16(caps->lan_channel_mask);
#endif
/* check HPM.2 revision */
if (caps->hpm2_revision_id != HPM2_REVISION) {
lprintf(LOG_NOTICE, "Bad HPM.2 revision, rev=%d",
caps->hpm2_revision_id);
return -1;
}
if (!caps->lan_channel_mask) {
return -1;
}
/* check response length */
if (rsp->data_len < 8) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.2 LAN parameters start */
if (caps->hpm2_lan_params_start < 0xC0) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN params start, start=%x",
caps->hpm2_lan_params_start);
return -1;
}
/* check HPM.2 LAN parameters revision */
if (caps->hpm2_lan_params_rev != HPM2_LAN_PARAMS_REV) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN params revision, rev=%d",
caps->hpm2_lan_params_rev);
return -1;
}
/* check for HPM.2 SOL extension */
if (!(caps->hpm2_caps & HPM2_CAPS_SOL_EXTENSION)) {
/* no further checks */
return 0;
}
/* check response length */
if (rsp->data_len < 10) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.2 SOL parameters start */
if (caps->hpm2_sol_params_start < 0xC0) {
lprintf(LOG_NOTICE, "Bad HPM.2 SOL params start, start=%x",
caps->hpm2_sol_params_start);
return -1;
}
/* check HPM.2 SOL parameters revision */
if (caps->hpm2_sol_params_rev != HPM2_SOL_PARAMS_REV) {
lprintf(LOG_NOTICE, "Bad HPM.2 SOL params revision, rev=%d",
caps->hpm2_sol_params_rev);
return -1;
}
return 0;
}
int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf,
uint8_t hpm2_lan_params_start,
struct hpm2_lan_channel_capabilities * caps)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
uint8_t rq[4];
/* reset result */
memset(caps, 0, sizeof(struct hpm2_lan_channel_capabilities));
/* prepare request */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_CONFIG;
req.msg.data = (uint8_t *)&rq;
req.msg.data_len = sizeof(rq);
/* prepare request data */
rq[0] = 0xE; /* sending channel */
rq[1] = hpm2_lan_params_start; /* HPM.2 Channel Caps */
rq[2] = rq[3] = 0;
/* send */
rsp = intf->sendrecv(intf, &req);
if (rsp) {
lprintf(LOG_NOTICE, "Error sending request");
return -1;
}
if (rsp->ccode == 0x80) {
lprintf(LOG_DEBUG, "HPM.2 Channel Caps parameter is not supported");
return rsp->ccode;
} else if (rsp->ccode) {
lprintf(LOG_NOTICE, "Get LAN Configuration Parameters request failed,"
" compcode = %x", rsp->ccode);
return rsp->ccode;
}
/* check response length */
if (rsp->data_len != sizeof (struct hpm2_lan_channel_capabilities) + 1) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check parameter revision */
if (rsp->data[0] != HPM2_LAN_PARAMS_REV) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN parameter revision, rev=%d",
rsp->data[0]);
return -1;
}
/* copy parameter data */
memcpy(caps, &rsp->data[1], sizeof (struct hpm2_lan_channel_capabilities));
#if WORDS_BIGENDIAN
/* swap bytes to convert from little-endian format */
caps->max_inbound_pld_size = BSWAP_16(caps->max_inbound_pld_size);
caps->max_outbound_pld_size = BSWAP_16(caps->max_outbound_pld_size);
#endif
return 0;
}
int hpm2_detect_max_payload_size(struct ipmi_intf * intf)
{
struct hpm2_lan_attach_capabilities attach_caps;
struct hpm2_lan_channel_capabilities channel_caps;
int err;
/* query HPM.2 support */
err = hpm2_get_capabilities(intf, &attach_caps);
/* check if HPM.2 is supported */
if (err != 0 || !attach_caps.lan_channel_mask) {
return err;
}
/* query channel capabilities */
err = hpm2_get_lan_channel_capabilities(intf,
attach_caps.hpm2_lan_params_start, &channel_caps);
/* check if succeeded */
if (err != 0) {
return err;
}
/* update request and response sizes */
ipmi_intf_set_max_request_data_size(intf,
channel_caps.max_inbound_pld_size - 7);
ipmi_intf_set_max_response_data_size(intf,
channel_caps.max_outbound_pld_size - 8);
/* print debug info */
lprintf(LOG_DEBUG, "Set maximum request size to %d\n"
"Set maximum response size to %d",
intf->max_request_data_size, intf->max_response_data_size);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More