mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-07-02 18:53:45 +00:00
Compare commits
15 Commits
IPMITOOL_1
...
IPMITOOL_1
Author | SHA1 | Date | |
---|---|---|---|
2b4f19222d | |||
19c0f522ed | |||
d52f792652 | |||
3177b09272 | |||
4de32a37e8 | |||
05df8eb9a2 | |||
5c337dcdf6 | |||
897e1c6a20 | |||
b502dc0bc7 | |||
fcb6595b6e | |||
2cca8ad7ba | |||
5d55d7dcfe | |||
14ac9f77c9 | |||
003b4ee57e | |||
357d98b74d |
47
ipmitool/Makefile.am
Normal file
47
ipmitool/Makefile.am
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
EXTRA_DIST = ipmitool.spec.in debian/*
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \
|
||||
config.guess config.sub depcomp install-sh ltmain.sh missing \
|
||||
mkinstalldirs config.h.in stamp-h.in $(distdir).tar.gz
|
||||
|
||||
SUBDIRS = libltdl lib src include doc
|
||||
|
||||
INCLUDES = $(LTDLINCL)
|
||||
|
||||
dist-hook: ipmitool.spec
|
||||
cp ipmitool.spec $(distdir)
|
||||
|
46
ipmitool/bootstrap
Executable file
46
ipmitool/bootstrap
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/sh -x
|
||||
#
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
aclocal
|
||||
libtoolize --automake --copy --ltdl
|
||||
|
||||
autoheader
|
||||
automake --foreign --add-missing --copy
|
||||
|
||||
aclocal
|
||||
autoconf
|
||||
automake --foreign
|
||||
|
133
ipmitool/configure.in
Normal file
133
ipmitool/configure.in
Normal file
@ -0,0 +1,133 @@
|
||||
dnl
|
||||
dnl autoconf for ipmitool
|
||||
dnl
|
||||
AC_INIT([src/ipmitool.c])
|
||||
AM_INIT_AUTOMAKE([ipmitool], [1.5.6])
|
||||
AM_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_SRCDIR([src/ipmitool.c])
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
IPMITOOL_PKG=ipmitool
|
||||
AC_SUBST(IPMITOOL_PKG)
|
||||
AC_SUBST(ac_configure_args)
|
||||
|
||||
dnl check for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
AC_CHECK_PROG(SED, sed, sed)
|
||||
|
||||
dnl setup libtool and ltdl
|
||||
AC_LIB_LTDL
|
||||
AC_LIBTOOL_DLOPEN
|
||||
AC_LIBLTDL_CONVENIENCE
|
||||
AM_PROG_LIBTOOL
|
||||
LIBTOOL="$LIBTOOL --silent"
|
||||
AC_SUBST(LTDLINCL)
|
||||
AC_SUBST(LIBLTDL)
|
||||
AC_CONFIG_SUBDIRS(libltdl)
|
||||
|
||||
AC_CHECK_LIB([m], [pow], [], [
|
||||
echo "** libm library pow() not found!"
|
||||
exit 1
|
||||
])
|
||||
|
||||
AC_SEARCH_LIBS(gethostbyname, nsl)
|
||||
AC_SEARCH_LIBS(socket, socket, ,
|
||||
[AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
|
||||
|
||||
AC_CHECK_LIB([ltdl], [lt_dlopen], [], [
|
||||
echo "** libltdl library lt_dlopen() not found!"
|
||||
exit 1
|
||||
])
|
||||
|
||||
dnl check for headers
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h])
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/socket.h])
|
||||
|
||||
have_openipmi=no
|
||||
AC_CHECK_HEADER([linux/ipmi.h],
|
||||
[have_openipmi=yes],
|
||||
[AC_MSG_WARN([Unable to find OpenIPMI header files])])
|
||||
|
||||
dnl check for typedefs, structs, and compiler options
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
dnl check for lib functions
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_FUNC_STAT
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([alarm gethostbyname socket select])
|
||||
AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
|
||||
|
||||
dnl check for byteswap functionality
|
||||
AC_CHECK_HEADERS([asm/byteorder.h byteswap.h])
|
||||
AC_CHECK_FUNCS([bswap_16 bswap_32])
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
prefix="$ac_default_prefix"
|
||||
fi
|
||||
|
||||
if test "x$exec_prefix" = "xNONE"; then
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
|
||||
dnl enable plugins for interfaces
|
||||
AC_ARG_WITH([plugin-path],
|
||||
[[ --with-plugin-path=DIR Set plugin path to DIR]],
|
||||
[pluginpath="$withval"],
|
||||
[pluginpath="${exec_prefix}/lib/ipmitool"])
|
||||
|
||||
AC_DEFINE_UNQUOTED(PLUGIN_PATH, "$pluginpath", "IPMI interface plugin path")
|
||||
AC_SUBST(pluginpath)
|
||||
|
||||
AC_ARG_ENABLE([intf-lan],
|
||||
[[ --enable-intf-lan enable IPMI-over-LAN interface [default=yes]]],
|
||||
[if test "x$enableval" = "xyes"; then
|
||||
PLUGINS="$PLUGINS lan"
|
||||
fi],
|
||||
[PLUGINS="$PLUGINS lan"])
|
||||
|
||||
AC_ARG_ENABLE([intf-open],
|
||||
[[ --enable-intf-open enable OpenIPMI device interface [default=no]]],
|
||||
[if test "x$enableval" = "xyes"; then
|
||||
if test "x$have_openipmi" = "xyes"; then
|
||||
PLUGINS="$PLUGINS open"
|
||||
else
|
||||
echo "** Unable to build OpenIPMI interface support!"
|
||||
exit 1
|
||||
fi
|
||||
fi])
|
||||
|
||||
AC_SUBST(PLUGINS)
|
||||
|
||||
AC_ARG_ENABLE([ipmievd],
|
||||
[[ --enable-ipmievd enable IPMI event daemon [default=no]]],,)
|
||||
|
||||
AM_CONDITIONAL(IPMIEVD, test "x$enable_ipmievd" = "xyes")
|
||||
|
||||
AC_CONFIG_FILES([ipmitool.spec
|
||||
Makefile
|
||||
doc/Makefile
|
||||
lib/Makefile
|
||||
include/Makefile
|
||||
include/ipmitool/Makefile
|
||||
src/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/lan/Makefile
|
||||
src/plugins/open/Makefile])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
echo
|
||||
echo Building $PACKAGE version $VERSION with interface plugins: $PLUGINS
|
||||
echo Plugin Path: $pluginpath
|
||||
echo
|
@ -1,8 +1,52 @@
|
||||
ipmitool (1.4.1.1-1) unstable; urgency=low
|
||||
ipmitool (1.5.6) unstable; urgency=low
|
||||
|
||||
* First public source relese
|
||||
* Fix SEL event decoding for generic events
|
||||
* Handle empty SEL gracefully when doing "sel list"
|
||||
* Fix sdr handling of sensors that do not return a reading
|
||||
* Fix for CSV display of sensor readings/units from Fredrik <20>hrn
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Wed, 12 Nov 2003 09:23:18 -0700
|
||||
-- Duncan Laurie <duncan@sun.com> Thu, 4 Dec 2003 14:47:19 -0700
|
||||
|
||||
ipmitool (1.5.5) unstable; urgency=low
|
||||
|
||||
* Add -U option for setting LAN username
|
||||
* Fix -v usage for plugin interfaces
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Tue, 25 Nov 2003 15:10:48 -0700
|
||||
|
||||
ipmitool (1.5.4) unstable; urgency=low
|
||||
|
||||
* Put interface plugin API into library
|
||||
* Fix ipmievd
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Fri, 14 Nov 2003 15:16:34 -0700
|
||||
|
||||
ipmitool (1.5.3) unstable; urgency=low
|
||||
|
||||
* Add -g option to work with grizzly bmc
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Mon, 3 Nov 2003 18:04:07 -0700
|
||||
|
||||
ipmitool (1.5.2) unstable; urgency=low
|
||||
|
||||
* add support for setting gratuitous arp interval
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Fri, 24 Oct 2003 11:00:00 -0700
|
||||
|
||||
ipmitool (1.5.1) unstable; urgency=low
|
||||
|
||||
* better SEL support
|
||||
* fix display bug in SDR list
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Wed, 8 Oct 2003 17:28:51 -0700
|
||||
|
||||
ipmitool (1.5.0) unstable; urgency=low
|
||||
|
||||
* more robust UDP packet handling
|
||||
* add Intel IMB driver support
|
||||
* use autoconf/automake/libtool
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Fri, 5 Sep 2003 11:57:32 -0700
|
||||
|
||||
ipmitool (1.2-1) unstable; urgency=low
|
||||
|
||||
@ -13,13 +57,13 @@ ipmitool (1.2-1) unstable; urgency=low
|
||||
|
||||
ipmitool (1.1-1) unstable; urgency=low
|
||||
|
||||
* Minor fixes
|
||||
* Minor fixes.
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Tue, 1 Apr 2003 14:31:10 -0700
|
||||
|
||||
ipmitool (1.0-1) unstable; urgency=low
|
||||
|
||||
* Initial Release
|
||||
* Initial Release.
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Sun, 30 Mar 2003 21:30:46 -0700
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
usr/sbin
|
||||
usr/bin
|
||||
usr/lib/ipmitool
|
||||
usr/include/ipmitool
|
||||
|
@ -1,20 +1,9 @@
|
||||
#!/usr/bin/make -f
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||
#
|
||||
# Modified to make a template file for a multi-binary package with separated
|
||||
# build-arch and build-indep targets by Bill Allombert 2001
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# This is the debhelper compatability version to use.
|
||||
export DH_COMPAT=4
|
||||
# This has to be exported to make some magic below work.
|
||||
export DH_OPTIONS
|
||||
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
@ -29,11 +18,11 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
./configure --enable-intf-lan --enable-intf-open \
|
||||
--enable-ipmievd \
|
||||
--prefix=/usr --mandir=/usr/share/man
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
#Architecture
|
||||
build: build-arch build-indep
|
||||
|
||||
@ -97,7 +86,7 @@ binary-common:
|
||||
# dh_installpam
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
dh_installmanpages
|
||||
# dh_installmanpages
|
||||
# dh_installinfo
|
||||
# dh_undocumented
|
||||
# dh_installchangelogs
|
||||
@ -111,6 +100,7 @@ binary-common:
|
||||
dh_installdeb
|
||||
# dh_perl
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
# Build architecture independant packages using the common target.
|
||||
binary-indep: build-indep install-indep
|
||||
@ -122,3 +112,4 @@ binary-arch: build-arch install-arch
|
||||
|
||||
binary: binary-arch #binary-indep
|
||||
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
|
||||
|
||||
|
39
ipmitool/doc/Makefile.am
Normal file
39
ipmitool/doc/Makefile.am
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
man_MANS = ipmitool.1
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
@ -1,12 +1,12 @@
|
||||
.TH "ipmitool" "1" "1.4.1.1" "Duncan Laurie" ""
|
||||
.TH "ipmitool" "1" "" "Duncan Laurie" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
ipmitool \- utility for IPMI control
|
||||
ipmitool \- utility for controlling IPMI-enabled devices
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
.br
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIdev\fP <\fIexpression\fP>
|
||||
ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIopen\fP <\fIexpression\fP>
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
This program lets you perform various IPMI functions with either a kernel device driver or over a LAN interface. These functions include printing FRU information, LAN configuration, sensor readings, and remote chassis power control.
|
||||
@ -18,6 +18,9 @@ Get basic usage help from the command line.
|
||||
.TP
|
||||
\fB\-c\fR
|
||||
Make output suitable for parsing where possible by separating fields with commas instead of spaces.
|
||||
.TP
|
||||
\fB\-g\fR
|
||||
Attempt to be extra robust in IPMI-over-LAN communications.
|
||||
.TP
|
||||
\fB\-V\fR
|
||||
Display version information.
|
||||
@ -26,7 +29,7 @@ Display version information.
|
||||
Increase verbose output level. This option may be specified multiple times to increase the level of debug output. If given three times you will get hexdumps of all incoming and outgoing packets.
|
||||
.TP
|
||||
\fB\-I\fR <\fIinterface\fP>
|
||||
Selects IPMI interface to use. Possible interfaces are \fIlan\fP or \fIdev\fP.
|
||||
Selects IPMI interface to use. Possible interfaces are \fIlan\fP or \fIopen\fP.
|
||||
.TP
|
||||
\fB\-H\fR <\fIaddress\fP>
|
||||
Remote server address, can be IP address or hostname. This option is required for the LAN interface connection.
|
||||
@ -40,17 +43,17 @@ Remote server password, 16 character maximum. This is optional for the LAN inte
|
||||
This can be used to get command-line help on ipmitool commands. It may also be placed at the end of commands to get option usage help.
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev help
|
||||
ipmitool -I open help
|
||||
.br
|
||||
Commands: chassis, fru, lan, sdr, sel
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis help
|
||||
ipmitool -I open chassis help
|
||||
.br
|
||||
Chassis Commands: status, power, identify, policy, restart_cause
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis power help
|
||||
ipmitool -I open chassis power help
|
||||
.br
|
||||
Chassis Power Commands: status, on, off, cycle, reset, diag, soft
|
||||
.LP
|
||||
@ -60,7 +63,7 @@ Chassis Power Commands: status, on, off, cycle, reset, diag, soft
|
||||
This will allow you to execute raw IPMI commands. For example to query the POH counter with a raw command:
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev raw 0x0 0xf
|
||||
ipmitool -I open raw 0x0 0xf
|
||||
.br
|
||||
RAW REQ (netfn=0x0 cmd=0xf data_len=0)
|
||||
.br
|
||||
@ -74,7 +77,7 @@ RAW RSP (5 bytes)
|
||||
This command will display information about the selected channel. If no channel is given it will display information about the currently used channel:
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev chaninfo
|
||||
ipmitool -I open chaninfo
|
||||
.br
|
||||
Channel 0xf info:
|
||||
.br
|
||||
@ -90,6 +93,26 @@ Channel 0xf info:
|
||||
.LP
|
||||
.RE
|
||||
.TP
|
||||
\fIuserinfo\fP <\fBchannel\fR>
|
||||
This command will display information about configured user information on a specific LAN channel. This command will fail on system interfaces. Try channel 6 or 7.
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I open userinfo 6
|
||||
.br
|
||||
Maximum User IDs : 4
|
||||
.br
|
||||
Enabled User IDs : 1
|
||||
.br
|
||||
Fixed Name User IDs : 1
|
||||
.br
|
||||
Access Available : call-in / callback
|
||||
.br
|
||||
Link Authentication : disabled
|
||||
.br
|
||||
IPMI Messaging : enabled
|
||||
.LP
|
||||
.RE
|
||||
.TP
|
||||
.I chassis
|
||||
.RS
|
||||
.TP
|
||||
@ -183,6 +206,32 @@ Set the backup gateway MAC address.
|
||||
\fIpassword\fP <\fBpass\fR>
|
||||
Set the null user password.
|
||||
.TP
|
||||
\fIuser\fP
|
||||
Enable user access mode.
|
||||
.TP
|
||||
\fIaccess\fP <\fBon|off\fR>
|
||||
Set LAN channel access mode.
|
||||
.TP
|
||||
\fIipsrc\fP <\fBsource\fR>
|
||||
Set the IP address source:
|
||||
.br
|
||||
none = unspecified
|
||||
.br
|
||||
static = manually configured static IP address
|
||||
.br
|
||||
dhcp = address obtained by BMC running DHCP
|
||||
.br
|
||||
bios = address loaded by BIOS or system software
|
||||
.TP
|
||||
\fIarp\fP \fIrespond\fP <\fBon|off\fR>
|
||||
Set BMC generated ARP responses.
|
||||
.TP
|
||||
\fIarp\fP \fIgenerate\fP <\fBon|off\fR>
|
||||
Set BMC generated gratuitous ARPs.
|
||||
.TP
|
||||
\fIarp\fP \fIinterval\fP <\fBseconds\fR>
|
||||
Set BMC generated gratuitous ARP interval.
|
||||
.TP
|
||||
\fIauth\fP <\fBlevel,...\fR> <\fBtype,...\fR>
|
||||
Set the valid authtypes for a given auth level.
|
||||
.RS
|
||||
@ -195,6 +244,7 @@ Levels:
|
||||
Types:
|
||||
.B none
|
||||
.B md2
|
||||
.B md5
|
||||
.B key
|
||||
.RE
|
||||
.RE
|
||||
@ -220,12 +270,22 @@ This command will read the SDR and extract sensor information, then query each s
|
||||
.I info
|
||||
This command will query the BMC for information about the SEL and its contents.
|
||||
.TP
|
||||
.I clear
|
||||
This command will clear the contents of the SEL. It cannot be undone so be careful.
|
||||
.TP
|
||||
.I list
|
||||
This command will list the contents of the SEL.
|
||||
.RE
|
||||
.SH "DEV INTERFACE"
|
||||
.TP
|
||||
.I sol
|
||||
.RS
|
||||
.TP
|
||||
.I setup
|
||||
Setup Serial-over-LAN: enable, set authentication and baud rate.
|
||||
.RE
|
||||
.SH "OPEN INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIdev\fP interface utilizes the MontaVista OpenIPMI kernel device driver. This driver is present in 2.5.57 and later development kernels and in 2.4.21pre1 and later stable kernels. There are also IPMI driver kernel patches for different versions available from the OpenIPMI homepage.
|
||||
The ipmitool \fIopen\fP interface utilizes the MontaVista OpenIPMI kernel device driver. This driver is present in 2.5.57 and later development kernels and in 2.4.21pre1 and later stable kernels. There are also IPMI driver kernel patches for different versions available from the OpenIPMI homepage.
|
||||
.LP
|
||||
The following kernel modules must be loaded in order for ipmitool to work:
|
||||
.TP
|
||||
@ -238,45 +298,43 @@ An IPMI Keyboard Controler Style (KCS) interface driver for the message handler.
|
||||
.B ipmi_devintf
|
||||
Linux character device interface for the message handler.
|
||||
.LP
|
||||
Once they are loaded there will be a dynamic char device entry that must exist at \fB/dev/ipmi/0\fR. Usually if this is the first dynamic device it will be major number \fB254\fR and minor number \fB0\fR so you would create the dev entry with:
|
||||
Once they are loaded there will be a dynamic char device entry that must exist at \fB/dev/ipmi0\fR. Usually if this is the first dynamic device it will be major number \fB254\fR and minor number \fB0\fR so you would create the dev entry with:
|
||||
.LP
|
||||
.I mknod /dev/ipmi/0 c 254 0
|
||||
.I mknod /dev/ipmi0 c 254 0
|
||||
.LP
|
||||
In order to force ipmitool to make use of the device interface you can specifiy it on the command line:
|
||||
.PP
|
||||
ipmitool \-I dev [option...]
|
||||
ipmitool \-I open [option...]
|
||||
.LP
|
||||
Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the dev interface.
|
||||
Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the open interface.
|
||||
.SH "LAN INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIlan\fP interface communicates with the BMC over an Ethernet LAN connection using UDP under IPv4. UDP datagrams are formatted to contain IPMI request/response messages with a IPMI session headers and RMCP headers.
|
||||
.LP
|
||||
IPMI\-over\-LAN uses version 1 of the Remote Management Control Protocol (RMCP) to support \fIpre\-OS\fP and \fIOS\-absent\fP management. RMCP is a request\-response protocol delivered using UDP datagrams to port 623.
|
||||
.LP
|
||||
The LAN interface is an authenticatiod multi\-session connection; messages delivered to the BMC can (and should) be authenticated with a challenge/response protocol with either straight password/key. ipmitool will attempt to connect with administrator privilege level as this is required to perform chassis power functions.
|
||||
The LAN interface is an authenticatiod multi\-session connection; messages delivered to the BMC can (and should) be authenticated with a challenge/response protocol with either straight password/key or MD5 message\-digest algorithm. ipmitool will attempt to connect with administrator privilege level as this is required to perform chassis power functions.
|
||||
.LP
|
||||
You can tell ipmitool to use the lan interface with the \fB\-I\fR option:
|
||||
.PP
|
||||
ipmitool \-I lan [option...] <address> [password]
|
||||
.LP
|
||||
A hostname \fBmust\fR be given on the command line in order to use the lan interface with ipmitool. The password field is optional; if you do not provide a password on the command line ipmitool will attempt to connect without authentication. If you specify a password it will use straight password/key.
|
||||
A hostname \fBmust\fR be given on the command line in order to use the lan interface with ipmitool. The password field is optional; if you do not provide a password on the command line ipmitool will attempt to connect without authentication. If you specify a password it will use MD5 authentication if supported by the BMC and straight password/key otherwise.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /dev/ipmi/0
|
||||
.I /dev/ipmi0
|
||||
This character device file is used by the OpenIPMI kernel driver.
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
If you want to remotely control the power of an IPMI\-over\-LAN enabled system you can use:
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power on
|
||||
.LP
|
||||
Chassis Power is off.
|
||||
.br
|
||||
Chassis Power Control: on
|
||||
.br
|
||||
Chassis Power Control: Up/On
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status
|
||||
.LP
|
||||
Chassis Power is on.
|
||||
.br
|
||||
Chassis Power is on
|
||||
.SH "AUTHOR"
|
||||
.LP
|
||||
Duncan Laurie <duncan@sun.com>
|
38
ipmitool/include/Makefile.am
Normal file
38
ipmitool/include/Makefile.am
Normal file
@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = ipmitool
|
||||
|
@ -1,366 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_SEL_H
|
||||
#define _IPMI_SEL_H
|
||||
|
||||
#include <ipmi.h>
|
||||
|
||||
enum {
|
||||
IPMI_EVENT_CLASS_DISCRETE,
|
||||
IPMI_EVENT_CLASS_DIGITAL,
|
||||
IPMI_EVENT_CLASS_THRESHOLD,
|
||||
IPMI_EVENT_CLASS_OEM,
|
||||
};
|
||||
|
||||
struct sel_get_rq {
|
||||
unsigned short reserve_id;
|
||||
unsigned short record_id;
|
||||
unsigned char offset;
|
||||
unsigned char length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_event_record {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
unsigned short gen_id;
|
||||
unsigned char evm_rev;
|
||||
unsigned char sensor_type;
|
||||
unsigned char sensor_num;
|
||||
unsigned char event_type : 7;
|
||||
unsigned char event_dir : 1;
|
||||
unsigned char event_data[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_ts {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
unsigned char mfg_id[3];
|
||||
unsigned char oem_defined[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_nots {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned char oem_defined[13];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct ipmi_event_type {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
unsigned char class;
|
||||
const char * desc;
|
||||
};
|
||||
|
||||
static struct ipmi_event_type event_types[] __attribute__((unused)) = {
|
||||
/* Threshold Based States */
|
||||
{ 0x01, 0x00, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going low" },
|
||||
{ 0x01, 0x01, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going high" },
|
||||
{ 0x01, 0x02, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going low" },
|
||||
{ 0x01, 0x03, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going high" },
|
||||
{ 0x01, 0x04, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going low" },
|
||||
{ 0x01, 0x05, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going high" },
|
||||
{ 0x01, 0x06, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going low" },
|
||||
{ 0x01, 0x07, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going high" },
|
||||
{ 0x01, 0x08, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going low" },
|
||||
{ 0x01, 0x09, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going high" },
|
||||
{ 0x01, 0x0a, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going low" },
|
||||
{ 0x01, 0x0b, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going high" },
|
||||
/* DMI-based "usage state" States */
|
||||
{ 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Idle" },
|
||||
{ 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Active" },
|
||||
{ 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Busy" },
|
||||
/* Digital-Discrete Event States */
|
||||
{ 0x03, 0x00, IPMI_EVENT_CLASS_DIGITAL, "State Deasserted" },
|
||||
{ 0x03, 0x01, IPMI_EVENT_CLASS_DIGITAL, "State Asserted" },
|
||||
{ 0x04, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Deasserted" },
|
||||
{ 0x04, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Asserted" },
|
||||
{ 0x05, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Limit Not Exceeded" },
|
||||
{ 0x05, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Limit Exceeded" },
|
||||
{ 0x06, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Performance Met" },
|
||||
{ 0x06, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Performance Lags" },
|
||||
/* Severity Event States */
|
||||
{ 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to OK" },
|
||||
{ 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critial from OK" },
|
||||
{ 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from less severe" },
|
||||
{ 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable from less severe" },
|
||||
{ 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critical from more severe" },
|
||||
{ 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from Non-recoverable" },
|
||||
{ 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable" },
|
||||
{ 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Monitor" },
|
||||
{ 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Informational" },
|
||||
/* Availability Status States */
|
||||
{ 0x08, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Removed/Absent" },
|
||||
{ 0x08, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Inserted/Present" },
|
||||
{ 0x09, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Disabled" },
|
||||
{ 0x09, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Enabled" },
|
||||
{ 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Running" },
|
||||
{ 0x0a, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to In Test" },
|
||||
{ 0x0a, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Off" },
|
||||
{ 0x0a, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to On Line" },
|
||||
{ 0x0a, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Line" },
|
||||
{ 0x0a, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Duty" },
|
||||
{ 0x0a, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Degraded" },
|
||||
{ 0x0a, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Save" },
|
||||
{ 0x0a, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Install Error" },
|
||||
/* Redundancy States */
|
||||
{ 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Fully Redundant" },
|
||||
{ 0x0b, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Lost" },
|
||||
{ 0x0b, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded" },
|
||||
{ 0x0b, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Redundant" },
|
||||
{ 0x0b, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Insufficient" },
|
||||
{ 0x0b, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Insufficient Resources" },
|
||||
{ 0x0b, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Fully Redundant" },
|
||||
{ 0x0b, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Non-Redundant" },
|
||||
/* ACPI Device Power States */
|
||||
{ 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "D0 Power State" },
|
||||
{ 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "D1 Power State" },
|
||||
{ 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "D2 Power State" },
|
||||
{ 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "D3 Power State" },
|
||||
/* END */
|
||||
{ 0x00, 0x00, 0x00, NULL },
|
||||
};
|
||||
|
||||
struct ipmi_sensor_types {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
const char * type;
|
||||
const char * event;
|
||||
};
|
||||
|
||||
static struct ipmi_sensor_types sensor_types[] __attribute__((unused)) = {
|
||||
{ 0x00, 0x00, "Reserved", NULL },
|
||||
{ 0x01, 0x00, "Temperature", NULL },
|
||||
{ 0x02, 0x00, "Voltage", NULL },
|
||||
{ 0x03, 0x00, "Current", NULL },
|
||||
{ 0x04, 0x00, "Fan", NULL },
|
||||
|
||||
{ 0x05, 0x00, "Chassis Intrusion", "General Chassis intrusion" },
|
||||
{ 0x05, 0x01, "Chassis Intrusion", "Drive Bay intrusion" },
|
||||
{ 0x05, 0x02, "Chassis Intrusion", "I/O Card area intrusion" },
|
||||
{ 0x05, 0x03, "Chassis Intrusion", "Processor area intrusion" },
|
||||
{ 0x05, 0x04, "Chassis Intrusion", "System unplugged from LAN" },
|
||||
{ 0x05, 0x05, "Chassis Intrusion", "Unauthorized dock/undock" },
|
||||
{ 0x05, 0x06, "Chassis Intrusion", "FAN area intrusion" },
|
||||
|
||||
{ 0x06, 0x00, "Platform Security", "Front Panel Lockout violation attempted" },
|
||||
{ 0x06, 0x01, "Platform Security", "Pre-boot password viiolation - user password" },
|
||||
{ 0x06, 0x02, "Platform Security", "Pre-boot password violation - setup password" },
|
||||
{ 0x06, 0x03, "Platform Security", "Pre-boot password violation - network boot password" },
|
||||
{ 0x06, 0x04, "Platform Security", "Other pre-boot password violation" },
|
||||
{ 0x06, 0x05, "Platform Security", "Out-of-band access password violation" },
|
||||
|
||||
{ 0x07, 0x00, "Processor", "IERR" },
|
||||
{ 0x07, 0x01, "Processor", "Thermal Trip" },
|
||||
{ 0x07, 0x02, "Processor", "FRB1/BIST failure" },
|
||||
{ 0x07, 0x03, "Processor", "FRB2/Hang in POST failure" },
|
||||
{ 0x07, 0x04, "Processor", "FRB3/Processor startup/init failure" },
|
||||
{ 0x07, 0x05, "Processor", "Configuration Error" },
|
||||
{ 0x07, 0x06, "Processor", "SM BIOS Uncorrectable CPU-complex Error" },
|
||||
{ 0x07, 0x07, "Processor", "Presence detected" },
|
||||
{ 0x07, 0x08, "Processor", "Disabled" },
|
||||
{ 0x07, 0x09, "Processor", "Terminator presence detected" },
|
||||
|
||||
{ 0x08, 0x00, "Power Supply", "Presence detected" },
|
||||
{ 0x08, 0x01, "Power Supply", "Failure detected" },
|
||||
{ 0x08, 0x02, "Power Supply", "Predictive failure" },
|
||||
{ 0x08, 0x03, "Power Supply", "Power Supply AC lost" },
|
||||
{ 0x08, 0x04, "Power Supply", "AC lost or out-of-range" },
|
||||
{ 0x08, 0x05, "Power Supply", "AC out-of-range, but present" },
|
||||
|
||||
{ 0x09, 0x00, "Power Unit", "Power off/down" },
|
||||
{ 0x09, 0x01, "Power Unit", "Power cycle" },
|
||||
{ 0x09, 0x02, "Power Unit", "240VA power down" },
|
||||
{ 0x09, 0x03, "Power Unit", "Interlock power down" },
|
||||
{ 0x09, 0x04, "Power Unit", "AC lost" },
|
||||
{ 0x09, 0x05, "Power Unit", "Soft-power control failure" },
|
||||
{ 0x09, 0x06, "Power Unit", "Failure detected" },
|
||||
{ 0x09, 0x07, "Power Unit", "Predictive failure" },
|
||||
|
||||
{ 0x0a, 0x00, "Cooling Device", NULL },
|
||||
{ 0x0b, 0x00, "Other Units-based Sensor", NULL },
|
||||
|
||||
{ 0x0c, 0x00, "Memory", "Correctable ECC" },
|
||||
{ 0x0c, 0x01, "Memory", "Uncorrectable ECC" },
|
||||
{ 0x0c, 0x02, "Memory", "Parity" },
|
||||
{ 0x0c, 0x03, "Memory", "Memory Scrub Failed" },
|
||||
{ 0x0c, 0x04, "Memory", "Memory Device Disabled" },
|
||||
{ 0x0c, 0x05, "Memory", "Correctable ECC logging limit reached" },
|
||||
|
||||
{ 0x0d, 0x00, "Drive Slot", NULL },
|
||||
{ 0x0e, 0x00, "POST Memory Resize", NULL },
|
||||
|
||||
{ 0x0f, 0x00, "System Firmware", "Error" },
|
||||
{ 0x0f, 0x01, "System Firmware", "Hang" },
|
||||
{ 0x0f, 0x02, "System Firmware", "Progress" },
|
||||
|
||||
{ 0x10, 0x00, "Event Logging Disabled", "Correctable memory error logging disabled" },
|
||||
{ 0x10, 0x01, "Event Logging Disabled", "Event logging disabled" },
|
||||
{ 0x10, 0x02, "Event Logging Disabled", "Log area reset/cleared" },
|
||||
{ 0x10, 0x03, "Event Logging Disabled", "All event logging disabled" },
|
||||
|
||||
{ 0x11, 0x00, "Watchdog 1", "BIOS Reset" },
|
||||
{ 0x11, 0x01, "Watchdog 1", "OS Reset" },
|
||||
{ 0x11, 0x02, "Watchdog 1", "OS Shut Down" },
|
||||
{ 0x11, 0x03, "Watchdog 1", "OS Power Down" },
|
||||
{ 0x11, 0x04, "Watchdog 1", "OS Power Cycle" },
|
||||
{ 0x11, 0x05, "Watchdog 1", "OS NMI/diag Interrupt" },
|
||||
{ 0x11, 0x06, "Watchdog 1", "OS Expired" },
|
||||
{ 0x11, 0x07, "Watchdog 1", "OS pre-timeout Interrupt" },
|
||||
|
||||
{ 0x12, 0x00, "System Event", "System Reconfigured" },
|
||||
{ 0x12, 0x01, "System Event", "OEM System boot event" },
|
||||
{ 0x12, 0x02, "System Event", "Undetermined system hardware failure" },
|
||||
{ 0x12, 0x03, "System Event", "Entry added to auxillary log" },
|
||||
{ 0x12, 0x04, "System Event", "PEF Action" },
|
||||
|
||||
{ 0x13, 0x00, "Critical Interrupt", "Front Panel NMI" },
|
||||
{ 0x13, 0x01, "Critical Interrupt", "Bus Timeout" },
|
||||
{ 0x13, 0x02, "Critical Interrupt", "I/O Channel check NMI" },
|
||||
{ 0x13, 0x03, "Critical Interrupt", "Software NMI" },
|
||||
{ 0x13, 0x04, "Critical Interrupt", "PCI PERR" },
|
||||
{ 0x13, 0x05, "Critical Interrupt", "PCI SERR" },
|
||||
{ 0x13, 0x06, "Critical Interrupt", "EISA failsafe timeout" },
|
||||
{ 0x13, 0x07, "Critical Interrupt", "Bus Correctable error" },
|
||||
{ 0x13, 0x08, "Critical Interrupt", "Bus Uncorrectable error" },
|
||||
{ 0x13, 0x09, "Critical Interrupt", "Fatal NMI" },
|
||||
|
||||
{ 0x14, 0x00, "Button", "Power Button pressed" },
|
||||
{ 0x14, 0x01, "Button", "Sleep Button pressed" },
|
||||
{ 0x14, 0x02, "Button", "Reset Button pressed" },
|
||||
|
||||
{ 0x15, 0x00, "Module/Board", NULL },
|
||||
{ 0x16, 0x00, "Microcontroller/Coprocessor", NULL },
|
||||
{ 0x17, 0x00, "Add-in Card", NULL },
|
||||
{ 0x18, 0x00, "Chassis", NULL },
|
||||
{ 0x19, 0x00, "Chip Set", NULL },
|
||||
{ 0x1a, 0x00, "Other FRU", NULL },
|
||||
{ 0x1b, 0x00, "Cable/Interconnect", NULL },
|
||||
{ 0x1c, 0x00, "Terminator", NULL },
|
||||
|
||||
{ 0x1d, 0x00, "System Boot Initiated", "Initiated by power up" },
|
||||
{ 0x1d, 0x01, "System Boot Initiated", "Initiated by hard reset" },
|
||||
{ 0x1d, 0x02, "System Boot Initiated", "Initiated by warm reset" },
|
||||
{ 0x1d, 0x03, "System Boot Initiated", "User requested PXE boot" },
|
||||
{ 0x1d, 0x04, "System Boot Initiated", "Automatic boot to diagnostic" },
|
||||
|
||||
{ 0x1e, 0x00, "Boot Error", "No bootable media" },
|
||||
{ 0x1e, 0x01, "Boot Error", "Non-bootable disk in drive" },
|
||||
{ 0x1e, 0x02, "Boot Error", "PXE server not found" },
|
||||
{ 0x1e, 0x03, "Boot Error", "Invalid boot sector" },
|
||||
{ 0x1e, 0x04, "Boot Error", "Timeout waiting for selection" },
|
||||
|
||||
{ 0x1f, 0x00, "OS Boot", "A: boot completed" },
|
||||
{ 0x1f, 0x01, "OS Boot", "C: boot completed" },
|
||||
{ 0x1f, 0x02, "OS Boot", "PXE boot completed" },
|
||||
{ 0x1f, 0x03, "OS Boot", "Diagnostic boot completed" },
|
||||
{ 0x1f, 0x04, "OS Boot", "CD-ROM boot completed" },
|
||||
{ 0x1f, 0x05, "OS Boot", "ROM boot completed" },
|
||||
{ 0x1f, 0x06, "OS Boot", "boot completed - device not specified" },
|
||||
|
||||
{ 0x20, 0x00, "OS Critical Stop", "Stop during OS load/init" },
|
||||
{ 0x20, 0x01, "OS Critical Stop", "Run-time stop" },
|
||||
|
||||
{ 0x21, 0x00, "Slot/Connector", "Fault Status asserted" },
|
||||
{ 0x21, 0x01, "Slot/Connector", "Identify Status asserted" },
|
||||
{ 0x21, 0x02, "Slot/Connector", "Slot/Connector Device installed/attached" },
|
||||
{ 0x21, 0x03, "Slot/Connector", "Slot/Connector ready for device installation" },
|
||||
{ 0x21, 0x04, "Slot/Connector", "Slot/Connector ready for device removal" },
|
||||
{ 0x21, 0x05, "Slot/Connector", "Slot Power is off" },
|
||||
{ 0x21, 0x06, "Slot/Connector", "Slot/Connector device removal request" },
|
||||
{ 0x21, 0x07, "Slot/Connector", "Interlock asserted" },
|
||||
{ 0x21, 0x08, "Slot/Connector", "Slot is disabled" },
|
||||
|
||||
{ 0x22, 0x00, "System ACPI Power State", "S0/G0: working" },
|
||||
{ 0x22, 0x01, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" },
|
||||
{ 0x22, 0x02, "System ACPI Power State", "S2: sleeping, processor context lost" },
|
||||
{ 0x22, 0x03, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" },
|
||||
{ 0x22, 0x04, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" },
|
||||
{ 0x22, 0x05, "System ACPI Power State", "S5/G2: soft-off" },
|
||||
{ 0x22, 0x06, "System ACPI Power State", "S4/S5: soft-off" },
|
||||
{ 0x22, 0x07, "System ACPI Power State", "G3: mechanical off" },
|
||||
{ 0x22, 0x08, "System ACPI Power State", "Sleeping in S1/S2/S3 state" },
|
||||
{ 0x22, 0x09, "System ACPI Power State", "G1: sleeping" },
|
||||
{ 0x22, 0x0a, "System ACPI Power State", "S5: entered by override" },
|
||||
{ 0x22, 0x0b, "System ACPI Power State", "Legacy ON state" },
|
||||
{ 0x22, 0x0c, "System ACPI Power State", "Legacy OFF state" },
|
||||
{ 0x22, 0x0e, "System ACPI Power State", "Unknown" },
|
||||
|
||||
{ 0x23, 0x00, "Watchdog 2", "Timer expired" },
|
||||
{ 0x23, 0x01, "Watchdog 2", "Hard reset" },
|
||||
{ 0x23, 0x02, "Watchdog 2", "Power down" },
|
||||
{ 0x23, 0x03, "Watchdog 2", "Power cycle" },
|
||||
{ 0x23, 0x04, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x05, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x06, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x07, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x08, "Watchdog 2", "Timer interrupt" },
|
||||
|
||||
{ 0x24, 0x00, "Platform Alert", "Platform generated page" },
|
||||
{ 0x24, 0x01, "Platform Alert", "Platform generated LAN alert" },
|
||||
{ 0x24, 0x02, "Platform Alert", "Platform Event Trap generated" },
|
||||
{ 0x24, 0x03, "Platform Alert", "Platform generated SNMP trap, OEM format" },
|
||||
|
||||
{ 0x25, 0x00, "Entity Presence", "Present" },
|
||||
{ 0x25, 0x01, "Entity Presence", "Absent" },
|
||||
{ 0x25, 0x02, "Entity Presence", "Disabled" },
|
||||
|
||||
{ 0x26, 0x00, "Monitor ASIC/IC", NULL },
|
||||
|
||||
{ 0x27, 0x00, "LAN", "Heartbeat Lost" },
|
||||
{ 0x27, 0x01, "LAN", "Heartbeat" },
|
||||
|
||||
{ 0x28, 0x00, "Management Subsystem Health", "Sensor access degraded or unavailable" },
|
||||
{ 0x28, 0x01, "Management Subsystem Health", "Controller access degraded or unavailable" },
|
||||
{ 0x28, 0x02, "Management Subsystem Health", "Management controller off-line" },
|
||||
{ 0x28, 0x03, "Management Subsystem Health", "Management controller unavailable" },
|
||||
|
||||
{ 0x29, 0x00, "Battery", "Low" },
|
||||
{ 0x29, 0x01, "Battery", "Failed" },
|
||||
{ 0x29, 0x02, "Battery", "Presence Detected" },
|
||||
|
||||
{ 0x00, 0x00, NULL, NULL },
|
||||
};
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /*_IPMI_SEL_H*/
|
42
ipmitool/include/ipmitool/Makefile.am
Normal file
42
ipmitool/include/ipmitool/Makefile.am
Normal file
@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
ipmitooldir = $(includedir)/ipmitool
|
||||
|
||||
ipmitool_HEADERS = bswap.h helper.h ipmi.h ipmi_intf.h \
|
||||
ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_lanp.h \
|
||||
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h
|
||||
|
55
ipmitool/include/ipmitool/bswap.h
Normal file
55
ipmitool/include/ipmitool/bswap.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_BSWAP_H
|
||||
#define IPMI_BSWAP_H
|
||||
|
||||
#if defined(__sun)
|
||||
|
||||
#define BSWAP_16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
|
||||
#define BSWAP_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |\
|
||||
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
||||
|
||||
#else
|
||||
|
||||
#include <byteswap.h>
|
||||
|
||||
#define BSWAP_16(x) bswap_16(x)
|
||||
#define BSWAP_32(x) bswap_32(x)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_BSWAP_H */
|
@ -34,8 +34,8 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef __HELPER_H
|
||||
#define __HELPER_H
|
||||
#ifndef IPMI_HELPER_H
|
||||
#define IPMI_HELPER_H
|
||||
|
||||
struct valstr {
|
||||
unsigned char val;
|
||||
@ -54,5 +54,5 @@ void signal_handler(int sig, void * handler);
|
||||
#define SIG_DEFAULT(s) ((void)signal((s), SIG_DFL))
|
||||
#define SIG_HANDLE(s,h) ((void)signal_handler((s), (h)))
|
||||
|
||||
#endif /* __HELPER_H */
|
||||
#endif /* IPMI_HELPER_H */
|
||||
|
@ -34,13 +34,13 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_H
|
||||
#define _IPMI_H
|
||||
#ifndef IPMI_H
|
||||
#define IPMI_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/ipmi.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
#define BUF_SIZE 256
|
||||
|
||||
@ -60,17 +60,26 @@ struct ipmi_session {
|
||||
int active;
|
||||
};
|
||||
|
||||
struct ipmi_req_entry {
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rq {
|
||||
struct {
|
||||
unsigned char netfn;
|
||||
unsigned char cmd;
|
||||
unsigned short data_len;
|
||||
unsigned char *data;
|
||||
} msg;
|
||||
};
|
||||
|
||||
struct ipmi_rq_entry {
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_intf * intf;
|
||||
struct ipmi_session * session;
|
||||
unsigned char rq_seq;
|
||||
unsigned char * msg_data;
|
||||
int msg_len;
|
||||
struct ipmi_req_entry * next;
|
||||
struct ipmi_rq_entry * next;
|
||||
};
|
||||
|
||||
struct ipmi_rsp {
|
||||
struct ipmi_rs {
|
||||
unsigned char ccode;
|
||||
unsigned char data[BUF_SIZE];
|
||||
int data_len;
|
||||
@ -94,11 +103,11 @@ struct ipmi_rsp {
|
||||
struct ipmi_intf {
|
||||
int fd;
|
||||
struct sockaddr_in addr;
|
||||
int (*open)(struct ipmi_intf *, char *, int, char *);
|
||||
int abort;
|
||||
int pedantic;
|
||||
int (*open)(struct ipmi_intf *, char *, int, char *, char *);
|
||||
void (*close)(struct ipmi_intf *);
|
||||
struct ipmi_rsp *(*sendrecv)(struct ipmi_intf *, struct ipmi_req *);
|
||||
int (*ll_send)(struct ipmi_intf *, unsigned char *, int);
|
||||
struct ipmi_rsp *(*ll_recv)(struct ipmi_intf *, int);
|
||||
struct ipmi_rs *(*sendrecv)(struct ipmi_intf *, struct ipmi_rq *);
|
||||
};
|
||||
|
||||
#define IPMI_NETFN_CHASSIS 0x0
|
||||
@ -108,10 +117,11 @@ struct ipmi_intf {
|
||||
#define IPMI_NETFN_FIRMWARE 0x8
|
||||
#define IPMI_NETFN_STORAGE 0xa
|
||||
#define IPMI_NETFN_TRANSPORT 0xc
|
||||
#define IPMI_NETFN_SOL 0x34
|
||||
|
||||
#define IPMI_BMC_SLAVE_ADDR 0x20
|
||||
#define IPMI_REMOTE_SWID 0x81
|
||||
|
||||
int handle_ipmi(struct ipmi_intf *intf, unsigned char * data, int data_len);
|
||||
const struct valstr completion_code_vals[25];
|
||||
|
||||
#endif /* _IPMI_H */
|
||||
#endif /* IPMI_H */
|
@ -34,16 +34,16 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_DEV_H
|
||||
#define _IPMI_DEV_H
|
||||
#ifndef IPMI_BMC_H
|
||||
#define IPMI_BMC_H
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include "ipmi.h"
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req);
|
||||
int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2);
|
||||
void ipmi_dev_close(struct ipmi_intf * intf);
|
||||
#define BMC_GET_DEVICE_ID 0x01
|
||||
#define BMC_COLD_RESET 0x02
|
||||
#define BMC_WARM_RESET 0x03
|
||||
#define BMC_GET_SELF_TEST 0x04
|
||||
|
||||
struct ipmi_intf ipmi_dev_intf;
|
||||
int ipmi_bmc_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif
|
||||
#endif /*IPMI_BMC_H*/
|
@ -34,10 +34,10 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_CHASSIS_H
|
||||
#define _IPMI_CHASSIS_H
|
||||
#ifndef IPMI_CHASSIS_H
|
||||
#define IPMI_CHASSIS_H
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0
|
||||
#define IPMI_CHASSIS_CTL_POWER_UP 0x1
|
||||
@ -53,4 +53,4 @@
|
||||
|
||||
int ipmi_chassis_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /*_IPMI_CHASSIS_H*/
|
||||
#endif /*IPMI_CHASSIS_H*/
|
@ -34,10 +34,10 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_ENTITY
|
||||
#define _IPMI_ENTITY
|
||||
#ifndef IPMI_ENTITY_H
|
||||
#define IPMI_ENTITY_H
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
const struct valstr entity_id_vals[] __attribute__((unused)) = {
|
||||
{ 0x00, "Unspecified" },
|
||||
@ -84,5 +84,5 @@ const struct valstr entity_id_vals[] __attribute__((unused)) = {
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
#endif /* _IPMI_ENTITY */
|
||||
#endif /* IPMI_ENTITY_H */
|
||||
|
@ -34,8 +34,10 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_FRU_H
|
||||
#define _IPMI_FRU_H
|
||||
#ifndef IPMI_FRU_H
|
||||
#define IPMI_FRU_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define GET_FRU_INFO 0x10
|
||||
#define GET_FRU_DATA 0x11
|
||||
@ -119,4 +121,4 @@ static const char * chassis_type_desc[] __attribute__((unused)) = {
|
||||
void ipmi_print_fru(struct ipmi_intf *, unsigned char);
|
||||
int ipmi_fru_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /* _IPMI_FRU_H */
|
||||
#endif /* IPMI_FRU_H */
|
46
ipmitool/include/ipmitool/ipmi_intf.h
Normal file
46
ipmitool/include/ipmitool/ipmi_intf.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_INTF_H
|
||||
#define IPMI_INTF_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
int ipmi_intf_init(void);
|
||||
void ipmi_intf_exit(void);
|
||||
struct ipmi_intf * ipmi_intf_load(char * name);
|
||||
|
||||
#endif /* IPMI_INTF_H */
|
@ -34,11 +34,10 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_LAN_H
|
||||
#define _IPMI_LAN_H
|
||||
#ifndef IPMI_LANP_H
|
||||
#define IPMI_LANP_H
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include "ipmi.h"
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define IPMI_LAN_SET_CONFIG 0x01
|
||||
#define IPMI_LAN_GET_CONFIG 0x02
|
||||
@ -47,9 +46,21 @@
|
||||
# define IPMI_LAN_SUSPEND_ARP_GRAT (1)
|
||||
#define IPMI_LAN_GET_STAT 0x04
|
||||
|
||||
#define IPMI_LAN_CHANNEL_1 0x07
|
||||
#define IPMI_LAN_CHANNEL_2 0x06
|
||||
#define IPMI_LAN_CHANNEL_E 0x0e
|
||||
#define IPMI_SESSION_AUTHTYPE_NONE 0x0
|
||||
#define IPMI_SESSION_AUTHTYPE_MD2 0x1
|
||||
#define IPMI_SESSION_AUTHTYPE_MD5 0x2
|
||||
#define IPMI_SESSION_AUTHTYPE_KEY 0x4
|
||||
#define IPMI_SESSION_AUTHTYPE_OEM 0x5
|
||||
|
||||
#define IPMI_SESSION_PRIV_CALLBACK 0x1
|
||||
#define IPMI_SESSION_PRIV_USER 0x2
|
||||
#define IPMI_SESSION_PRIV_OPERATOR 0x3
|
||||
#define IPMI_SESSION_PRIV_ADMIN 0x4
|
||||
#define IPMI_SESSION_PRIV_OEM 0x5
|
||||
|
||||
extern const struct valstr ipmi_privlvl_vals[];
|
||||
extern const struct valstr ipmi_authtype_vals[];
|
||||
extern struct ipmi_session lan_session;
|
||||
|
||||
enum {
|
||||
IPMI_LANP_SET_IN_PROGRESS,
|
||||
@ -117,27 +128,7 @@ static struct lan_param {
|
||||
{ -1 }
|
||||
};
|
||||
|
||||
#define IPMI_SESSION_AUTHTYPE_NONE 0x0
|
||||
#define IPMI_SESSION_AUTHTYPE_MD2 0x1
|
||||
#define IPMI_SESSION_AUTHTYPE_KEY 0x4
|
||||
#define IPMI_SESSION_AUTHTYPE_OEM 0x5
|
||||
|
||||
#define IPMI_SESSION_PRIV_CALLBACK 0x1
|
||||
#define IPMI_SESSION_PRIV_USER 0x2
|
||||
#define IPMI_SESSION_PRIV_OPERATOR 0x3
|
||||
#define IPMI_SESSION_PRIV_ADMIN 0x4
|
||||
#define IPMI_SESSION_PRIV_OEM 0x5
|
||||
|
||||
extern struct ipmi_session lan_session;
|
||||
|
||||
unsigned char ipmi_csum(unsigned char * d, int s);
|
||||
|
||||
struct ipmi_rsp * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password);
|
||||
void ipmi_lan_close(struct ipmi_intf * intf);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
int ipmi_lan_main(struct ipmi_intf *, int, char **);
|
||||
int ipmi_lanp_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
struct ipmi_intf ipmi_lan_intf;
|
||||
|
||||
#endif /*_IPMI_LAN_H*/
|
||||
#endif /*IPMI_LANP_H*/
|
@ -34,24 +34,24 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_SDR_H
|
||||
#define _IPMI_SDR_H
|
||||
#ifndef IPMI_SDR_H
|
||||
#define IPMI_SDR_H
|
||||
|
||||
#include <math.h>
|
||||
#include <byteswap.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmitool/bswap.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
int ipmi_sdr_main(struct ipmi_intf *, int, char **);
|
||||
int utos(unsigned val, unsigned bits);
|
||||
|
||||
#define __TO_TOL(mtol) (bswap_16(mtol) & 0x3f)
|
||||
#define __TO_M(mtol) (utos((((bswap_16(mtol) & 0xff00) >> 8) | ((bswap_16(mtol) & 0xc0) << 2)), 10))
|
||||
#define __TO_B(bacc) (utos((((bswap_32(bacc) & 0xff000000) >> 24) | \
|
||||
((bswap_32(bacc) & 0xc00000) >> 14)), 10))
|
||||
#define __TO_ACC(bacc) (((bswap_32(bacc) & 0x3f0000) >> 16) | ((bswap_32(bacc) & 0xf000) >> 6))
|
||||
#define __TO_ACC_EXP(bacc) ((bswap_32(bacc) & 0xc00) >> 10)
|
||||
#define __TO_R_EXP(bacc) (utos(((bswap_32(bacc) & 0xf0) >> 4), 4))
|
||||
#define __TO_B_EXP(bacc) (utos((bswap_32(bacc) & 0xf), 4))
|
||||
#define __TO_TOL(mtol) (unsigned short)(BSWAP_16(mtol) & 0x3f)
|
||||
#define __TO_M(mtol) (unsigned short)(utos((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10))
|
||||
#define __TO_B(bacc) (unsigned int)(utos((((BSWAP_32(bacc) & 0xff000000) >> 24) | \
|
||||
((BSWAP_32(bacc) & 0xc00000) >> 14)), 10))
|
||||
#define __TO_ACC(bacc) (unsigned int)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6))
|
||||
#define __TO_ACC_EXP(bacc) (unsigned int)((BSWAP_32(bacc) & 0xc00) >> 10)
|
||||
#define __TO_R_EXP(bacc) (unsigned int)(utos(((BSWAP_32(bacc) & 0xf0) >> 4), 4))
|
||||
#define __TO_B_EXP(bacc) (unsigned int)(utos((BSWAP_32(bacc) & 0xf), 4))
|
||||
|
||||
#define CONVERT_RAW(val, m, b, k1, k2) (float)(((m * val) + (b * pow(10, k1))) * pow(10, k2))
|
||||
#define CONVERT_TOL(val, m, k2) (float)(((m * val) / 2) * pow(10, k2))
|
||||
@ -322,5 +322,4 @@ static const char * unit_desc[] __attribute__((unused)) = {
|
||||
"error", "correctable error", "uncorrectable error",
|
||||
};
|
||||
|
||||
#endif /* _IPMI_SDR_H */
|
||||
|
||||
#endif /* IPMI_SDR_H */
|
361
ipmitool/include/ipmitool/ipmi_sel.h
Normal file
361
ipmitool/include/ipmitool/ipmi_sel.h
Normal file
@ -0,0 +1,361 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_SEL_H
|
||||
#define IPMI_SEL_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
enum {
|
||||
IPMI_EVENT_CLASS_DISCRETE,
|
||||
IPMI_EVENT_CLASS_DIGITAL,
|
||||
IPMI_EVENT_CLASS_THRESHOLD,
|
||||
IPMI_EVENT_CLASS_OEM,
|
||||
};
|
||||
|
||||
struct sel_get_rq {
|
||||
unsigned short reserve_id;
|
||||
unsigned short record_id;
|
||||
unsigned char offset;
|
||||
unsigned char length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_event_record {
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
unsigned short gen_id;
|
||||
unsigned char evm_rev;
|
||||
unsigned char sensor_type;
|
||||
unsigned char sensor_num;
|
||||
unsigned char event_type : 7;
|
||||
unsigned char event_dir : 1;
|
||||
unsigned char event_data[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_ts {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
unsigned char mfg_id[3];
|
||||
unsigned char oem_defined[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sel_oem_record_nots {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned char oem_defined[13];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct ipmi_event_sensor_types {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
unsigned char class;
|
||||
const char * type;
|
||||
const char * desc;
|
||||
};
|
||||
|
||||
static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unused)) = {
|
||||
/* Threshold Based States */
|
||||
{ 0x01, 0x00, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going low" },
|
||||
{ 0x01, 0x01, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going high" },
|
||||
{ 0x01, 0x02, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going low" },
|
||||
{ 0x01, 0x03, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going high" },
|
||||
{ 0x01, 0x04, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going low" },
|
||||
{ 0x01, 0x05, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going high" },
|
||||
{ 0x01, 0x06, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going low" },
|
||||
{ 0x01, 0x07, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going high" },
|
||||
{ 0x01, 0x08, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going low" },
|
||||
{ 0x01, 0x09, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going high" },
|
||||
{ 0x01, 0x0a, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going low" },
|
||||
{ 0x01, 0x0b, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going high" },
|
||||
/* DMI-based "usage state" States */
|
||||
{ 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Idle" },
|
||||
{ 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Active" },
|
||||
{ 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Busy" },
|
||||
/* Digital-Discrete Event States */
|
||||
{ 0x03, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Deasserted" },
|
||||
{ 0x03, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Asserted" },
|
||||
{ 0x04, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Deasserted" },
|
||||
{ 0x04, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Asserted" },
|
||||
{ 0x05, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Not Exceeded" },
|
||||
{ 0x05, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Exceeded" },
|
||||
{ 0x06, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Met" },
|
||||
{ 0x06, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Lags" },
|
||||
/* Severity Event States */
|
||||
{ 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" },
|
||||
{ 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critial from OK" },
|
||||
{ 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from less severe" },
|
||||
{ 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable from less severe" },
|
||||
{ 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from more severe" },
|
||||
{ 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from Non-recoverable" },
|
||||
{ 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable" },
|
||||
{ 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Monitor" },
|
||||
{ 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Informational" },
|
||||
/* Availability Status States */
|
||||
{ 0x08, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Removed/Absent" },
|
||||
{ 0x08, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Inserted/Present" },
|
||||
{ 0x09, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Disabled" },
|
||||
{ 0x09, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Enabled" },
|
||||
{ 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Running" },
|
||||
{ 0x0a, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to In Test" },
|
||||
{ 0x0a, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Off" },
|
||||
{ 0x0a, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to On Line" },
|
||||
{ 0x0a, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Line" },
|
||||
{ 0x0a, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Duty" },
|
||||
{ 0x0a, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Degraded" },
|
||||
{ 0x0a, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Save" },
|
||||
{ 0x0a, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Install Error" },
|
||||
/* Redundancy States */
|
||||
{ 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Fully Redundant" },
|
||||
{ 0x0b, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Lost" },
|
||||
{ 0x0b, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded" },
|
||||
{ 0x0b, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Redundant" },
|
||||
{ 0x0b, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Insufficient" },
|
||||
{ 0x0b, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Insufficient Resources" },
|
||||
{ 0x0b, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Fully Redundant" },
|
||||
{ 0x0b, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Non-Redundant" },
|
||||
/* ACPI Device Power States */
|
||||
{ 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D0 Power State" },
|
||||
{ 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D1 Power State" },
|
||||
{ 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D2 Power State" },
|
||||
{ 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D3 Power State" },
|
||||
/* END */
|
||||
{ 0x00, 0x00, 0x00, NULL, NULL },
|
||||
};
|
||||
|
||||
static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unused)) = {
|
||||
{ 0x00, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Reserved", NULL },
|
||||
{ 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Temperature", NULL },
|
||||
{ 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Voltage", NULL },
|
||||
{ 0x03, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Current", NULL },
|
||||
{ 0x04, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Fan", NULL },
|
||||
|
||||
{ 0x05, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "General Chassis intrusion" },
|
||||
{ 0x05, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Drive Bay intrusion" },
|
||||
{ 0x05, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "I/O Card area intrusion" },
|
||||
{ 0x05, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Processor area intrusion" },
|
||||
{ 0x05, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "System unplugged from LAN" },
|
||||
{ 0x05, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock/undock" },
|
||||
{ 0x05, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "FAN area intrusion" },
|
||||
|
||||
{ 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Front Panel Lockout violation attempted" },
|
||||
{ 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password viiolation - user password" },
|
||||
{ 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - setup password" },
|
||||
{ 0x06, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - network boot password" },
|
||||
{ 0x06, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Other pre-boot password violation" },
|
||||
{ 0x06, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Out-of-band access password violation" },
|
||||
|
||||
{ 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Processor", "IERR" },
|
||||
{ 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Thermal Trip" },
|
||||
{ 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB1/BIST failure" },
|
||||
{ 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB2/Hang in POST failure" },
|
||||
{ 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB3/Processor startup/init failure" },
|
||||
{ 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Configuration Error" },
|
||||
{ 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Processor", "SM BIOS Uncorrectable CPU-complex Error" },
|
||||
{ 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Presence detected" },
|
||||
{ 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" },
|
||||
{ 0x07, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" },
|
||||
|
||||
{ 0x08, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" },
|
||||
{ 0x08, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" },
|
||||
{ 0x08, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Predictive failure" },
|
||||
{ 0x08, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply AC lost" },
|
||||
{ 0x08, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC lost or out-of-range" },
|
||||
{ 0x08, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC out-of-range, but present" },
|
||||
|
||||
{ 0x09, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" },
|
||||
{ 0x09, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" },
|
||||
{ 0x09, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "240VA power down" },
|
||||
{ 0x09, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Interlock power down" },
|
||||
{ 0x09, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "AC lost" },
|
||||
{ 0x09, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Soft-power control failure" },
|
||||
{ 0x09, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Failure detected" },
|
||||
{ 0x09, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Predictive failure" },
|
||||
|
||||
{ 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Cooling Device", NULL },
|
||||
{ 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Other Units-based Sensor", NULL },
|
||||
|
||||
{ 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC" },
|
||||
{ 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Uncorrectable ECC" },
|
||||
{ 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Parity" },
|
||||
{ 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Scrub Failed" },
|
||||
{ 0x0c, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Device Disabled" },
|
||||
{ 0x0c, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC logging limit reached" },
|
||||
|
||||
{ 0x0d, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", NULL },
|
||||
{ 0x0e, 0x00, IPMI_EVENT_CLASS_DISCRETE, "POST Memory Resize", NULL },
|
||||
|
||||
{ 0x0f, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Error" },
|
||||
{ 0x0f, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Hang" },
|
||||
{ 0x0f, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress" },
|
||||
|
||||
{ 0x10, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Correctable memory error logging disabled" },
|
||||
{ 0x10, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Event logging disabled" },
|
||||
{ 0x10, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log area reset/cleared" },
|
||||
{ 0x10, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "All event logging disabled" },
|
||||
|
||||
{ 0x11, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "BIOS Reset" },
|
||||
{ 0x11, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Reset" },
|
||||
{ 0x11, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Shut Down" },
|
||||
{ 0x11, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Down" },
|
||||
{ 0x11, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Cycle" },
|
||||
{ 0x11, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/diag Interrupt" },
|
||||
{ 0x11, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Expired" },
|
||||
{ 0x11, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS pre-timeout Interrupt" },
|
||||
|
||||
{ 0x12, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Event", "System Reconfigured" },
|
||||
{ 0x12, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Event", "OEM System boot event" },
|
||||
{ 0x12, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Undetermined system hardware failure" },
|
||||
{ 0x12, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxillary log" },
|
||||
{ 0x12, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Event", "PEF Action" },
|
||||
{ 0x12, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Timestamp Clock Sync." },
|
||||
|
||||
{ 0x13, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Front Panel NMI" },
|
||||
{ 0x13, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Timeout" },
|
||||
{ 0x13, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "I/O Channel check NMI" },
|
||||
{ 0x13, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Software NMI" },
|
||||
{ 0x13, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI PERR" },
|
||||
{ 0x13, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI SERR" },
|
||||
{ 0x13, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "EISA failsafe timeout" },
|
||||
{ 0x13, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Correctable error" },
|
||||
{ 0x13, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" },
|
||||
{ 0x13, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" },
|
||||
|
||||
{ 0x14, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" },
|
||||
{ 0x14, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" },
|
||||
{ 0x14, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Button", "Reset Button pressed" },
|
||||
|
||||
{ 0x15, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Module/Board", NULL },
|
||||
{ 0x16, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Microcontroller/Coprocessor", NULL },
|
||||
{ 0x17, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL },
|
||||
{ 0x18, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL },
|
||||
{ 0x19, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL },
|
||||
{ 0x1a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL },
|
||||
{ 0x1b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", NULL },
|
||||
{ 0x1c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Terminator", NULL },
|
||||
|
||||
{ 0x1d, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by power up" },
|
||||
{ 0x1d, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by hard reset" },
|
||||
{ 0x1d, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by warm reset" },
|
||||
{ 0x1d, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "User requested PXE boot" },
|
||||
{ 0x1d, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Automatic boot to diagnostic" },
|
||||
|
||||
{ 0x1e, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "No bootable media" },
|
||||
{ 0x1e, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Non-bootable disk in drive" },
|
||||
{ 0x1e, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "PXE server not found" },
|
||||
{ 0x1e, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Invalid boot sector" },
|
||||
{ 0x1e, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Timeout waiting for selection" },
|
||||
|
||||
{ 0x1f, 0x00, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "A: boot completed" },
|
||||
{ 0x1f, 0x01, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "C: boot completed" },
|
||||
{ 0x1f, 0x02, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "PXE boot completed" },
|
||||
{ 0x1f, 0x03, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Diagnostic boot completed" },
|
||||
{ 0x1f, 0x04, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" },
|
||||
{ 0x1f, 0x05, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" },
|
||||
{ 0x1f, 0x06, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" },
|
||||
|
||||
{ 0x20, 0x00, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Stop during OS load/init" },
|
||||
{ 0x20, 0x01, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Run-time stop" },
|
||||
|
||||
{ 0x21, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status asserted" },
|
||||
{ 0x21, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status asserted" },
|
||||
{ 0x21, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector Device installed/attached" },
|
||||
{ 0x21, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device installation" },
|
||||
{ 0x21, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device removal" },
|
||||
{ 0x21, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is off" },
|
||||
{ 0x21, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector device removal request" },
|
||||
{ 0x21, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock asserted" },
|
||||
{ 0x21, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is disabled" },
|
||||
|
||||
{ 0x22, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S0/G0: working" },
|
||||
{ 0x22, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" },
|
||||
{ 0x22, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S2: sleeping, processor context lost" },
|
||||
{ 0x22, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" },
|
||||
{ 0x22, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" },
|
||||
{ 0x22, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5/G2: soft-off" },
|
||||
{ 0x22, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4/S5: soft-off" },
|
||||
{ 0x22, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G3: mechanical off" },
|
||||
{ 0x22, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Sleeping in S1/S2/S3 state" },
|
||||
{ 0x22, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G1: sleeping" },
|
||||
{ 0x22, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5: entered by override" },
|
||||
{ 0x22, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy ON state" },
|
||||
{ 0x22, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy OFF state" },
|
||||
{ 0x22, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Unknown" },
|
||||
|
||||
{ 0x23, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer expired" },
|
||||
{ 0x23, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Hard reset" },
|
||||
{ 0x23, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power down" },
|
||||
{ 0x23, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power cycle" },
|
||||
{ 0x23, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer interrupt" },
|
||||
|
||||
{ 0x24, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated page" },
|
||||
{ 0x24, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated LAN alert" },
|
||||
{ 0x24, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform Event Trap generated" },
|
||||
{ 0x24, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated SNMP trap, OEM format" },
|
||||
|
||||
{ 0x25, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Present" },
|
||||
{ 0x25, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Absent" },
|
||||
{ 0x25, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Disabled" },
|
||||
|
||||
{ 0x26, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Monitor ASIC/IC", NULL },
|
||||
|
||||
{ 0x27, 0x00, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat Lost" },
|
||||
{ 0x27, 0x01, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat" },
|
||||
|
||||
{ 0x28, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor access degraded or unavailable" },
|
||||
{ 0x28, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Controller access degraded or unavailable" },
|
||||
{ 0x28, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller off-line" },
|
||||
{ 0x28, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller unavailable" },
|
||||
|
||||
{ 0x29, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Low" },
|
||||
{ 0x29, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Failed" },
|
||||
{ 0x29, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Presence Detected" },
|
||||
|
||||
{ 0x00, 0x00, 0x00, NULL, NULL },
|
||||
};
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf *, int, char **);
|
||||
void ipmi_sel_print_std_entry(int num, struct sel_event_record * evt);
|
||||
|
||||
#endif /* IPMI_SEL_H */
|
55
ipmitool/include/ipmitool/ipmi_sol.h
Normal file
55
ipmitool/include/ipmitool/ipmi_sol.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_SOL_H
|
||||
#define IPMI_SOL_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define ACTIVATE_SOL 0x01
|
||||
#define SET_SOL_CONFIG 0x03
|
||||
#define GET_SOL_CONFIG 0x04
|
||||
|
||||
#define SOL_ENABLE_PARAM 0x01
|
||||
#define SOL_AUTHENTICATION_PARAM 0x02
|
||||
#define SOL_ENABLE_FLAG 0x01
|
||||
#define SOL_PRIVILEGE_LEVEL_USER 0x02
|
||||
#define SOL_BAUD_RATE_PARAM 0x05
|
||||
#define SOL_PREFERRED_BAUD_RATE 0x07
|
||||
|
||||
int ipmi_sol_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /* IPMI_SOL_H */
|
@ -1,290 +0,0 @@
|
||||
.TH "ipmitool" "1" "@@VERSION@@" "Duncan Laurie" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
ipmitool \- utility for IPMI control
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
.br
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIdev\fP <\fIexpression\fP>
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
This program lets you perform various IPMI functions with either a kernel device driver or over a LAN interface. These functions include printing FRU information, LAN configuration, sensor readings, and remote chassis power control.
|
||||
.SH "OPTIONS"
|
||||
.LP
|
||||
.TP
|
||||
\fB\-h\fR
|
||||
Get basic usage help from the command line.
|
||||
.TP
|
||||
\fB\-c\fR
|
||||
Make output suitable for parsing where possible by separating fields with commas instead of spaces.
|
||||
.TP
|
||||
\fB\-V\fR
|
||||
Display version information.
|
||||
.TP
|
||||
\fB\-v\fR
|
||||
Increase verbose output level. This option may be specified multiple times to increase the level of debug output. If given three times you will get hexdumps of all incoming and outgoing packets.
|
||||
.TP
|
||||
\fB\-I\fR <\fIinterface\fP>
|
||||
Selects IPMI interface to use. Possible interfaces are \fIlan\fP or \fIdev\fP.
|
||||
.TP
|
||||
\fB\-H\fR <\fIaddress\fP>
|
||||
Remote server address, can be IP address or hostname. This option is required for the LAN interface connection.
|
||||
.TP
|
||||
\fB\-P\fR <\fIpassword\fP>
|
||||
Remote server password, 16 character maximum. This is optional for the LAN interface, if it is not provided the session will not be authenticated.
|
||||
.SH "EXPRESSIONS"
|
||||
.LP
|
||||
.TP
|
||||
.I help
|
||||
This can be used to get command-line help on ipmitool commands. It may also be placed at the end of commands to get option usage help.
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev help
|
||||
.br
|
||||
Commands: chassis, fru, lan, sdr, sel
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis help
|
||||
.br
|
||||
Chassis Commands: status, power, identify, policy, restart_cause
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis power help
|
||||
.br
|
||||
Chassis Power Commands: status, on, off, cycle, reset, diag, soft
|
||||
.LP
|
||||
.RE
|
||||
.TP
|
||||
\fIraw\fP <\fBnetfn\fR> <\fBcmd\fR> [\fBdata\fR]
|
||||
This will allow you to execute raw IPMI commands. For example to query the POH counter with a raw command:
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev raw 0x0 0xf
|
||||
.br
|
||||
RAW REQ (netfn=0x0 cmd=0xf data_len=0)
|
||||
.br
|
||||
RAW RSP (5 bytes)
|
||||
.br
|
||||
3c 72 0c 00 00
|
||||
.LP
|
||||
.RE
|
||||
.TP
|
||||
\fIchaninfo\fP [\fBchannel\fR]
|
||||
This command will display information about the selected channel. If no channel is given it will display information about the currently used channel:
|
||||
.RS
|
||||
.PP
|
||||
ipmitool -I dev chaninfo
|
||||
.br
|
||||
Channel 0xf info:
|
||||
.br
|
||||
Channel Medium Type : System Interface
|
||||
.br
|
||||
Channel Protocol Type : KCS
|
||||
.br
|
||||
Session Support : session-less
|
||||
.br
|
||||
Active Session Count : 0
|
||||
.br
|
||||
Protocol Vendor ID : 7154
|
||||
.LP
|
||||
.RE
|
||||
.TP
|
||||
.I chassis
|
||||
.RS
|
||||
.TP
|
||||
.I status
|
||||
This command returns information about the high-level status of the system chassis and main power subsystem.
|
||||
.TP
|
||||
.I poh
|
||||
This command will return the Power-On Hours counter.
|
||||
.TP
|
||||
\fIidentify\fP <\fBinterval\fR>
|
||||
Control the front panel identify light. Default is 15. Use 0 to turn off.
|
||||
.TP
|
||||
.I restart_cause
|
||||
Query the chassis for the cause of the last system restart.
|
||||
.TP
|
||||
.I policy
|
||||
Set the chassis power policy in the event power failure.
|
||||
.RS
|
||||
.TP
|
||||
.I list
|
||||
Return supported policies.
|
||||
.TP
|
||||
.I always-on
|
||||
Turn on when power is restored.
|
||||
.TP
|
||||
.I previous
|
||||
Returned to previous state when power is restored.
|
||||
.TP
|
||||
.I always-off
|
||||
Stay off after power is restored.
|
||||
.RE
|
||||
.TP
|
||||
.I power
|
||||
Performs a chassis control command to view and change the power state.
|
||||
.RS
|
||||
.TP
|
||||
.I status
|
||||
Show current chassis power status.
|
||||
.TP
|
||||
.I on
|
||||
Power up chassis.
|
||||
.TP
|
||||
.I off
|
||||
Power down chassis into soft off (S4/S5 state). WARNING: this command does not initiate a clean shutdown of the operating system prior to powering down the system.
|
||||
.TP
|
||||
.I cycle
|
||||
This command provides a power off interval of at least 1 second. No action should occur if chassis power is in S4/S5 state, but it is recommended to check power state first and only issue a power cycle command if the system power is on or in lower sleep state than S4/S5.
|
||||
.TP
|
||||
.I reset
|
||||
This command will perform a hard reset.
|
||||
.TP
|
||||
.I diag
|
||||
Pulse a version of a diagnostic interrupt (NMI) that goes directly to the processor(s).
|
||||
.TP
|
||||
.I soft
|
||||
Initiate a soft\-shutdown of OS via ACPI by emulating a fatal overtemperature.
|
||||
.RE
|
||||
.RE
|
||||
.TP
|
||||
.I lan
|
||||
.RS
|
||||
.TP
|
||||
\fIprint\fP <\fBchannel\fR>
|
||||
Print the current configuration for the given channel.
|
||||
.TP
|
||||
\fIset\fP <\fBchannel\fR> <\fBparameter\fR>
|
||||
Set the given parameter on the given channel. Valid parameters are:
|
||||
.RS
|
||||
.TP
|
||||
\fIipaddr\fP <\fBx.x.x.x\fR>
|
||||
Set the IP address for this channel.
|
||||
.TP
|
||||
\fInetmask\fP <\fBx.x.x.x\fR>
|
||||
Set the netmask for this channel.
|
||||
.TP
|
||||
\fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR>
|
||||
Set the MAC adddress for this channel.
|
||||
.TP
|
||||
\fIdefgw\fP \fIipaddr\fP <\fBx.x.x.x\fR>
|
||||
Set the default gateway IP address.
|
||||
.TP
|
||||
\fIdefgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR>
|
||||
Set the default gateway MAC address.
|
||||
.TP
|
||||
\fIbakgw\fP \fIipaddr\fP <\fBx.x.x.x\fR>
|
||||
Set the backup gateway IP address.
|
||||
.TP
|
||||
\fIbakgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR>
|
||||
Set the backup gateway MAC address.
|
||||
.TP
|
||||
\fIpassword\fP <\fBpass\fR>
|
||||
Set the null user password.
|
||||
.TP
|
||||
\fIauth\fP <\fBlevel,...\fR> <\fBtype,...\fR>
|
||||
Set the valid authtypes for a given auth level.
|
||||
.RS
|
||||
Levels:
|
||||
.B callback
|
||||
.B user
|
||||
.B operator
|
||||
.B admin
|
||||
.br
|
||||
Types:
|
||||
.B none
|
||||
.B md2
|
||||
.B key
|
||||
.RE
|
||||
.RE
|
||||
.RE
|
||||
.TP
|
||||
.I fru
|
||||
.RS
|
||||
.TP
|
||||
.I print
|
||||
This command will read all Field Replacable Unit inventory data and extract such information as serial number, part number, asset tags, and short strings describing the chassis, board, or product.
|
||||
.RE
|
||||
.TP
|
||||
.I sdr
|
||||
.RS
|
||||
.TP
|
||||
.I list
|
||||
This command will read the SDR and extract sensor information, then query each sensor and print its name, reading, and status.
|
||||
.RE
|
||||
.TP
|
||||
.I sel
|
||||
.RS
|
||||
.TP
|
||||
.I info
|
||||
This command will query the BMC for information about the SEL and its contents.
|
||||
.TP
|
||||
.I list
|
||||
This command will list the contents of the SEL.
|
||||
.RE
|
||||
.SH "DEV INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIdev\fP interface utilizes the MontaVista OpenIPMI kernel device driver. This driver is present in 2.5.57 and later development kernels and in 2.4.21pre1 and later stable kernels. There are also IPMI driver kernel patches for different versions available from the OpenIPMI homepage.
|
||||
.LP
|
||||
The following kernel modules must be loaded in order for ipmitool to work:
|
||||
.TP
|
||||
.B ipmi_msghandler
|
||||
Incoming and outgoing message handler for IPMI interfaces.
|
||||
.TP
|
||||
.B ipmi_kcs_drv
|
||||
An IPMI Keyboard Controler Style (KCS) interface driver for the message handler.
|
||||
.TP
|
||||
.B ipmi_devintf
|
||||
Linux character device interface for the message handler.
|
||||
.LP
|
||||
Once they are loaded there will be a dynamic char device entry that must exist at \fB/dev/ipmi/0\fR. Usually if this is the first dynamic device it will be major number \fB254\fR and minor number \fB0\fR so you would create the dev entry with:
|
||||
.LP
|
||||
.I mknod /dev/ipmi/0 c 254 0
|
||||
.LP
|
||||
In order to force ipmitool to make use of the device interface you can specifiy it on the command line:
|
||||
.PP
|
||||
ipmitool \-I dev [option...]
|
||||
.LP
|
||||
Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the dev interface.
|
||||
.SH "LAN INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIlan\fP interface communicates with the BMC over an Ethernet LAN connection using UDP under IPv4. UDP datagrams are formatted to contain IPMI request/response messages with a IPMI session headers and RMCP headers.
|
||||
.LP
|
||||
IPMI\-over\-LAN uses version 1 of the Remote Management Control Protocol (RMCP) to support \fIpre\-OS\fP and \fIOS\-absent\fP management. RMCP is a request\-response protocol delivered using UDP datagrams to port 623.
|
||||
.LP
|
||||
The LAN interface is an authenticatiod multi\-session connection; messages delivered to the BMC can (and should) be authenticated with a challenge/response protocol with either straight password/key. ipmitool will attempt to connect with administrator privilege level as this is required to perform chassis power functions.
|
||||
.LP
|
||||
You can tell ipmitool to use the lan interface with the \fB\-I\fR option:
|
||||
.PP
|
||||
ipmitool \-I lan [option...] <address> [password]
|
||||
.LP
|
||||
A hostname \fBmust\fR be given on the command line in order to use the lan interface with ipmitool. The password field is optional; if you do not provide a password on the command line ipmitool will attempt to connect without authentication. If you specify a password it will use straight password/key.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /dev/ipmi/0
|
||||
This character device file is used by the OpenIPMI kernel driver.
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
If you want to remotely control the power of an IPMI\-over\-LAN enabled system you can use:
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power on
|
||||
.LP
|
||||
Chassis Power is off.
|
||||
.br
|
||||
Chassis Power Control: on
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status
|
||||
.LP
|
||||
Chassis Power is on.
|
||||
.SH "AUTHOR"
|
||||
.LP
|
||||
Duncan Laurie <duncan@sun.com>
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
.TP
|
||||
Intelligent Platform Management Interface Specification
|
||||
http://www.intel.com/design/servers/ipmi/spec.htm
|
||||
.TP
|
||||
OpenIPMI project (MontaVista IPMI kernel driver)
|
||||
http://openipmi.sourceforge.net/
|
@ -1,53 +1,105 @@
|
||||
Summary: Utility for interfacing with IPMI hardware
|
||||
Name: ipmitool
|
||||
Version: @@VERSION@@
|
||||
Name: @IPMITOOL_PKG@
|
||||
Summary: @IPMITOOL_PKG@ - Utility for interfacing with IPMI devices
|
||||
Version: @VERSION@
|
||||
Release: 1
|
||||
Copyright: Sun Microsystems
|
||||
License: BSD
|
||||
Group: Applications/System
|
||||
Source: ipmitool.tar.gz
|
||||
Copyright: BSD
|
||||
Group: Utilities
|
||||
Vendor: Sun Microsystems
|
||||
Packager: Duncan Laurie <duncan@sun.com>
|
||||
Source: @IPMITOOL_PKG@-@VERSION@.tar.gz
|
||||
Buildroot: /var/tmp/@IPMITOOL_PKG@-root
|
||||
|
||||
%package dev
|
||||
Summary: Development files for ipmitool
|
||||
Group: Utilities
|
||||
|
||||
%description
|
||||
This package contains a utility for interfacing with IPMI
|
||||
hardware through either the Linux OpenIPMI kernel driver or
|
||||
over ethernet LAN. It provides some basic functions for
|
||||
reading the SDR and displaying sensor values, printing FRU
|
||||
information, LAN configuration, and chassis power control.
|
||||
This package contains a utility for interfacing with IPMI-enabled devices
|
||||
through either the OpenIPMI kernel driver or with IPMI-over-LAN protocol.
|
||||
It provides some basic functions for reading the SDR and displaying sensor
|
||||
values, displaying the contents of the SEL, printing FRU information,
|
||||
reading and setting LAN configuration, and chassis power control.
|
||||
|
||||
%description dev
|
||||
Additional development files for creating applications or interface plugins
|
||||
for ipmitool.
|
||||
|
||||
%prep
|
||||
[ "$RPM_BUILD_ROOT" ] && rm -rf $RPM_BUILD_ROOT
|
||||
if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
fi
|
||||
|
||||
%setup -q -n ipmitool
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
|
||||
%setup
|
||||
|
||||
%build
|
||||
make
|
||||
./configure @ac_configure_args@ \
|
||||
--prefix=%{_prefix} \
|
||||
--bindir=%{_bindir} \
|
||||
--datadir=%{_datadir} \
|
||||
--includedir=%{_includedir} \
|
||||
--libdir=%{_libdir} \
|
||||
--mandir=%{_mandir} \
|
||||
--sysconfdir=%{_sysconfdir}
|
||||
make
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
make install-man DESTDIR=$RPM_BUILD_ROOT
|
||||
install -m 0755 -o root -g root bmcautoconf.sh $RPM_BUILD_ROOT/usr/sbin
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
fi
|
||||
rm -rf $RPM_BUILD_DIR/@IPMITOOL_PKG@-@VERSION@
|
||||
|
||||
%files
|
||||
/usr/sbin/ipmitool
|
||||
/usr/sbin/bmcautoconf.sh
|
||||
/usr/share/man/man1/ipmitool.1.gz
|
||||
%defattr(-,root,root)
|
||||
%doc %{_mandir}/man1/*
|
||||
%{_bindir}/*
|
||||
%dir %{_libdir}/ipmitool
|
||||
%attr(755,root,root) %{_libdir}/ipmitool/*
|
||||
|
||||
%files dev
|
||||
%defattr(-,root,root)
|
||||
%dir %{_includedir}/ipmitool
|
||||
%{_includedir}/ipmitool/*.h
|
||||
|
||||
%changelog
|
||||
* Wed Nov 12 2003 <duncan@sun.com> 1.4.1.1-1
|
||||
- first public release
|
||||
* Thu Dec 4 2003 <duncan@sun.com> 1.5.6-1
|
||||
- Fix SEL event decoding for generic events
|
||||
- Handle empty SEL gracefully when doing "sel list"
|
||||
- Fix sdr handling of sensors that do not return a reading
|
||||
- Fix for CSV display of sensor readings/units from Fredrik <EFBFBD>hrn
|
||||
|
||||
* Tue Nov 25 2003 <duncan@sun.com> 1.5.5-1
|
||||
- Add -U option for setting LAN username
|
||||
- Fix -v usage for plugin interfaces
|
||||
|
||||
* Fri Nov 14 2003 <duncan@sun.com> 1.5.4-1
|
||||
- pull interface plugin api into library
|
||||
- fix ipmievd
|
||||
|
||||
* Fri Oct 31 2003 <duncan@sun.com> 1.5.3-1
|
||||
- add -g optin for pedantic ipmi-over-lan communication
|
||||
|
||||
* Fri Oct 24 2003 <duncan@sun.com> 1.5.2-1
|
||||
- add gratuitous arp interval setting
|
||||
|
||||
* Wed Oct 8 2003 <duncan@sun.com> 1.5.1-1
|
||||
- better SEL support
|
||||
- fix display bug in SDR list
|
||||
|
||||
* Fri Sep 5 2003 <duncan@sun.com> 1.5.0-1
|
||||
- use automake/autoconf/libtool
|
||||
- dynamic loading interface plugins
|
||||
|
||||
* Wed May 28 2003 <duncan@sun.com> 1.4.0-1
|
||||
- make UDP packet handling more robust
|
||||
- fix imb driver support
|
||||
|
||||
* Thu May 22 2003 <duncan@sun.com> 1.3-1
|
||||
- update manpage
|
||||
- rework of low-level network handling
|
||||
- add basic imb driver support
|
||||
|
||||
* Wed Apr 2 2003 <duncan@sun.com> 1.2-1
|
||||
- change command line option parsing
|
||||
|
43
ipmitool/lib/Makefile.am
Normal file
43
ipmitool/lib/Makefile.am
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
noinst_LTLIBRARIES = libipmitool.la
|
||||
libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_lanp.c \
|
||||
ipmi_fru.c ipmi_chassis.c ipmi_bmc.c ipmi_intf.c
|
||||
libipmitool_la_LDFLAGS = -export-dynamic
|
||||
libipmitool_la_LIBADD = -lm $(LIBLTDL)
|
||||
libipmitool_la_DEPENDENCIES = $(LIBLTDL)
|
@ -37,7 +37,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <helper.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -115,18 +115,13 @@ void signal_handler(int sig, void * handler)
|
||||
act.sa_flags = 0;
|
||||
|
||||
if (sigemptyset(&act.sa_mask) < 0) {
|
||||
printf("SIGNAL[%s] unable to empty signal set\n",
|
||||
(char *)strsignal(sig));
|
||||
psignal(sig, "unable to empty signal set");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sigaction(sig, &act, NULL) < 0) {
|
||||
printf("SIGNAL[%s] unable to register handler @ %p\n",
|
||||
(char *)strsignal(sig), (void *)handler);
|
||||
psignal(sig, "unable to register handler");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("SIGNAL[%s]: handler registered @ %p\n",
|
||||
(char *)strsignal(sig), (void *)handler);
|
||||
}
|
||||
|
||||
|
119
ipmitool/lib/ipmi_bmc.c
Normal file
119
ipmitool/lib/ipmi_bmc.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_bmc.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
const struct valstr completion_code_vals[] = {
|
||||
{ 0x00, "Command completed normally" },
|
||||
{ 0xc0, "Node busy" },
|
||||
{ 0xc1, "Invalid command" },
|
||||
{ 0xc2, "Invalid command on LUN" },
|
||||
{ 0xc3, "Timeout" },
|
||||
{ 0xc4, "Out of space" },
|
||||
{ 0xc5, "Reservation cancelled or invalid" },
|
||||
{ 0xc6, "Request data truncated" },
|
||||
{ 0xc7, "Request data length invalid" },
|
||||
{ 0xc8, "Request data field length limit exceeded" },
|
||||
{ 0xc9, "Parameter out of range" },
|
||||
{ 0xca, "Cannot return number of requested data bytes" },
|
||||
{ 0xcb, "Requested sensor, data, or record not found" },
|
||||
{ 0xcc, "Invalid data field in request" },
|
||||
{ 0xcd, "Command illegal for specified sensor or record type" },
|
||||
{ 0xce, "Command response could not be provided" },
|
||||
{ 0xcf, "Cannot execute duplicated request" },
|
||||
{ 0xd0, "SDR Repository in update mode" },
|
||||
{ 0xd1, "Device firmeware in update mode" },
|
||||
{ 0xd2, "BMC initialization in progress" },
|
||||
{ 0xd3, "Destination unavailable" },
|
||||
{ 0xd4, "Insufficient priviledge level" },
|
||||
{ 0xd5, "Command not supported in present state" },
|
||||
{ 0xff, "Unspecified error" },
|
||||
{ 0x00, NULL }
|
||||
};
|
||||
|
||||
static int ipmi_bmc_reset(struct ipmi_intf * intf, int cmd)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = cmd;
|
||||
req.msg.data_len = 0;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp) {
|
||||
printf("Error in BMC Reset Command\n");
|
||||
return -1;
|
||||
}
|
||||
if (rsp->ccode) {
|
||||
printf("BMC Reset Command returned %x\n", rsp->ccode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ipmi_bmc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "help", 4)) {
|
||||
printf("BMC Commands: reset\n");
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[0], "reset", 5)) {
|
||||
if (argc < 2 || !strncmp(argv[1], "help", 4)) {
|
||||
printf("reset commands: warm, cold\n");
|
||||
}
|
||||
else if (!strncmp(argv[1], "cold", 4)) {
|
||||
ipmi_bmc_reset(intf, BMC_COLD_RESET);
|
||||
}
|
||||
else if (!strncmp(argv[1], "warm", 4)) {
|
||||
ipmi_bmc_reset(intf, BMC_WARM_RESET);
|
||||
}
|
||||
else {
|
||||
printf("reset commands: warm, cold\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -38,14 +38,16 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_chassis.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_chassis.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static int ipmi_chassis_power_status(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -75,7 +77,7 @@ static const struct valstr ipmi_chassis_power_control_vals[] = {
|
||||
|
||||
static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ctl)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -83,14 +85,16 @@ static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ct
|
||||
req.msg.data = &ctl;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
printf("Chassis Power Control: %s\n", val2str(ctl, ipmi_chassis_power_control_vals));
|
||||
printf("Chassis Power Control: %s\n",
|
||||
val2str(ctl, ipmi_chassis_power_control_vals));
|
||||
|
||||
intf->sendrecv(intf, &req);
|
||||
intf->abort = 1;
|
||||
}
|
||||
|
||||
static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -117,8 +121,8 @@ static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
|
||||
static void ipmi_chassis_poh(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned long count;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -138,8 +142,8 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf)
|
||||
|
||||
static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -190,8 +194,8 @@ static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
|
||||
|
||||
static void ipmi_chassis_status(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -246,8 +250,8 @@ static void ipmi_chassis_status(struct ipmi_intf * intf)
|
||||
|
||||
static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[16];
|
||||
|
||||
memset(msg_data, 0, 16);
|
||||
@ -271,8 +275,8 @@ static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char pa
|
||||
|
||||
static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[3];
|
||||
|
||||
if (!arg)
|
||||
@ -341,8 +345,8 @@ static void ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg)
|
||||
|
||||
static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char policy)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
if (!policy)
|
||||
return;
|
@ -34,12 +34,14 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_fru.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_fru.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static char * get_fru_area_str(unsigned char * data, int * offset)
|
||||
{
|
||||
char * str;
|
||||
@ -64,8 +66,8 @@ static char * get_fru_area_str(unsigned char * data, int * offset)
|
||||
|
||||
static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char fru_data[256], msg_data[4];
|
||||
int i, len, offset;
|
||||
|
105
ipmitool/lib/ipmi_intf.c
Normal file
105
ipmitool/lib/ipmi_intf.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
/* ipmi_intf_init
|
||||
* initialize dynamic plugin interface
|
||||
*/
|
||||
int ipmi_intf_init(void)
|
||||
{
|
||||
if (lt_dlinit() < 0) {
|
||||
printf("ERROR: Unable to initialize ltdl\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lt_dlsetsearchpath(PLUGIN_PATH) < 0) {
|
||||
printf("ERROR: Unable to set ltdl plugin path to %s\n",
|
||||
PLUGIN_PATH);
|
||||
lt_dlexit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ipmi_intf_exit
|
||||
* close dynamic plugin interface
|
||||
*/
|
||||
void ipmi_intf_exit(void)
|
||||
{
|
||||
if (lt_dlexit() < 0)
|
||||
printf("ERROR: Unable to cleanly exit ltdl\n");
|
||||
}
|
||||
|
||||
/* ipmi_intf_load
|
||||
* name: interface plugin name to load
|
||||
*/
|
||||
struct ipmi_intf * ipmi_intf_load(char * name)
|
||||
{
|
||||
lt_dlhandle handle;
|
||||
struct ipmi_intf * intf;
|
||||
int (*intf_setup)(struct ipmi_intf ** intf);
|
||||
|
||||
handle = lt_dlopenext(name);
|
||||
if (handle == NULL) {
|
||||
printf("ERROR: Unable to find plugin '%s' in '%s'\n",
|
||||
name, PLUGIN_PATH);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
intf_setup = lt_dlsym(handle, "intf_setup");
|
||||
if (!intf_setup) {
|
||||
printf("ERROR: Unable to find interface setup symbol in plugin %s\n", name);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (intf_setup(&intf) < 0) {
|
||||
printf("ERROR: Unable to run interface setup for plugin %s\n", name);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return intf;
|
||||
}
|
||||
|
@ -47,15 +47,73 @@
|
||||
#include <setjmp.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_lan.h>
|
||||
#include <helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi_lanp.h>
|
||||
|
||||
static struct lan_param * get_lan_param(struct ipmi_intf * intf, unsigned char chan, int param)
|
||||
extern int verbose;
|
||||
extern struct ipmi_session lan_session;
|
||||
|
||||
const struct valstr ipmi_privlvl_vals[] = {
|
||||
{ IPMI_SESSION_PRIV_CALLBACK, "CALLBACK" },
|
||||
{ IPMI_SESSION_PRIV_USER, "USER" },
|
||||
{ IPMI_SESSION_PRIV_OPERATOR, "OPERATOR" },
|
||||
{ IPMI_SESSION_PRIV_ADMIN, "ADMINISTRATOR" },
|
||||
{ IPMI_SESSION_PRIV_OEM, "OEM" },
|
||||
{ 0xF, "NO ACCESS" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
const struct valstr ipmi_authtype_vals[] = {
|
||||
{ IPMI_SESSION_AUTHTYPE_NONE, "NONE" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD2, "MD2" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD5, "MD5" },
|
||||
{ IPMI_SESSION_AUTHTYPE_KEY, "PASSWORD" },
|
||||
{ IPMI_SESSION_AUTHTYPE_OEM, "OEM" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static const struct valstr ipmi_channel_protocol_vals[] = {
|
||||
{ 0x00, "reserved" },
|
||||
{ 0x01, "IPMB-1.0" },
|
||||
{ 0x02, "ICMB-1.0" },
|
||||
{ 0x03, "reserved" },
|
||||
{ 0x04, "IPMI-SMBus" },
|
||||
{ 0x05, "KCS" },
|
||||
{ 0x06, "SMIC" },
|
||||
{ 0x07, "BT-10" },
|
||||
{ 0x08, "BT-15" },
|
||||
{ 0x09, "TMode" },
|
||||
{ 0x1c, "OEM 1" },
|
||||
{ 0x1d, "OEM 2" },
|
||||
{ 0x1e, "OEM 3" },
|
||||
{ 0x1f, "OEM 4" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
static const struct valstr ipmi_channel_medium_vals[] = {
|
||||
{ 0x00, "reserved" },
|
||||
{ 0x01, "IPMB (I2C)" },
|
||||
{ 0x02, "ICMB v1.0" },
|
||||
{ 0x03, "ICMB v0.9" },
|
||||
{ 0x04, "802.3 LAN" },
|
||||
{ 0x05, "Serial/Modem" },
|
||||
{ 0x06, "Other LAN" },
|
||||
{ 0x07, "PCI SMBus" },
|
||||
{ 0x08, "SMBus v1.0/v1.1" },
|
||||
{ 0x09, "SMBus v2.0" },
|
||||
{ 0x0a, "USB 1.x" },
|
||||
{ 0x0b, "USB 2.x" },
|
||||
{ 0x0c, "System Interface" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
static struct lan_param *
|
||||
get_lan_param(struct ipmi_intf * intf, unsigned char chan, int param)
|
||||
{
|
||||
struct lan_param * p;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
|
||||
p = &ipmi_lan_params[param];
|
||||
@ -83,10 +141,11 @@ static struct lan_param * get_lan_param(struct ipmi_intf * intf, unsigned char c
|
||||
return p;
|
||||
}
|
||||
|
||||
static int set_lan_param(struct ipmi_intf * intf, unsigned char chan, int param, unsigned char * data, int len)
|
||||
static int
|
||||
set_lan_param(struct ipmi_intf * intf, unsigned char chan, int param, unsigned char * data, int len)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[32];
|
||||
|
||||
if (param < 0)
|
||||
@ -110,11 +169,101 @@ static int set_lan_param(struct ipmi_intf * intf, unsigned char chan, int param,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x42;
|
||||
req.msg.data = &channel;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Get Channel Info Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!verbose)
|
||||
return;
|
||||
|
||||
printf("Channel 0x%x info:\n", rsp->data[0] & 0xf);
|
||||
|
||||
printf(" Channel Medium Type : %s\n",
|
||||
val2str(rsp->data[1] & 0x7f, ipmi_channel_medium_vals));
|
||||
|
||||
printf(" Channel Protocol Type : %s\n",
|
||||
val2str(rsp->data[2] & 0x1f, ipmi_channel_protocol_vals));
|
||||
|
||||
printf(" Session Support : ");
|
||||
switch (rsp->data[3] & 0xc0) {
|
||||
case 0x00:
|
||||
printf("session-less\n");
|
||||
break;
|
||||
case 0x40:
|
||||
printf("single-session\n");
|
||||
break;
|
||||
case 0x80:
|
||||
printf("multi-session\n");
|
||||
break;
|
||||
case 0xc0:
|
||||
default:
|
||||
printf("session-based\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Active Session Count : %d\n",
|
||||
rsp->data[3] & 0x3f);
|
||||
printf(" Protocol Vendor ID : %d\n",
|
||||
rsp->data[4] | rsp->data[5] << 8 | rsp->data[6] << 16);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
rqdata[1] = 0x80; /* 0x80=active, 0x40=non-volatile */
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x41;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Alerting : %sabled\n", (rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n", (rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n", (rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
switch (rsp->data[0] & 0x7) {
|
||||
case 0:
|
||||
printf("disabled\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("pre-boot only\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("always available\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("shared\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void suspend_lan_arp(struct ipmi_intf * intf, int suspend)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_1;
|
||||
@ -131,18 +280,6 @@ static void suspend_lan_arp(struct ipmi_intf * intf, int suspend)
|
||||
printf("Suspend BMC ARP status : 0x%x\n", rsp->data[0]);
|
||||
}
|
||||
|
||||
/* Enable Gratuitous ARP and Interval */
|
||||
static void lan_set_arp(struct ipmi_intf * intf)
|
||||
{
|
||||
unsigned char data;
|
||||
|
||||
data = 0x01;
|
||||
set_lan_param(intf, IPMI_LANP_BMC_ARP, &data, 1);
|
||||
|
||||
data = 0x03;
|
||||
set_lan_param(intf, IPMI_LANP_GRAT_ARP, &data, 1);
|
||||
}
|
||||
|
||||
static void set_lan_params(struct ipmi_intf * intf)
|
||||
{
|
||||
lan_set_auth(intf);
|
||||
@ -152,7 +289,69 @@ static void set_lan_params(struct ipmi_intf * intf)
|
||||
|
||||
#endif
|
||||
|
||||
static void ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
static void
|
||||
lan_set_arp_interval(struct ipmi_intf * intf, unsigned char chan, unsigned char * ival)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char interval;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP);
|
||||
if (!lp)
|
||||
return;
|
||||
|
||||
if (ival) {
|
||||
interval = ((unsigned char)atoi(ival) * 2) - 1;
|
||||
set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1);
|
||||
printf("BMC-generated Gratuitous ARP interval: %.1f seconds\n",
|
||||
(float)((interval + 1) / 2));
|
||||
} else {
|
||||
printf("BMC-generated Gratuitous ARP interval: %.1f seconds\n",
|
||||
(float)((lp->data[0] + 1) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lan_set_arp_generate(struct ipmi_intf * intf, unsigned char chan, unsigned char ctl)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char data;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP);
|
||||
if (!lp)
|
||||
return;
|
||||
data = lp->data[0];
|
||||
|
||||
if (ctl)
|
||||
data |= 0x1;
|
||||
else
|
||||
data &= ~0x1;
|
||||
|
||||
printf("BMC-generated Gratuitous ARPs %sabled\n", ctl ? "en" : "dis");
|
||||
set_lan_param(intf, chan, IPMI_LANP_BMC_ARP, &data, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
lan_set_arp_respond(struct ipmi_intf * intf, unsigned char chan, unsigned char ctl)
|
||||
{
|
||||
struct lan_param *lp;
|
||||
unsigned char data;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP);
|
||||
if (!lp)
|
||||
return;
|
||||
data = lp->data[0];
|
||||
|
||||
if (ctl)
|
||||
data |= 0x2;
|
||||
else
|
||||
data &= ~0x2;
|
||||
|
||||
printf("BMC-generated ARP response %sabled\n", ctl ? "en" : "dis");
|
||||
set_lan_param(intf, chan, IPMI_LANP_BMC_ARP, &data, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
{
|
||||
struct lan_param * p;
|
||||
|
||||
@ -209,7 +408,8 @@ static void ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
}
|
||||
|
||||
/* Configure Authentication Types */
|
||||
static void ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char * level, char * types)
|
||||
static void
|
||||
ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char * level, char * types)
|
||||
{
|
||||
unsigned char data[5];
|
||||
unsigned char authtype = 0;
|
||||
@ -234,6 +434,8 @@ static void ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_NONE;
|
||||
else if (!strncmp(p, "md2", 3))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD2;
|
||||
else if (!strncmp(p, "md5", 3))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD5;
|
||||
else if (!strncmp(p, "key", 3))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_KEY;
|
||||
else
|
||||
@ -270,8 +472,8 @@ static void
|
||||
ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
unsigned char userid, unsigned char * password)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[18];
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
@ -303,6 +505,64 @@ ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
printf("Password for user %d set to %s\n", userid, lan_session.authcode);
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_set_channel_access(struct ipmi_intf * intf, unsigned char channel, unsigned char enable)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[3];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
|
||||
rqdata[1] = 0xa0; /* set pef disabled, per-msg auth enabled */
|
||||
if (enable)
|
||||
rqdata[1] |= 0x2; /* set always available if enable is set */
|
||||
rqdata[2] = 0x04; /* don't change channel privilege limit */
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x40;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Set Channel Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_set_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned char userid)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[4];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = 0x90 | (channel & 0xf);
|
||||
rqdata[1] = userid & 0x3f;
|
||||
rqdata[2] = 0x4;
|
||||
rqdata[3] = 0;
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x43;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Set User Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmdline_macaddr(char * arg, unsigned char * buf)
|
||||
{
|
||||
@ -336,7 +596,8 @@ get_cmdline_ipaddr(char * arg, unsigned char * buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
static void
|
||||
ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned char data[32];
|
||||
unsigned char chan;
|
||||
@ -344,7 +605,7 @@ static void ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
|
||||
if (argc < 2 || !strncmp(argv[0], "help", 4)) {
|
||||
printf("usage: lan set <channel> <command>\n");
|
||||
printf("LAN set commands: ipaddr, netmask, macaddr, defgw, bakgw, password, auth, ipsrc\n");
|
||||
printf("LAN set commands: ipaddr, netmask, macaddr, defgw, bakgw, password, auth, ipsrc, access, user, arp\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,13 +615,75 @@ static void ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return;
|
||||
}
|
||||
|
||||
/* set user access */
|
||||
if (!strncmp(argv[1], "user", 4)) {
|
||||
ipmi_set_user_access(intf, chan, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* set channel access mode */
|
||||
if (!strncmp(argv[1], "access", 6)) {
|
||||
if (argc < 3 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("lan set access <on|off>\n");
|
||||
}
|
||||
else if (!strncmp(argv[2], "on", 2)) {
|
||||
ipmi_set_channel_access(intf, chan, 1);
|
||||
}
|
||||
else if (!strncmp(argv[2], "off", 3)) {
|
||||
ipmi_set_channel_access(intf, chan, 0);
|
||||
}
|
||||
else {
|
||||
printf("lan set access <on|off>\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* set ARP control */
|
||||
if (!strncmp(argv[1], "arp", 3)) {
|
||||
if (argc < 3 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("lan set <channel> arp respond <on|off>\n");
|
||||
printf("lan set <channel> arp generate <on|off>\n");
|
||||
printf("lan set <channel> arp interval <seconds>\n\n");
|
||||
printf("example: lan set 7 arp gratuitous off\n");
|
||||
}
|
||||
else if (!strncmp(argv[2], "interval", 8)) {
|
||||
lan_set_arp_interval(intf, chan, argv[3]);
|
||||
}
|
||||
else if (!strncmp(argv[2], "generate", 8)) {
|
||||
if (argc < 4)
|
||||
printf("lan set <channel> arp generate <on|off>\n");
|
||||
else if (!strncmp(argv[3], "on", 2))
|
||||
lan_set_arp_generate(intf, chan, 1);
|
||||
else if (!strncmp(argv[3], "off", 3))
|
||||
lan_set_arp_generate(intf, chan, 0);
|
||||
else
|
||||
printf("lan set <channel> arp generate <on|off>\n");
|
||||
}
|
||||
else if (!strncmp(argv[2], "respond", 7)) {
|
||||
if (argc < 4)
|
||||
printf("lan set <channel> arp respond <on|off>\n");
|
||||
else if (!strncmp(argv[3], "on", 2))
|
||||
lan_set_arp_respond(intf, chan, 1);
|
||||
else if (!strncmp(argv[3], "off", 3))
|
||||
lan_set_arp_respond(intf, chan, 0);
|
||||
else
|
||||
printf("lan set <channel> arp respond <on|off>\n");
|
||||
}
|
||||
else {
|
||||
printf("lan set <channel> arp respond <on|off>\n");
|
||||
printf("lan set <channel> arp generate <on|off>\n");
|
||||
printf("lan set <channel> arp interval <seconds>\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* set authentication types */
|
||||
if (!strncmp(argv[1], "auth", 4)) {
|
||||
if (argc < 3 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("lan set <channel> auth <level> <type,type,...>\n");
|
||||
printf(" level = callback, user, operator, admin\n");
|
||||
printf(" types = none, md2, key\n");
|
||||
printf("example: lan set 7 auth admin key\n");
|
||||
printf(" types = none, md2, md5, key\n");
|
||||
printf("example: lan set 7 auth admin key,md5\n");
|
||||
return;
|
||||
}
|
||||
ipmi_lan_set_auth(intf, chan, argv[2], argv[3]);
|
||||
@ -462,7 +785,8 @@ static void ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_lan_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
int
|
||||
ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "help", 4))
|
||||
printf("LAN Commands: print, set\n");
|
@ -37,9 +37,11 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_sdr.h>
|
||||
#include <ipmi_entity.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sdr.h>
|
||||
#include <ipmitool/ipmi_entity.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
/* convert unsigned value to 2's complement signed */
|
||||
int utos(unsigned val, unsigned bits)
|
||||
@ -70,11 +72,11 @@ sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, unsigned char
|
||||
#define GET_SENSOR_THRES 0x27
|
||||
#define GET_SENSOR_TYPE 0x2f
|
||||
|
||||
static inline struct ipmi_rsp *
|
||||
static inline struct ipmi_rs *
|
||||
ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_SE;
|
||||
@ -84,9 +86,6 @@ ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor)
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode)
|
||||
return NULL;
|
||||
|
||||
return rsp;
|
||||
}
|
||||
|
||||
@ -112,8 +111,8 @@ ipmi_sdr_get_status(unsigned char stat)
|
||||
static struct sdr_get_rs *
|
||||
ipmi_sdr_get_header(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
static struct sdr_get_rs sdr_rs;
|
||||
|
||||
@ -155,14 +154,13 @@ ipmi_sdr_get_header(struct ipmi_intf * intf, unsigned short reserve_id, unsigned
|
||||
return &sdr_rs;
|
||||
}
|
||||
|
||||
static struct sdr_record_full_sensor *
|
||||
ipmi_sdr_get_entry(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id, int len)
|
||||
static struct sdr_record_compact_sensor *
|
||||
ipmi_sdr_get_entry_02(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id, int len)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
struct sdr_get_rs sdr_rs;
|
||||
struct sdr_record_full_sensor * sensor;
|
||||
struct sdr_record_compact_sensor * sensor;
|
||||
unsigned char data[256];
|
||||
int i;
|
||||
|
||||
@ -177,7 +175,78 @@ ipmi_sdr_get_entry(struct ipmi_intf * intf, unsigned short reserve_id, unsigned
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
memcpy(&sdr_rs, rsp->data, sizeof(sdr_rs));
|
||||
/* read SDR record with partial (30 byte) reads
|
||||
* because a full read (0xff) exceeds the maximum
|
||||
* transport buffer size. (completion code 0xca)
|
||||
*/
|
||||
memset(data, 0, sizeof(data));
|
||||
for (i=0; i<len; i+=GET_SDR_MAX_LEN) {
|
||||
sdr_rq.length = (len-i < GET_SDR_MAX_LEN) ? len-i : GET_SDR_MAX_LEN;
|
||||
sdr_rq.offset = i+5; /* 5 header bytes */
|
||||
if (verbose > 1)
|
||||
printf("getting %d bytes from SDR at offset %d\n",
|
||||
sdr_rq.length, sdr_rq.offset);
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp && rsp->data)
|
||||
memcpy(data+i, rsp->data+2, sdr_rq.length);
|
||||
}
|
||||
|
||||
sensor = malloc(sizeof(*sensor));
|
||||
memcpy(sensor, data, sizeof(*sensor));
|
||||
|
||||
if (verbose > 1) {
|
||||
printbuf(data, len, "SDR Entry");
|
||||
|
||||
printf("keys.owner_id: 0x%x\n", sensor->keys.owner_id);
|
||||
printf("keys.lun: 0x%x\n", sensor->keys.lun);
|
||||
printf("keys.channel: 0x%x\n", sensor->keys.channel);
|
||||
printf("keys.sensor_num: 0x%x\n", sensor->keys.sensor_num);
|
||||
|
||||
printf("entity: %d.%d\n", sensor->entity.id, sensor->entity.instance);
|
||||
|
||||
printf("entity.id: %s\n", val2str(sensor->entity.id, entity_id_vals));
|
||||
printf("entity.instance: %d\n", sensor->entity.instance);
|
||||
printf("entity.logical: %d\n", sensor->entity.logical);
|
||||
|
||||
printf("sensor unit.pct: 0x%x\n", sensor->unit.pct);
|
||||
printf("sensor unit.rate: 0x%x\n", sensor->unit.rate);
|
||||
printf("sensor unit.analog: 0x%x\n", sensor->unit.analog);
|
||||
printf("sensor unit.modifier: 0x%x\n", sensor->unit.modifier);
|
||||
printf("sensor unit.type.base: 0x%x\n", sensor->unit.type.base);
|
||||
printf("sensor unit.type.modifier: 0x%x\n", sensor->unit.type.modifier);
|
||||
|
||||
printf("sensor.type: 0x%02x\n", sensor->sensor.type);
|
||||
printf("event_type: 0x%02x\n", sensor->event_type);
|
||||
|
||||
printf("sensor id code: 0x%x\n", sensor->id_code);
|
||||
|
||||
if (sensor->id_code)
|
||||
printf("sensor id: %s\n", sensor->id_string);
|
||||
}
|
||||
|
||||
return sensor;
|
||||
}
|
||||
|
||||
static struct sdr_record_full_sensor *
|
||||
ipmi_sdr_get_entry_01(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id, int len)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
struct sdr_record_full_sensor * sensor;
|
||||
unsigned char data[256];
|
||||
int i;
|
||||
|
||||
memset(&sdr_rq, 0, sizeof(sdr_rq));
|
||||
sdr_rq.reserve_id = reserve_id;
|
||||
sdr_rq.id = record_id;
|
||||
sdr_rq.offset = 0;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR;
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
/* read SDR record with partial (30 byte) reads
|
||||
* because a full read (0xff) exceeds the maximum
|
||||
@ -264,17 +333,18 @@ ipmi_sdr_get_entry(struct ipmi_intf * intf, unsigned short reserve_id, unsigned
|
||||
static void
|
||||
ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct sdr_repo_info_rs sdr_info;
|
||||
struct sdr_reserve_repo_rs sdr_reserve;
|
||||
struct sdr_get_rs * header;
|
||||
struct sdr_record_full_sensor * sensor;
|
||||
|
||||
int next = 0, i = 0, total;
|
||||
int next = 0, i = 0, total, validread;
|
||||
unsigned short reservation;
|
||||
float val;
|
||||
char sval[16], unitstr[16];
|
||||
char desc[17];
|
||||
|
||||
if (verbose)
|
||||
printf("Querying SDR for sensor list\n");
|
||||
@ -313,12 +383,21 @@ ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
printf("SDR reserveration ID %04x\n", reservation);
|
||||
|
||||
while (next < total) {
|
||||
validread = 1;
|
||||
i = 0;
|
||||
|
||||
header = ipmi_sdr_get_header(intf, reservation, next);
|
||||
if (!header)
|
||||
break;
|
||||
|
||||
if (header->type == SDR_RECORD_TYPE_COMPACT_SENSOR) {
|
||||
struct sdr_record_compact_sensor * s;
|
||||
s = ipmi_sdr_get_entry_02(intf, reservation, next, header->length);
|
||||
next = header->next;
|
||||
free(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (header->type != SDR_RECORD_TYPE_FULL_SENSOR) {
|
||||
if (verbose > 1)
|
||||
printf("Invalid SDR type 0x%02x\n", header->type);
|
||||
@ -326,7 +405,7 @@ ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
continue;
|
||||
}
|
||||
|
||||
sensor = ipmi_sdr_get_entry(intf, reservation, next, header->length);
|
||||
sensor = ipmi_sdr_get_entry_01(intf, reservation, next, header->length);
|
||||
next = header->next;
|
||||
|
||||
/* only handle linear sensors (for now) */
|
||||
@ -335,16 +414,26 @@ ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(desc, 0, sizeof(desc));
|
||||
memcpy(desc, sensor->id_string, 16);
|
||||
|
||||
rsp = ipmi_sdr_get_sensor_reading(intf, sensor->keys.sensor_num);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("error reading sensor\n");
|
||||
continue;
|
||||
if (rsp && rsp->ccode == 0xcb) {
|
||||
/* sensor not found */
|
||||
val = 0.0;
|
||||
validread = 0;
|
||||
} else {
|
||||
printf("Error reading sensor: %s\n",
|
||||
val2str(rsp->ccode, completion_code_vals));
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/* convert RAW reading into units */
|
||||
val = rsp->data[0] ? sdr_convert_sensor_reading(sensor, rsp->data[0]) : 0;
|
||||
}
|
||||
|
||||
/* convert RAW reading into units */
|
||||
val = rsp->data[0] ? sdr_convert_sensor_reading(sensor, rsp->data[0]) : 0;
|
||||
|
||||
if (do_unit) {
|
||||
if (do_unit && validread) {
|
||||
memset(unitstr, 0, sizeof(unitstr));
|
||||
/* determine units with possible modifiers */
|
||||
switch (sensor->unit.modifier) {
|
||||
@ -372,18 +461,30 @@ ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
*/
|
||||
if (csv_output)
|
||||
printf("%s,",
|
||||
sensor->id_code ? sensor->id_string : NULL);
|
||||
sensor->id_code ? desc : NULL);
|
||||
else
|
||||
printf("%-16s | ",
|
||||
sensor->id_code ? sensor->id_string : NULL);
|
||||
sensor->id_code ? desc : NULL);
|
||||
|
||||
memset(sval, 0, sizeof(sval));
|
||||
i += snprintf(sval, sizeof(sval), "%.*f",
|
||||
(val==(int)val) ? 0 : 3, val);
|
||||
if (validread) {
|
||||
i += snprintf(sval, sizeof(sval), "%.*f",
|
||||
(val==(int)val) ? 0 : 3, val);
|
||||
} else {
|
||||
i += snprintf(sval, sizeof(sval), "no reading");
|
||||
i--;
|
||||
}
|
||||
printf("%s", sval);
|
||||
|
||||
if (do_unit)
|
||||
printf(" %s", unitstr);
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
|
||||
if (validread) {
|
||||
if (!csv_output)
|
||||
printf(" ");
|
||||
if (do_unit)
|
||||
printf("%s", unitstr);
|
||||
}
|
||||
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
@ -398,13 +499,16 @@ ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
}
|
||||
else {
|
||||
printf("Sensor | %s (0x%x)\n",
|
||||
sensor->id_code ? sensor->id_string : NULL,
|
||||
sensor->id_code ? desc : NULL,
|
||||
sensor->keys.sensor_num);
|
||||
printf("Entity | %d.%d (%s)\n",
|
||||
sensor->entity.id, sensor->entity.instance,
|
||||
val2str(sensor->entity.id, entity_id_vals));
|
||||
printf("Reading | %.*f %s\n",
|
||||
(val==(int)val) ? 0 : 3, val, unitstr);
|
||||
if (validread)
|
||||
printf("Reading | %.*f %s\n",
|
||||
(val==(int)val) ? 0 : 3, val, unitstr);
|
||||
else
|
||||
printf("Reading | not present\n");
|
||||
printf("Status | %s\n",
|
||||
ipmi_sdr_get_status(rsp->data[2]));
|
||||
printf("\n");
|
@ -37,9 +37,11 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_sel.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sel.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static const struct valstr event_dir_vals[] = {
|
||||
{ 0, "Assertion Event" },
|
||||
@ -81,34 +83,21 @@ ipmi_get_event_type(unsigned char code)
|
||||
static const char *
|
||||
ipmi_get_event_desc(struct sel_event_record * rec)
|
||||
{
|
||||
int class;
|
||||
unsigned char offset = 0;
|
||||
struct ipmi_event_type *evt;
|
||||
unsigned char code, offset;
|
||||
struct ipmi_event_sensor_types *evt;
|
||||
|
||||
class = ipmi_get_event_class(rec->event_type);
|
||||
if (class < 0)
|
||||
return "Invalid Class";
|
||||
|
||||
switch (class) {
|
||||
case IPMI_EVENT_CLASS_DISCRETE:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_DIGITAL:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_THRESHOLD:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
default:
|
||||
return "Unknown Class";
|
||||
if (rec->event_type == 0x6f) {
|
||||
evt = sensor_specific_types;
|
||||
code = rec->sensor_type;
|
||||
} else {
|
||||
evt = generic_event_types;
|
||||
code = rec->event_type;
|
||||
}
|
||||
|
||||
if (verbose > 2)
|
||||
printf("offset: 0x%02x\n", offset);
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
|
||||
evt = event_types;
|
||||
while (evt->desc) {
|
||||
if (evt->code == rec->event_type && evt->offset == offset)
|
||||
while (evt->type) {
|
||||
if (evt->code == code && evt->offset == offset)
|
||||
return evt->desc;
|
||||
evt++;
|
||||
}
|
||||
@ -119,7 +108,7 @@ ipmi_get_event_desc(struct sel_event_record * rec)
|
||||
static const char *
|
||||
ipmi_sel_get_sensor_type(unsigned char code)
|
||||
{
|
||||
struct ipmi_sensor_types *st = sensor_types;
|
||||
struct ipmi_event_sensor_types *st = sensor_specific_types;
|
||||
while (st->type) {
|
||||
if (st->code == code)
|
||||
return st->type;
|
||||
@ -128,10 +117,11 @@ ipmi_sel_get_sensor_type(unsigned char code)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
static void
|
||||
ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
@ -189,17 +179,18 @@ static void ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
}
|
||||
}
|
||||
|
||||
static void * ipmi_sel_get_entry(struct ipmi_intf * intf, unsigned short record_id)
|
||||
static struct sel_event_record *
|
||||
ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short * next_id)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
unsigned char msg_data[6];
|
||||
unsigned char type;
|
||||
|
||||
memset(msg_data, 0, 6);
|
||||
msg_data[0] = 0x00; /* no reserve id, not partial get */
|
||||
msg_data[1] = 0x00;
|
||||
memcpy(msg_data+2, &record_id, 2);
|
||||
memcpy(msg_data+2, next_id, sizeof(*next_id));
|
||||
msg_data[4] = 0x00; /* offset */
|
||||
msg_data[5] = 0xff; /* length */
|
||||
|
||||
@ -212,35 +203,145 @@ static void * ipmi_sel_get_entry(struct ipmi_intf * intf, unsigned short record_
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error%x in Get SEL Entry %x Command\n",
|
||||
rsp ? rsp->ccode : 0, record_id);
|
||||
rsp ? rsp->ccode : 0, *next_id);
|
||||
return NULL;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "SEL Entry");
|
||||
|
||||
type = rsp->data[2];
|
||||
if (type < 0xc0) {
|
||||
/* standard SEL event record */
|
||||
return (struct sel_event_record *) rsp->data;
|
||||
*next_id = (rsp->data[1] << 8) | rsp->data[0];
|
||||
|
||||
if (rsp->data[4] >= 0xc0) {
|
||||
printf("Not a standard SEL Entry!\n");
|
||||
return NULL;
|
||||
}
|
||||
else if (type < 0xe0) {
|
||||
/* OEM timestamp record */
|
||||
return (struct sel_oem_record_ts *) rsp->data;
|
||||
}
|
||||
else {
|
||||
/* OEM no-timestamp record */
|
||||
return (struct sel_oem_record_nots *) rsp->data;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return (struct sel_event_record *) &rsp->data[2];
|
||||
}
|
||||
|
||||
static void ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
static char *
|
||||
ipmi_sel_timestamp(unsigned long stamp)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned short reserve_id, next_id;
|
||||
static unsigned char tbuf[40];
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&stamp));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
ipmi_sel_timestamp_date(unsigned long stamp)
|
||||
{
|
||||
static unsigned char tbuf[11];
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&stamp));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
ipmi_sel_timestamp_time(unsigned long stamp)
|
||||
{
|
||||
static unsigned char tbuf[9];
|
||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&stamp));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_std_entry(int num, struct sel_event_record * evt)
|
||||
{
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
if (csv_output)
|
||||
printf("%d,", num);
|
||||
else
|
||||
printf("%4d | ", num);
|
||||
|
||||
if (evt->timestamp < 0x20000000) {
|
||||
printf("Pre-Init Time-stamp");
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
}
|
||||
else {
|
||||
printf("%s", ipmi_sel_timestamp_date(evt->timestamp));
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
|
||||
printf("%s", ipmi_sel_timestamp_time(evt->timestamp));
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
}
|
||||
|
||||
printf("%s #0x%02x", ipmi_sel_get_sensor_type(evt->sensor_type), evt->sensor_num);
|
||||
|
||||
if (csv_output)
|
||||
printf(",%s\n", ipmi_get_event_desc(evt));
|
||||
else
|
||||
printf(" | %s\n", ipmi_get_event_desc(evt));
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_std_entry_verbose(struct sel_event_record * evt)
|
||||
{
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
printf("SEL Record ID : %04x\n",
|
||||
evt->record_id);
|
||||
printf(" Record Type : %02x\n",
|
||||
evt->record_type);
|
||||
printf(" Timestamp : %s\n",
|
||||
ipmi_sel_timestamp(evt->timestamp));
|
||||
printf(" Generator ID : %04x\n",
|
||||
evt->gen_id);
|
||||
printf(" EvM Revision : %02x\n",
|
||||
evt->evm_rev);
|
||||
printf(" Sensor Type : %s\n",
|
||||
ipmi_sel_get_sensor_type(evt->sensor_type));
|
||||
printf(" Sensor Num : %02x\n",
|
||||
evt->sensor_num);
|
||||
printf(" Event Type : %s\n",
|
||||
ipmi_get_event_type(evt->event_type));
|
||||
printf(" Event Direction : %s\n",
|
||||
val2str(evt->event_dir, event_dir_vals));
|
||||
printf(" Event Data : %02x%02x%02x\n",
|
||||
evt->event_data[0], evt->event_data[1], evt->event_data[2]);
|
||||
printf(" Description : %s\n",
|
||||
ipmi_get_event_desc(evt));
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short reserve_id, next_id = 0;
|
||||
int num = 1;
|
||||
struct sel_event_record * evt;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x40;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error%x in Get SEL Info command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "sel_info");
|
||||
|
||||
if (!rsp->data[1]) {
|
||||
printf("SEL has no entries\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x42; /* reserve SEL */
|
||||
@ -256,40 +357,88 @@ static void ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
if (verbose)
|
||||
printf("SEL Reservation ID: %04x\n", reserve_id);
|
||||
|
||||
next_id = 0;
|
||||
while (next_id != 0xffff) {
|
||||
evt = (struct sel_event_record *) ipmi_sel_get_entry(intf, next_id);
|
||||
if (verbose > 1)
|
||||
printf("SEL Next ID: %04x\n", next_id);
|
||||
/* next_id is updated by this function */
|
||||
evt = ipmi_sel_get_std_entry(intf, &next_id);
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
printf("SEL Record ID : %04x\n", evt->record_id);
|
||||
printf(" Record Type : %02x\n", evt->record_type);
|
||||
printf(" Timestamp : %08lx\n", evt->timestamp);
|
||||
printf(" Generator ID : %04x\n", evt->gen_id);
|
||||
printf(" EvM Revision : %02x\n", evt->evm_rev);
|
||||
printf(" Sensor Type : %s\n", ipmi_sel_get_sensor_type(evt->sensor_type));
|
||||
printf(" Sensor Num : %02x\n", evt->sensor_num);
|
||||
printf(" Event Type : %s\n", ipmi_get_event_type(evt->event_type));
|
||||
printf(" Event Direction : %s\n", val2str(evt->event_dir, event_dir_vals));
|
||||
printf(" Event Data : %02x%02x%02x\n",
|
||||
evt->event_data[0], evt->event_data[1], evt->event_data[2]);
|
||||
printf(" Description : %s\n", ipmi_get_event_desc(evt));
|
||||
printf("\n");
|
||||
|
||||
next_id = evt->next_id;
|
||||
break;
|
||||
if (verbose)
|
||||
ipmi_sel_print_std_entry_verbose(evt);
|
||||
else
|
||||
ipmi_sel_print_std_entry(num, evt);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned short
|
||||
ipmi_sel_reserve(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x42; /* reserve SEL */
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x unable to reserve SEL\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return rsp->data[0] | rsp->data[1] << 8;
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sel_clear(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short reserve_id;
|
||||
unsigned char msg_data[6];
|
||||
|
||||
reserve_id = ipmi_sel_reserve(intf);
|
||||
if (reserve_id == 0)
|
||||
return;
|
||||
|
||||
memset(msg_data, 0, 6);
|
||||
msg_data[0] = reserve_id & 0xff;
|
||||
msg_data[1] = reserve_id >> 8;
|
||||
msg_data[2] = 'C';
|
||||
msg_data[3] = 'L';
|
||||
msg_data[4] = 'R';
|
||||
msg_data[5] = 0xaa;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x47; /* clear SEL */
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 6;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x unable to clear SEL\n", rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Clearing SEL. Please allow a few seconds to erase.\n");
|
||||
}
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc)
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "help", 4))
|
||||
printf("SEL Commands: info\n");
|
||||
printf("SEL Commands: info clear list\n");
|
||||
else if (!strncmp(argv[0], "info", 4))
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "list", 4))
|
||||
ipmi_sel_list_entries(intf);
|
||||
else if (!strncmp(argv[0], "clear", 5))
|
||||
ipmi_sel_clear(intf);
|
||||
else
|
||||
printf("Invalid SEL command: %s\n", argv[0]);
|
||||
return 0;
|
143
ipmitool/lib/ipmi_sol.c
Normal file
143
ipmitool/lib/ipmi_sol.c
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sol.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static int ipmi_sol_setup(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[6];
|
||||
|
||||
/* TEST FOR AVAILABILITY */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = SOL_ENABLE_PARAM;
|
||||
data[2] = SOL_ENABLE_FLAG;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_SOL;
|
||||
req.msg.cmd = SET_SOL_CONFIG;
|
||||
req.msg.data = data;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp) {
|
||||
printf("Error in Set SOL Config Command\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rsp->ccode == 0xc1) {
|
||||
printf("Serial Over Lan not supported!\n");
|
||||
return -1;
|
||||
}
|
||||
if (rsp->ccode) {
|
||||
printf("Set Serial Over Lan Config returned %x\n", rsp->ccode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* GET SOL CONFIG */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = SOL_AUTHENTICATION_PARAM;
|
||||
data[2] = 0x00; /* block */
|
||||
data[3] = 0x00; /* selector */
|
||||
req.msg.cmd = GET_SOL_CONFIG;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Get SOL Config command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose > 1)
|
||||
printbuf(rsp->data, rsp->data_len, "SOL Config");
|
||||
|
||||
/* SET SOL CONFIG - AUTHENTICATION */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = SOL_AUTHENTICATION_PARAM;
|
||||
data[2] = SOL_PRIVILEGE_LEVEL_USER | (rsp->data[1] & 0x80);
|
||||
req.msg.cmd = SET_SOL_CONFIG;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Set SOL Config (Authentication) command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* SET SOL CONFIG - BAUD RATE */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = SOL_BAUD_RATE_PARAM;
|
||||
data[2] = SOL_PREFERRED_BAUD_RATE;
|
||||
req.msg.cmd = SET_SOL_CONFIG;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Set SOL Config (Baud Rate) command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "help", 4)) {
|
||||
printf("SOL Commands: setup\n");
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[0], "setup", 5)) {
|
||||
ipmi_sol_setup(intf);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -32,70 +32,29 @@
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
V_MAJ = 1
|
||||
V_MIN = 4
|
||||
V_REV = 1.1
|
||||
VERSION = $(V_MAJ).$(V_MIN).$(V_REV)
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
SUBDIRS = plugins
|
||||
|
||||
PROG = ipmitool
|
||||
SPEC = $(PROG).spec
|
||||
MAN = $(PROG).1
|
||||
OBJS = main.o ipmi_sdr.o ipmi_sel.o ipmi_fru.o ipmi_chassis.o ipmi_lanp.o
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
LIB = libipmitool.a
|
||||
LIB_OBJS= lib/helper.o lib/ipmi_dev.o lib/ipmi_lan.o
|
||||
if IPMIEVD
|
||||
|
||||
CC = gcc
|
||||
RM = rm -f
|
||||
AR = ar rc
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
EXTRA_DIST = bmcautoconf.sh
|
||||
bin_PROGRAMS = ipmievd ipmitool
|
||||
ipmievd_SOURCES = ipmievd.c
|
||||
ipmievd_LDADD = $(top_srcdir)/lib/libipmitool.la
|
||||
ipmievd_LDFLAGS =
|
||||
|
||||
INCLUDE = -I include
|
||||
CFLAGS = -g -Wall -Werror -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
|
||||
LDFLAGS = -L . -lm -lipmitool
|
||||
else
|
||||
|
||||
SBINDIR = $(DESTDIR)/usr/sbin
|
||||
MANDIR = $(DESTDIR)/usr/share/man/man1
|
||||
EXTRA_DIST = bmcautoconf.sh ipmievd.c
|
||||
bin_PROGRAMS = ipmitool
|
||||
|
||||
.PHONY: all
|
||||
all: $(LIB) $(PROG) man
|
||||
endif
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) $(INCLUDE) -o $@ $(OBJS) $(LDFLAGS)
|
||||
ipmitool_SOURCES = ipmitool.c
|
||||
ipmitool_LDADD = $(top_srcdir)/lib/libipmitool.la
|
||||
ipmitool_LDFLAGS =
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
$(AR) $(LIB) $?
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
install: $(PROG)
|
||||
strip $(PROG)
|
||||
install -m755 -o root -g root $(PROG) $(SBINDIR)/$(PROG)
|
||||
|
||||
install-man: man
|
||||
gzip -c $(PROG).1 > $(MANDIR)/$(PROG).1.gz
|
||||
|
||||
clean:
|
||||
-$(RM) $(PROG) $(SPEC) $(MAN) $(LIB)
|
||||
-$(RM) $(OBJS)
|
||||
-$(RM) $(LIB_OBJS)
|
||||
|
||||
dist: clean spec
|
||||
tar -C .. -czf ../$(PROG)-$(VERSION).tar.gz $(PROG)
|
||||
|
||||
man:
|
||||
sed -e "s/@@VERSION@@/$(VERSION)/" $(MAN).in > $(MAN)
|
||||
|
||||
spec:
|
||||
sed -e "s/@@VERSION@@/$(VERSION)/" $(SPEC).in > $(SPEC)
|
||||
|
||||
rpm: spec
|
||||
tar -C .. -czf $(PROG).tar.gz $(PROG); \
|
||||
RPM=`which rpmbuild`; \
|
||||
if [ -z "$$RPM" ]; then RPM=rpm; fi; \
|
||||
$$RPM -ta $(PROG).tar.gz; \
|
||||
rm $(PROG).tar.gz
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c $(@D)/$(<F) -o $(@D)/$(@F)
|
||||
bin_SCRIPTS = bmcautoconf.sh
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# bmcautoconf [interface] [channel]
|
||||
#
|
||||
#
|
||||
@ -35,15 +36,25 @@
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
#
|
||||
|
||||
: ${DEBUG:=0}
|
||||
: ${IFACE:=eth0}
|
||||
: ${CHANNEL:=7}
|
||||
: ${IPMIINTF:=dev}
|
||||
DEBUG=0
|
||||
|
||||
# if the wrong channel is used serious problems could occur
|
||||
# Channel 6 == eth0, top interface on v60x and v65x
|
||||
# Channel 6 == eth1, top interface on LX50
|
||||
# Channel 7 == eth1, bottom interface on v60x and v65x
|
||||
# Channel 7 == eth0, bottom interface on LX50
|
||||
CHANNEL=6
|
||||
IFACE=eth0
|
||||
|
||||
# ipmitool interface
|
||||
# open = OpenIPMI kernel driver
|
||||
# [ipmi_msghandler, ipmi_kcs_drv, ipmi_devintf]
|
||||
# imb = Intel IMB
|
||||
IPMIINTF=open
|
||||
|
||||
# util locations
|
||||
IPMITOOL=/usr/sbin/ipmitool
|
||||
IPMITOOL=/usr/bin/ipmitool
|
||||
PING=/bin/ping
|
||||
ARP=/sbin/arp
|
||||
IFCONFIG=/sbin/ifconfig
|
||||
@ -51,14 +62,18 @@ ROUTE=/sbin/route
|
||||
|
||||
ipmitool_lan_set ()
|
||||
{
|
||||
[ $# -lt 2 ] && return
|
||||
[ $# -lt 1 ] && return
|
||||
PARAM=$1
|
||||
VALUE=$2
|
||||
|
||||
VALUE=
|
||||
[ $# -ge 2 ] && VALUE=$2
|
||||
|
||||
if [ $DEBUG -gt 0 ]; then
|
||||
echo "Setting LAN parameter ${PARAM} to ${VALUE}"
|
||||
echo "$IPMITOOL -I $IPMIINTF lan set $CHANNEL $PARAM $VALUE"
|
||||
fi
|
||||
|
||||
$IPMITOOL -I $IPMIINTF lan set $CHANNEL $PARAM $VALUE
|
||||
}
|
||||
|
||||
if [ ! -x $IPMITOOL ]; then
|
||||
@ -114,8 +129,8 @@ fi
|
||||
|
||||
# Default Route MAC Address
|
||||
# (ping it first to populate arp table)
|
||||
$PING -q -c1 >/dev/null 2>&1
|
||||
DEF_ROUTE_MAC=$( $ARP -an -i $IFACE | grep $DEF_ROUTE_IP | awk '{ print $4 }' )
|
||||
$PING -q -c1 $DEF_ROUTE_IP >/dev/null 2>&1
|
||||
DEF_ROUTE_MAC=$( $ARP -an -i $IFACE | grep "$DEF_ROUTE_IP[^0-9]" | awk '{ print $4 }' )
|
||||
if [ X$DEF_ROUTE_MAC = X ]; then
|
||||
echo "Unable to determine default route MAC address"
|
||||
exit 6
|
||||
@ -127,6 +142,8 @@ ipmitool_lan_set "netmask" $IP_NETMASK
|
||||
ipmitool_lan_set "macaddr" $MAC_ADDRESS
|
||||
ipmitool_lan_set "defgw ipaddr" $DEF_ROUTE_IP
|
||||
ipmitool_lan_set "defgw macaddr" $DEF_ROUTE_MAC
|
||||
ipmitool_lan_set "auth callback,user,operator,admin"
|
||||
ipmitool_lan_set "auth callback,user,operator,admin" "md2,md5"
|
||||
ipmitool_lan_set "access" "on"
|
||||
ipmitool_lan_set "user"
|
||||
|
||||
exit 0
|
255
ipmitool/src/ipmievd.c
Normal file
255
ipmitool/src/ipmievd.c
Normal file
@ -0,0 +1,255 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include <config.h>
|
||||
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi_sel.h>
|
||||
|
||||
extern int errno;
|
||||
int verbose = 0;
|
||||
int csv_output = 0;
|
||||
int num = 0;
|
||||
|
||||
static int enable_event_msg_buffer(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char bmc_global_enables;
|
||||
int r;
|
||||
|
||||
/* we must read/modify/write bmc global enables */
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x2f; /* Get BMC Global Enables */
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("ERROR:%x Get BMC Global Enables command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bmc_global_enables = rsp->data[0] | 0x04;
|
||||
req.msg.cmd = 0x2e; /* Set BMC Global Enables */
|
||||
req.msg.data = &bmc_global_enables;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("ERROR:%x Set BMC Global Enables command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("BMC Event Message Buffer enabled.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void read_event(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_addr addr;
|
||||
struct ipmi_recv recv;
|
||||
unsigned char data[80];
|
||||
int rv;
|
||||
|
||||
recv.addr = (char *) &addr;
|
||||
recv.addr_len = sizeof(addr);
|
||||
recv.msg.data = data;
|
||||
recv.msg.data_len = sizeof(data);
|
||||
|
||||
rv = ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv);
|
||||
if (rv < 0) {
|
||||
if (errno == EINTR)
|
||||
/* abort */
|
||||
return;
|
||||
if (errno == EMSGSIZE) {
|
||||
/* message truncated */
|
||||
recv.msg.data_len = sizeof(data);
|
||||
} else {
|
||||
printf("ERROR: receiving IPMI message: %s\n",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!recv.msg.data || recv.msg.data_len == 0) {
|
||||
printf("ERROR: No data in event!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
printf(" type = %d\n", recv.recv_type);
|
||||
printf(" channel = 0x%x\n", addr.channel);
|
||||
printf(" msgid = %ld\n", recv.msgid);
|
||||
printf(" netfn = 0x%x\n", recv.msg.netfn);
|
||||
printf(" cmd = 0x%x\n", recv.msg.cmd);
|
||||
printf(" data_len = %d\n", recv.msg.data_len);
|
||||
printbuf(recv.msg.data, recv.msg.data_len, "data");
|
||||
}
|
||||
|
||||
if (recv.recv_type != IPMI_ASYNC_EVENT_RECV_TYPE) {
|
||||
printf("ERROR: Not an event!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
ipmi_sel_print_std_entry_verbose((struct sel_event_record *)recv.msg.data);
|
||||
else
|
||||
ipmi_sel_print_std_entry(num++, (struct sel_event_record *)recv.msg.data);
|
||||
}
|
||||
|
||||
static int do_exit(struct ipmi_intf * intf, int rv)
|
||||
{
|
||||
if (intf)
|
||||
intf->close(intf);
|
||||
ipmi_intf_exit();
|
||||
exit(rv);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("usage: ipmievd [-hv]\n");
|
||||
printf("\n");
|
||||
printf(" -h This help\n");
|
||||
printf(" -v Verbose (can use multiple times)\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_intf * intf;
|
||||
int r, i=1, a;
|
||||
struct pollfd pfd;
|
||||
|
||||
while ((a = getopt(argc, (char **)argv, "hv")) != -1) {
|
||||
switch (a) {
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("Loading OpenIPMI interface plugin.\n");
|
||||
|
||||
/* init interface plugin support */
|
||||
r = ipmi_intf_init();
|
||||
if (r < 0) {
|
||||
printf("ERROR: Unable to initialize plugin interface\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* load interface plugin */
|
||||
intf = ipmi_intf_load("intf_open");
|
||||
if (!intf) {
|
||||
printf("ERROR: unable to load OpenIPMI interface plugin\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("Connecting to OpenIPMI device.\n");
|
||||
|
||||
/* open connection to openipmi device */
|
||||
r = intf->open(intf, NULL, 0, NULL, NULL);
|
||||
if (r < 0) {
|
||||
printf("ERROR: Unable to open OpenIPMI device\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* enable event message buffer */
|
||||
r = enable_event_msg_buffer(intf);
|
||||
if (r < 0) {
|
||||
printf("ERROR: Unable to enable event message buffer.\n");
|
||||
do_exit(intf, EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("Enabling event receiver.\n");
|
||||
|
||||
/* enable OpenIPMI event receiver */
|
||||
if (ioctl(intf->fd, IPMICTL_SET_GETS_EVENTS_CMD, &i)) {
|
||||
perror("ERROR: Could not enable event receiver");
|
||||
do_exit(intf, EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("ipmievd loaded, waiting for events...\n");
|
||||
|
||||
for (;;) {
|
||||
pfd.fd = intf->fd; /* wait on openipmi device */
|
||||
pfd.events = POLLIN; /* wait for input */
|
||||
r = poll(&pfd, 1, -1);
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
/* timeout is disabled */
|
||||
break;
|
||||
case -1:
|
||||
perror("ERROR: poll operation failed");
|
||||
do_exit(intf, EXIT_FAILURE);
|
||||
break;
|
||||
default:
|
||||
if (pfd.revents && POLLIN)
|
||||
read_event(intf);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("Exiting.\n");
|
||||
|
||||
do_exit(intf, EXIT_SUCCESS);
|
||||
}
|
@ -40,23 +40,25 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
|
||||
#include <ipmi_dev.h>
|
||||
#include <ipmi_lan.h>
|
||||
|
||||
#include <ipmi_sdr.h>
|
||||
#include <ipmi_sel.h>
|
||||
#include <ipmi_fru.h>
|
||||
#include <ipmi_chassis.h>
|
||||
#include <config.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sdr.h>
|
||||
#include <ipmitool/ipmi_sel.h>
|
||||
#include <ipmitool/ipmi_fru.h>
|
||||
#include <ipmitool/ipmi_sol.h>
|
||||
#include <ipmitool/ipmi_lanp.h>
|
||||
#include <ipmitool/ipmi_chassis.h>
|
||||
#include <ipmitool/ipmi_bmc.h>
|
||||
|
||||
struct ipmi_session lan_session;
|
||||
int csv_output = 0;
|
||||
extern int verbose;
|
||||
int verbose = 0;
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
@ -64,21 +66,24 @@ void usage(void)
|
||||
printf("\n");
|
||||
printf("usage: ipmitool [options...] <command>\n");
|
||||
printf("\n");
|
||||
printf(" -h this help\n");
|
||||
printf(" -h This help\n");
|
||||
printf(" -V Show version information\n");
|
||||
printf(" -v verbose (can use multiple times)\n");
|
||||
printf(" -v Verbose (can use multiple times)\n");
|
||||
printf(" -c CSV output suitable for parsing\n");
|
||||
printf(" -I intf Inteface: lan, dev\n");
|
||||
printf(" -g Attempt to be extra robust in LAN communications\n");
|
||||
printf(" -H hostname Remote host name for LAN interface\n");
|
||||
printf(" -P password Power commands: down, up, cycle, reset, pulse, soft\n");
|
||||
printf("\n");
|
||||
exit(1);
|
||||
printf(" -p port Remote RMCP port (default is 623)\n");
|
||||
printf(" -P password Remote administrator password\n");
|
||||
printf(" -I intf Inteface to use\n");
|
||||
printf("\n\n");
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char netfn, cmd;
|
||||
int i;
|
||||
unsigned char data[32];
|
||||
@ -134,14 +139,101 @@ int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned char userid)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
rqdata[1] = userid & 0x3f;
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x44;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Get User Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Maximum User IDs : %d\n", rsp->data[0] & 0x3f);
|
||||
printf("Enabled User IDs : %d\n", rsp->data[1] & 0x3f);
|
||||
printf("Fixed Name User IDs : %d\n", rsp->data[2] & 0x3f);
|
||||
printf("Access Available : %s\n", (rsp->data[3] & 0x40) ? "callback" : "call-in / callback");
|
||||
printf("Link Authentication : %sabled\n", (rsp->data[3] & 0x20) ? "en" : "dis");
|
||||
printf("IPMI Messaging : %sabled\n", (rsp->data[3] & 0x10) ? "en" : "dis");
|
||||
// printf("Privilege Level : %s\n", val2str(rsp->data[3] & 0x0f, ipmi_privlvl_vals));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_send_platform_event(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[8];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(rqdata, 0, 8);
|
||||
|
||||
#if 0
|
||||
/* System Interface */
|
||||
rqdata[0] = 0x20; /* generator ID */
|
||||
rqdata[1] = 0x04; /* EvMRev */
|
||||
rqdata[2] = 0x01; /* Sensor Type */
|
||||
rqdata[3] = 0x30; /* Sensor # */
|
||||
rqdata[4] = 0x04; /* Event Dir / Event Type */
|
||||
rqdata[5] = 0x00; /* Event Data 1 */
|
||||
rqdata[6] = 0x00; /* Event Data 2 */
|
||||
rqdata[7] = 0x00; /* Event Data 3 */
|
||||
#else
|
||||
/* IPMB/LAN/etc */
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x01; /* Sensor Type */
|
||||
rqdata[2] = 0x30; /* Sensor # */
|
||||
rqdata[3] = 0x04; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x00; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
#endif
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_SE;
|
||||
req.msg.cmd = 0x02;
|
||||
req.msg.data = rqdata;
|
||||
#if 0
|
||||
req.msg.data_len = 8;
|
||||
#else
|
||||
req.msg.data_len = 7;
|
||||
#endif
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Platform Event Message Command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int (*submain)(struct ipmi_intf *, int, char **);
|
||||
struct ipmi_intf * intf = NULL;
|
||||
char * hostname = NULL, * password = NULL;
|
||||
int argflag, rc=0, port = 623;
|
||||
char * hostname = NULL, * password = NULL, * username = NULL;
|
||||
int argflag, i, rc=0, port = 623, pedantic = 0;
|
||||
char intfname[32];
|
||||
|
||||
while ((argflag = getopt(argc, (char **)argv, "hVvcI:H:P:p:")) != -1)
|
||||
if (ipmi_intf_init() < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((argflag = getopt(argc, (char **)argv, "hVvcgI:H:P:U:p:")) != -1)
|
||||
{
|
||||
switch (argflag) {
|
||||
case 'h':
|
||||
@ -151,6 +243,9 @@ int main(int argc, char ** argv)
|
||||
printf("ipmitool version %s\n", VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'g':
|
||||
pedantic = 1;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
@ -158,10 +253,13 @@ int main(int argc, char ** argv)
|
||||
csv_output = 1;
|
||||
break;
|
||||
case 'I':
|
||||
if (!strncmp(optarg, "lan", 3))
|
||||
intf = &ipmi_lan_intf;
|
||||
else if (!strncmp(optarg, "dev", 3))
|
||||
intf = &ipmi_dev_intf;
|
||||
memset(intfname, 0, sizeof(intfname));
|
||||
i = snprintf(intfname, sizeof(intfname), "intf_%s", optarg);
|
||||
intf = ipmi_intf_load(intfname);
|
||||
if (!intf) {
|
||||
printf("Error loading interface %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
hostname = strdup(optarg);
|
||||
@ -169,6 +267,9 @@ int main(int argc, char ** argv)
|
||||
case 'P':
|
||||
password = strdup(optarg);
|
||||
break;
|
||||
case 'U':
|
||||
username = strdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
port = atoi(optarg);
|
||||
break;
|
||||
@ -187,10 +288,21 @@ int main(int argc, char ** argv)
|
||||
usage();
|
||||
}
|
||||
|
||||
intf->pedantic = pedantic;
|
||||
|
||||
if (!strncmp(argv[optind], "help", 4)) {
|
||||
printf("Commands: chassis, fru, lan, sdr, sel\n");
|
||||
goto out_free;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "event", 5)) {
|
||||
if (intf->open(intf, hostname, port, username, password) < 0)
|
||||
goto out_free;
|
||||
ipmi_send_platform_event(intf);
|
||||
goto out_close;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "bmc", 3)) {
|
||||
submain = ipmi_bmc_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "chassis", 7)) {
|
||||
submain = ipmi_chassis_main;
|
||||
}
|
||||
@ -198,7 +310,7 @@ int main(int argc, char ** argv)
|
||||
submain = ipmi_fru_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "lan", 3)) {
|
||||
submain = ipmi_lan_main;
|
||||
submain = ipmi_lanp_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sdr", 3)) {
|
||||
submain = ipmi_sdr_main;
|
||||
@ -206,13 +318,31 @@ int main(int argc, char ** argv)
|
||||
else if (!strncmp(argv[optind], "sel", 3)) {
|
||||
submain = ipmi_sel_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sol", 3)) {
|
||||
submain = ipmi_sol_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "raw", 3)) {
|
||||
submain = ipmi_raw_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "userinfo", 8)) {
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = strtod(argv[optind+1], NULL);
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
ipmi_get_user_access(intf, c, 1);
|
||||
goto out_close;
|
||||
}
|
||||
else {
|
||||
printf("userinfo <channel>\n");
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
else if (!strncmp(argv[optind], "chaninfo", 8)) {
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = strtod(argv[optind+1], NULL);
|
||||
if (intf->open(intf, hostname, port, password) < 0)
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
verbose++;
|
||||
ipmi_get_channel_info(intf, c);
|
||||
@ -234,11 +364,9 @@ int main(int argc, char ** argv)
|
||||
goto out_free;
|
||||
|
||||
if (intf->open) {
|
||||
rc = intf->open(intf, hostname, port, password);
|
||||
if (rc < 0) {
|
||||
printf("unable to open interface\n");
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
|
||||
rc = submain(intf, argc-optind-1, &(argv[optind+1]));
|
||||
@ -247,13 +375,17 @@ int main(int argc, char ** argv)
|
||||
if (intf->close)
|
||||
intf->close(intf);
|
||||
|
||||
ipmi_intf_exit();
|
||||
|
||||
out_free:
|
||||
if (hostname)
|
||||
free(hostname);
|
||||
if (username)
|
||||
free(username);
|
||||
if (password)
|
||||
free(password);
|
||||
|
||||
if (!rc)
|
||||
if (rc >= 0)
|
||||
exit(EXIT_SUCCESS);
|
||||
else
|
||||
exit(EXIT_FAILURE);
|
39
ipmitool/src/plugins/Makefile.am
Normal file
39
ipmitool/src/plugins/Makefile.am
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
plugindir = $(pluginpath)
|
||||
|
||||
SUBDIRS = @PLUGINS@
|
46
ipmitool/src/plugins/lan/Makefile.am
Normal file
46
ipmitool/src/plugins/lan/Makefile.am
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
plugindir = $(pluginpath)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
intf_lan_la_LDFLAGS = -module -avoid-version
|
||||
intf_lan_la_LIBADD = $(top_srcdir)/lib/libipmitool.la
|
||||
intf_lan_la_SOURCES = lan.c lan.h asf.h rmcp.h md5.c md5.h
|
||||
|
||||
plugin_LTLIBRARIES = intf_lan.la
|
||||
|
@ -34,11 +34,11 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef __ASF_H
|
||||
#define __ASF_H
|
||||
#ifndef IPMI_ASF_H
|
||||
#define IPMI_ASF_H
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi_lan.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include "lan.h"
|
||||
|
||||
#define ASF_RMCP_IANA 0x000011be
|
||||
|
||||
@ -70,4 +70,4 @@ struct asf_hdr {
|
||||
|
||||
int handle_asf(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
|
||||
#endif /* __ASF_H */
|
||||
#endif /* IPMI_ASF_H */
|
@ -48,38 +48,33 @@
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_lan.h>
|
||||
#include "lan.h"
|
||||
#include "md5.h"
|
||||
#include "rmcp.h"
|
||||
#include "asf.h"
|
||||
|
||||
#include <rmcp.h>
|
||||
#include <asf.h>
|
||||
|
||||
#define RECV_TIMEOUT 3
|
||||
#define SEND_RETRY 2
|
||||
|
||||
struct ipmi_req_entry * ipmi_req_entries;
|
||||
static struct ipmi_req_entry * ipmi_req_entries_tail;
|
||||
struct ipmi_rq_entry * ipmi_req_entries;
|
||||
static struct ipmi_rq_entry * ipmi_req_entries_tail;
|
||||
|
||||
extern int h_errno;
|
||||
int verbose;
|
||||
|
||||
static int recv_timeout = 1;
|
||||
static int curr_seq;
|
||||
static sigjmp_buf jmpbuf;
|
||||
struct ipmi_session lan_session;
|
||||
|
||||
static int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
static struct ipmi_rsp * ipmi_lan_recv_packet(struct ipmi_intf * intf, int timeout);
|
||||
static struct ipmi_rsp * ipmi_lan_poll_recv(struct ipmi_intf * intf);
|
||||
static struct ipmi_rs * ipmi_lan_recv_packet(struct ipmi_intf * intf);
|
||||
static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf);
|
||||
|
||||
struct ipmi_intf ipmi_lan_intf = {
|
||||
.open = ipmi_lan_open,
|
||||
.close = ipmi_lan_close,
|
||||
.sendrecv = ipmi_lan_send_cmd,
|
||||
.ll_send = ipmi_lan_send_packet,
|
||||
.ll_recv = ipmi_lan_recv_packet,
|
||||
};
|
||||
|
||||
static void
|
||||
@ -88,23 +83,26 @@ query_alarm(int signo)
|
||||
siglongjmp(jmpbuf, 1);
|
||||
}
|
||||
|
||||
static const struct valstr ipmi_privlvl_vals[] = {
|
||||
#if 0
|
||||
const struct valstr ipmi_privlvl_vals[] = {
|
||||
{ IPMI_SESSION_PRIV_CALLBACK, "CALLBACK" },
|
||||
{ IPMI_SESSION_PRIV_USER, "USER" },
|
||||
{ IPMI_SESSION_PRIV_OPERATOR, "OPERATOR" },
|
||||
{ IPMI_SESSION_PRIV_ADMIN, "ADMINISTRATOR" },
|
||||
{ IPMI_SESSION_PRIV_OEM, "OEM" },
|
||||
{ 0xF, "NO ACCESS" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static const struct valstr ipmi_authtype_vals[] = {
|
||||
const struct valstr ipmi_authtype_vals[] = {
|
||||
{ IPMI_SESSION_AUTHTYPE_NONE, "NONE" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD2, "MD2" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD5, "MD5" },
|
||||
{ IPMI_SESSION_AUTHTYPE_KEY, "PASSWORD" },
|
||||
{ IPMI_SESSION_AUTHTYPE_OEM, "OEM" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#endif
|
||||
static const struct valstr ipmi_channel_protocol_vals[] = {
|
||||
{ 0x00, "reserved" },
|
||||
{ 0x01, "IPMB-1.0" },
|
||||
@ -140,10 +138,10 @@ static const struct valstr ipmi_channel_medium_vals[] = {
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
static struct ipmi_req_entry *
|
||||
static struct ipmi_rq_entry *
|
||||
ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
{
|
||||
struct ipmi_req_entry * e = ipmi_req_entries;
|
||||
struct ipmi_rq_entry * e = ipmi_req_entries;
|
||||
while (e && (e->rq_seq != seq || e->req.msg.cmd != cmd)) {
|
||||
if (e == e->next)
|
||||
return NULL;
|
||||
@ -155,7 +153,7 @@ ipmi_req_lookup_entry(unsigned char seq, unsigned char cmd)
|
||||
static void
|
||||
ipmi_req_remove_entry(unsigned char seq, unsigned char cmd)
|
||||
{
|
||||
struct ipmi_req_entry * p, * e;
|
||||
struct ipmi_rq_entry * p, * e;
|
||||
|
||||
e = p = ipmi_req_entries;
|
||||
|
||||
@ -186,7 +184,7 @@ ipmi_req_remove_entry(unsigned char seq, unsigned char cmd)
|
||||
static void
|
||||
ipmi_req_clear_entries(void)
|
||||
{
|
||||
struct ipmi_req_entry * p, * e;
|
||||
struct ipmi_rq_entry * p, * e;
|
||||
|
||||
e = ipmi_req_entries;
|
||||
while (e) {
|
||||
@ -223,25 +221,22 @@ int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, int data
|
||||
|
||||
addrlen = sizeof(intf->addr);
|
||||
|
||||
return sendto(intf->fd, data, data_len, 0,
|
||||
(struct sockaddr *)&intf->addr, addrlen);
|
||||
return send(intf->fd, data, data_len, 0);
|
||||
// (struct sockaddr *)&intf->addr, addrlen);
|
||||
}
|
||||
|
||||
struct ipmi_rsp * ipmi_lan_recv_packet(struct ipmi_intf * intf, int timeout)
|
||||
struct ipmi_rs * ipmi_lan_recv_packet(struct ipmi_intf * intf)
|
||||
{
|
||||
static struct ipmi_rsp rsp;
|
||||
volatile int try;
|
||||
static struct ipmi_rs rsp;
|
||||
int rc;
|
||||
|
||||
/* setup alarm timeout */
|
||||
try = 0;
|
||||
if (sigsetjmp(jmpbuf, 1) != 0 && ++try >= SEND_RETRY) {
|
||||
printf("server is not responding\n");
|
||||
if (sigsetjmp(jmpbuf, 1) != 0) {
|
||||
alarm(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
alarm(timeout);
|
||||
alarm(recv_timeout);
|
||||
rc = recv(intf->fd, &rsp.data, BUF_SIZE, 0);
|
||||
alarm(0);
|
||||
|
||||
@ -256,7 +251,7 @@ struct ipmi_rsp * ipmi_lan_recv_packet(struct ipmi_intf * intf, int timeout)
|
||||
* response is read before the connection refused is returned)
|
||||
*/
|
||||
if (rc < 0) {
|
||||
alarm(timeout);
|
||||
alarm(recv_timeout);
|
||||
rc = recv(intf->fd, &rsp.data, BUF_SIZE, 0);
|
||||
alarm(0);
|
||||
if (rc < 0) {
|
||||
@ -298,7 +293,7 @@ struct ipmi_rsp * ipmi_lan_recv_packet(struct ipmi_intf * intf, int timeout)
|
||||
* asf.data[f:a]= 0x000000000000
|
||||
*/
|
||||
static int
|
||||
ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rsp * rsp)
|
||||
ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
||||
{
|
||||
struct rmcp_pong {
|
||||
struct rmcp_hdr rmcp;
|
||||
@ -352,8 +347,8 @@ ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rsp * rsp)
|
||||
* asf.len = 0x00
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ipmi_ping(struct ipmi_intf * intf)
|
||||
int
|
||||
ipmi_lan_ping(struct ipmi_intf * intf)
|
||||
{
|
||||
struct asf_hdr asf_ping = {
|
||||
.iana = ASF_RMCP_IANA,
|
||||
@ -376,7 +371,7 @@ ipmi_ping(struct ipmi_intf * intf)
|
||||
if (verbose)
|
||||
printf("Sending IPMI/RMCP presence ping packet\n");
|
||||
|
||||
rv = intf->ll_send(intf, data, len);
|
||||
rv = ipmi_lan_send_packet(intf, data, len);
|
||||
|
||||
free(data);
|
||||
|
||||
@ -391,6 +386,47 @@ ipmi_ping(struct ipmi_intf * intf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* special packet, no idea what it does */
|
||||
ipmi_lan_first(struct ipmi_intf * intf)
|
||||
{
|
||||
unsigned char data[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x07, 0x20, 0x18, 0xc8, 0xc2, 0x01, 0x01, 0x3c };
|
||||
ipmi_lan_send_packet(intf, data, 16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_lan_pedantic(struct ipmi_intf * intf)
|
||||
{
|
||||
unsigned char data[10] = "dummy";
|
||||
ipmi_lan_send_packet(intf, data, 10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* multi-session authcode generation for md5
|
||||
* H(password + session_id + msg + session_seq + password)
|
||||
*/
|
||||
unsigned char * ipmi_auth_md5(unsigned char * data, int data_len)
|
||||
{
|
||||
md5_state_t state;
|
||||
static md5_byte_t digest[16];
|
||||
|
||||
md5_init(&state);
|
||||
|
||||
md5_append(&state, (const md5_byte_t *)lan_session.authcode, 16);
|
||||
md5_append(&state, (const md5_byte_t *)&lan_session.id, 4);
|
||||
md5_append(&state, (const md5_byte_t *)data, data_len);
|
||||
md5_append(&state, (const md5_byte_t *)&lan_session.in_seq, 4);
|
||||
md5_append(&state, (const md5_byte_t *)lan_session.authcode, 16);
|
||||
|
||||
md5_finish(&state, digest);
|
||||
|
||||
if (verbose > 3)
|
||||
printf(" MD5 AuthCode : %s\n", buf2str(digest, 16));
|
||||
return digest;
|
||||
}
|
||||
|
||||
unsigned char ipmi_csum(unsigned char * d, int s)
|
||||
{
|
||||
unsigned char c = 0;
|
||||
@ -399,15 +435,15 @@ unsigned char ipmi_csum(unsigned char * d, int s)
|
||||
return -c;
|
||||
}
|
||||
|
||||
static struct ipmi_rsp *
|
||||
static struct ipmi_rs *
|
||||
ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
{
|
||||
struct rmcp_hdr rmcp_rsp;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req_entry * entry;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq_entry * entry;
|
||||
int x, rv;
|
||||
|
||||
rsp = intf->ll_recv(intf, RECV_TIMEOUT);
|
||||
rsp = ipmi_lan_recv_packet(intf);
|
||||
while (rsp) {
|
||||
|
||||
/* parse response headers */
|
||||
@ -421,7 +457,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
|
||||
if (rmcp_rsp.class != RMCP_CLASS_IPMI) {
|
||||
printf("Invalid RMCP class: %x\n", rmcp_rsp.class);
|
||||
rsp = intf->ll_recv(intf, RECV_TIMEOUT);
|
||||
rsp = ipmi_lan_recv_packet(intf);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -474,7 +510,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
} else {
|
||||
if (verbose)
|
||||
printf("WARNING: IPMI Request Match NOT FOUND!\n");
|
||||
rsp = intf->ll_recv(intf, RECV_TIMEOUT);
|
||||
rsp = ipmi_lan_recv_packet(intf);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -519,8 +555,8 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
* | checksum | 1 byte
|
||||
* +--------------------+
|
||||
*/
|
||||
static struct ipmi_req_entry *
|
||||
ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
static struct ipmi_rq_entry *
|
||||
ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
{
|
||||
struct rmcp_hdr rmcp = {
|
||||
.ver = RMCP_VERSION_1,
|
||||
@ -529,14 +565,14 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
};
|
||||
unsigned char * msg;
|
||||
int cs, mp, ap = 0, len = 0, tmp;
|
||||
struct ipmi_req_entry * entry;
|
||||
struct ipmi_rq_entry * entry;
|
||||
|
||||
if (curr_seq >= 64)
|
||||
curr_seq = 0;
|
||||
|
||||
entry = malloc(sizeof(struct ipmi_req_entry));
|
||||
memset(entry, 0, sizeof(struct ipmi_req_entry));
|
||||
memcpy(&entry->req, req, sizeof(struct ipmi_req));
|
||||
entry = malloc(sizeof(struct ipmi_rq_entry));
|
||||
memset(entry, 0, sizeof(struct ipmi_rq_entry));
|
||||
memcpy(&entry->req, req, sizeof(struct ipmi_rq));
|
||||
|
||||
entry->intf = intf;
|
||||
entry->session = &lan_session;
|
||||
@ -618,6 +654,12 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
tmp = len - cs;
|
||||
msg[len++] = ipmi_csum(msg+cs, tmp);
|
||||
|
||||
if (lan_session.active &&
|
||||
lan_session.authtype == IPMI_SESSION_AUTHTYPE_MD5) {
|
||||
unsigned char * d = ipmi_auth_md5(msg+mp, msg[mp-1]);
|
||||
memcpy(msg+ap, d, 16);
|
||||
}
|
||||
|
||||
if (lan_session.in_seq) {
|
||||
lan_session.in_seq++;
|
||||
if (!lan_session.in_seq)
|
||||
@ -630,11 +672,11 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
return entry;
|
||||
}
|
||||
|
||||
struct ipmi_rsp *
|
||||
ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
struct ipmi_rs *
|
||||
ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
{
|
||||
struct ipmi_req_entry * entry;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_rq_entry * entry;
|
||||
struct ipmi_rs * rsp;
|
||||
|
||||
entry = ipmi_lan_build_cmd(intf, req);
|
||||
if (!entry) {
|
||||
@ -642,17 +684,31 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (intf->ll_send(intf, entry->msg_data, entry->msg_len) < 0) {
|
||||
if (ipmi_lan_send_packet(intf, entry->msg_data, entry->msg_len) < 0) {
|
||||
printf("ipmi_lan_send_cmd failed\n");
|
||||
free(entry->msg_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (intf->pedantic)
|
||||
ipmi_lan_pedantic(intf);
|
||||
|
||||
rsp = ipmi_lan_poll_recv(intf);
|
||||
if (!rsp && intf->ll_send(intf, entry->msg_data, entry->msg_len) < 0) {
|
||||
printf("ipmi_lan_send_cmd failed\n");
|
||||
free(entry->msg_data);
|
||||
return NULL;
|
||||
if (!rsp) {
|
||||
if (ipmi_lan_send_packet(intf, entry->msg_data, entry->msg_len) < 0) {
|
||||
printf("ipmi_lan_send_cmd failed\n");
|
||||
free(entry->msg_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (intf->pedantic)
|
||||
ipmi_lan_pedantic(intf);
|
||||
|
||||
rsp = ipmi_lan_poll_recv(intf);
|
||||
if (!rsp) {
|
||||
free(entry->msg_data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free(entry->msg_data);
|
||||
@ -661,11 +717,13 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
return rsp;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
@ -714,8 +772,47 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
printf(" Protocol Vendor ID : %d\n",
|
||||
rsp->data[4] | rsp->data[5] << 8 | rsp->data[6] << 16);
|
||||
|
||||
printf("\n");
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
rqdata[1] = 0x80; /* 0x80=active, 0x40=non-volatile */
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x41;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Get Channel Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Alerting : %sabled\n",
|
||||
(rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n",
|
||||
(rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n",
|
||||
(rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
switch (rsp->data[0] & 0x7) {
|
||||
case 0:
|
||||
printf("disabled\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("pre-boot only\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("always available\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("shared\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IPMI Get Channel Authentication Capabilities Command
|
||||
@ -723,8 +820,8 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
static int
|
||||
ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_E;
|
||||
@ -738,7 +835,8 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp) {
|
||||
printf("error in Get Auth Capabilities Command\n");
|
||||
if (verbose)
|
||||
printf("error in Get Auth Capabilities Command\n");
|
||||
return -1;
|
||||
}
|
||||
if (verbose > 2)
|
||||
@ -759,6 +857,8 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
printf("NONE ");
|
||||
if (rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD2)
|
||||
printf("MD2 ");
|
||||
if (rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD5)
|
||||
printf("MD5 ");
|
||||
if (rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_KEY)
|
||||
printf("KEY ");
|
||||
if (rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_OEM)
|
||||
@ -778,6 +878,10 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
}
|
||||
|
||||
if (lan_session.password &&
|
||||
rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD5) {
|
||||
lan_session.authtype = IPMI_SESSION_AUTHTYPE_MD5;
|
||||
}
|
||||
else if (lan_session.password &&
|
||||
rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_KEY) {
|
||||
lan_session.authtype = IPMI_SESSION_AUTHTYPE_KEY;
|
||||
}
|
||||
@ -803,8 +907,8 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
static int
|
||||
ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[17];
|
||||
|
||||
memset(msg_data, 0, 17);
|
||||
@ -861,8 +965,8 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
||||
static int
|
||||
ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[22];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -954,8 +1058,8 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
static int
|
||||
ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
@ -985,8 +1089,8 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
||||
static int
|
||||
impi_close_session_cmd(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[4];
|
||||
|
||||
if (!lan_session.active)
|
||||
@ -1046,17 +1150,24 @@ ipmi_lan_activate_session(struct ipmi_intf * intf)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = ipmi_ping(intf);
|
||||
/*
|
||||
rc = ipmi_lan_ping(intf);
|
||||
if (rc <= 0) {
|
||||
printf("IPMI not supported!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*/
|
||||
lan_session.privlvl = IPMI_SESSION_PRIV_ADMIN;
|
||||
|
||||
if (intf->pedantic)
|
||||
ipmi_lan_first(intf);
|
||||
|
||||
rc = ipmi_get_auth_capabilities_cmd(intf);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
if (rc < 0) {
|
||||
rc = ipmi_get_auth_capabilities_cmd(intf);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = ipmi_get_session_challenge_cmd(intf);
|
||||
if (rc < 0)
|
||||
@ -1078,12 +1189,13 @@ ipmi_lan_activate_session(struct ipmi_intf * intf)
|
||||
|
||||
void ipmi_lan_close(struct ipmi_intf * intf)
|
||||
{
|
||||
impi_close_session_cmd(intf);
|
||||
if (!intf->abort)
|
||||
impi_close_session_cmd(intf);
|
||||
close(intf->fd);
|
||||
ipmi_req_clear_entries();
|
||||
}
|
||||
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password)
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * username, char * password)
|
||||
{
|
||||
int rc;
|
||||
struct sigaction act;
|
||||
@ -1091,6 +1203,9 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
if (!intf)
|
||||
return -1;
|
||||
|
||||
if (intf->pedantic)
|
||||
recv_timeout = 3;
|
||||
|
||||
if (!hostname) {
|
||||
printf("No hostname specified!\n");
|
||||
return -1;
|
||||
@ -1099,11 +1214,17 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
memset(&lan_session, 0, sizeof(lan_session));
|
||||
curr_seq = 0;
|
||||
|
||||
if (username) {
|
||||
memcpy(lan_session.username, username, strlen(username));
|
||||
}
|
||||
|
||||
if (password) {
|
||||
lan_session.password = 1;
|
||||
memcpy(lan_session.authcode, password, strlen(password));
|
||||
}
|
||||
|
||||
intf->abort = 0;
|
||||
|
||||
/* open port to BMC */
|
||||
memset(&intf->addr, 0, sizeof(struct sockaddr_in));
|
||||
intf->addr.sin_family = AF_INET;
|
||||
@ -1157,3 +1278,8 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
return intf->fd;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf)
|
||||
{
|
||||
*intf = &ipmi_lan_intf;
|
||||
return 0;
|
||||
}
|
73
ipmitool/src/plugins/lan/lan.h
Normal file
73
ipmitool/src/plugins/lan/lan.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_LAN_H
|
||||
#define IPMI_LAN_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define IPMI_LAN_CHANNEL_1 0x07
|
||||
#define IPMI_LAN_CHANNEL_2 0x06
|
||||
#define IPMI_LAN_CHANNEL_E 0x0e
|
||||
|
||||
#define IPMI_SESSION_AUTHTYPE_NONE 0x0
|
||||
#define IPMI_SESSION_AUTHTYPE_MD2 0x1
|
||||
#define IPMI_SESSION_AUTHTYPE_MD5 0x2
|
||||
#define IPMI_SESSION_AUTHTYPE_KEY 0x4
|
||||
#define IPMI_SESSION_AUTHTYPE_OEM 0x5
|
||||
|
||||
#define IPMI_SESSION_PRIV_CALLBACK 0x1
|
||||
#define IPMI_SESSION_PRIV_USER 0x2
|
||||
#define IPMI_SESSION_PRIV_OPERATOR 0x3
|
||||
#define IPMI_SESSION_PRIV_ADMIN 0x4
|
||||
#define IPMI_SESSION_PRIV_OEM 0x5
|
||||
|
||||
extern const struct valstr ipmi_privlvl_vals[];
|
||||
extern const struct valstr ipmi_authtype_vals[];
|
||||
|
||||
extern struct ipmi_session lan_session;
|
||||
unsigned char * ipmi_auth_md5(unsigned char * data, int data_len);
|
||||
unsigned char ipmi_csum(unsigned char * d, int s);
|
||||
|
||||
struct ipmi_rs * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * username, char * password);
|
||||
void ipmi_lan_close(struct ipmi_intf * intf);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
int ipmi_lan_ping(struct ipmi_intf * intf);
|
||||
|
||||
struct ipmi_intf ipmi_lan_intf;
|
||||
|
||||
#endif /*IPMI_LAN_H*/
|
381
ipmitool/src/plugins/lan/md5.c
Normal file
381
ipmitool/src/plugins/lan/md5.c
Normal file
@ -0,0 +1,381 @@
|
||||
/*
|
||||
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
L. Peter Deutsch
|
||||
ghost@aladdin.com
|
||||
|
||||
*/
|
||||
/* $Id: md5.c,v 1.1 2003/11/18 17:56:02 iceblink Exp $ */
|
||||
/*
|
||||
Independent implementation of MD5 (RFC 1321).
|
||||
|
||||
This code implements the MD5 Algorithm defined in RFC 1321, whose
|
||||
text is available at
|
||||
http://www.ietf.org/rfc/rfc1321.txt
|
||||
The code is derived from the text of the RFC, including the test suite
|
||||
(section A.5) but excluding the rest of Appendix A. It does not include
|
||||
any code or documentation that is identified in the RFC as being
|
||||
copyrighted.
|
||||
|
||||
The original and principal author of md5.c is L. Peter Deutsch
|
||||
<ghost@aladdin.com>. Other authors are noted in the change history
|
||||
that follows (in reverse chronological order):
|
||||
|
||||
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
|
||||
either statically or dynamically; added missing #include <string.h>
|
||||
in library.
|
||||
2002-03-11 lpd Corrected argument list for main(), and added int return
|
||||
type, in test program and T value program.
|
||||
2002-02-21 lpd Added missing #include <stdio.h> in test program.
|
||||
2000-07-03 lpd Patched to eliminate warnings about "constant is
|
||||
unsigned in ANSI C, signed in traditional"; made test program
|
||||
self-checking.
|
||||
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
|
||||
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
|
||||
1999-05-03 lpd Original version.
|
||||
*/
|
||||
|
||||
#include "md5.h"
|
||||
#include <string.h>
|
||||
|
||||
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
|
||||
#ifdef ARCH_IS_BIG_ENDIAN
|
||||
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
|
||||
#else
|
||||
# define BYTE_ORDER 0
|
||||
#endif
|
||||
|
||||
#define T_MASK ((md5_word_t)~0)
|
||||
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
|
||||
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
|
||||
#define T3 0x242070db
|
||||
#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
|
||||
#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
|
||||
#define T6 0x4787c62a
|
||||
#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
|
||||
#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
|
||||
#define T9 0x698098d8
|
||||
#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
|
||||
#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
|
||||
#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
|
||||
#define T13 0x6b901122
|
||||
#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
|
||||
#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
|
||||
#define T16 0x49b40821
|
||||
#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
|
||||
#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
|
||||
#define T19 0x265e5a51
|
||||
#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
|
||||
#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
|
||||
#define T22 0x02441453
|
||||
#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
|
||||
#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
|
||||
#define T25 0x21e1cde6
|
||||
#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
|
||||
#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
|
||||
#define T28 0x455a14ed
|
||||
#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
|
||||
#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
|
||||
#define T31 0x676f02d9
|
||||
#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
|
||||
#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
|
||||
#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
|
||||
#define T35 0x6d9d6122
|
||||
#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
|
||||
#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
|
||||
#define T38 0x4bdecfa9
|
||||
#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
|
||||
#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
|
||||
#define T41 0x289b7ec6
|
||||
#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
|
||||
#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
|
||||
#define T44 0x04881d05
|
||||
#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
|
||||
#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
|
||||
#define T47 0x1fa27cf8
|
||||
#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
|
||||
#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
|
||||
#define T50 0x432aff97
|
||||
#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
|
||||
#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
|
||||
#define T53 0x655b59c3
|
||||
#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
|
||||
#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
|
||||
#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
|
||||
#define T57 0x6fa87e4f
|
||||
#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
|
||||
#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
|
||||
#define T60 0x4e0811a1
|
||||
#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
|
||||
#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
|
||||
#define T63 0x2ad7d2bb
|
||||
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
|
||||
|
||||
|
||||
static void
|
||||
md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
|
||||
{
|
||||
md5_word_t
|
||||
a = pms->abcd[0], b = pms->abcd[1],
|
||||
c = pms->abcd[2], d = pms->abcd[3];
|
||||
md5_word_t t;
|
||||
#if BYTE_ORDER > 0
|
||||
/* Define storage only for big-endian CPUs. */
|
||||
md5_word_t X[16];
|
||||
#else
|
||||
/* Define storage for little-endian or both types of CPUs. */
|
||||
md5_word_t xbuf[16];
|
||||
const md5_word_t *X;
|
||||
#endif
|
||||
|
||||
{
|
||||
#if BYTE_ORDER == 0
|
||||
/*
|
||||
* Determine dynamically whether this is a big-endian or
|
||||
* little-endian machine, since we can use a more efficient
|
||||
* algorithm on the latter.
|
||||
*/
|
||||
static const int w = 1;
|
||||
|
||||
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
|
||||
#endif
|
||||
#if BYTE_ORDER <= 0 /* little-endian */
|
||||
{
|
||||
/*
|
||||
* On little-endian machines, we can process properly aligned
|
||||
* data without copying it.
|
||||
*/
|
||||
if (!((data - (const md5_byte_t *)0) & 3)) {
|
||||
/* data are properly aligned */
|
||||
X = (const md5_word_t *)data;
|
||||
} else {
|
||||
/* not aligned */
|
||||
memcpy(xbuf, data, 64);
|
||||
X = xbuf;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if BYTE_ORDER == 0
|
||||
else /* dynamic big-endian */
|
||||
#endif
|
||||
#if BYTE_ORDER >= 0 /* big-endian */
|
||||
{
|
||||
/*
|
||||
* On big-endian machines, we must arrange the bytes in the
|
||||
* right order.
|
||||
*/
|
||||
const md5_byte_t *xp = data;
|
||||
int i;
|
||||
|
||||
# if BYTE_ORDER == 0
|
||||
X = xbuf; /* (dynamic only) */
|
||||
# else
|
||||
# define xbuf X /* (static only) */
|
||||
# endif
|
||||
for (i = 0; i < 16; ++i, xp += 4)
|
||||
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
/* Round 1. */
|
||||
/* Let [abcd k s i] denote the operation
|
||||
a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + F(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
SET(a, b, c, d, 0, 7, T1);
|
||||
SET(d, a, b, c, 1, 12, T2);
|
||||
SET(c, d, a, b, 2, 17, T3);
|
||||
SET(b, c, d, a, 3, 22, T4);
|
||||
SET(a, b, c, d, 4, 7, T5);
|
||||
SET(d, a, b, c, 5, 12, T6);
|
||||
SET(c, d, a, b, 6, 17, T7);
|
||||
SET(b, c, d, a, 7, 22, T8);
|
||||
SET(a, b, c, d, 8, 7, T9);
|
||||
SET(d, a, b, c, 9, 12, T10);
|
||||
SET(c, d, a, b, 10, 17, T11);
|
||||
SET(b, c, d, a, 11, 22, T12);
|
||||
SET(a, b, c, d, 12, 7, T13);
|
||||
SET(d, a, b, c, 13, 12, T14);
|
||||
SET(c, d, a, b, 14, 17, T15);
|
||||
SET(b, c, d, a, 15, 22, T16);
|
||||
#undef SET
|
||||
|
||||
/* Round 2. */
|
||||
/* Let [abcd k s i] denote the operation
|
||||
a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + G(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
SET(a, b, c, d, 1, 5, T17);
|
||||
SET(d, a, b, c, 6, 9, T18);
|
||||
SET(c, d, a, b, 11, 14, T19);
|
||||
SET(b, c, d, a, 0, 20, T20);
|
||||
SET(a, b, c, d, 5, 5, T21);
|
||||
SET(d, a, b, c, 10, 9, T22);
|
||||
SET(c, d, a, b, 15, 14, T23);
|
||||
SET(b, c, d, a, 4, 20, T24);
|
||||
SET(a, b, c, d, 9, 5, T25);
|
||||
SET(d, a, b, c, 14, 9, T26);
|
||||
SET(c, d, a, b, 3, 14, T27);
|
||||
SET(b, c, d, a, 8, 20, T28);
|
||||
SET(a, b, c, d, 13, 5, T29);
|
||||
SET(d, a, b, c, 2, 9, T30);
|
||||
SET(c, d, a, b, 7, 14, T31);
|
||||
SET(b, c, d, a, 12, 20, T32);
|
||||
#undef SET
|
||||
|
||||
/* Round 3. */
|
||||
/* Let [abcd k s t] denote the operation
|
||||
a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + H(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
SET(a, b, c, d, 5, 4, T33);
|
||||
SET(d, a, b, c, 8, 11, T34);
|
||||
SET(c, d, a, b, 11, 16, T35);
|
||||
SET(b, c, d, a, 14, 23, T36);
|
||||
SET(a, b, c, d, 1, 4, T37);
|
||||
SET(d, a, b, c, 4, 11, T38);
|
||||
SET(c, d, a, b, 7, 16, T39);
|
||||
SET(b, c, d, a, 10, 23, T40);
|
||||
SET(a, b, c, d, 13, 4, T41);
|
||||
SET(d, a, b, c, 0, 11, T42);
|
||||
SET(c, d, a, b, 3, 16, T43);
|
||||
SET(b, c, d, a, 6, 23, T44);
|
||||
SET(a, b, c, d, 9, 4, T45);
|
||||
SET(d, a, b, c, 12, 11, T46);
|
||||
SET(c, d, a, b, 15, 16, T47);
|
||||
SET(b, c, d, a, 2, 23, T48);
|
||||
#undef SET
|
||||
|
||||
/* Round 4. */
|
||||
/* Let [abcd k s t] denote the operation
|
||||
a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define I(x, y, z) ((y) ^ ((x) | ~(z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + I(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
SET(a, b, c, d, 0, 6, T49);
|
||||
SET(d, a, b, c, 7, 10, T50);
|
||||
SET(c, d, a, b, 14, 15, T51);
|
||||
SET(b, c, d, a, 5, 21, T52);
|
||||
SET(a, b, c, d, 12, 6, T53);
|
||||
SET(d, a, b, c, 3, 10, T54);
|
||||
SET(c, d, a, b, 10, 15, T55);
|
||||
SET(b, c, d, a, 1, 21, T56);
|
||||
SET(a, b, c, d, 8, 6, T57);
|
||||
SET(d, a, b, c, 15, 10, T58);
|
||||
SET(c, d, a, b, 6, 15, T59);
|
||||
SET(b, c, d, a, 13, 21, T60);
|
||||
SET(a, b, c, d, 4, 6, T61);
|
||||
SET(d, a, b, c, 11, 10, T62);
|
||||
SET(c, d, a, b, 2, 15, T63);
|
||||
SET(b, c, d, a, 9, 21, T64);
|
||||
#undef SET
|
||||
|
||||
/* Then perform the following additions. (That is increment each
|
||||
of the four registers by the value it had before this block
|
||||
was started.) */
|
||||
pms->abcd[0] += a;
|
||||
pms->abcd[1] += b;
|
||||
pms->abcd[2] += c;
|
||||
pms->abcd[3] += d;
|
||||
}
|
||||
|
||||
void
|
||||
md5_init(md5_state_t *pms)
|
||||
{
|
||||
pms->count[0] = pms->count[1] = 0;
|
||||
pms->abcd[0] = 0x67452301;
|
||||
pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
|
||||
pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
|
||||
pms->abcd[3] = 0x10325476;
|
||||
}
|
||||
|
||||
void
|
||||
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
|
||||
{
|
||||
const md5_byte_t *p = data;
|
||||
int left = nbytes;
|
||||
int offset = (pms->count[0] >> 3) & 63;
|
||||
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
||||
|
||||
if (nbytes <= 0)
|
||||
return;
|
||||
|
||||
/* Update the message length. */
|
||||
pms->count[1] += nbytes >> 29;
|
||||
pms->count[0] += nbits;
|
||||
if (pms->count[0] < nbits)
|
||||
pms->count[1]++;
|
||||
|
||||
/* Process an initial partial block. */
|
||||
if (offset) {
|
||||
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
|
||||
memcpy(pms->buf + offset, p, copy);
|
||||
if (offset + copy < 64)
|
||||
return;
|
||||
p += copy;
|
||||
left -= copy;
|
||||
md5_process(pms, pms->buf);
|
||||
}
|
||||
|
||||
/* Process full blocks. */
|
||||
for (; left >= 64; p += 64, left -= 64)
|
||||
md5_process(pms, p);
|
||||
|
||||
/* Process a final partial block. */
|
||||
if (left)
|
||||
memcpy(pms->buf, p, left);
|
||||
}
|
||||
|
||||
void
|
||||
md5_finish(md5_state_t *pms, md5_byte_t digest[16])
|
||||
{
|
||||
static const md5_byte_t pad[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
md5_byte_t data[8];
|
||||
int i;
|
||||
|
||||
/* Save the length before padding. */
|
||||
for (i = 0; i < 8; ++i)
|
||||
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
|
||||
/* Pad to 56 bytes mod 64. */
|
||||
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
|
||||
/* Append the length. */
|
||||
md5_append(pms, data, 8);
|
||||
for (i = 0; i < 16; ++i)
|
||||
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
|
||||
}
|
91
ipmitool/src/plugins/lan/md5.h
Normal file
91
ipmitool/src/plugins/lan/md5.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
L. Peter Deutsch
|
||||
ghost@aladdin.com
|
||||
|
||||
*/
|
||||
/* $Id: md5.h,v 1.1 2003/11/18 17:56:02 iceblink Exp $ */
|
||||
/*
|
||||
Independent implementation of MD5 (RFC 1321).
|
||||
|
||||
This code implements the MD5 Algorithm defined in RFC 1321, whose
|
||||
text is available at
|
||||
http://www.ietf.org/rfc/rfc1321.txt
|
||||
The code is derived from the text of the RFC, including the test suite
|
||||
(section A.5) but excluding the rest of Appendix A. It does not include
|
||||
any code or documentation that is identified in the RFC as being
|
||||
copyrighted.
|
||||
|
||||
The original and principal author of md5.h is L. Peter Deutsch
|
||||
<ghost@aladdin.com>. Other authors are noted in the change history
|
||||
that follows (in reverse chronological order):
|
||||
|
||||
2002-04-13 lpd Removed support for non-ANSI compilers; removed
|
||||
references to Ghostscript; clarified derivation from RFC 1321;
|
||||
now handles byte order either statically or dynamically.
|
||||
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
|
||||
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
|
||||
added conditionalization for C++ compilation from Martin
|
||||
Purschke <purschke@bnl.gov>.
|
||||
1999-05-03 lpd Original version.
|
||||
*/
|
||||
|
||||
#ifndef md5_INCLUDED
|
||||
# define md5_INCLUDED
|
||||
|
||||
/*
|
||||
* This package supports both compile-time and run-time determination of CPU
|
||||
* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
|
||||
* compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
|
||||
* defined as non-zero, the code will be compiled to run only on big-endian
|
||||
* CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
|
||||
* run on either big- or little-endian CPUs, but will run slightly less
|
||||
* efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
|
||||
*/
|
||||
|
||||
typedef unsigned char md5_byte_t; /* 8-bit byte */
|
||||
typedef unsigned int md5_word_t; /* 32-bit word */
|
||||
|
||||
/* Define the state of the MD5 Algorithm. */
|
||||
typedef struct md5_state_s {
|
||||
md5_word_t count[2]; /* message length in bits, lsw first */
|
||||
md5_word_t abcd[4]; /* digest buffer */
|
||||
md5_byte_t buf[64]; /* accumulate block */
|
||||
} md5_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Initialize the algorithm. */
|
||||
void md5_init(md5_state_t *pms);
|
||||
|
||||
/* Append a string to the message. */
|
||||
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
|
||||
|
||||
/* Finish the message and return the digest. */
|
||||
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* md5_INCLUDED */
|
@ -34,11 +34,11 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef __RMCP_H
|
||||
#define __RMCP_H
|
||||
#ifndef IPMI_RMCP_H
|
||||
#define IPMI_RMCP_H
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi_lan.h>
|
||||
#include <ipmitool/helper.h>
|
||||
#include "lan.h"
|
||||
|
||||
#define RMCP_VERSION_1 0x06
|
||||
|
||||
@ -77,4 +77,4 @@ struct rmcp_hdr {
|
||||
|
||||
int handle_rmcp(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
|
||||
#endif /* __RMCP_H */
|
||||
#endif /* IPMI_RMCP_H */
|
46
ipmitool/src/plugins/open/Makefile.am
Normal file
46
ipmitool/src/plugins/open/Makefile.am
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistribution of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistribution in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of Sun Microsystems, Inc. or the names of
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# This software is provided "AS IS," without a warranty of any kind.
|
||||
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
# You acknowledge that this software is not designed or intended for use
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
plugindir = $(pluginpath)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
intf_open_la_LDFLAGS = -module -avoid-version
|
||||
intf_open_la_LIBADD = $(top_srcdir)/lib/libipmitool.la
|
||||
intf_open_la_SOURCES = open.c open.h
|
||||
|
||||
plugin_LTLIBRARIES = intf_open.la
|
||||
|
@ -40,36 +40,38 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_dev.h>
|
||||
#include <helper.h>
|
||||
|
||||
#include "open.h"
|
||||
|
||||
static int curr_seq;
|
||||
extern int verbose;
|
||||
|
||||
struct ipmi_intf ipmi_dev_intf = {
|
||||
.open = ipmi_dev_open,
|
||||
.close = ipmi_dev_close,
|
||||
.sendrecv = ipmi_dev_send_cmd,
|
||||
struct ipmi_intf ipmi_openipmi_intf = {
|
||||
.open = ipmi_openipmi_open,
|
||||
.close = ipmi_openipmi_close,
|
||||
.sendrecv = ipmi_openipmi_send_cmd,
|
||||
};
|
||||
|
||||
void ipmi_dev_close(struct ipmi_intf * intf)
|
||||
void ipmi_openipmi_close(struct ipmi_intf * intf)
|
||||
{
|
||||
if (intf && intf->fd >= 0)
|
||||
close(intf->fd);
|
||||
}
|
||||
|
||||
int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2)
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2, char * __unused3)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (!dev)
|
||||
intf->fd = open("/dev/ipmi/0", O_RDWR);
|
||||
intf->fd = open(OPENIPMI_DEV, O_RDWR);
|
||||
else
|
||||
intf->fd = open(dev, O_RDWR);
|
||||
|
||||
@ -88,17 +90,20 @@ int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __u
|
||||
return intf->fd;
|
||||
}
|
||||
|
||||
struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
struct ipmi_rs * ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
{
|
||||
struct ipmi_recv recv;
|
||||
struct ipmi_addr addr;
|
||||
struct ipmi_system_interface_addr bmc_addr;
|
||||
static struct ipmi_rsp rsp;
|
||||
struct ipmi_req _req;
|
||||
static struct ipmi_rs rsp;
|
||||
fd_set rset;
|
||||
|
||||
if (!req)
|
||||
return NULL;
|
||||
|
||||
memset(&_req, 0, sizeof(struct ipmi_req));
|
||||
|
||||
if (verbose > 2)
|
||||
printbuf(req->msg.data, req->msg.data_len, "send_ipmi_cmd_dev");
|
||||
|
||||
@ -108,11 +113,17 @@ struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * r
|
||||
bmc_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
|
||||
bmc_addr.channel = IPMI_BMC_CHANNEL;
|
||||
bmc_addr.lun = 0;
|
||||
req->addr = (char *) &bmc_addr;
|
||||
req->addr_len = sizeof(bmc_addr);
|
||||
req->msgid = curr_seq++;
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SEND_COMMAND, req) < 0) {
|
||||
_req.addr = (char *) &bmc_addr;
|
||||
_req.addr_len = sizeof(bmc_addr);
|
||||
_req.msgid = curr_seq++;
|
||||
|
||||
_req.msg.netfn = req->msg.netfn;
|
||||
_req.msg.cmd = req->msg.cmd;
|
||||
_req.msg.data = req->msg.data;
|
||||
_req.msg.data_len = req->msg.data_len;
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SEND_COMMAND, &_req) < 0) {
|
||||
printf("Error sending command: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
@ -162,3 +173,8 @@ struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * r
|
||||
return &rsp;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf)
|
||||
{
|
||||
*intf = &ipmi_openipmi_intf;
|
||||
return 0;
|
||||
}
|
48
ipmitool/src/plugins/open/open.h
Normal file
48
ipmitool/src/plugins/open/open.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_OPENIPMI_H
|
||||
#define IPMI_OPENIPMI_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define OPENIPMI_DEV "/dev/ipmi0"
|
||||
|
||||
struct ipmi_rs * ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2, char * __unused3);
|
||||
void ipmi_openipmi_close(struct ipmi_intf * intf);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user