Compare commits

...

30 Commits

Author SHA1 Message Date
19d78782d7 Release Version 1.8.19
Update ChangeLog, configure.ac to 1.8.19
2022-09-01 21:42:31 +03:00
46fd8d942c Cast type before the left shift
Building ipmitool with UBSAN and I got:
```
...
xxx/ipmitool/include/ipmitool/helper.h:191:14: runtime error: left shift of 160
by 24 places cannot be represented in type 'int'
    #0 0x55bddaa56f11 in ipmi32toh
       xxx/ipmitool/include/ipmitool/helper.h:191:14
```

Tested: with this, I tested ipmitool again and the issue disappeared.

Resolved: ipmitool/ipmitool#352
Signed-off-by: Tom Tung <shes050117@gmail.com>
2022-08-28 20:23:25 +03:00
a1dc78c456 sel: Fix the deasserted thresholds inequality
The choice of > or < when printing the threshold inequality currently
only depends on whether it is an upper or lower threshold. This is
correct when the event is asserted, but when the event is deasserted the
inequality is reversed and therefore the current code can give confusing
results, e.g.:

```
Temperature ps1_inlet_temp |
Upper Non-critical going high |
Deasserted |
Reading 43.94 > Threshold 44.88 degrees C
```

This commit fixes that.

See ipmitool/ipmitool#349

Signed-off-by: Andy Clegg <andyc@graphcore.ai>
2022-08-05 18:57:19 +03:00
4d25a93f49 man: Update the text for -C option
The default cipher suite has been changed earlier in commit
7772254b62, and the manual has been
then updated by commit 50479484a2,
but it turned out that the description of the -C option was
not affected by the update.

Also, a typo was found as the cipher suites are listed in IPMI v2.0
specification Table 22-20, not 22-19 as stated in the manual.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2022-03-31 16:20:54 +03:00
65ba015f5c chassis restart_cause: Add new causes
Add 'soft reset' and 'power-up by RTC wakeup' causes
from IPMI 2.0 spec.

Resolves ipmitool/ipmitool#329

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2022-03-09 17:39:45 +03:00
4d4f29f0b6 sel: Remove redundant "Reserve SEL"
There is no need to reserve SEL when doing "sel list" and "sel get"
since we don't do partial get in both commands, and we didn't even use
the reservation ID returned by "Reserve SEL".

Signed-off-by: Bing-Hua Wang <binghuawang@ami.com>
2022-02-07 14:35:28 +03:00
5ac7f6a54e zero initialize the recv structure on the stack
Zero initialize the recv structure used by openipmi_read().
2022-02-05 23:55:26 +03:00
a24a512bdd zero initialize the recv structure on the stack
This was caught via a sanitized build where the recv was used with stack data in some cases.
2022-02-05 23:40:08 +03:00
39ca56bf33 ci: Add support for MacOS-11
GitHub has made macos-11 virtual environment available.
Enable it for ipmitool.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-11-03 16:30:34 +03:00
08151adef3 ci: Remove ubuntu-16.04 support
GitHub has removed support for ubuntu 16.04 virtual environment
since Sep 20, 2021. We just follow.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-11-03 16:30:34 +03:00
86ef8fb091 sdr: Fix modifier unit
Previously instead of the modifier unit, the base unit was printed.
2021-11-03 16:04:41 +03:00
66cda7e18f Fix compile error
Signed-off-by: Patrick Huesmann <info@patrick-huesmann.de>
2021-09-15 16:39:55 +03:00
15418696ea Refactor bridging level detection to dedicated function
Signed-off-by: Patrick Huesmann <info@patrick-huesmann.de>
2021-09-15 16:39:55 +03:00
7c47cf75f4 Fix double bridge detection in get_max_(req|rsp)_data_size()
Signed-off-by: Patrick Huesmann <info@patrick-huesmann.de>
2021-09-15 16:39:55 +03:00
b7adc1dcaf ipmi_mc: Fix the IPM_DEV_FWREV1_MAJOR_MASK
The IPM_DEV_FWREV1_MAJOR_MASK was incorrectly defined as 0x3F.
The spec indicates that the major firmware revision has 0~6 valid bits,
so the mask shall be 0x7F.

Tested: Verify a BMC that has a major version that is large than 0x3F,
        and ipmitool shows the correct major version.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
2021-07-14 15:27:00 +03:00
11c7605c0d helper: Fix stderr file descriptor
The third file descriptor is STDERR_FILENO, not STDOUT_FILENO
2021-06-22 23:55:49 +03:00
5cf436056f Fix codefactor-io / CodeFactor warnings
Use $(...) notation instead of legacy backticked `...`. (SC2006)
2021-06-22 23:45:59 +03:00
cdac4e07f7 Use /run instead of /var/run
In FHS 3.0, /var/run is replaced by /run:

https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s13.html
2021-06-22 23:45:59 +03:00
cd57365fc4 oem: Update product IDs for YADRO
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-06-18 17:45:28 +03:00
351dad24a2 lan: Add processing of get/set specific CCs
Both 'Set/Get LAN Configuration Parameter' commands may return
command-specific codes that weren't properly parsed and were
reported as 'Unknown' before. This is fixed now.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-06-15 21:12:49 +03:00
fb47ae8d7c lan: Refactor pointer style
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-06-15 21:12:49 +03:00
50479484a2 doc: update lanplus doc to reflect default cipher suite change
Modify the documentation to reflect commit 7772254b ("lanplus: Auto-select
'best' cipher suite available") which changed the default cipher suite for
lanplus from 3 to 17
2021-06-06 18:57:38 +03:00
9a1c0e68ba ekanalyzer: Fix internal use area off-by-one bug
The length of internal use area printed by ekanalyzer
didn't take in account the version byte.
The data printed was also 1 byte longer than needed.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-05-21 02:39:16 +03:00
1f429f1ed7 ekanalyzer frushow: Fix internal area size calc
When there was no chassis and board areas, the internal use
are size was calculated incorrectly.

Additionally, it is possible that the internal area is actually
located after all other areas or that areas are arranged in
a different order than their offsets in the header. All those
cases weren't properly handled.

Now that is fixed.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-05-21 01:16:16 +03:00
59b7d6cf8f sel: Fix "power supply inactive" flag offset
There was a wrong offset for the "Power Supply Inactive" flag,
hence the trigger on this event type could not be set.

Resolves ipmitool/ipmitool#280

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-27 08:36:58 +03:00
6b1ce6c1ac ci: Add support for Ubuntu 20.04
- Add ubuntu-20.04 target
- Disable building of Solaris-specific `bmc` interface on Ubuntu
- Rename `ubuntu` matrix to `linux`

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-21 13:24:43 +03:00
6a3ded7333 ci: Fix Ubuntu builds
GitHub machines sometimes aren't immediately updated after
Ubuntu repos update. That leads to failed CI builds due
to inability to install some packages.

Add a call to `apt update` to update the package database
before installing anything.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-21 13:24:43 +03:00
61bb233c5b Fix compiler warning
Move #ifdef from the inside to the outside of assert()'s
to get rid of this compiler warning:

warning: embedding a directive within macro arguments has undefined
behavior [-Wembedded-directive]

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-21 13:24:43 +03:00
fb176a1995 Fix compiler warning
Drop some unused variables detected by the compiler

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-21 13:24:43 +03:00
d88bbf3c41 Fix compiler warning
Refactor plugin ipmi_intf structure initialization for some
plugins to stop the compiler complaining like this:

warning: use of GNU old-style field designator
extension [-Wgnu-designator]

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-21 13:24:43 +03:00
31 changed files with 531 additions and 246 deletions

View File

@ -1,5 +1,5 @@
# vi: set et ts=2 sw=2 : # vi: set et ts=2 sw=2 :
name: C/C++ CI name: build
on: on:
push: push:
@ -8,10 +8,10 @@ on:
branches: [ master ] branches: [ master ]
jobs: jobs:
ubuntu: linux:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-16.04, ubuntu-18.04 ] os: [ ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: install dependencies - name: install dependencies
@ -24,17 +24,12 @@ jobs:
libtool \ libtool \
make \ make \
wget wget
# TODO: Add ubuntu-20.04 to the matrix.os list and fix the build
# - name: install extra dependencies
# # In Ubuntu 20.04 some crucial development headers/libraries
# # have been moved from libc6-dev to musl-dev
# if: matrix.os == 'ubuntu-20.04'
# run: sudo apt install musl-dev
- name: install extra libraries - name: install extra libraries
# This build job tries to verify as much of ipmitool code # This build job tries to verify as much of ipmitool code
# as possible, hence these libraries. They aren't usually # as possible, hence these libraries. They aren't usually
# needed for normal user builds: # needed for normal user builds:
run: | run: |
sudo apt update
sudo apt install \ sudo apt install \
libsystemd-dev \ libsystemd-dev \
libreadline-dev \ libreadline-dev \
@ -50,7 +45,6 @@ jobs:
./configure --enable-intf-dummy \ ./configure --enable-intf-dummy \
--enable-intf-dbus \ --enable-intf-dbus \
--enable-intf-usb \ --enable-intf-usb \
--enable-intf-bmc \
--enable-intf-free --enable-intf-free
- name: make - name: make
run: make run: make
@ -60,8 +54,10 @@ jobs:
run: make distcheck run: make distcheck
macos-catalina: macos-catalina:
strategy:
runs-on: macos-10.15 matrix:
os: [ macos-10.15, macos-11 ]
runs-on: ${{ matrix.os }}
steps: steps:
- name: install dependencies - name: install dependencies

235
ChangeLog
View File

@ -1,3 +1,238 @@
version 1.8.19 2022-08-31
* Cast type before the left shift
* sel: Fix the deasserted thresholds inequality
* man: Update the text for -C option
* chassis restart_cause: Add new causes
* sel: Remove redundant "Reserve SEL"
* zero initialize the recv structure on the stack
* zero initialize the recv structure on the stack
* ci: Add support for MacOS-11
* ci: Remove ubuntu-16.04 support
* sdr: Fix modifier unit
* Fix compile error
* Refactor bridging level detection to dedicated function
* Fix double bridge detection in get_max_(req|rsp)_data_size()
* ipmi_mc: Fix the IPM_DEV_FWREV1_MAJOR_MASK
* helper: Fix stderr file descriptor
* Fix codefactor-io / CodeFactor warnings
* Use /run instead of /var/run
* oem: Update product IDs for YADRO
* lan: Add processing of get/set specific CCs
* lan: Refactor pointer style
* doc: update lanplus doc to reflect default cipher suite change
* ekanalyzer: Fix internal use area off-by-one bug
* ekanalyzer frushow: Fix internal area size calc
* sel: Fix "power supply inactive" flag offset
* ci: Add support for Ubuntu 20.04
* ci: Fix Ubuntu builds
* Fix compiler warning
* Fix compiler warning
* Fix compiler warning
* ci: Update for GitHub Actions v2.274.2
* free: Fix implicit function declarations
* Use "#pragma once" for headers
* Remove unneeded execution bits from C source files and a header file
* Convert line endings to LF
* Fixed compiler warning.
* RPM support: fixed broken build due to use of headers from kernel
* imbapi: replace __FUNCTION__ to eleminate compiler warnings
* lanplus: remove unused variable
* hpmfwupg: Clean up / refactor
* fru: Fix crashes on 6-bit ASCII strings
* oem: Add product ID for YADRO VEGMAN
* configure.ac: add '--location' for curl to follow location
* configure.ac: replace '-#' by '--progress-bar' with curl
* Add version info to debug output
* doc, ci: Fix an error in package name for Windows
* doc: Fix a small typo in INSTALL
* RPM support: updated spec file changelog
* RPM support: simplified build process
* RPM support: fixed broken RPM build
* doc: Update INSTALL with Windows info
* ci: Add Windows/cygwin config
* doc: Update INSTALL for new CI
* ci: Add github workflow, drop travis
* Fix compatibility with OpenBSD and macOS
* dist: Fix dependencies and cleanup
* dist: Add missing ipmi_time.h header to packaging
* configure: Fix compatibility with non-bash systems
* Finalize refactoring of string comparisons
* channel: Refactor set_user_access option processing
* Refactor string comparisons
* sel: Fix OEM record definition example
* sdr: harden against bad records
* fru: fix memory leak in ipmi_spd_print_fru
* ipmi_sel_set_time: fix strptime() return check
* hpm: use portable __max() in hpmfwupg
* hpmfwupg: move variable definition to .c file
* sel: time: fix null pointer dereference in set
* fru, sdr: Fix id_string buffer overflows
* lanp: Fix buffer overflows in get_lan_param_select
* channel: Fix buffer overflow
* session: Fix buffer overflow in ipmi_get_session_info
* fru: Fix buffer overflow in ipmi_spd_print_fru
* fru: Fix buffer overflow vulnerabilities
* configure: Drop requirement for curses et. al libs
* configure: remove some duplicate code
* doc: Update INSTALL to fix installation errors
* ipmi_dcmi: fix typo in nm_policy_options initialization.
* Docs: Add info on packages to install on Ubuntu 16.04
* chassis: Refactor to get rid of strncmp()
* chassis: Refactor main for centralized exiting
* chassis: bootdev: Refactor more
* chassis: bootdev: Refactor to reduce nesting
* chassis: bootdev: Fix help message and its formatting
* chassis: bootparam/bootdev: Refactor for less magic
* oem: supermicro: Add product codes from IPMICFG
* doc: Update man page regarding `user set password`
* user: Cleanup/refactor ipmi_user_password()
* user: Improve password length handling
* user: Alter "set password" usage information
* intf: Add missing function declarations
* doc: fix URL in README
* event: Clean up event sending from a file
* event: Clean up the event sending code
* event: Fix event submission via SSIF
* make: Use DESTDIR to install IANA PEN database
* lanplus: Fix embedded bridged responses handling
* Update .gitignore
* mc: Fix reporting of manufacturers > 64K
* Add installation of enterprise-numbers database
* Update documentation in regard to IANA PEN registry
* Use configurable path to IANA PEN registry
* Load IANA PEN registry from a file
* dbus: Replace obsolete INCLUDES with AM_CPPFLAGS
* oem: name change from Newisys to Viking Enterprise Solutions
* Fix default interface to behave as it did before
* man: Add documentation for chassis bootmbox
* man: Update the chassis bootparam section
* chassis: Add boot initiator mailbox support
* chassis: Use command-specific completion code parser
* Add support for command-specific completion codes
* Add a helper htoipmi24() function
* Add a helper args2buf() function
* man: Cleanup the manpage formatting tags
* create_pen_list: only print if values are set
* chassis: Refactor to reduce code duplication
* chassis: Refactor to reduce code duplication
* sdr: Fix segfault on invalid unit types
* vendor: Add YADRO TATLIN Storage Controller ID
* exchange-bmc-os-info: Remove dependency on ipmi.service
* Add mechanism to configure to set the default interface
* ci: Update INSTALL to reflect recent changes
* ci: Set up matrix builds with Travis CI
* Enable Travis build of D-Bus interface
* add OpenBMC D-Bus interface
* Fix "ipmitool pef {status,info}" not printing final newline
* Remove unused include
* Fix IPMI DCMI message typo
* open: swap free() calls for free_n()
* open: checking received msg id against expectation
* open: fix whitespace
* Refactor free_n() function
* fru: swap free() calls for free_n()
* fru: Fix write chunk reduction code
* fru: add macro FRU_AREA macros
* fru: replace magic return codes with macros
* fru header: add return error codes specific to fru
* fru: fix ipmi_fru_picmg_ext_edit as bool
* fru: use bool with ipmi_fru_oemkontron_edit
* fru: change ipmi_fru_query_new_value to return bool
* fru: mark ipmi_fru_query_new_value as static
* fru: add fru_cc_rq2big helper method for code checks
* fru: cleanup ipmi_fru_upg_ekeying
* fru: use ipmi_cc defined maros for return codes
* fru: drop extraneous parentheses on negative returns
* fru: delete unused variable matchInstance
* fru: cleanup ipmi_fru_oemkontron_get
* fru: fixup array bounds checking
* hpm: Adhere to centralized exiting
* hpm: Minor refactoring
* hpm: Fix resource leak
* sol: Make interface timeout obey the -N option
* helper: add free_n method to handle clearing pointers
* cygwin: imb: Fix build error (wchar_t)
* lanplus: Fix segfault for truncated dcmi response
* Move led color static array to source file
* drop unused static arrays
* move static objects to source file
* cleanup all unused-parameter warnings
* use __UNUSED__ macro instead of gcc specific attribute
* implement __UNUSED__ macro for marking unused
* Add .dirstamp to .gitignore
* fru: Fix processing of unspecified board mfg. date
* [compiler-warnings-fixes] use correct fall through comment
* [compiler-warnings-fixes] ipmi_start_daemon: check return values
* [compiler-warnings-fixes] ipmi_sdr.c: remove unused function parameters
* lan: Fix processing disabled VLAN
* Make ipmitool respect system locale settings
* Fix strftime() non-literal argument warning
* Refactor timestamp handling
* doc: Update manpage with new contact info
* lanplus: Refactoring
* lanplus: Fix -C option processing
* lanplus: Auto-select 'best' cipher suite available
* lanplus: Fix compile with deprecated APIs disabled.
* doc: Update home page links
* doc: Update formatting of ipmitool man page
* sensor: Refactor ipmi_sensor_print_fc_threshold()
* sensor: Add support for csv output
* plugins: open: Properly enable event receiver (#35)
* lan: Refactoring: Remove unused function
* general: Get rid of some unused parameter warnings
* mc: guid: Implement encoding autodetection
* mc: guid: Fix timestamp decoding
* mc: guid: Add support for non-standard encodings
* mc: guid: Fix byte ordering to follow IPMI spec
* Refactoring: optimize pointer checks
* imb: Refactoring: remove duplicate code
* Refactoring: get rid of superfluous comparisons
* Refactoring. Improve code reuse ratio.
* general: Fix several misspellings
* mc: Fix compiler warnings
* general: Add array_byteswap() to helper
* lanplus: Make byteswapping generic
* framework: Update .gitignore
* framework: Switch to C11 standard with GNU extensions
* framework: ci: Add support for Travis CI
* oem: Add basic support for Quanta
* intf: Refactoring. Remove unused sendrsp()
* dummy: Add default dummy socket
* mc: Fix manufacturer ID masking
* Refactoring. Remove useless feature test macros.
* general: Make byteswapping arch-independent
* sel: Minor refactoring
* sdr: Refactor/optimize code. No functional changes.
* Add an option to display all dates in UTC
* mc: Code refactor to reduce copy-paste ratio
* mc: watchdog set: Refactor to reduce complexity
* mc: watchdog set: Fix intr setting
* mc: watchdog get: Update to match IPMI 2.0 spec
* mc: watchdog: Add `set` command
* framework: Make git ignore cscope.out
* plugins/open: Fix for interrupted select
* nm: Fix policy range (#12)
* Replace user_id masks with a macro (#8)
* fru: internaluse: Fix segmentation fault (#9)
* dcmi: Refactor
* ID:508 - Fix segfaults in dcmi command handlers
* vendor: Add YADRO VESNIN identification
* ID:491 - Fetch vendor IDs from IANA
* ID:472 - Fix The Most recent Addition/Erase date
* ID:480 - Call EVP_CIPHER_CTX_free() instead of EVP_CIPHER_CTX_cleanup()
* ID:480 - ipmitool coredumps in EVP_CIPHER_CTX_init
* Make git revision more descriptive
* ID:477 - fru: Fix decoding of non-text data in get_fru_area_str()
* ID:479 - ekanalyzer: fix processing of custom mfg. fields
* ID:478 - ekanalyzer: Fixed decoding of FRU fields
* Add some more configure/build/editor byproducts to .gitignore
* Add git hash and dirty mark to ipmitool version
* Prevent autoreconf from complaining about missing NEWS
* Add bootstrap support for Mac
* ID:474 - Compile fix on nonlinux systems
* ID:461 - Make compiler happier about changes related to OpenSSL 1.1
* ID:461 - OpenSSL 1.1 compatibility - "error: storage size of 'ctx' isn't known"
version 1.8.18 2016-10-08 version 1.8.18 2016-10-08
* Add mac2str() and str2mac() to print/parse MAC address * Add mac2str() and str2mac() to print/parse MAC address
* Change formatting, remove commented-out code in * Change formatting, remove commented-out code in

View File

@ -2,7 +2,7 @@ dnl
dnl autoconf for ipmitool dnl autoconf for ipmitool
dnl dnl
m4_define([git_suffix], m4_esyscmd_s(./csv-revision)) m4_define([git_suffix], m4_esyscmd_s(./csv-revision))
AC_INIT([ipmitool], [1.8.18git_suffix]) AC_INIT([ipmitool], [1.8.19git_suffix])
AC_CONFIG_SRCDIR([src/ipmitool.c]) AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_CONFIG_COMMANDS_PRE([export prefix=$prefix]) AC_CONFIG_COMMANDS_PRE([export prefix=$prefix])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM

View File

@ -27,9 +27,9 @@ TRAPD_BMC_CONF="${SNMPD_BMC_CONF_DIR}/snmptrapd.local.conf"
TRAPD_CONF="/etc/snmp/snmptrapd.conf" TRAPD_CONF="/etc/snmp/snmptrapd.conf"
LOCKFILE="/var/lock/subsys/bmc-snmp-proxy" LOCKFILE="/var/lock/subsys/bmc-snmp-proxy"
BMC_INFO="/var/run/bmc-info" BMC_INFO="/run/bmc-info"
IPMITOOL=`which ipmitool` IPMITOOL=$(which ipmitool)
#Default config #Default config
BMC_COMMUNITY="public" BMC_COMMUNITY="public"
@ -158,7 +158,7 @@ pick_alert_dest()
{ {
test_ip="$1" test_ip="$1"
# We have 4 IPv4 and 4 IPv6 alert dest. We will set IPv4 for now. # We have 4 IPv4 and 4 IPv6 alert dest. We will set IPv4 for now.
for ALERT_DEST in `seq 1 4` for ALERT_DEST in $(seq 1 4)
do do
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\ temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
2>/dev/null| sed -n "s#^Alert IP Address.*: ##p") 2>/dev/null| sed -n "s#^Alert IP Address.*: ##p")
@ -178,7 +178,7 @@ config_bmc_alert_dest()
{ {
# call with enable|disable # call with enable|disable
# Pick the first active LAN channel # Pick the first active LAN channel
for CHANNEL in `seq 1 14` for CHANNEL in $(seq 1 14)
do do
[ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \ [ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \
| grep -q "802\.3") ] || break | grep -q "802\.3") ] || break

View File

@ -5,7 +5,7 @@ After=exchange-bmc-os-info.service
Requires=exchange-bmc-os-info.service Requires=exchange-bmc-os-info.service
PartOf=exchange-bmc-os-info.service PartOf=exchange-bmc-os-info.service
ConditionPathExists=/var/run/bmc-info ConditionPathExists=/run/bmc-info
[Service] [Service]
Type=oneshot Type=oneshot

View File

@ -12,10 +12,10 @@
# Description: Script to set OS information in the BMC; fetch BMC IP/URL # Description: Script to set OS information in the BMC; fetch BMC IP/URL
# and set in the OS for use by other scripts/user. # and set in the OS for use by other scripts/user.
# #
# BMC IP and URL are made available in /var/run/bmc-info # BMC IP and URL are made available in /run/bmc-info
# #
# Example to launch BMC web-interface: # Example to launch BMC web-interface:
# # . /var/run/bmc-info # # . /run/bmc-info
# # xdg-open $BMC_URL # # xdg-open $BMC_URL
# #
# See here for details: # See here for details:
@ -42,7 +42,7 @@
############################################################################# #############################################################################
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
IPMI_TOOL=/usr/bin/ipmitool IPMI_TOOL=/usr/bin/ipmitool
BMC_INFO=/var/run/bmc-info BMC_INFO=/run/bmc-info
# BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url' # BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url'
DELL="674" DELL="674"

View File

@ -22,7 +22,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="IPMI event daemon" DESC="IPMI event daemon"
NAME=ipmievd NAME=ipmievd
DAEMON=/usr/sbin/$NAME DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid PIDFILE=/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed. # Gracefully exit if the package has been removed.

View File

@ -174,7 +174,7 @@ Do NOT become a daemon, instead log all messages to stderr.
.TP .TP
\fIpidfile\fP=<\fBfilename\fR> \fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device /run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0). number -- defaults to 0).
.RE .RE
@ -197,7 +197,7 @@ Do NOT become a daemon, instead log all messages to stderr.
.TP .TP
\fIpidfile\fP=<\fBfilename\fR> \fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device /run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0). number -- defaults to 0).
.TP .TP
\fItimeout\fP=<\fBseconds\fR> \fItimeout\fP=<\fBseconds\fR>

View File

@ -97,9 +97,14 @@ This is not available with all commands.
.TP .TP
\fB\-C\fR <\fIciphersuite\fP> \fB\-C\fR <\fIciphersuite\fP>
The remote server authentication, integrity, and encryption algorithms The remote server authentication, integrity, and encryption algorithms
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-19 in the to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-20 in the
IPMIv2.0 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1 IPMI v2.0 specification. The default is 17 which specifies RAKP\-HMAC\-SHA256
authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 encryption algorithms. authentication, HMAC\-SHA256\-128 integrity, and AES\-CBC\-128 encryption algorithms.
NOTE: In
.BR ipmitool
1.8.18 and earlier the default was 3, which was insecure and was not supported
by some more recent BMC implementations.
.TP .TP
\fB\-d \fIN\fP\fR \fB\-d \fIN\fP\fR
Use device number N to specify the /dev/ipmiN (or Use device number N to specify the /dev/ipmiN (or
@ -3742,9 +3747,9 @@ those available for the \fIlan\fP interface.
The \fB\-C\fR option allows you specify the authentication, integrity, The \fB\-C\fR option allows you specify the authentication, integrity,
and encryption algorithms to use for for \fIlanplus\fP session based and encryption algorithms to use for for \fIlanplus\fP session based
on the cipher suite ID found in the IPMIv2.0 specification in table on the cipher suite ID found in the IPMIv2.0 specification in table
22\-19. The default cipher suite is \fI3\fP which specifies 22\-20. The default cipher suite is \fI17\fP which specifies
RAKP\-HMAC\-SHA1 authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 RAKP\-HMAC\-SHA256 authentication, HMAC\-SHA256\-128 integrity, and
encryption algorightms. AES\-CBC\-128 encryption algorightms.
.SH "FREE INTERFACE" .SH "FREE INTERFACE"
.LP .LP

View File

@ -152,7 +152,7 @@ static inline uint16_t ipmi16toh(void *ipmi16)
uint8_t *ipmi = (uint8_t *)ipmi16; uint8_t *ipmi = (uint8_t *)ipmi16;
uint16_t h; uint16_t h;
h = ipmi[1] << 8; /* MSB */ h = (uint16_t)ipmi[1] << 8; /* MSB */
h |= ipmi[0]; /* LSB */ h |= ipmi[0]; /* LSB */
return h; return h;
@ -169,7 +169,7 @@ static inline uint32_t ipmi24toh(void *ipmi24)
uint8_t *ipmi = (uint8_t *)ipmi24; uint8_t *ipmi = (uint8_t *)ipmi24;
uint32_t h = 0; uint32_t h = 0;
h = ipmi[2] << 16; /* MSB */ h = (uint32_t)ipmi[2] << 16; /* MSB */
h |= ipmi[1] << 8; h |= ipmi[1] << 8;
h |= ipmi[0]; /* LSB */ h |= ipmi[0]; /* LSB */
@ -188,7 +188,7 @@ static inline uint32_t ipmi32toh(void *ipmi32)
uint8_t *ipmi = ipmi32; uint8_t *ipmi = ipmi32;
uint32_t h; uint32_t h;
h = ipmi[3] << 24; /* MSB */ h = (uint32_t)ipmi[3] << 24; /* MSB */
h |= ipmi[2] << 16; h |= ipmi[2] << 16;
h |= ipmi[1] << 8; h |= ipmi[1] << 8;
h |= ipmi[0]; /* LSB */ h |= ipmi[0]; /* LSB */

View File

@ -242,6 +242,7 @@ struct ipmi_intf {
uint16_t ipmi_intf_get_max_request_data_size(struct ipmi_intf *intf); uint16_t ipmi_intf_get_max_request_data_size(struct ipmi_intf *intf);
uint16_t ipmi_intf_get_max_response_data_size(struct ipmi_intf *intf); uint16_t ipmi_intf_get_max_response_data_size(struct ipmi_intf *intf);
uint8_t ipmi_intf_get_bridging_level(const struct ipmi_intf *intf);
struct ipmi_intf * ipmi_intf_load(char * name); struct ipmi_intf * ipmi_intf_load(char * name);
void ipmi_intf_print(struct ipmi_intf_support * intflist); void ipmi_intf_print(struct ipmi_intf_support * intflist);

View File

@ -83,7 +83,7 @@ struct ipm_devid_rsp {
#define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */ #define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */
#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */ #define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */ #define IPM_DEV_FWREV1_MAJOR_MASK (0x7f) /* Major rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */ #define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */ #define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */

View File

@ -256,7 +256,7 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
{ 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" }, { 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" },
{ 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" }, { 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" },
{ 0x08, 0x06, 0xff, "Config Error" }, { 0x08, 0x06, 0xff, "Config Error" },
{ 0x08, 0x06, 0xff, "Power Supply Inactive" }, { 0x08, 0x07, 0xff, "Power Supply Inactive" },
/* Power Unit */ /* Power Unit */
{ 0x09, 0x00, 0xff, "Power off/down" }, { 0x09, 0x00, 0xff, "Power off/down" },
{ 0x09, 0x01, 0xff, "Power cycle" }, { 0x09, 0x01, 0xff, "Power cycle" },

View File

@ -49,6 +49,7 @@ extern const struct valstr ipmi_authtype_vals[];
extern const struct valstr ipmi_channel_protocol_vals[]; extern const struct valstr ipmi_channel_protocol_vals[];
extern const struct valstr ipmi_channel_medium_vals[]; extern const struct valstr ipmi_channel_medium_vals[];
extern const struct valstr ipmi_chassis_power_control_vals[]; extern const struct valstr ipmi_chassis_power_control_vals[];
extern const struct valstr ipmi_chassis_restart_cause_vals[];
extern const struct valstr ipmi_auth_algorithms[]; extern const struct valstr ipmi_auth_algorithms[];
extern const struct valstr ipmi_integrity_algorithms[]; extern const struct valstr ipmi_integrity_algorithms[];
extern const struct valstr ipmi_encryption_algorithms[]; extern const struct valstr ipmi_encryption_algorithms[];

View File

@ -54,7 +54,7 @@
#ifdef HAVE_PATHS_H #ifdef HAVE_PATHS_H
# include <paths.h> # include <paths.h>
#else #else
# define _PATH_VARRUN "/var/run/" # define _PATH_RUN "/run/"
#endif #endif
#include <ipmitool/ipmi.h> #include <ipmitool/ipmi.h>
@ -935,7 +935,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
exit(1); exit(1);
} }
ret = dup(fd); ret = dup(fd);
if (ret != STDOUT_FILENO) { if (ret != STDERR_FILENO) {
lprintf(LOG_ERR, "failed to reset stderr: %s (%d)", strerror(errno), errno); lprintf(LOG_ERR, "failed to reset stderr: %s (%d)", strerror(errno), errno);
exit(1); exit(1);
} }

View File

@ -378,42 +378,8 @@ ipmi_chassis_restart_cause(struct ipmi_intf * intf)
return -1; return -1;
} }
printf("System restart cause: "); printf("System restart cause: %s\n",
val2str(rsp->data[0] & 0xf, ipmi_chassis_restart_cause_vals));
switch (rsp->data[0] & 0xf) {
case 0:
printf("unknown\n");
break;
case 1:
printf("chassis power control command\n");
break;
case 2:
printf("reset via pushbutton\n");
break;
case 3:
printf("power-up via pushbutton\n");
break;
case 4:
printf("watchdog expired\n");
break;
case 5:
printf("OEM\n");
break;
case 6:
printf("power-up due to always-restore power policy\n");
break;
case 7:
printf("power-up due to restore-previous power policy\n");
break;
case 8:
printf("reset via PEF\n");
break;
case 9:
printf("power-cycle via PEF\n");
break;
default:
printf("invalid\n");
}
return 0; return 0;
} }

View File

@ -43,6 +43,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#define NO_MORE_INFO_FIELD 0xc1 #define NO_MORE_INFO_FIELD 0xc1
#define TYPE_CODE 0xc0 /*Language code*/ #define TYPE_CODE 0xc0 /*Language code*/
@ -2443,6 +2445,8 @@ ipmi_ek_display_fru_header_detail(char *filename)
if (header.offset.internal != 0) { if (header.offset.internal != 0) {
unsigned char format_version; unsigned char format_version;
unsigned long len = 0; unsigned long len = 0;
uint8_t *area_offset;
uint8_t next_offset = UINT8_MAX;
printf("%s\n", EQUAL_LINE_LIMITER); printf("%s\n", EQUAL_LINE_LIMITER);
printf("FRU Internal Use Info\n"); printf("FRU Internal Use Info\n");
@ -2456,12 +2460,46 @@ ipmi_ek_display_fru_header_detail(char *filename)
} }
printf("Format Version: %d\n", (format_version & 0x0f)); printf("Format Version: %d\n", (format_version & 0x0f));
if (header.offset.chassis > 0) { /* Internal use area doesn't contain the size byte.
len = (header.offset.chassis * FACTOR_OFFSET) * We need to calculate its size by finding the area
- (header.offset.internal * FACTOR_OFFSET); * that is next. Areas may not follow the same order
} else { * as their offsets listed in the header, so we need
len = (header.offset.board * FACTOR_OFFSET) * to find the area that is physically next to the
- (header.offset.internal * FACTOR_OFFSET); * internal use area.
*/
for (area_offset = &header.offset.internal + 1;
area_offset <= &header.offset.multi;
++area_offset)
{
/* If the area is closer to us than the previously
* checked one, make it our best candidate
*/
if (*area_offset < next_offset
&& *area_offset > header.offset.internal)
{
next_offset = *area_offset;
}
}
/* If there was at least one area after internal use one,
* then we must have found it and can use it to calculate
* length. Otherwise, everything till the end of file is
* internal use area expect for the last (checksum) byte.
*/
if (next_offset < UINT8_MAX) {
len = (next_offset - header.offset.internal) * FACTOR_OFFSET;
--len; /* First byte of internal use area is version and we've
already read it */
}
else {
struct stat fs;
long curpos = ftell(input_file);
if (curpos < 0 || 0 > fstat(fileno(input_file), &fs)) {
lprintf(LOG_ERR, "Failed to determine FRU file size");
fclose(input_file);
return -1;
}
len = fs.st_size - curpos - 1; /* Last byte is checksum */
} }
printf("Length: %ld\n", len); printf("Length: %ld\n", len);
printf("Data dump:\n"); printf("Data dump:\n");

View File

@ -100,6 +100,19 @@ static struct lan_param {
{ -1, -1, "", NULL, -1 } { -1, -1, "", NULL, -1 }
}; };
static const struct valstr set_lan_cc_vals[] = {
{ 0x80, "Unsupported parameter" },
{ 0x81, "Attempt to set 'in progress' while not in 'complete' state" },
{ 0x82, "Parameter is read-only" },
{ 0x83, "Parameter is wrote-only" },
{ 0x00, NULL }
};
static const struct valstr get_lan_cc_vals[] = {
{ 0x80, "Unsupported parameter" },
{ 0x00, NULL }
};
static void print_lan_alert_print_usage(void); static void print_lan_alert_print_usage(void);
static void print_lan_alert_set_usage(void); static void print_lan_alert_set_usage(void);
static void print_lan_set_usage(void); static void print_lan_set_usage(void);
@ -177,6 +190,7 @@ static struct lan_param *
get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select) get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select)
{ {
struct lan_param *p = NULL; struct lan_param *p = NULL;
struct lan_param *rc = NULL;
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
struct ipmi_rq req; struct ipmi_rq req;
int i = 0; int i = 0;
@ -191,7 +205,7 @@ get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int selec
if (!p) { if (!p) {
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter."); lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
return NULL; return rc;
} }
msg_data[0] = chan; msg_data[0] = chan;
@ -208,7 +222,7 @@ get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int selec
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (!rsp) { if (!rsp) {
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed", p->desc); lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed", p->desc);
return NULL; return rc;
} }
switch (rsp->ccode) switch (rsp->ccode)
@ -219,19 +233,18 @@ get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int selec
case 0x80: /* parameter not supported */ case 0x80: /* parameter not supported */
case 0xc9: /* parameter out of range */ case 0xc9: /* parameter out of range */
case 0xcc: /* invalid data field in request */ case 0xcc: /* invalid data field in request */
/* We treat them as valid but empty response */
/* these completion codes usually mean parameter not supported */
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
p->desc, val2str(rsp->ccode, completion_code_vals));
p->data = NULL; p->data = NULL;
p->data_len = 0; p->data_len = 0;
return p; rc = p;
/* fall through */
default: default:
/* other completion codes are treated as error */ /* other completion codes are treated as error */
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s", lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
p->desc, val2str(rsp->ccode, completion_code_vals)); p->desc,
specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
return NULL; return NULL;
} }
@ -361,7 +374,9 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
} }
if (rsp->ccode && wait) { if (rsp->ccode && wait) {
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s", lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
val2str(rsp->ccode, completion_code_vals)); specific_val2str(rsp->ccode,
set_lan_cc_vals,
completion_code_vals));
if (rsp->ccode == 0xcc) { if (rsp->ccode == 0xcc) {
/* retry hack for invalid data field ccode */ /* retry hack for invalid data field ccode */
int retry = 10; /* 10 retries */ int retry = 10; /* 10 retries */
@ -2137,7 +2152,9 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
if (rsp->ccode) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get LAN Stats command failed: %s", lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals)); specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
return (-1); return (-1);
} }
@ -2213,7 +2230,9 @@ ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
if (rsp->ccode) { if (rsp->ccode) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s", lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals)); specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
return (-1); return (-1);
} }

View File

@ -258,7 +258,7 @@ ipmi_sdr_get_unit_string(bool pct, uint8_t relation,
} }
if (modifier <= UNIT_TYPE_MAX) { if (modifier <= UNIT_TYPE_MAX) {
modstr = unit_desc[base]; modstr = unit_desc[modifier];
} }
else { else {
modstr = "invalid"; modstr = "invalid";

View File

@ -1955,8 +1955,20 @@ ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
(trigger_reading==(int)trigger_reading) ? 0 : 2, (trigger_reading==(int)trigger_reading) ? 0 : 2,
trigger_reading); trigger_reading);
if (threshold_reading_provided) { if (threshold_reading_provided) {
/* According to Table 29-6, Event Data byte 1 contains,
* among other info, the offset from the Threshold type
* code. According to Table 42-2, all even offsets
* are 'going low', and all odd offsets are 'going high'
*/
bool going_high =
(evt->sel_type.standard_type.event_data[0]
& EVENT_OFFSET_MASK) % 2;
if (evt->sel_type.standard_type.event_dir) {
/* Event is de-asserted so the inequality is reversed */
going_high = !going_high;
}
printf(" %s Threshold %.*f %s", printf(" %s Threshold %.*f %s",
((evt->sel_type.standard_type.event_data[0] & 0xf) % 2) ? ">" : "<", going_high ? ">" : "<",
(threshold_reading==(int)threshold_reading) ? 0 : 2, (threshold_reading==(int)threshold_reading) ? 0 : 2,
threshold_reading, threshold_reading,
ipmi_sdr_get_unit_string(sdr->record.common->unit.pct, ipmi_sdr_get_unit_string(sdr->record.common->unit.pct,
@ -2273,21 +2285,6 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
return 0; return 0;
} }
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = IPMI_CMD_RESERVE_SEL;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
lprintf(LOG_ERR, "Reserve SEL command failed");
return -1;
}
if (rsp->ccode) {
lprintf(LOG_ERR, "Reserve SEL command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (count < 0) { if (count < 0) {
/** Show only the most recent 'count' records. */ /** Show only the most recent 'count' records. */
int i; int i;
@ -2923,11 +2920,6 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
return (-1); return (-1);
} }
if (ipmi_sel_reserve(intf) == 0) {
lprintf(LOG_ERR, "Unable to reserve SEL");
return (-1);
}
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
if (str2ushort(argv[i], &id) != 0) { if (str2ushort(argv[i], &id) != 0) {
lprintf(LOG_ERR, "Given SEL ID '%s' is invalid.", lprintf(LOG_ERR, "Given SEL ID '%s' is invalid.",

View File

@ -928,8 +928,9 @@ const struct oemvalstr ipmi_oem_product_info[] = {
{ IPMI_OEM_SUPERMICRO, 0xF580, "X8ST3" }, { IPMI_OEM_SUPERMICRO, 0xF580, "X8ST3" },
/* YADRO */ /* YADRO */
{ IPMI_OEM_YADRO, 0x0001, "VESNIN BMC" }, { IPMI_OEM_YADRO, 0x0001, "VESNIN BMC" },
{ IPMI_OEM_YADRO, 0x000A, "TATLIN Storage Controller BMC" }, { IPMI_OEM_YADRO, 0x000A, "TATLIN.UNIFIED Storage Controller BMC" },
{ IPMI_OEM_YADRO, 0x0014, "VEGMAN BMC" }, { IPMI_OEM_YADRO, 0x0014, "VEGMAN Series BMC" },
{ IPMI_OEM_YADRO, 0x0015, "TATLIN.ARCHIVE/xS BMC" },
{ 0xffffff , 0xffff , NULL }, { 0xffffff , 0xffff , NULL },
}; };
@ -1264,6 +1265,25 @@ const struct valstr ipmi_chassis_power_control_vals[] = {
{ 0x00, NULL }, { 0x00, NULL },
}; };
/*
* See Table 28-11, Get System Restart Cause Command
*/
const struct valstr ipmi_chassis_restart_cause_vals[] = {
{ 0x0, "unknown" },
{ 0x1, "chassis power control command" },
{ 0x2, "reset via pushbutton" },
{ 0x3, "power-up via pushbutton" },
{ 0x4, "watchdog expired" },
{ 0x5, "OEM" },
{ 0x6, "power-up due to always-restore power policy" },
{ 0x7, "power-up due to restore-previous power policy" },
{ 0x8, "reset via PEF" },
{ 0x9, "power-cycle via PEF" },
{ 0xa, "soft reset" },
{ 0xb, "power-up via RTC wakeup" },
{ 0xFF, NULL },
};
const struct valstr ipmi_auth_algorithms[] = { const struct valstr ipmi_auth_algorithms[] = {
{ IPMI_AUTH_RAKP_NONE, "none" }, { IPMI_AUTH_RAKP_NONE, "none" },
{ IPMI_AUTH_RAKP_HMAC_SHA1, "hmac_sha1" }, { IPMI_AUTH_RAKP_HMAC_SHA1, "hmac_sha1" },

View File

@ -54,8 +54,8 @@
# include <paths.h> # include <paths.h>
#endif #endif
#ifndef _PATH_VARRUN #ifndef _PATH_RUN
# define _PATH_VARRUN "/var/run/" # define _PATH_RUN "/run/"
#endif #endif
#ifdef IPMI_INTF_OPEN #ifdef IPMI_INTF_OPEN
@ -82,7 +82,7 @@
#include <ipmitool/ipmi_main.h> #include <ipmitool/ipmi_main.h>
#define WARNING_THRESHOLD 80 #define WARNING_THRESHOLD 80
#define DEFAULT_PIDFILE _PATH_VARRUN "ipmievd.pid" #define DEFAULT_PIDFILE _PATH_RUN "ipmievd.pid"
char pidfile[64]; char pidfile[64];
/* global variables */ /* global variables */
@ -422,7 +422,7 @@ static int
openipmi_read(struct ipmi_event_intf * eintf) openipmi_read(struct ipmi_event_intf * eintf)
{ {
struct ipmi_addr addr; struct ipmi_addr addr;
struct ipmi_recv recv; struct ipmi_recv recv = {};
uint8_t data[80]; uint8_t data[80];
int rv; int rv;

View File

@ -68,11 +68,12 @@ static struct ipmi_rs *ipmi_bmc_send_cmd_putmsg(struct ipmi_intf *intf,
#define MESSAGE_BUFSIZE 1024 #define MESSAGE_BUFSIZE 1024
struct ipmi_intf ipmi_bmc_intf = { struct ipmi_intf ipmi_bmc_intf = {
name: "bmc", .name = "bmc",
desc: "IPMI v2.0 BMC interface", .desc = "IPMI v2.0 BMC interface",
open: ipmi_bmc_open, .open = ipmi_bmc_open,
close: ipmi_bmc_close, .close = ipmi_bmc_close,
sendrecv: ipmi_bmc_send_cmd}; .sendrecv = ipmi_bmc_send_cmd
};
void void
ipmi_bmc_close(struct ipmi_intf *intf) ipmi_bmc_close(struct ipmi_intf *intf)

View File

@ -63,8 +63,6 @@ extern int verbose;
static int ipmi_free_open(struct ipmi_intf * intf) static int ipmi_free_open(struct ipmi_intf * intf)
{ {
int kcs_ret = -1, ssif_ret = -1;
if (getuid() != 0) { if (getuid() != 0) {
fprintf(stderr, "Permission denied, must be root\n"); fprintf(stderr, "Permission denied, must be root\n");
return -1; return -1;
@ -310,11 +308,11 @@ static struct ipmi_rs * ipmi_free_send_cmd(struct ipmi_intf * intf, struct ipmi_
} }
struct ipmi_intf ipmi_free_intf = { struct ipmi_intf ipmi_free_intf = {
name: "free", .name = "free",
desc: "FreeIPMI IPMI Interface", .desc = "FreeIPMI IPMI Interface",
open: ipmi_free_open, .open = ipmi_free_open,
close: ipmi_free_close, .close = ipmi_free_close,
sendrecv: ipmi_free_send_cmd, .sendrecv = ipmi_free_send_cmd,
target_addr: IPMI_BMC_SLAVE_ADDR, .target_addr = IPMI_BMC_SLAVE_ADDR,
}; };

View File

@ -502,13 +502,14 @@ uint16_t
ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf) ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
{ {
int16_t size; int16_t size;
uint8_t bridging_level = ipmi_intf_get_bridging_level(intf);
size = intf->max_request_data_size; size = intf->max_request_data_size;
/* check if request size is not specified */ /* check if request size is not specified */
if (!size) { if (!size) {
/* /*
* The IPMB standard overall message length for <EFBFBD>non -bridging<EFBFBD> * The IPMB standard overall message length for non-bridging
* messages is specified as 32 bytes, maximum, including slave * messages is specified as 32 bytes, maximum, including slave
* address. This sets the upper limit for typical IPMI messages. * address. This sets the upper limit for typical IPMI messages.
* With the exception of messages used for bridging messages to * With the exception of messages used for bridging messages to
@ -521,14 +522,14 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
size = IPMI_DEFAULT_PAYLOAD_SIZE; size = IPMI_DEFAULT_PAYLOAD_SIZE;
/* check if message is forwarded */ /* check if message is forwarded */
if (intf->target_addr && intf->target_addr != intf->my_addr) { if (bridging_level) {
/* add Send Message request size */ /* add Send Message request size */
size += 8; size += 8;
} }
} }
/* check if message is forwarded */ /* check if message is forwarded */
if (intf->target_addr && intf->target_addr != intf->my_addr) { if (bridging_level) {
/* subtract send message request size */ /* subtract send message request size */
size -= 8; size -= 8;
@ -541,7 +542,7 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
} }
/* check for double bridging */ /* check for double bridging */
if (intf->transit_addr && intf->transit_addr != intf->target_addr) { if (bridging_level == 2) {
/* subtract inner send message request size */ /* subtract inner send message request size */
size -= 8; size -= 8;
} }
@ -559,13 +560,14 @@ uint16_t
ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf) ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
{ {
int16_t size; int16_t size;
uint8_t bridging_level = ipmi_intf_get_bridging_level(intf);
size = intf->max_response_data_size; size = intf->max_response_data_size;
/* check if response size is not specified */ /* check if response size is not specified */
if (!size) { if (!size) {
/* /*
* The IPMB standard overall message length for <EFBFBD>non -bridging<EFBFBD> * The IPMB standard overall message length for non-bridging
* messages is specified as 32 bytes, maximum, including slave * messages is specified as 32 bytes, maximum, including slave
* address. This sets the upper limit for typical IPMI messages. * address. This sets the upper limit for typical IPMI messages.
* With the exception of messages used for bridging messages to * With the exception of messages used for bridging messages to
@ -578,14 +580,14 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
size = IPMI_DEFAULT_PAYLOAD_SIZE; /* response length with subtracted header and checksum byte */ size = IPMI_DEFAULT_PAYLOAD_SIZE; /* response length with subtracted header and checksum byte */
/* check if message is forwarded */ /* check if message is forwarded */
if (intf->target_addr && intf->target_addr != intf->my_addr) { if (bridging_level) {
/* add Send Message header size */ /* add Send Message header size */
size += 7; size += 7;
} }
} }
/* check if message is forwarded */ /* check if message is forwarded */
if (intf->target_addr && intf->target_addr != intf->my_addr) { if (bridging_level) {
/* /*
* Some IPMI controllers like PICMG AMC Carriers embed responses * Some IPMI controllers like PICMG AMC Carriers embed responses
* to the forwarded messages into the Send Message response. * to the forwarded messages into the Send Message response.
@ -603,7 +605,7 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
} }
/* check for double bridging */ /* check for double bridging */
if (intf->transit_addr && intf->transit_addr != intf->target_addr) { if (bridging_level == 2) {
/* subtract inner send message header size */ /* subtract inner send message header size */
size -= 8; size -= 8;
} }
@ -617,6 +619,25 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
return size; return size;
} }
uint8_t
ipmi_intf_get_bridging_level(const struct ipmi_intf *intf)
{
uint8_t bridging_level;
if (intf->target_addr && (intf->target_addr != intf->my_addr)) {
if (intf->transit_addr &&
(intf->transit_addr != intf->target_addr || intf->transit_channel != intf->target_channel)) {
bridging_level = 2;
} else {
bridging_level = 1;
}
} else {
bridging_level = 0;
}
return bridging_level;
}
void void
ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size) ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size)
{ {

View File

@ -741,8 +741,6 @@ ipmi_lan_poll_single(struct ipmi_intf * intf)
return (struct ipmi_rs *)1; return (struct ipmi_rs *)1;
}; };
uint8_t target_cmd = entry->req.msg.target_cmd;
lprintf(LOG_DEBUG+2, "IPMI Request Match found"); lprintf(LOG_DEBUG+2, "IPMI Request Match found");
if (entry->bridging_level) { if (entry->bridging_level) {

View File

@ -84,12 +84,16 @@ lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
return 1; return 1;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
bufferLength = bufferLength =
@ -251,12 +255,16 @@ lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
return 1; return 1;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
} }
bufferLength = bufferLength =
@ -417,12 +425,16 @@ lanplus_generate_rakp3_authcode(uint8_t * output_buffer,
} }
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
input_buffer_length = input_buffer_length =
16 + /* Rc */ 16 + /* Rc */
@ -539,12 +551,16 @@ lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf)
return 0; return 0;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
input_buffer_length = input_buffer_length =
16 + /* Rm */ 16 + /* Rm */

View File

@ -119,11 +119,11 @@ static struct ipmi_rs * ipmi_lipmi_send_cmd(struct ipmi_intf * intf, struct ipmi
} }
struct ipmi_intf ipmi_lipmi_intf = { struct ipmi_intf ipmi_lipmi_intf = {
name: "lipmi", .name = "lipmi",
desc: "Solaris x86 LIPMI Interface", .desc = "Solaris x86 LIPMI Interface",
open: ipmi_lipmi_open, .open = ipmi_lipmi_open,
close: ipmi_lipmi_close, .close = ipmi_lipmi_close,
sendrecv: ipmi_lipmi_send_cmd, .sendrecv = ipmi_lipmi_send_cmd,
target_addr: IPMI_BMC_SLAVE_ADDR, .target_addr = IPMI_BMC_SLAVE_ADDR,
}; };

View File

@ -170,7 +170,7 @@ static
struct ipmi_rs * struct ipmi_rs *
ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req) ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
{ {
struct ipmi_recv recv; struct ipmi_recv recv = {};
struct ipmi_addr addr; struct ipmi_addr addr;
struct ipmi_system_interface_addr bmc_addr = { struct ipmi_system_interface_addr bmc_addr = {
.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE, .addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE,

View File

@ -612,18 +612,7 @@ serial_bm_build_msg(const struct ipmi_intf * intf,
uint8_t * data = msg, seq; uint8_t * data = msg, seq;
struct ipmb_msg_hdr * hdr = (struct ipmb_msg_hdr *) msg; struct ipmb_msg_hdr * hdr = (struct ipmb_msg_hdr *) msg;
struct ipmi_send_message_rq * inner_rq = NULL, * outer_rq = NULL; struct ipmi_send_message_rq * inner_rq = NULL, * outer_rq = NULL;
int bridging_level; int bridging_level = ipmi_intf_get_bridging_level(intf);
/* acquire bridging level */
if (intf->target_addr && intf->target_addr != intf->my_addr) {
if (intf->transit_addr != 0) {
bridging_level = 2;
} else {
bridging_level = 1;
}
} else {
bridging_level = 0;
}
/* check overall packet length */ /* check overall packet length */
if(req->msg.data_len + 7 + bridging_level * 8 > max_len) { if(req->msg.data_len + 7 + bridging_level * 8 > max_len) {

View File

@ -473,18 +473,7 @@ serial_term_build_msg(const struct ipmi_intf * intf,
struct serial_term_hdr * term_hdr = (struct serial_term_hdr *) msg; struct serial_term_hdr * term_hdr = (struct serial_term_hdr *) msg;
struct ipmi_send_message_rq * outer_rq = NULL; struct ipmi_send_message_rq * outer_rq = NULL;
struct ipmi_send_message_rq * inner_rq = NULL; struct ipmi_send_message_rq * inner_rq = NULL;
int bridging_level; int bridging_level = ipmi_intf_get_bridging_level(intf);
/* acquire bridging level */
if (intf->target_addr && intf->target_addr != intf->my_addr) {
if (intf->transit_addr != 0) {
bridging_level = 2;
} else {
bridging_level = 1;
}
} else {
bridging_level = 0;
}
/* check overall packet length */ /* check overall packet length */
if(req->msg.data_len + 3 + bridging_level * 8 > max_len) { if(req->msg.data_len + 3 + bridging_level * 8 > max_len) {
@ -635,7 +624,7 @@ serial_term_send_msg(struct ipmi_intf * intf, uint8_t * msg, int msg_len)
/* body */ /* body */
for (i = 0; i < msg_len; i++) { for (i = 0; i < msg_len; i++) {
buf += sprintf( buf, "%02x", msg[i]); buf += sprintf((char*) buf, "%02x", msg[i]);
} }
/* stop character */ /* stop character */