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
38 changed files with 300 additions and 846 deletions

View File

@ -1,37 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: AlexanderAmelkin
---
**Describe the bug**
A clear and concise description of what the bug is.
*Please **DO NOT** report ANYTHING about 1.8.18, it is outdated. Please first check your alleged bug with the latest code from the top of the master branch here.*
**IPMITOOL Version**
Make sure you're reporting a bug in the latest code taken from `master` branch here, NOT a bug
that you've found in some version that you've got from your OS vendor or any source other than this repository.
```none
$ ipmitool -V
<output here>
```
**To Reproduce**
Steps to reproduce the behavior:
1. Using hardware/BMC '...'
2. Run `ipmitool ...`
3. Observe the abnormal reply:
```none
abnormal output example
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context about the problem here.

View File

@ -11,7 +11,7 @@ jobs:
linux:
strategy:
matrix:
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04 ]
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: install dependencies
@ -53,11 +53,8 @@ jobs:
- name: make distcheck
run: make distcheck
macos:
strategy:
matrix:
os: [ macos-10.15, macos-11, macos-12 ]
runs-on: ${{ matrix.os }}
macos-catalina:
runs-on: macos-10.15
steps:
- name: install dependencies
@ -77,11 +74,9 @@ jobs:
- name: make distcheck
run: make distcheck
windows:
strategy:
matrix:
os: [ windows-2019, windows-2022 ]
runs-on: ${{ matrix.os }}
win-srv-2019:
runs-on: windows-2019
steps:
- name: install dependencies

235
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
* Add mac2str() and str2mac() to print/parse MAC address
* Change formatting, remove commented-out code in

11
INSTALL
View File

@ -18,14 +18,11 @@ library and development headers are required. As of July 2020, the
project is tested automatically to build cleanly for the following
64-bit operating systems using GitHub Actions workflow:
- Ubuntu 16.04 Xenial Xerus
- Ubuntu 18.04 Bionic Beaver
- Ubuntu 20.04 Focal Fossa
- Ubuntu 22.04 Jammy Jellyfish
- MacOS X 10.15 Catalina
- MacOS 11 Big Sur
- MacOS 12 Monterey
- Microsoft Windows Server 2019
- Microsoft Windows Server 2022
It is also known to build successfully on Ubuntu 14.04 and Fedora 31,
but that is not automatically verified.
@ -44,8 +41,8 @@ but that is not automatically verified.
$ sudo dnf install automake gcc git libtool make openssl-devel \
readline-devel wget
For MacOS with Xcode and homebrew installed, it is recommended to do the
following before building:
For MacOS X 10.15 with Xcode and homebrew installed, it is
recommended to do the following before building:
$ brew install automake openssl libtool freeipmi wget
$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
@ -185,7 +182,7 @@ architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS and later systems, you can create libraries and
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like

View File

@ -28,7 +28,7 @@
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
DOCDIR = $(docdir)
DOCDIR = $(datadir)/doc/$(PACKAGE)
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
EXTRA_DIST = $(DOCLIST) bootstrap
@ -41,7 +41,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \
$(distdir).tar.gz $(distdir).tar.bz2
SUBDIRS = lib src include doc contrib control
IANA_PEN = http://www.iana.org/assignments/enterprise-numbers.txt
IANA_PEN = http://www.iana.org/assignments/enterprise-numbers
dist-hook:
cp control/ipmitool.spec $(distdir)

View File

@ -2,7 +2,7 @@ dnl
dnl autoconf for ipmitool
dnl
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_COMMANDS_PRE([export prefix=$prefix])
AC_CANONICAL_SYSTEM
@ -18,6 +18,8 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROG([RPMBUILD], [rpmbuild], [rpmbuild], [rpm])
AC_CHECK_PROG([SED], [sed], [sed])
AC_CHECK_PROG([WGET], [wget], [wget])
AC_CHECK_PROG([CURL], [curl], [curl])
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h])
@ -54,33 +56,21 @@ if test "x$exec_prefix" = "xNONE"; then
exec_prefix="$prefix"
fi
dnl allow enabling/disabling the fetching of the IANA PEN registry
AC_ARG_ENABLE([registry-download],
[AC_HELP_STRING([--enable-registry-download],
[download/install the IANA PEN registry [default=yes]])],
[xenable_registry_download=$enableval],
[xenable_registry_download=yes])
AM_CONDITIONAL([DOWNLOAD], [false])
if test "x$xenable_registry_download" = "xyes"; then
AC_CHECK_PROG([WGET], [wget], [wget])
AC_CHECK_PROG([CURL], [curl], [curl])
if test "x$WGET" = "x" && test "x$CURL" = "x"; then
if test "x$WGET" = "x"; then
if test "x$CURL" = "x"; then
AC_MSG_WARN([** Neither wget nor curl could be found.])
AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
else
AM_CONDITIONAL([DOWNLOAD], [true])
if test "x$WGET" != "x"; then
DOWNLOAD="$WGET -c -nd -O -"
else
DOWNLOAD="$CURL --location --progress-bar"
AM_CONDITIONAL([DOWNLOAD], [true])
fi
fi
else
DOWNLOAD="$WGET -c -nd -O -"
AM_CONDITIONAL([DOWNLOAD], [true])
fi
AC_MSG_WARN([** Download is: $DOWNLOAD])
AC_MSG_WARN([** Download is:])
AC_MSG_WARN($DOWNLOAD)
AC_SUBST(DOWNLOAD, $DOWNLOAD)
dnl
@ -634,11 +624,7 @@ AC_ARG_ENABLE([ipmishell],
dnl check for readline library to enable ipmi shell
if test "x$xenable_ipmishell" = "xyes"; then
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([READLINE], [readline],
[LIBS="$LIBS $READLINE_LIBS" have_readline=yes],
[AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])]
)
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
if test "x$have_readline" != "xyes"; then
AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
xenable_ipmishell=no

View File

@ -27,9 +27,9 @@ TRAPD_BMC_CONF="${SNMPD_BMC_CONF_DIR}/snmptrapd.local.conf"
TRAPD_CONF="/etc/snmp/snmptrapd.conf"
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
BMC_COMMUNITY="public"
@ -158,7 +158,7 @@ pick_alert_dest()
{
test_ip="$1"
# 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
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
2>/dev/null| sed -n "s#^Alert IP Address.*: ##p")
@ -178,7 +178,7 @@ config_bmc_alert_dest()
{
# call with enable|disable
# Pick the first active LAN channel
for CHANNEL in $(seq 1 14)
for CHANNEL in `seq 1 14`
do
[ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \
| grep -q "802\.3") ] || break

View File

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

View File

@ -12,10 +12,10 @@
# Description: Script to set OS information in the BMC; fetch BMC IP/URL
# and set in the OS for use by other scripts/user.
#
# BMC IP and URL are made available in /run/bmc-info
# BMC IP and URL are made available in /var/run/bmc-info
#
# Example to launch BMC web-interface:
# # . /run/bmc-info
# # . /var/run/bmc-info
# # xdg-open $BMC_URL
#
# See here for details:
@ -42,7 +42,7 @@
#############################################################################
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
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'
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"
NAME=ipmievd
DAEMON=/usr/sbin/$NAME
PIDFILE=/run/$NAME.pid
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# 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
\fIpidfile\fP=<\fBfilename\fR>
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).
.RE
@ -197,7 +197,7 @@ Do NOT become a daemon, instead log all messages to stderr.
.TP
\fIpidfile\fP=<\fBfilename\fR>
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).
.TP
\fItimeout\fP=<\fBseconds\fR>

View File

@ -97,14 +97,9 @@ This is not available with all commands.
.TP
\fB\-C\fR <\fIciphersuite\fP>
The remote server authentication, integrity, and encryption algorithms
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-20 in the
IPMI v2.0 specification. The default is 17 which specifies RAKP\-HMAC\-SHA256
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.
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-19 in the
IPMIv2.0 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1
authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 encryption algorithms.
.TP
\fB\-d \fIN\fP\fR
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,
and encryption algorithms to use for for \fIlanplus\fP session based
on the cipher suite ID found in the IPMIv2.0 specification in table
22\-20. The default cipher suite is \fI17\fP which specifies
RAKP\-HMAC\-SHA256 authentication, HMAC\-SHA256\-128 integrity, and
AES\-CBC\-128 encryption algorightms.
22\-19. The default cipher suite is \fI3\fP which specifies
RAKP\-HMAC\-SHA1 authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128
encryption algorightms.
.SH "FREE INTERFACE"
.LP

View File

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

View File

@ -89,16 +89,10 @@ struct channel_info_t {
uint8_t aux_info[2];
};
/* (22.22 / 22.23) Set/Get Channel Access */
typedef enum {
ALERTING_ENABLED = 0,
ALERTING_DISABLED = (1 << 5) /* See Table 22 */
} alerting_t;
/* (22.23) Get Channel Access */
struct channel_access_t {
uint8_t access_mode;
alerting_t alerting;
uint8_t alerting;
uint8_t channel;
uint8_t per_message_auth;
uint8_t privilege_limit;

View File

@ -343,6 +343,10 @@ typedef struct _power_headroom
uint16_t peakheadroom;
} __attribute__ ((packed)) POWER_HEADROOM;
struct vFlashstr {
uint8_t val;
const char * str;
};
typedef struct ipmi_vFlash_extended_info
{
uint8_t vflashcompcode;

View File

@ -127,7 +127,6 @@ struct fru_area_product {
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
/* See Table 16-1 of "IPMI FRU Information Storage Specification" */
struct fru_multirec_header {
#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00
#define FRU_RECORD_TYPE_DC_OUTPUT 0x01
@ -137,8 +136,6 @@ struct fru_multirec_header {
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0
uint8_t type;
#define FRU_RECORD_FORMAT_EOL_MASK 0x80
#define FRU_RECORD_FORMAT_VER_MASK 0x0F
uint8_t format;
uint8_t len;
uint8_t record_checksum;
@ -244,43 +241,6 @@ struct fru_multirec_dcload {
#pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
#pragma pack(push, 1)
#endif
/*
* In accordance with Table 18-7 of "IPMI Platform Management FRU Information
* Storage Definition v1.0"
*/
struct fru_multirec_mgmt {
#define FRU_MULTIREC_MGMT_SUBTYPE_MIN 0x01
#define FRU_MULTIREC_MGMT_SUBTYPE_MAX 0x07
uint8_t subtype;
#define FRU_MULTIREC_MGMT_SYSURL 0x01
#define FRU_MULTIREC_MGMT_CMPURL 0x04
#define FRU_MULTIREC_MGMT_URL_MINLEN 16
#define FRU_MULTIREC_MGMT_URL_MAXLEN 256
#define FRU_MULTIREC_MGMT_SYSNAME 0x02
#define FRU_MULTIREC_MGMT_CMPNAME 0x05
#define FRU_MULTIREC_MGMT_NAME_MINLEN 8
#define FRU_MULTIREC_MGMT_NAME_MAXLEN 64
#define FRU_MULTIREC_MGMT_SYSPINGADDR 0x03
#define FRU_MULTIREC_MGMT_CMPPINGADDR 0x06
#define FRU_MULTIREC_MGMT_PINGADDR_MINLEN 8
#define FRU_MULTIREC_MGMT_PINGADDR_MAXLEN 64
#define FRU_MULTIREC_MGMT_UUID 0x07
#define FRU_MULTIREC_MGMT_UUID_LEN 16
#define FRU_MULTIREC_MGMT_DATA_MAXLEN FRU_MULTIREC_MGMT_URL_MAXLEN
uint8_t data[];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
#pragma pack(pop)
#endif
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif

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_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);
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_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_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
@ -211,21 +211,6 @@ typedef struct {
parsed_guid_t ipmi_parse_guid(void *guid, ipmi_guid_mode_t guid_mode);
/**
* Convert a binary GUID/UUID to a canonical hex string form.
* If the version/encoding of the source data is unknown,
* dump the source data as a simple hex string.
*
* @param[out] str The string representation of GUID
* @param[in] data The source binary GUID data
* @param[in] mode The conversion mode, use GUID_AUTO for automatic detection
*
* @returns The parsed GUID structure
*/
parsed_guid_t
ipmi_guid2str(char *str, const void *data, ipmi_guid_mode_t mode);
#define GUID_STR_MAXLEN 36 /* 8+4+4+4+12 bytes plus the dashes */
int _ipmi_mc_get_guid(struct ipmi_intf *intf, ipmi_guid_t *guid);
#ifdef HAVE_PRAGMA_PACK

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, 0x04, "Config Error: Voltage Rating Mismatch" },
{ 0x08, 0x06, 0xff, "Config Error" },
{ 0x08, 0x07, 0xff, "Power Supply Inactive" },
{ 0x08, 0x06, 0xff, "Power Supply Inactive" },
/* Power Unit */
{ 0x09, 0x00, 0xff, "Power off/down" },
{ 0x09, 0x01, 0xff, "Power cycle" },

View File

@ -49,13 +49,12 @@ extern const struct valstr ipmi_authtype_vals[];
extern const struct valstr ipmi_channel_protocol_vals[];
extern const struct valstr ipmi_channel_medium_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_integrity_algorithms[];
extern const struct valstr ipmi_encryption_algorithms[];
extern const struct valstr ipmi_user_enable_status_vals[];
extern const struct valstr *ipmi_oem_info;
void ipmi_oem_info_init();
int ipmi_oem_info_init();
void ipmi_oem_info_free();
extern const struct valstr picmg_frucontrol_vals[];

View File

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

View File

@ -378,8 +378,42 @@ ipmi_chassis_restart_cause(struct ipmi_intf * intf)
return -1;
}
printf("System restart cause: %s\n",
val2str(rsp->data[0] & 0xf, ipmi_chassis_restart_cause_vals));
printf("System restart cause: ");
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;
}

View File

@ -115,7 +115,7 @@ char NIC_Selection_Mode_String_12g[] [50] = {
"shared with failover all loms"
};
const struct valstr vFlash_completion_code_vals[] = {
const struct vFlashstr vFlash_completion_code_vals[] = {
{0x00, "SUCCESS"},
{0x01, "NO_SD_CARD"},
{0x63, "UNKNOWN_ERROR"},
@ -232,6 +232,8 @@ static void ipmi_powermonitor_usage(void);
/* vFlash Function prototypes */
static int ipmi_delloem_vFlash_main(struct ipmi_intf *intf, int argc,
char **argv);
const char *get_vFlash_compcode_str(uint8_t vflashcompcode,
const struct vFlashstr *vs);
static int ipmi_get_sd_card_info(struct ipmi_intf *intf);
static int ipmi_delloem_vFlash_process(struct ipmi_intf *intf, int current_arg,
char **argv);
@ -3754,6 +3756,28 @@ ipmi_delloem_vFlash_main(struct ipmi_intf * intf, int __UNUSED__(argc), char **
rc = ipmi_delloem_vFlash_process(intf, current_arg, argv);
return rc;
}
/*
* Function Name: get_vFlash_compcode_str
*
* Description: This function maps the vFlash completion code
* to a string
* Input : vFlash completion code and static array of codes vs strings
* Output: -
* Return: returns the mapped string
*/
const char *
get_vFlash_compcode_str(uint8_t vflashcompcode, const struct vFlashstr *vs)
{
static char un_str[32];
int i;
for (i = 0; vs[i].str; i++) {
if (vs[i].val == vflashcompcode)
return vs[i].str;
}
memset(un_str, 0, 32);
snprintf(un_str, 32, "Unknown (0x%02X)", vflashcompcode);
return un_str;
}
/*
* Function Name: ipmi_get_sd_card_info
*
@ -3798,7 +3822,7 @@ ipmi_get_sd_card_info(struct ipmi_intf * intf) {
return -1;
} else if (sdcardinfoblock->vflashcompcode != 0x00) {
lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)",
val2str(sdcardinfoblock->vflashcompcode,
get_vFlash_compcode_str(sdcardinfoblock->vflashcompcode,
vFlash_completion_code_vals));
return -1;
}

View File

@ -43,8 +43,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#define NO_MORE_INFO_FIELD 0xc1
#define TYPE_CODE 0xc0 /*Language code*/
@ -2445,8 +2443,6 @@ ipmi_ek_display_fru_header_detail(char *filename)
if (header.offset.internal != 0) {
unsigned char format_version;
unsigned long len = 0;
uint8_t *area_offset;
uint8_t next_offset = UINT8_MAX;
printf("%s\n", EQUAL_LINE_LIMITER);
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));
/* Internal use area doesn't contain the size byte.
* We need to calculate its size by finding the area
* that is next. Areas may not follow the same order
* as their offsets listed in the header, so we need
* to find the area that is physically next to the
* 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 */
if (header.offset.chassis > 0) {
len = (header.offset.chassis * FACTOR_OFFSET)
- (header.offset.internal * FACTOR_OFFSET);
} else {
len = (header.offset.board * FACTOR_OFFSET)
- (header.offset.internal * FACTOR_OFFSET);
}
printf("Length: %ld\n", len);
printf("Data dump:\n");

View File

@ -42,7 +42,6 @@
#include <ipmitool/ipmi_time.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@ -141,50 +140,6 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
uint32_t offset, uint32_t length, uint8_t *frubuf);
void free_fru_bloc(t_ipmi_fru_bloc *bloc);
/**
* Caclculate the simple FRU checksum as per IPMI FRU specification.
* Works both for the whole FRU image and for separate areas.
*
* @param[in] area Pointer to the start of checksummed area,
* the area must end with the checksum byte
* @param[in[ len Length of the checksummed area, including
* the trailing checksum byte
* @returns The calculated checksum byte
*/
static
uint8_t fru_calc_checksum(void *area, size_t len)
{
uint8_t checksum = 0;
uint8_t * data = area;
size_t i;
for (i = 0; i < len - 1; i++)
checksum += data[i];
return -checksum;
}
/**
* Check if FRU checksum is valid. Works both on the
* whole FRU image and on separate areas.
*
* @param[in] area Pointer to the start of checksummed area,
* the area must end with the checksum byte
* @param[in[ len Length of the checksummed area, including
* the trailing checksum byte
* @returns The boolean state of checksum validity
* @retval true Checksum is valid
* @retval false Checsum in invalid
*/
static
bool fru_checksum_is_valid(void *area, size_t len)
{
uint8_t * data = area;
/* Checksum is valid when the stored checksum equals calculated */
return data[len - 1] == fru_calc_checksum(area, len);
}
/* get_fru_area_str - Parse FRU area string from raw data
*
* @data: raw FRU data
@ -1092,12 +1047,6 @@ fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru,
}
}
/* Check area checksum */
printf(" Chassis Area Checksum : %s\n",
fru_checksum_is_valid(fru_data, fru_len)
? "OK"
: "INVALID");
free_n(&fru_data);
}
@ -1209,12 +1158,6 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
break;
}
/* Check area checksum */
printf(" Board Area Checksum : %s\n",
fru_checksum_is_valid(fru_data, fru_len)
? "OK"
: "INVALID");
free_n(&fru_data);
}
@ -1337,35 +1280,9 @@ fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
break;
}
/* Check area checksum */
printf(" Product Area Checksum : %s\n",
fru_checksum_is_valid(fru_data, fru_len)
? "OK"
: "INVALID");
free_n(&fru_data);
}
/**
* Take n bytes from src and convert them into hex doublets in dst
*
* The function is invoked from a place where the dst is known to
* have enough space to accomodate the hex string representation
* of a UUID.
*
* @param[out] dst The destination buffer (at least 33 bytes long)
* @param[in] src The source binary data
* @param[in] n The length of the source data, for compatibility
* with strncpy() on calls from fru_area_print_multirec()
*/
static
char *
uuidstrncpy(char *dst, const char *src, size_t n)
{
(void)ipmi_guid2str(dst, src, GUID_AUTO);
return dst;
}
/* fru_area_print_multirec - Print FRU Multi Record Area
*
* @intf: ipmi interface
@ -1550,86 +1467,8 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
}
}
break;
case FRU_RECORD_TYPE_MANAGEMENT_ACCESS:
{
struct fru_multirec_mgmt *mmh =
(struct fru_multirect_mgmt *)
&fru_data[sizeof(struct fru_multirec_header)];
size_t datalen = h->len - sizeof(*mmh);
struct {
unsigned char *name;
size_t minlen;
size_t maxlen;
char * (*convert)(char *, const char *, size_t);
} subtypes[FRU_MULTIREC_MGMT_SUBTYPE_MAX + 1] = {
[FRU_MULTIREC_MGMT_SYSURL] = {
"System Management URL",
FRU_MULTIREC_MGMT_URL_MINLEN,
FRU_MULTIREC_MGMT_URL_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_SYSNAME] = {
"System Name",
FRU_MULTIREC_MGMT_NAME_MINLEN,
FRU_MULTIREC_MGMT_NAME_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_SYSPINGADDR] = {
"System Ping Address",
FRU_MULTIREC_MGMT_PINGADDR_MINLEN,
FRU_MULTIREC_MGMT_PINGADDR_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_CMPURL] = {
"Component Management URL",
FRU_MULTIREC_MGMT_URL_MINLEN,
FRU_MULTIREC_MGMT_URL_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_CMPNAME] = {
"Component Name",
FRU_MULTIREC_MGMT_NAME_MINLEN,
FRU_MULTIREC_MGMT_NAME_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_CMPPINGADDR] = {
"Component Ping Address",
FRU_MULTIREC_MGMT_PINGADDR_MINLEN,
FRU_MULTIREC_MGMT_PINGADDR_MAXLEN,
strncpy
},
[FRU_MULTIREC_MGMT_UUID] = {
"System Unique ID",
FRU_MULTIREC_MGMT_UUID_LEN,
FRU_MULTIREC_MGMT_UUID_LEN,
uuidstrncpy
}
};
unsigned char string[FRU_MULTIREC_MGMT_DATA_MAXLEN + 1] = { 0 };
if (mmh->subtype < FRU_MULTIREC_MGMT_SUBTYPE_MIN ||
mmh->subtype > FRU_MULTIREC_MGMT_SUBTYPE_MAX)
{
lprintf(LOG_WARN, "Unsupported subtype 0x%02x found for "
"multi-record area management record\n",
mmh->subtype);
break;
}
if (datalen < subtypes[mmh->subtype].minlen ||
datalen > subtypes[mmh->subtype].maxlen)
{
lprintf(LOG_WARN,
"Wrong data length %zu, must be %zu < X < %zu\n",
datalen,
subtypes[mmh->subtype].minlen,
subtypes[mmh->subtype].maxlen);
}
subtypes[mmh->subtype].convert(string, mmh->data, datalen);
printf(" %-22s: %s\n", subtypes[mmh->subtype].name, string);
}
}
} while (!(h->format & FRU_RECORD_FORMAT_EOL_MASK));
} while (!(h->format & 0x80));
lprintf(LOG_DEBUG ,"Multi-Record area ends at: %i (%xh)", last_off, last_off);

View File

@ -100,19 +100,6 @@ static struct lan_param {
{ -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_set_usage(void);
static void print_lan_set_usage(void);
@ -190,7 +177,6 @@ static struct lan_param *
get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int select)
{
struct lan_param * p = NULL;
struct lan_param *rc = NULL;
struct ipmi_rs * rsp;
struct ipmi_rq req;
int i = 0;
@ -205,7 +191,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
if (!p) {
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
return rc;
return NULL;
}
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);
if (!rsp) {
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed", p->desc);
return rc;
return NULL;
}
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 0xc9: /* parameter out of range */
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_len = 0;
rc = p;
/* fall through */
return p;
default:
/* other completion codes are treated as error */
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
p->desc,
specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
p->desc, val2str(rsp->ccode, completion_code_vals));
return NULL;
}
@ -374,9 +361,7 @@ __set_lan_param(struct ipmi_intf *intf, uint8_t chan,
}
if (rsp->ccode && wait) {
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
specific_val2str(rsp->ccode,
set_lan_cc_vals,
completion_code_vals));
val2str(rsp->ccode, completion_code_vals));
if (rsp->ccode == 0xcc) {
/* retry hack for invalid data field ccode */
int retry = 10; /* 10 retries */
@ -1026,10 +1011,10 @@ ipmi_set_alert_enable(struct ipmi_intf *intf, uint8_t channel, uint8_t enable)
channel);
return (-1);
}
if (enable) {
channel_access.alerting = ALERTING_ENABLED;
if (enable != 0) {
channel_access.alerting = 1;
} else {
channel_access.alerting = ALERTING_DISABLED;
channel_access.alerting = 0;
}
/* non-volatile */
ccode = _ipmi_set_channel_access(intf, channel_access, 1, 0);
@ -2152,9 +2137,7 @@ ipmi_lan_stats_get(struct ipmi_intf *intf, uint8_t chan)
if (rsp->ccode) {
lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
val2str(rsp->ccode, completion_code_vals));
return (-1);
}
@ -2230,9 +2213,7 @@ ipmi_lan_stats_clear(struct ipmi_intf *intf, uint8_t chan)
if (rsp->ccode) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
specific_val2str(rsp->ccode,
get_lan_cc_vals,
completion_code_vals));
val2str(rsp->ccode, completion_code_vals));
return (-1);
}

View File

@ -853,7 +853,10 @@ ipmi_main(int argc, char ** argv,
}
/* load the IANA PEN registry */
ipmi_oem_info_init();
if (ipmi_oem_info_init()) {
lprintf(LOG_ERR, "Failed to initialize the OEM info dictionary");
goto out_free;
}
/* run OEM setup if found */
if (oemtype &&

View File

@ -696,27 +696,6 @@ out:
return parsed_guid;
}
parsed_guid_t
ipmi_guid2str(char *str, const void *data, ipmi_guid_mode_t mode)
{
parsed_guid_t guid;
guid = ipmi_parse_guid(data, mode);
if (GUID_DUMP == guid.mode) {
sprintf(str, "%s", buf2str(data, sizeof(ipmi_guid_t)));
return guid;
}
sprintf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
(int)guid.time_low,
(int)guid.time_mid,
(int)guid.time_hi_and_version,
(int)guid.clock_seq_and_rsvd,
(int)guid.node[0], (int)guid.node[1], (int)guid.node[2],
(int)guid.node[3], (int)guid.node[4], (int)guid.node[5]);
return guid;
}
/* ipmi_mc_print_guid - print-out given BMC GUID
*
* @param[in] intf - The IPMI interface to request GUID from
@ -761,11 +740,24 @@ ipmi_mc_print_guid(struct ipmi_intf *intf, ipmi_guid_mode_t guid_mode)
printf("System GUID : ");
char buf[GUID_STR_MAXLEN + 1];
guid = ipmi_guid2str(buf, guid_data, guid_mode);
printf("%s\n", buf);
guid = ipmi_parse_guid(guid_data, guid_mode);
if (GUID_DUMP == guid.mode) {
size_t i;
for (i = 0; i < sizeof(guid_data); ++i) {
printf("%02X", guid_data[i]);
}
printf("\n");
return 0;
}
printf("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x\n",
(int)guid.time_low,
(int)guid.time_mid,
(int)guid.time_hi_and_version,
guid.clock_seq_and_rsvd,
guid.node[0], guid.node[1], guid.node[2],
guid.node[3], guid.node[4], guid.node[5]);
/* Print the GUID properties */
if (GUID_AUTO == guid_mode) {
/* ipmi_parse_guid() returns only valid modes in guid.ver */
printf("GUID Encoding : %s", guid_mode_str[guid.mode]);

View File

@ -258,7 +258,7 @@ ipmi_sdr_get_unit_string(bool pct, uint8_t relation,
}
if (modifier <= UNIT_TYPE_MAX) {
modstr = unit_desc[modifier];
modstr = unit_desc[base];
}
else {
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);
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",
going_high ? ">" : "<",
((evt->sel_type.standard_type.event_data[0] & 0xf) % 2) ? ">" : "<",
(threshold_reading==(int)threshold_reading) ? 0 : 2,
threshold_reading,
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;
}
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) {
/** Show only the most recent 'count' records. */
int i;
@ -2920,6 +2923,11 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
return (-1);
}
if (ipmi_sel_reserve(intf) == 0) {
lprintf(LOG_ERR, "Unable to reserve SEL");
return (-1);
}
for (i = 0; i < argc; i++) {
if (str2ushort(argv[i], &id) != 0) {
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" },
/* YADRO */
{ IPMI_OEM_YADRO, 0x0001, "VESNIN BMC" },
{ IPMI_OEM_YADRO, 0x000A, "TATLIN.UNIFIED Storage Controller BMC" },
{ IPMI_OEM_YADRO, 0x0014, "VEGMAN Series BMC" },
{ IPMI_OEM_YADRO, 0x0015, "TATLIN.ARCHIVE/xS BMC" },
{ IPMI_OEM_YADRO, 0x000A, "TATLIN Storage Controller BMC" },
{ IPMI_OEM_YADRO, 0x0014, "VEGMAN BMC" },
{ 0xffffff , 0xffff , NULL },
};
@ -1265,25 +1264,6 @@ const struct valstr ipmi_chassis_power_control_vals[] = {
{ 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[] = {
{ IPMI_AUTH_RAKP_NONE, "none" },
{ IPMI_AUTH_RAKP_HMAC_SHA1, "hmac_sha1" },
@ -1719,30 +1699,39 @@ out:
return rc;
}
void ipmi_oem_info_init()
int ipmi_oem_info_init()
{
oem_valstr_list_t terminator = { { -1, NULL}, NULL }; /* Terminator */
oem_valstr_list_t *oemlist = &terminator;
bool free_strings = true;
int count;
size_t count;
int rc = -4;
lprintf(LOG_INFO, "Loading IANA PEN Registry...");
if (ipmi_oem_info) {
lprintf(LOG_INFO, "IANA PEN Registry is already loaded");
rc = 0;
goto out;
}
if ((count = oem_info_list_load(&oemlist)) < 1) {
lprintf(LOG_WARN, "Failed to load entries from IANA PEN Registry");
count = 0;
if (!(count = oem_info_list_load(&oemlist))) {
/*
* We can't identify OEMs without a loaded registry.
* Set the pointer to dummy and return.
*/
ipmi_oem_info = ipmi_oem_info_dummy;
goto out;
}
/* In the array was allocated, don't free the strings at cleanup */
free_strings = !oem_info_init_from_list(oemlist, count);
rc = IPMI_CC_OK;
out:
oem_info_list_free(&oemlist, free_strings);
return rc;
}
void ipmi_oem_info_free()

View File

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

View File

@ -502,14 +502,13 @@ uint16_t
ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
{
int16_t size;
uint8_t bridging_level = ipmi_intf_get_bridging_level(intf);
size = intf->max_request_data_size;
/* check if request size is not specified */
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
* address. This sets the upper limit for typical IPMI messages.
* 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;
/* check if message is forwarded */
if (bridging_level) {
if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* add Send Message request size */
size += 8;
}
}
/* check if message is forwarded */
if (bridging_level) {
if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* subtract send message request size */
size -= 8;
@ -542,7 +541,7 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
}
/* check for double bridging */
if (bridging_level == 2) {
if (intf->transit_addr && intf->transit_addr != intf->target_addr) {
/* subtract inner send message request size */
size -= 8;
}
@ -560,14 +559,13 @@ uint16_t
ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
{
int16_t size;
uint8_t bridging_level = ipmi_intf_get_bridging_level(intf);
size = intf->max_response_data_size;
/* check if response size is not specified */
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
* address. This sets the upper limit for typical IPMI messages.
* 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 */
/* check if message is forwarded */
if (bridging_level) {
if (intf->target_addr && intf->target_addr != intf->my_addr) {
/* add Send Message header size */
size += 7;
}
}
/* 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
* 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 */
if (bridging_level == 2) {
if (intf->transit_addr && intf->transit_addr != intf->target_addr) {
/* subtract inner send message header size */
size -= 8;
}
@ -619,25 +617,6 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
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
ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size)
{

View File

@ -1727,7 +1727,6 @@ ipmi_lanplus_build_v2x_msg(
*/
if (session->v2_data.session_state == LANPLUS_STATE_ACTIVE)
{
uint16_t old_payload_length = payload->payload_length;
/* Payload len is adjusted as necessary by lanplus_encrypt_payload */
lanplus_encrypt_payload(session->v2_data.crypt_alg, /* input */
session->v2_data.k2, /* input */
@ -1736,24 +1735,6 @@ ipmi_lanplus_build_v2x_msg(
msg + IPMI_LANPLUS_OFFSET_PAYLOAD, /* output */
&(payload->payload_length)); /* output */
if (old_payload_length != payload->payload_length)
{
len =
IPMI_LANPLUS_OFFSET_PAYLOAD +
payload->payload_length +
IPMI_MAX_INTEGRITY_PAD_SIZE +
IPMI_LANPLUS_PAD_LENGTH_SIZE +
IPMI_LANPLUS_NEXT_HEADER_SIZE +
IPMI_MAX_AUTH_CODE_SIZE;
uint8_t * new_msg = realloc(msg, len);
if (!new_msg) {
free(msg);
lprintf(LOG_ERR, "ipmitool: realloc failure");
return;
}
msg = new_msg;
}
}
/* Now we know the payload length */

View File

@ -86,8 +86,6 @@
#define IPMI_LANPLUS_OFFSET_PAYLOAD_SIZE 0x0E
#define IPMI_LANPLUS_OFFSET_PAYLOAD 0x10
#define IPMI_LANPLUS_PAD_LENGTH_SIZE 1
#define IPMI_LANPLUS_NEXT_HEADER_SIZE 1
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38

View File

@ -170,7 +170,7 @@ static
struct ipmi_rs *
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_system_interface_addr bmc_addr = {
.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;
struct ipmb_msg_hdr * hdr = (struct ipmb_msg_hdr *) msg;
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 */
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 ipmi_send_message_rq * outer_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 */
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 */
for (i = 0; i < msg_len; i++) {
buf += sprintf((char*) buf, "%02x", msg[i]);
buf += sprintf( buf, "%02x", msg[i]);
}
/* stop character */