Compare commits

..

5 Commits

Author SHA1 Message Date
cac593b83d 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-17 02:44:37 +03:00
8554e19e68 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-17 02:10:48 +03:00
e6632dcf43 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-17 01:59:03 +03:00
692a357808 Fix compiler warning
Drop some unused variables detected by the compiler

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 01:59:03 +03:00
87fc969e45 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-17 01:59:03 +03:00
26 changed files with 207 additions and 486 deletions

View File

@ -11,7 +11,7 @@ jobs:
linux: linux:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ] os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: install dependencies - name: install dependencies
@ -54,10 +54,7 @@ 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

269
ChangeLog
View File

@ -1,238 +1,3 @@
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
@ -882,7 +647,7 @@ version 1.8.11 released 2009-02-25
* Patch ID 1990560 to get readings from non-linear analog sensors * Patch ID 1990560 to get readings from non-linear analog sensors
* Add support for SOL payload status command * Add support for SOL payload status command
* SOL set parameter range checking added * SOL set parameter range checking added
* Fixed SOL activate options usage * Fixed SOL activate options usage
* Fixed crashes when parsing 'sol payload' and 'tsol' cmds (#216967) * Fixed crashes when parsing 'sol payload' and 'tsol' cmds (#216967)
* Added retries to SOL keepalive * Added retries to SOL keepalive
* Fixed wrong mask values for Front Panel disable/enable status * Fixed wrong mask values for Front Panel disable/enable status
@ -898,14 +663,14 @@ version 1.8.11 released 2009-02-25
* Fix occasional SDR dump segfault; #1793076 * Fix occasional SDR dump segfault; #1793076
* Allow ipmitool sel delete to accept hex list entry numbers * Allow ipmitool sel delete to accept hex list entry numbers
* Fix SEL total space reporting. * Fix SEL total space reporting.
* Fix for garbage sensor threshold values reported when none * Fix for garbage sensor threshold values reported when none
returned. Tracker Bug #863748 returned. Tracker Bug #863748
* ipmievd change to Monitor %used in SEL buffer and log warnings when * ipmievd change to Monitor %used in SEL buffer and log warnings when
the buffer is 80% and 100% full the buffer is 80% and 100% full
version 1.8.10 released 2008-08-08 version 1.8.10 released 2008-08-08
* Added support for BULL IANA number. * Added support for BULL IANA number.
* Fixed contrib build so the oem_ibm_sel_map file gets included in * Fixed contrib build so the oem_ibm_sel_map file gets included in
rpm builds again. rpm builds again.
* Added support for Debian packages to be built from CVS * Added support for Debian packages to be built from CVS
* Fix for sdr and sel timestamp reporting issues * Fix for sdr and sel timestamp reporting issues
@ -914,11 +679,11 @@ version 1.8.10 released 2008-08-08
* Change ipmi_chassis_status() to non-static so it can be used * Change ipmi_chassis_status() to non-static so it can be used
externally externally
* Added retries to SOL keepalive * Added retries to SOL keepalive
* Fix to stop sensor list command from reporting a failure due * Fix to stop sensor list command from reporting a failure due
to missing sensor to missing sensor
* Fix bug in sdr free space reporting * Fix bug in sdr free space reporting
* Add support for IANA number to vendor name conversion for many * Add support for IANA number to vendor name conversion for many
vendors vendors
* Fix segfault bug in lan set command * Fix segfault bug in lan set command
* Fix bug in population of raw i2c wdata buffer * Fix bug in population of raw i2c wdata buffer
* Fix bug in ipmb sensor reading * Fix bug in ipmb sensor reading
@ -932,7 +697,7 @@ version 1.8.10 released 2008-08-08
* Add more JEDEC support info for DIMMs; decrease request size * Add more JEDEC support info for DIMMs; decrease request size
for DIMM FRU info to 16 bytes at a time to allow more for DIMM FRU info to 16 bytes at a time to allow more
DIMM FRUs to respond. DIMM FRUs to respond.
* Fix to change hpmfwupg to version 1.02; fix to reduce hpmfwupg * Fix to change hpmfwupg to version 1.02; fix to reduce hpmfwupg
buffer length more aggressively when no response from iol buffer length more aggressively when no response from iol
* Fix HPM firmware activation via IOL; fake a timeout after IOL * Fix HPM firmware activation via IOL; fake a timeout after IOL
session re-open to force get upgrade status retry; session re-open to force get upgrade status retry;
@ -941,11 +706,11 @@ version 1.8.10 released 2008-08-08
* Fix for oemval2str size * Fix for oemval2str size
* Add support for product name resolution in mc info * Add support for product name resolution in mc info
* Fix FRU display format * Fix FRU display format
* Added PICMG ekeying analyzer module support (ekanalyzer); * Added PICMG ekeying analyzer module support (ekanalyzer);
display point to point physical connectivity and power display point to point physical connectivity and power
supply information between carriers and AMC modules; supply information between carriers and AMC modules;
display matched results of ekeying match between an display matched results of ekeying match between an
on-carrier device and AMC module or between 2 AMC modules on-carrier device and AMC module or between 2 AMC modules
* Fix AMC GUID display support * Fix AMC GUID display support
* Improved amcportstate operations * Improved amcportstate operations
* Added resolution for new sensor types * Added resolution for new sensor types
@ -958,8 +723,8 @@ version 1.8.10 released 2008-08-08
* Added SPD support for parms: channel number, max read size * Added SPD support for parms: channel number, max read size
* Add SDR support for adding SDR records from a dumped file, * Add SDR support for adding SDR records from a dumped file,
clearing SDR, adding partial SDR records clearing SDR, adding partial SDR records
* Add updates and fixes to hpmfwupg: upload block size to 32 bytes * Add updates and fixes to hpmfwupg: upload block size to 32 bytes
for KCS, handle long response option, implement rollback for KCS, handle long response option, implement rollback
override, garbage output fix override, garbage output fix
* Add double bridge lan support , fix bridging issue * Add double bridge lan support , fix bridging issue
* Add HPM support to pre-check which components need to be skipped * Add HPM support to pre-check which components need to be skipped
@ -993,7 +758,7 @@ version 1.8.9 released 2007-03-06
* Added edit support for AMC activation "Maximum Internal Current" * Added edit support for AMC activation "Maximum Internal Current"
* Fix bug generating garbage on the screen when handling GetDeviceId * Fix bug generating garbage on the screen when handling GetDeviceId
and sol traffic occurs and sol traffic occurs
* Added ability to map OEM sensor types to OEM description string using * Added ability to map OEM sensor types to OEM description string using
IANA number; moved IANA number table IANA number; moved IANA number table
* Fix lan set access command to use value already saved within * Fix lan set access command to use value already saved within
parameters for PEF and authentication parameters for PEF and authentication
@ -1011,13 +776,13 @@ version 1.8.9 released 2007-03-06
* Fix SOL set errors when commit-write not supported * Fix SOL set errors when commit-write not supported
* Fix reset of session timeout for lanplus interface * Fix reset of session timeout for lanplus interface
* Fixed lan interface accessibility timeout handling * Fixed lan interface accessibility timeout handling
* Fix bug with Function Get Channel Cipher Suites command when * Fix bug with Function Get Channel Cipher Suites command when
more than 1 page used. more than 1 page used.
* Fix missing firmware firewall top-level command * Fix missing firmware firewall top-level command
* Fix bug in SOL keepalive functionality * Fix bug in SOL keepalive functionality
* Fix SOLv2 NACK and retry handling for Intel ESB2 BMC * Fix SOLv2 NACK and retry handling for Intel ESB2 BMC
* Added ipmi_sel_get_oem_sensor* APIs * Added ipmi_sel_get_oem_sensor* APIs
* Added HPM.1 support * Added HPM.1 support
* Fix segfault when incorrect oem option supplied * Fix segfault when incorrect oem option supplied
* Fix bus problem with spd command * Fix bus problem with spd command
* Fix segfault in SOL when remote BMC does not return packet * Fix segfault in SOL when remote BMC does not return packet
@ -1031,7 +796,7 @@ version 1.8.9 released 2007-03-06
* Add freeipmi interface support * Add freeipmi interface support
* Add remote spd printing * Add remote spd printing
* Add better detection of linux/compiler.h to config * Add better detection of linux/compiler.h to config
* Makefile changes to fix makedistcheck, etc. * Makefile changes to fix makedistcheck, etc.
version 1.8.8 version 1.8.8
* Fix segfaults in sensor data repository list * Fix segfaults in sensor data repository list

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.19git_suffix]) AC_INIT([ipmitool], [1.8.18git_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="/run/bmc-info" BMC_INFO="/var/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=/run/bmc-info ConditionPathExists=/var/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 /run/bmc-info # BMC IP and URL are made available in /var/run/bmc-info
# #
# Example to launch BMC web-interface: # Example to launch BMC web-interface:
# # . /run/bmc-info # # . /var/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=/run/bmc-info BMC_INFO=/var/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=/run/$NAME.pid PIDFILE=/var/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
/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device /var/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
/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device /var/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,14 +97,9 @@ 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\-20 in the to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-19 in the
IPMI v2.0 specification. The default is 17 which specifies RAKP\-HMAC\-SHA256 IPMIv2.0 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1
authentication, HMAC\-SHA256\-128 integrity, and AES\-CBC\-128 encryption algorithms. authentication, HMAC\-SHA1\-96 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
@ -3747,9 +3742,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\-20. The default cipher suite is \fI17\fP which specifies 22\-19. The default cipher suite is \fI3\fP which specifies
RAKP\-HMAC\-SHA256 authentication, HMAC\-SHA256\-128 integrity, and RAKP\-HMAC\-SHA1 authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128
AES\-CBC\-128 encryption algorightms. 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 = (uint16_t)ipmi[1] << 8; /* MSB */ h = 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 = (uint32_t)ipmi[2] << 16; /* MSB */ h = 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 = (uint32_t)ipmi[3] << 24; /* MSB */ h = 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,7 +242,6 @@ 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 (0x7f) /* Major rev, BCD-encoded */ #define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* 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, 0x07, 0xff, "Power Supply Inactive" }, { 0x08, 0x06, 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,7 +49,6 @@ 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_RUN "/run/" # define _PATH_VARRUN "/var/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 != STDERR_FILENO) { if (ret != STDOUT_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,8 +378,42 @@ ipmi_chassis_restart_cause(struct ipmi_intf * intf)
return -1; return -1;
} }
printf("System restart cause: %s\n", printf("System restart cause: ");
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,8 +43,6 @@
#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*/
@ -2445,8 +2443,6 @@ 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");
@ -2460,46 +2456,12 @@ ipmi_ek_display_fru_header_detail(char *filename)
} }
printf("Format Version: %d\n", (format_version & 0x0f)); printf("Format Version: %d\n", (format_version & 0x0f));
/* Internal use area doesn't contain the size byte. if (header.offset.chassis > 0) {
* We need to calculate its size by finding the area len = (header.offset.chassis * FACTOR_OFFSET)
* that is next. Areas may not follow the same order - (header.offset.internal * FACTOR_OFFSET);
* as their offsets listed in the header, so we need } else {
* to find the area that is physically next to the len = (header.offset.board * FACTOR_OFFSET)
* internal use area. - (header.offset.internal * FACTOR_OFFSET);
*/
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

@ -61,7 +61,7 @@ static struct lan_param {
int cmd; int cmd;
int size; int size;
char desc[24]; char desc[24];
uint8_t *data; uint8_t * data;
int data_len; int data_len;
} ipmi_lan_params[] = { } ipmi_lan_params[] = {
{ IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress", NULL, 0 }, { IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress", NULL, 0 },
@ -100,19 +100,6 @@ 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);
@ -136,7 +123,7 @@ static void print_lan_usage(void);
* @chan: channel number to check * @chan: channel number to check
*/ */
static int static int
is_lan_channel(struct ipmi_intf *intf, uint8_t chan) is_lan_channel(struct ipmi_intf * intf, uint8_t chan)
{ {
uint8_t medium; uint8_t medium;
@ -161,7 +148,7 @@ is_lan_channel(struct ipmi_intf *intf, uint8_t chan)
* @start: channel number to start searching from * @start: channel number to start searching from
*/ */
uint8_t uint8_t
find_lan_channel(struct ipmi_intf *intf, uint8_t start) find_lan_channel(struct ipmi_intf * intf, uint8_t start)
{ {
uint8_t chan = 0; uint8_t chan = 0;
@ -187,11 +174,10 @@ find_lan_channel(struct ipmi_intf *intf, uint8_t start)
* @select: lan parameter set selector * @select: lan parameter set selector
*/ */
static struct lan_param * 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;
uint8_t msg_data[4]; uint8_t msg_data[4];
@ -205,7 +191,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
if (!p) { if (!p) {
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter."); lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
return rc; return NULL;
} }
msg_data[0] = chan; msg_data[0] = chan;
@ -222,7 +208,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
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 rc; return NULL;
} }
switch (rsp->ccode) switch (rsp->ccode)
@ -233,18 +219,19 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
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;
rc = p; return 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, p->desc, val2str(rsp->ccode, completion_code_vals));
specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
return NULL; return NULL;
} }
@ -267,7 +254,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
* @param: lan parameter id * @param: lan parameter id
*/ */
static struct lan_param * static struct lan_param *
get_lan_param(struct ipmi_intf *intf, uint8_t chan, int param) get_lan_param(struct ipmi_intf * intf, uint8_t chan, int param)
{ {
return get_lan_param_select(intf, chan, param, 0); return get_lan_param_select(intf, chan, param, 0);
} }
@ -288,10 +275,10 @@ get_lan_param(struct ipmi_intf *intf, uint8_t chan, int param)
* @len: length of lan parameter data * @len: length of lan parameter data
*/ */
static int static int
set_lan_param_wait(struct ipmi_intf *intf, uint8_t chan, set_lan_param_wait(struct ipmi_intf * intf, uint8_t chan,
int param, uint8_t *data, int len) int param, uint8_t * data, int len)
{ {
struct lan_param *p; struct lan_param * p;
int retry = 10; /* 10 retries */ int retry = 10; /* 10 retries */
lprintf(LOG_DEBUG, "Waiting for Set LAN Parameter to complete..."); lprintf(LOG_DEBUG, "Waiting for Set LAN Parameter to complete...");
@ -347,10 +334,10 @@ set_lan_param_wait(struct ipmi_intf *intf, uint8_t chan,
* @wait: whether to wait for write completion * @wait: whether to wait for write completion
*/ */
static int static int
__set_lan_param(struct ipmi_intf *intf, uint8_t chan, __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
int param, uint8_t *data, int len, int wait) int param, uint8_t * data, int len, int wait)
{ {
struct ipmi_rs *rsp; struct ipmi_rs * rsp;
struct ipmi_rq req; struct ipmi_rq req;
uint8_t msg_data[32]; uint8_t msg_data[32];
@ -374,9 +361,7 @@ __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",
specific_val2str(rsp->ccode, val2str(rsp->ccode, completion_code_vals));
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 */
@ -414,9 +399,9 @@ __set_lan_param(struct ipmi_intf *intf, uint8_t chan,
* @chan: ipmi channel * @chan: ipmi channel
*/ */
static int static int
ipmi_lanp_lock_state(struct ipmi_intf *intf, uint8_t chan) ipmi_lanp_lock_state(struct ipmi_intf * intf, uint8_t chan)
{ {
struct lan_param *p; struct lan_param * p;
p = get_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS); p = get_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS);
if (!p) if (!p)
return -1; return -1;
@ -437,7 +422,7 @@ ipmi_lanp_lock_state(struct ipmi_intf *intf, uint8_t chan)
* @chan: ipmi channel * @chan: ipmi channel
*/ */
static void static void
ipmi_lanp_lock(struct ipmi_intf *intf, uint8_t chan) ipmi_lanp_lock(struct ipmi_intf * intf, uint8_t chan)
{ {
uint8_t val = IPMI_LANP_WRITE_LOCK; uint8_t val = IPMI_LANP_WRITE_LOCK;
int retry = 3; int retry = 3;
@ -467,7 +452,7 @@ ipmi_lanp_lock(struct ipmi_intf *intf, uint8_t chan)
* @chan: ipmi channel * @chan: ipmi channel
*/ */
static void static void
ipmi_lanp_unlock(struct ipmi_intf *intf, uint8_t chan) ipmi_lanp_unlock(struct ipmi_intf * intf, uint8_t chan)
{ {
uint8_t val = IPMI_LANP_WRITE_COMMIT; uint8_t val = IPMI_LANP_WRITE_COMMIT;
int rc; int rc;
@ -492,8 +477,8 @@ ipmi_lanp_unlock(struct ipmi_intf *intf, uint8_t chan)
* @len: length of lan parameter data * @len: length of lan parameter data
*/ */
static int static int
set_lan_param(struct ipmi_intf *intf, uint8_t chan, set_lan_param(struct ipmi_intf * intf, uint8_t chan,
int param, uint8_t *data, int len) int param, uint8_t * data, int len)
{ {
int rc; int rc;
ipmi_lanp_lock(intf, chan); ipmi_lanp_lock(intf, chan);
@ -513,8 +498,8 @@ set_lan_param(struct ipmi_intf *intf, uint8_t chan,
* @len: length of lan parameter data * @len: length of lan parameter data
*/ */
static int static int
set_lan_param_nowait(struct ipmi_intf *intf, uint8_t chan, set_lan_param_nowait(struct ipmi_intf * intf, uint8_t chan,
int param, uint8_t *data, int len) int param, uint8_t * data, int len)
{ {
int rc; int rc;
ipmi_lanp_lock(intf, chan); ipmi_lanp_lock(intf, chan);
@ -524,7 +509,7 @@ set_lan_param_nowait(struct ipmi_intf *intf, uint8_t chan,
} }
static int static int
lan_set_arp_interval(struct ipmi_intf *intf, uint8_t chan, uint8_t ival) lan_set_arp_interval(struct ipmi_intf * intf, uint8_t chan, uint8_t ival)
{ {
struct lan_param *lp; struct lan_param *lp;
uint8_t interval = 0; uint8_t interval = 0;
@ -554,7 +539,7 @@ lan_set_arp_interval(struct ipmi_intf *intf, uint8_t chan, uint8_t ival)
} }
static int static int
lan_set_arp_generate(struct ipmi_intf *intf, lan_set_arp_generate(struct ipmi_intf * intf,
uint8_t chan, uint8_t ctl) uint8_t chan, uint8_t ctl)
{ {
struct lan_param *lp; struct lan_param *lp;
@ -578,7 +563,7 @@ lan_set_arp_generate(struct ipmi_intf *intf,
} }
static int static int
lan_set_arp_respond(struct ipmi_intf *intf, lan_set_arp_respond(struct ipmi_intf * intf,
uint8_t chan, uint8_t ctl) uint8_t chan, uint8_t ctl)
{ {
struct lan_param *lp; struct lan_param *lp;
@ -630,9 +615,9 @@ static char priv_level_to_char(unsigned char priv_level)
static int static int
ipmi_lan_print(struct ipmi_intf *intf, uint8_t chan) ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
{ {
struct lan_param *p; struct lan_param * p;
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) { if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
lprintf(LOG_ERR, "Invalid Channel %d", chan); lprintf(LOG_ERR, "Invalid Channel %d", chan);
@ -918,12 +903,12 @@ ipmi_lan_print(struct ipmi_intf *intf, uint8_t chan)
/* Configure Authentication Types */ /* Configure Authentication Types */
/* TODO - probably some code duplication going on ??? */ /* TODO - probably some code duplication going on ??? */
static int static int
ipmi_lan_set_auth(struct ipmi_intf *intf, uint8_t chan, char *level, char *types) ipmi_lan_set_auth(struct ipmi_intf * intf, uint8_t chan, char * level, char * types)
{ {
uint8_t data[5]; uint8_t data[5];
uint8_t authtype = 0; uint8_t authtype = 0;
char *p; char * p;
struct lan_param *lp; struct lan_param * lp;
if (!level || !types) if (!level || !types)
return -1; return -1;
@ -1159,7 +1144,7 @@ ipmi_set_user_access(struct ipmi_intf *intf, uint8_t channel, uint8_t user_id)
static int static int
get_cmdline_cipher_suite_priv_data(char *arg, uint8_t *buf) get_cmdline_cipher_suite_priv_data(char * arg, uint8_t * buf)
{ {
int i, ret = 0; int i, ret = 0;
@ -1236,7 +1221,7 @@ get_cmdline_cipher_suite_priv_data(char *arg, uint8_t *buf)
static int static int
get_cmdline_ipaddr(char *arg, uint8_t *buf) get_cmdline_ipaddr(char * arg, uint8_t * buf)
{ {
uint32_t ip1, ip2, ip3, ip4; uint32_t ip1, ip2, ip3, ip4;
if (sscanf(arg, if (sscanf(arg,
@ -1388,7 +1373,7 @@ get_cmdline_bad_pass_thresh(char *argv[], uint8_t *buf)
} }
static int static int
ipmi_lan_set(struct ipmi_intf *intf, int argc, char **argv) ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
{ {
uint8_t data[32]; uint8_t data[32];
uint8_t chan; uint8_t chan;
@ -1744,9 +1729,9 @@ ipmi_lan_set(struct ipmi_intf *intf, int argc, char **argv)
static int static int
is_alert_destination(struct ipmi_intf *intf, uint8_t channel, uint8_t alert) is_alert_destination(struct ipmi_intf * intf, uint8_t channel, uint8_t alert)
{ {
struct lan_param *p; struct lan_param * p;
p = get_lan_param(intf, channel, IPMI_LANP_NUM_DEST); p = get_lan_param(intf, channel, IPMI_LANP_NUM_DEST);
if (!p) if (!p)
@ -1761,7 +1746,7 @@ is_alert_destination(struct ipmi_intf *intf, uint8_t channel, uint8_t alert)
} }
static int static int
ipmi_lan_alert_print(struct ipmi_intf *intf, uint8_t channel, uint8_t alert) ipmi_lan_alert_print(struct ipmi_intf * intf, uint8_t channel, uint8_t alert)
{ {
# define PTYPE_LEN 4 # define PTYPE_LEN 4
# define PADDR_LEN 13 # define PADDR_LEN 13
@ -1835,10 +1820,10 @@ ipmi_lan_alert_print(struct ipmi_intf *intf, uint8_t channel, uint8_t alert)
} }
static int static int
ipmi_lan_alert_print_all(struct ipmi_intf *intf, uint8_t channel) ipmi_lan_alert_print_all(struct ipmi_intf * intf, uint8_t channel)
{ {
int j, ndest; int j, ndest;
struct lan_param *p; struct lan_param * p;
p = get_lan_param(intf, channel, IPMI_LANP_NUM_DEST); p = get_lan_param(intf, channel, IPMI_LANP_NUM_DEST);
if (!p) if (!p)
@ -1855,10 +1840,10 @@ ipmi_lan_alert_print_all(struct ipmi_intf *intf, uint8_t channel)
} }
static int static int
ipmi_lan_alert_set(struct ipmi_intf *intf, uint8_t chan, uint8_t alert, ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
int argc, char **argv) int argc, char ** argv)
{ {
struct lan_param *p; struct lan_param * p;
uint8_t data[32], temp[32]; uint8_t data[32], temp[32];
int rc = 0; int rc = 0;
@ -2028,7 +2013,7 @@ ipmi_lan_alert_set(struct ipmi_intf *intf, uint8_t chan, uint8_t alert,
} }
static int static int
ipmi_lan_alert(struct ipmi_intf *intf, int argc, char **argv) ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
{ {
uint8_t alert; uint8_t alert;
uint8_t channel = 1; uint8_t channel = 1;
@ -2120,10 +2105,10 @@ ipmi_lan_alert(struct ipmi_intf *intf, int argc, char **argv)
static int static int
ipmi_lan_stats_get(struct ipmi_intf *intf, uint8_t chan) ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
{ {
int rc = 0; int rc = 0;
struct ipmi_rs *rsp; struct ipmi_rs * rsp;
struct ipmi_rq req; struct ipmi_rq req;
uint8_t msg_data[2]; uint8_t msg_data[2];
uint16_t statsTemp; uint16_t statsTemp;
@ -2152,9 +2137,7 @@ 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",
specific_val2str(rsp->ccode, val2str(rsp->ccode, completion_code_vals));
get_lan_cc_vals,
completion_code_vals));
return (-1); return (-1);
} }
@ -2200,10 +2183,10 @@ ipmi_lan_stats_get(struct ipmi_intf *intf, uint8_t chan)
static int static int
ipmi_lan_stats_clear(struct ipmi_intf *intf, uint8_t chan) ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
{ {
int rc = 0; int rc = 0;
struct ipmi_rs *rsp; struct ipmi_rs * rsp;
struct ipmi_rq req; struct ipmi_rq req;
uint8_t msg_data[2]; uint8_t msg_data[2];
@ -2230,9 +2213,7 @@ 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",
specific_val2str(rsp->ccode, val2str(rsp->ccode, completion_code_vals));
get_lan_cc_vals,
completion_code_vals));
return (-1); return (-1);
} }
@ -2492,7 +2473,7 @@ print_lan_usage(void)
int int
ipmi_lanp_main(struct ipmi_intf *intf, int argc, char **argv) ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
{ {
int rc = 0; int rc = 0;
uint8_t chan = 0; uint8_t chan = 0;

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[modifier]; modstr = unit_desc[base];
} }
else { else {
modstr = "invalid"; modstr = "invalid";

View File

@ -1955,20 +1955,8 @@ 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",
going_high ? ">" : "<", ((evt->sel_type.standard_type.event_data[0] & 0xf) % 2) ? ">" : "<",
(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,
@ -2285,6 +2273,21 @@ __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;
@ -2920,6 +2923,11 @@ 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,9 +928,8 @@ 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.UNIFIED Storage Controller BMC" }, { IPMI_OEM_YADRO, 0x000A, "TATLIN Storage Controller BMC" },
{ IPMI_OEM_YADRO, 0x0014, "VEGMAN Series BMC" }, { IPMI_OEM_YADRO, 0x0014, "VEGMAN BMC" },
{ IPMI_OEM_YADRO, 0x0015, "TATLIN.ARCHIVE/xS BMC" },
{ 0xffffff , 0xffff , NULL }, { 0xffffff , 0xffff , NULL },
}; };
@ -1265,25 +1264,6 @@ 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_RUN #ifndef _PATH_VARRUN
# define _PATH_RUN "/run/" # define _PATH_VARRUN "/var/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_RUN "ipmievd.pid" #define DEFAULT_PIDFILE _PATH_VARRUN "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

@ -502,14 +502,13 @@ 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 non-bridging * The IPMB standard overall message length for <EFBFBD>non -bridging<EFBFBD>
* 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
@ -522,14 +521,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 (bridging_level) { if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* 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 (bridging_level) { if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* subtract send message request size */ /* subtract send message request size */
size -= 8; size -= 8;
@ -542,7 +541,7 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
} }
/* check for double bridging */ /* check for double bridging */
if (bridging_level == 2) { if (intf->transit_addr && intf->transit_addr != intf->target_addr) {
/* subtract inner send message request size */ /* subtract inner send message request size */
size -= 8; size -= 8;
} }
@ -560,14 +559,13 @@ 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 non-bridging * The IPMB standard overall message length for <EFBFBD>non -bridging<EFBFBD>
* 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
@ -580,14 +578,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 (bridging_level) { if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* 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 (bridging_level) { if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* /*
* 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.
@ -605,7 +603,7 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
} }
/* check for double bridging */ /* check for double bridging */
if (bridging_level == 2) { if (intf->transit_addr && intf->transit_addr != intf->target_addr) {
/* subtract inner send message header size */ /* subtract inner send message header size */
size -= 8; size -= 8;
} }
@ -619,25 +617,6 @@ 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

@ -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,7 +612,18 @@ 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 = ipmi_intf_get_bridging_level(intf); int bridging_level;
/* 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,7 +473,18 @@ 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 = ipmi_intf_get_bridging_level(intf); int bridging_level;
/* 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) {
@ -624,7 +635,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((char*) buf, "%02x", msg[i]); buf += sprintf( buf, "%02x", msg[i]);
} }
/* stop character */ /* stop character */