diff options
52 files changed, 691 insertions, 590 deletions
diff --git a/.configure.ac.swp b/.configure.ac.swp Binary files differdeleted file mode 100644 index b01444d..0000000 --- a/.configure.ac.swp +++ /dev/null @@ -4137,3 +4137,38 @@ wdt.8 iwdt.8 (ipmiutil wdt) ipmi_port (ipmi_port) ver 1.4 +04/29/2016 ARCress ipmiutil-2.9.9 changes + util/ihealth.c - skip get_chan_auth if vendor Giga-Byte (handle fw bug) + util/subs.c - show vendor Giga-Byte in get_iana_str + util/isensor.c - show Intel full sensor as Absent if (sens[2] == 0xc7) + util/idiscover.c - v1.11 allow .0 if fBroadCastOK (-a -b) + Makefile.am - remove more temp files when making tarball + doc/ipmiutil.spec - refine detection if IPMI is present, + add BuildRequires: systemd-units for epel7 RH#1318393 + scripts/ipmiutil_wdt - add >/dev/null to avoid extra root mail + util/ipmilan.c - retry for WSAECONNRESET(10054) also + util/ipmimv.c - set FD_CLOEXEC + util/ipmicmd.c - add ERR_SDR_MALFORMED to decode_rv + util/ipmicmd.h - add ERR_SDR_MALFORMED + util/isensor.c - set ERR_SDR_MALFORMED if bad SDR data returned, + add -k option for num sec loop delay, + abort if ReservationID retry fails, + with -j try to create SDR file if not there + doc/isensor.8 - update with -j description + doc/UserGuide - update with -j description + doc/ipmiutil.spec - do not chkconfig --add ipmiutil_wdt + util/idcmi.c - handle if mc_id is truncated + util/iekanalyzer.c - stub out unless configure --enable-ekanalyzer + configure.ac - add ekanalyzer option + util/oem_supermicro.c - fix Supermicro dimm decoding + scripts/ipmi.init.basic - do not start ipmi_watchdog if Supermicro + lib/lanplus/lanplus.c - enable cipher 15,16 if HAVE_SHA256 + util/*.c - changes to reduce compile warnings + ipmiutil-2.9.9 contains: + ipmiutil (ipmiutil) ver 2.99 + ...(various subcommands) ver 2.99 + ifwum (ipmiutil fwum) ver 1.3 + ihpm (ipmiutil hpm) ver 1.09 + iekanalyzer (ipmiutil ekanalyzer) ver 1.00 + idiscover (ipmiutil discover) ver 1.11 + ipmi_port (ipmi_port) ver 1.4 diff --git a/Makefile.am b/Makefile.am index 92a03ce..7abc355 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,14 +29,15 @@ tarball: rm -rf $(TMPDIR) mkdir -p $(TMPDIR) find . -print | cpio -pdumv $(TMPDIR) - rm -f $(TMPDIR)/lib/libipmiapi*.a* cd $(TMPDIR)/test; make clean; cd .. cd $(TMPDIR)/hpiutil; make clean; cd .. cd $(TMPDIR); make distclean + cd $(TMPDIR); rm -f lib/libipmiapi*.a* lib/libipmi*.a cd $(TMPDIR); rm -rf autom4te.cache cd $(TMPDIR); rm -f util/events cd $(TMPDIR); sed -i 's/\r//' ChangeLog AUTHORS COPYING NEWS README TODO doc/UserGuide cd $(TMPDIR); chmod 644 doc/UserGuide + cd $(TMPDIR); rm -f cprpm debug*.list *~ .*.swp cd $(TMPDIR); find . -name '*.orig' -delete cd $(TMPDIR); find . -name '*.rej' -delete cd $(TMPDIR); cd ..; tar -czvf $(TARDIR)/$(PNAME).tar.gz $(PNAME) diff --git a/Makefile.in b/Makefile.in index 0f65e8c..3157e1a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -759,14 +759,15 @@ tarball: rm -rf $(TMPDIR) mkdir -p $(TMPDIR) find . -print | cpio -pdumv $(TMPDIR) - rm -f $(TMPDIR)/lib/libipmiapi*.a* cd $(TMPDIR)/test; make clean; cd .. cd $(TMPDIR)/hpiutil; make clean; cd .. cd $(TMPDIR); make distclean + cd $(TMPDIR); rm -f lib/libipmiapi*.a* lib/libipmi*.a cd $(TMPDIR); rm -rf autom4te.cache cd $(TMPDIR); rm -f util/events cd $(TMPDIR); sed -i 's/\r//' ChangeLog AUTHORS COPYING NEWS README TODO doc/UserGuide cd $(TMPDIR); chmod 644 doc/UserGuide + cd $(TMPDIR); rm -f cprpm debug*.list *~ .*.swp cd $(TMPDIR); find . -name '*.orig' -delete cd $(TMPDIR); find . -name '*.rej' -delete cd $(TMPDIR); cd ..; tar -czvf $(TARDIR)/$(PNAME).tar.gz $(PNAME) diff --git a/config.h.in~ b/config.h.in~ deleted file mode 100644 index 8e5136e..0000000 --- a/config.h.in~ +++ /dev/null @@ -1,121 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* if socklen_t is defined, make note of it */ -#undef HAVE_SOCKLEN_T - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcspn' function. */ -#undef HAVE_STRCSPN - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strspn' function. */ -#undef HAVE_STRSPN - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define to 1 if you have the <syslog.h> header file. */ -#undef HAVE_SYSLOG_H - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if the system has the type `wchar_t'. */ -#undef HAVE_WCHAR_T - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Version number of package */ -#undef VERSION - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long' if <sys/types.h> does not define. */ -#undef off_t - -/* if socklen_t is not defined, provide something useful */ -#undef socklen_t @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for ipmiutil 2.9.8. +# Generated by GNU Autoconf 2.63 for ipmiutil 2.9.9. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ipmiutil' PACKAGE_TARNAME='ipmiutil' -PACKAGE_VERSION='2.9.8' -PACKAGE_STRING='ipmiutil 2.9.8' +PACKAGE_VERSION='2.9.9' +PACKAGE_STRING='ipmiutil 2.9.9' PACKAGE_BUGREPORT='' ac_unique_file="util/ipmiutil.c" @@ -934,6 +934,7 @@ enable_libtool_lock enable_landesk enable_lanplus enable_sha256 +enable_ekanalyzer enable_useflags enable_standalone enable_libsensors @@ -1502,7 +1503,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ipmiutil 2.9.8 to adapt to many kinds of systems. +\`configure' configures ipmiutil 2.9.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1572,7 +1573,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ipmiutil 2.9.8:";; + short | recursive ) echo "Configuration of ipmiutil 2.9.9:";; esac cat <<\_ACEOF @@ -1590,6 +1591,7 @@ Optional Features: --enable-landesk adds landesk library support [default=no] --disable-lanplus disable lanplus support [default=enabled] --enable-sha256 build with SHA256 support, requires later openssl. + --enable-ekanalyzer build with ekanalyzer function enabled. --enable-useflags include environment CFLAGS and LDFLAGS. --enable-standalone build standalone, with no GPL or LanPlus libs. --enable-libsensors build libipmiutil with sensor modules [default=no] @@ -1681,7 +1683,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ipmiutil configure 2.9.8 +ipmiutil configure 2.9.9 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1695,7 +1697,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ipmiutil $as_me 2.9.8, which was +It was created by ipmiutil $as_me 2.9.9, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2549,7 +2551,7 @@ fi # Define the identity of the package. PACKAGE='ipmiutil' - VERSION='2.9.8' + VERSION='2.9.9' cat >>confdefs.h <<_ACEOF @@ -6634,13 +6636,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6637: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6639: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6640: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6642: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6643: output\"" >&5) + (eval echo "\"\$as_me:6645: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7834,7 +7836,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7837 "configure"' > conftest.$ac_ext + echo '#line 7839 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9199,11 +9201,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9202: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9204: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9206: \$? = $ac_status" >&5 + echo "$as_me:9208: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9538,11 +9540,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9541: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9543: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9545: \$? = $ac_status" >&5 + echo "$as_me:9547: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9643,11 +9645,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9646: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9648: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9650: \$? = $ac_status" >&5 + echo "$as_me:9652: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9698,11 +9700,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9701: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9703: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9705: \$? = $ac_status" >&5 + echo "$as_me:9707: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12501,7 +12503,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12504 "configure" +#line 12506 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12597,7 +12599,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12600 "configure" +#line 12602 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13078,6 +13080,15 @@ if test "${enable_sha256+set}" = set; then fi +# Check whether --enable-ekanalyzer was given. +if test "${enable_ekanalyzer+set}" = set; then + enableval=$enable_ekanalyzer; if test "x$enableval" = "xyes"; then + OS_CFLAGS="$OS_CFLAGS -DHAVE_EKANAL" + fi + +fi + + GPL_CFLAGS="" CROSS_LFLAGS="" CROSS_CFLAGS="" @@ -13271,7 +13282,8 @@ else tmpc=/tmp/tmp.c tmpo=/tmp/tmp.o echo $ECHO_N "checking compile sign warning flags ... $ECHO_C" - cfwarn="-Wno-pointer-sign -Wno-sign-conversion -Wunused-result" + cfwarn="-Wno-pointer-sign -Wno-sign-conversion" + # want "-Wno-unused-result", but unrecognized echo "int main() { return(1); }" >$tmpc $CC -o $tmpo -c $cfwarn $tmpc >/dev/null 2>&1 if test $? -ne 0 ; then @@ -13919,7 +13931,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ipmiutil $as_me 2.9.8, which was +This file was extended by ipmiutil $as_me 2.9.9, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13982,7 +13994,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -ipmiutil config.status 2.9.8 +ipmiutil config.status 2.9.9 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 345a344..ab41768 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(ipmiutil,2.9.8) +AC_INIT(ipmiutil,2.9.9) AC_CONFIG_SRCDIR(util/ipmiutil.c) echo "ipmiutil version ${PACKAGE_VERSION}" AM_CONFIG_HEADER(config.h) @@ -136,6 +136,14 @@ AC_ARG_ENABLE([sha256], fi] ) +dnl configure for EKANALYZER, build with ekanalyzer function enabled +AC_ARG_ENABLE([ekanalyzer], + [ --enable-ekanalyzer build with ekanalyzer function enabled.], + [if test "x$enableval" = "xyes"; then + OS_CFLAGS="$OS_CFLAGS -DHAVE_EKANAL" + fi] + ) + GPL_CFLAGS="" CROSS_LFLAGS="" CROSS_CFLAGS="" @@ -312,7 +320,8 @@ else tmpc=/tmp/tmp.c tmpo=/tmp/tmp.o echo $ECHO_N "checking compile sign warning flags ... $ECHO_C" - cfwarn="-Wno-pointer-sign -Wno-sign-conversion -Wunused-result" + cfwarn="-Wno-pointer-sign -Wno-sign-conversion" + # want "-Wno-unused-result", but unrecognized echo "int main() { return(1); }" >$tmpc $CC -o $tmpo -c $cfwarn $tmpc >/dev/null 2>&1 if test $? -ne 0 ; then diff --git a/debpkg/changelog b/debpkg/changelog index 6ff9cc1..50930f7 100644 --- a/debpkg/changelog +++ b/debpkg/changelog @@ -1,3 +1,9 @@ +ipmiutil (2.9.9-1) unstable; urgency=low + + * New upstream version. + + -- Andy Cress <arcress@users.sourceforge.net> Wed, 20 Jan 2016 22:48:40 -0500 + ipmiutil (2.9.8-1) unstable; urgency=low * New upstream version. diff --git a/doc/Makefile b/doc/Makefile index dbb2ee0..4c9b615 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -46,12 +46,12 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run aclocal-1.11 -AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run tar +ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run aclocal-1.11 +AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run tar AR = ar -AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoconf -AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoheader -AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run automake-1.11 +AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoconf +AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoheader +AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run automake-1.11 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -99,13 +99,13 @@ LIB_DIR = /usr/lib64 LIPO = LN_S = ln -s LTLIBOBJS = -MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run makeinfo +MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run makeinfo MKDIR_P = /bin/mkdir -p NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o -OS_CFLAGS = -DLINUX -fPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 +OS_CFLAGS = -DLINUX -fPIC -Wno-pointer-sign -Wno-sign-conversion -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 OS_DRIVERS = imbapi.c ipmimv.c ipmild.c ipmidir.c OS_LFLAGS = OTOOL = @@ -113,9 +113,9 @@ OTOOL64 = PACKAGE = ipmiutil PACKAGE_BUGREPORT = PACKAGE_NAME = ipmiutil -PACKAGE_STRING = ipmiutil 2.9.8 +PACKAGE_STRING = ipmiutil 2.9.9 PACKAGE_TARNAME = ipmiutil -PACKAGE_VERSION = 2.9.8 +PACKAGE_VERSION = 2.9.9 PATH_SEPARATOR = : PKG_DIR = /root/rpmbuild RANLIB = ranlib @@ -127,11 +127,11 @@ SHR_LINK = libipmiutil.so.1 STRIP = strip SUBDIR_S = doc scripts lib util SYSTEMD_DIR = /usr/share/ipmiutil -VERSION = 2.9.8 -abs_builddir = /usr/dev/ipmiutil-2.9.8/doc -abs_srcdir = /usr/dev/ipmiutil-2.9.8/doc -abs_top_builddir = /usr/dev/ipmiutil-2.9.8 -abs_top_srcdir = /usr/dev/ipmiutil-2.9.8 +VERSION = 2.9.9 +abs_builddir = /usr/dev/ipmiutil-2.9.9/doc +abs_srcdir = /usr/dev/ipmiutil-2.9.9/doc +abs_top_builddir = /usr/dev/ipmiutil-2.9.9 +abs_top_srcdir = /usr/dev/ipmiutil-2.9.9 ac_ct_CC = gcc ac_ct_DUMPBIN = am__include = include @@ -159,7 +159,7 @@ host_vendor = redhat htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.8/install-sh +install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.9/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale diff --git a/doc/UserGuide b/doc/UserGuide index fef91aa..142ecb2 100644 --- a/doc/UserGuide +++ b/doc/UserGuide @@ -1,6 +1,6 @@ IPMIUTIL USER GUIDE - VERSION 2.9.8 + VERSION 2.9.9 An easy-to-use IPMI server management utility @@ -2088,7 +2088,7 @@ NAME ipmiutil_sensor - show Sensor Data Records SYNOPSIS - ipmiutil sensor [-abcdefgmpqrstuvwx -i id -n snum -h tval -l tval + ipmiutil sensor [-abcdefgjkmpqrstuvwxL -i id -n snum -h tval -l tval -NUPREFJTVY] @@ -2118,141 +2118,157 @@ OPTIONS information is shown. (same as -s). -d <file> - Dump the SDRs to a specified binary file. + Dump the SDRs to a specified binary file. This file can be used + with -j to jumpstart getting the sensor readings. - -e Show Every SDR in a bladed system by traversing the child MCs + -e Show Every SDR in a bladed system by traversing the child MCs (same as -b). -f <file> - Restore the SDRs from the specified binary File. This is nor- + Restore the SDRs from the specified binary File. This is nor- mally only done with the initial factory provisioning. -g sens_type Shows only those SDRs matching the given sensor type group. The - sens_type string can be "fan", "temp", "voltage", or any string - or substring matching those in the IPMI 2.0 Table 42-3 for Sen- - sor Types. Multiple types can be listed, separated by a comma + sens_type string can be "fan", "temp", "voltage", or any string + or substring matching those in the IPMI 2.0 Table 42-3 for Sen- + sor Types. Multiple types can be listed, separated by a comma (,) but no spaces. -h tval - Highest threshold value to set for the specified sensor. This - tval can be in decimal, or of the form 0x1a, to match the raw - reading value shown by sensor following the " = ". The value + Highest threshold value to set for the specified sensor. This + tval can be in decimal, or of the form 0x1a, to match the raw + reading value shown by sensor following the " = ". The value passed is set as the non-critical threshold value, with the more - critical ones set by the utility as incrementally lower. This - simplifies the interface and ensures that the threshold values - do not get out of order. This requires specifying the sensor + critical ones set by the utility as incrementally lower. This + simplifies the interface and ensures that the threshold values + do not get out of order. This requires specifying the sensor number via -n. - -i ID Show or set only the sensor Index corresponding to ID, where ID - is the hex ID of the SDR as shown in the sensor output under - "_ID_". The ID argument can be one hex number (e.g. 0x0e or - 0e), or a range of hex numbers (e.g. 0e-1a or 1a,2a or + -i ID Show or set only the sensor Index corresponding to ID, where ID + is the hex ID of the SDR as shown in the sensor output under + "_ID_". The ID argument can be one hex number (e.g. 0x0e or + 0e), or a range of hex numbers (e.g. 0e-1a or 1a,2a or 0x0e-0x2a). This is useful to repeatedly view just a few sensor - readings for changes, or to set just one sensor quickly without + readings for changes, or to set just one sensor quickly without reading all of the SDRs. + -j file + Jump-start by caching the SDRs from a file. This uses an SDR + binary file to read the SDRs, so that only the sensor readings + need to be read from the firmware. This avoids getting the SDR + reservation and reading each SDR, so it makes getting the sensor + readings more efficient. The SDR binary file can be created + using the -d option to dump the SDRs to a file, or -j will try + to create the file if not there. + + -k K + When looping with -L, wait K seconds between loops. Default is + 1 second. + -l tval - Lowest threshold value to set for the specified sensor. This - tval can be in decimal, or of the form 0x1a, to match the raw - reading value shown by sensor following the " = ". The value + Lowest threshold value to set for the specified sensor. This + tval can be in decimal, or of the form 0x1a, to match the raw + reading value shown by sensor following the " = ". The value passed is set as the non-critical threshold value, with the more - critical ones set by the utility as incrementally higher. This - simplifies the interface and ensures that the threshold values - do not get out of order. This requires specifying the sensor + critical ones set by the utility as incrementally higher. This + simplifies the interface and ensures that the threshold values + do not get out of order. This requires specifying the sensor number via -n. -m 002000s - Show SDRs for a specific MC (e.g. bus 00, sa 20, lun 00). This - could be used for PICMG or ATCA blade systems. The trailing - character, if present, indicates SMI addressing if ’s’, or IPMB + Show SDRs for a specific MC (e.g. bus 00, sa 20, lun 00). This + could be used for PICMG or ATCA blade systems. The trailing + character, if present, indicates SMI addressing if ’s’, or IPMB addressing if ’i’ or not present. -n snum - Number of the sensor to set. This num can be in decimal, or of - the form 0x1a, to match the value shown by sensor following the - "snum" tag. This is required if setting hi/lo thresholds via + Number of the sensor to set. This num can be in decimal, or of + the form 0x1a, to match the value shown by sensor following the + "snum" tag. This is required if setting hi/lo thresholds via -h/-l. - -o Output the memory DIMM information from SMBIOS, including size. + -o Output the memory DIMM information from SMBIOS, including size. Not available if using IPMI LAN via -N. Sample output: Memory Device (0,0): DIMM_A1 : size=2048MB Memory Device (0,1): DIMM_A2 : not present - -p Persist the threshold being set (as specified via -l or -h). - This writes a "sensor -i" script line to the file + -p Persist the threshold being set (as specified via -l or -h). + This writes a "sensor -i" script line to the file /usr/share/ipmiutil/thresholds.sh, which can then be executed at - each reboot by starting the /etc/init.d/ipmi_port service for - the desired runlevels. For Windows, the filename is thresh- + each reboot by starting the /etc/init.d/ipmi_port service for + the desired runlevels. For Windows, the filename is thresh- olds.cmd. - -q Show any thresholds for each sensor in short format with ’:’ - delimiters, useful as an example for setting thresholds with - ’-u’. + -q Show threshold values in d:d:d format. Thresholds are shown for + each sensor in short format with ’:’ delimiters, which is useful + as an example for setting thresholds with ’-u’. -r Show Raw SDR bytes also. - -s Show sensor list in a simpler/canonical format without uninter- + -s Show sensor list in a simpler/canonical format without uninter- preted binary values. Only the user-friendly interpreted sensor information is shown. (same as -c). -t Show any Thresholds for each sensor also, in text format. - -u Set unique threshold values. The values are specified in a - string of threshold values. It can be in raw hex characters or - in float values. All 6 possible thresholds must be specified, - but only the ones that are valid for this sensor will be + -u Set unique threshold values. The values are specified in a + string of threshold values. It can be in raw hex characters or + in float values. All 6 possible thresholds must be specified, + but only the ones that are valid for this sensor will be applied. These values are validated for ordering. For example: -u 6:5:4:60:65:69 (float) or -u 0x0605043c4145 (raw hex) - would mean 0x06=noncrit_lo, 0x05=crit_lo, 0x04=nonrec_lo, + would mean 0x06=noncrit_lo, 0x05=crit_lo, 0x04=nonrec_lo, 0x3c=noncrit_hi, 0x41=crit_hi, 0x45=nonrec_hi. - -v Show Verbose output, including volatile thresholds, SDR thresh- + -v Show Verbose output, including volatile thresholds, SDR thresh- olds, max/min, hysteresis, and BMC_TAM decoding. - -w Wrap the threshold data onto the same line as the sensor. This + -w Wrap the threshold data onto the same line as the sensor. This may be convenient for scripting. -x Causes eXtra debug messages to be displayed. - -L n Loop n times. This is useful along with -i. Default is one - loop. + -L n Loop n times every K seconds. Default is one loop and K defaults + to 1 second. See option -k to change K seconds if desired. + This is useful along with -i or -g to read some sensors as they + change. Using -j with this option makes run it quicker. -N nodename - Nodename or IP address of the remote target system. If a node- - name is specified, IPMI LAN interface is used. Otherwise the + Nodename or IP address of the remote target system. If a node- + name is specified, IPMI LAN interface is used. Otherwise the local system management interface is used. -P/-R rmt_pswd - Remote password for the nodename given. The default is a null + Remote password for the nodename given. The default is a null password. -U rmt_user - Remote username for the nodename given. The default is a null + Remote username for the nodename given. The default is a null username. -E Use the remote password from Environment variable IPMI_PASSWORD. -F drv_t - Force the driver type to one of the followng: imb, va, open, + Force the driver type to one of the followng: imb, va, open, gnu, landesk, lan, lan2, lan2i, kcs, smb. Note that lan2i means - lan2 with intelplus. The default is to detect any available + lan2 with intelplus. The default is to detect any available driver type and use it. - -J Use the specified LanPlus cipher suite (0 thru 17): - 0=none/none/none, 1=sha1/none/none, 2=sha1/sha1/none, + -J Use the specified LanPlus cipher suite (0 thru 17): + 0=none/none/none, 1=sha1/none/none, 2=sha1/sha1/none, 3=sha1/sha1/cbc128, 4=sha1/sha1/xrc4_128, 5=sha1/sha1/xrc4_40, 6=md5/none/none, ... 14=md5/md5/xrc4_40. Default is 3. - -T Use a specified IPMI LAN Authentication Type: 0=None, 1=MD2, + -T Use a specified IPMI LAN Authentication Type: 0=None, 1=MD2, 2=MD5, 4=Straight Password, 5=OEM. - -V Use a specified IPMI LAN privilege level. 1=Callback level, + -V Use a specified IPMI LAN privilege level. 1=Callback level, 2=User level, 3=Operator level, 4=Administrator level (default), 5=OEM level. - -Y Yes, do prompt the user for the IPMI LAN remote password. + -Y Yes, do prompt the user for the IPMI LAN remote password. Alternatives for the password are -E or -P. @@ -2263,11 +2279,11 @@ EXAMPLES -- BMC version 0.17, IPMI version 2.0 _ID_ SDR_Type_xx ET Own Typ S_Num Sens_Description Hex & Interp Read- ing - 000b SDR Full 01 01 20 a 01 snum 30 Baseboard Temp = 2e OK 46.00 + 000b SDR Full 01 01 20 a 01 snum 30 Baseboard Temp = 2e OK 46.00 degrees C - 000e SDR Full 01 01 20 m 04 snum 50 Fan 1A = 6f OK 7659.00 + 000e SDR Full 01 01 20 m 04 snum 50 Fan 1A = 6f OK 7659.00 RPM - 0042 SDR Comp 02 6f 20 a 21 snum e0 DIMM 1A = 00 c0 04 00 + 0042 SDR Comp 02 6f 20 a 21 snum e0 DIMM 1A = 00 c0 04 00 Present 004e SDR FRU 11 1b dev: 20 03 80 00 0a 01 Pwr Supply 1 FRU 0050 SDR IPMB 12 1b dev: 20 00 bf 07 01 Basbrd Mgmt Ctlr @@ -2276,31 +2292,31 @@ EXAMPLES [...] Output Columns: - _ID_: This is an SDR ID or index number, in hex. This may vary from + _ID_: This is an SDR ID or index number, in hex. This may vary from chassis to chassis. - SDR_Type_xx: This shows the SDR Type and its hex representation. Some + SDR_Type_xx: This shows the SDR Type and its hex representation. Some SDR types have a custom display. The OEM SDRs only show the OEM vendor by IANA number and then usually the data is listed in hex. - ET: For Full or Comp SDRs, this shows the Event Type. For other SDRs, + ET: For Full or Comp SDRs, this shows the Event Type. For other SDRs, this shows the size of the SDR entry in hex (Sz). Own: This is the hex slave address of the SDR Owner, usually 20 if BMC. a/m: This indicates whether this sensor is either automatically or man- ually rearmed, respectively. - Typ: This is the Sensor Type as defined in Table 42-3 of the IPMI 2.0 + Typ: This is the Sensor Type as defined in Table 42-3 of the IPMI 2.0 spec. (01 = Temperature, 02 = Voltage, 03 = Current, 04 = Fan, etc.) - S_Num: This is the sensor number in hex. This remains consistent - across baseboards of the same type. The output can be parsed with the + S_Num: This is the sensor number in hex. This remains consistent + across baseboards of the same type. The output can be parsed with the "snum" delimiter to extract this value. - Sens_Description: This is the text description of this SDR, which is + Sens_Description: This is the text description of this SDR, which is stored within the SDR on the BMC. - Hex & Interp Reading: This is the raw hex value returned by GetSensor- + Hex & Interp Reading: This is the raw hex value returned by GetSensor- Reading, and its interpreted meaning. SEE ALSO - ipmiutil(8) ialarms(8) iconfig(8) icmd(8) idiscover(8) ievents(8) - ifru(8) igetevent(8) ihealth(8) ilan(8) ireset(8) isel(8) iserial(8) + ipmiutil(8) ialarms(8) iconfig(8) icmd(8) idiscover(8) ievents(8) + ifru(8) igetevent(8) ihealth(8) ilan(8) ireset(8) isel(8) iserial(8) isol(8) iwdt(8) @@ -5198,8 +5214,10 @@ directory and then run showsel.reg, so that the Windows EventLog service can find information about the showsel events. Note that the openssl crypto libraries (libeay32.dll and ssleay32.dll) -should be copied to %SystemRoot%\System32 also to provide crypto functions +should be copied to %SystemRoot%\System32 to provide crypto functions for the lanplus logic, if they are not already present. +For WinPE 64-bit, or other variants without openssl, see also +http://www.indyproject.org/Sockets/fpc/OpenSSLforWin64.en.aspx Note that for Windows Vista/7 workstation and later, make sure to 'Run as administrator' when installing. Windows Server should not diff --git a/doc/ipmiutil.spec b/doc/ipmiutil.spec index facb897..bff272f 100644 --- a/doc/ipmiutil.spec +++ b/doc/ipmiutil.spec @@ -3,7 +3,7 @@ # Copyright (c) 2012 Andy Cress # Name: ipmiutil -Version: 2.9.8 +Version: 2.9.9 Release: 1%{?dist} Summary: Easy-to-use IPMI server management utilities License: BSD @@ -13,30 +13,32 @@ URL: http://ipmiutil.sourceforge.net BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) # Suggests: cron or vixie-cron or cronie or similar %if 0%{?fedora} >= 15 -BuildRequires: systemd autoconf automake +BuildRequires: systemd autoconf automake systemd-units Requires: systemd-units %endif -%if 0%{?suse_version} >= 1210 -%define req_systemd 1 -%endif %if 0%{?sles_version} >= 10 BuildRequires: libopenssl-devel %else BuildRequires: openssl-devel %endif -%if 0%{?req_systemd} +%if 0%{?suse_version} >= 1210 BuildRequires: gcc gcc-c++ libtool systemd +%define req_systemd 1 %define unit_dir %{_unitdir} %define systemd_fls %{unit_dir} # Requires: %{?systemd_requires} %else BuildRequires: gcc gcc-c++ libtool +%define systemd_fls %{_datadir}/%{name} %if 0%{?fedora} == 16 %define unit_dir /lib/systemd/system %else +%if 0%{?rhel} >= 7 +BuildRequires: systemd-units %define unit_dir %{_unitdir} %endif -%define systemd_fls %{_datadir}/%{name} +%{!?unit_dir: %define unit_dir /usr/lib/systemd/system} +%endif %endif %define init_dir %{_initrddir} @@ -213,11 +215,17 @@ then fi %endif + # Test whether an IPMI interface is known to the motherboard + IPMIret=1 + %{_sbindir}/dmidecode |grep -q IPMI && IPMIret=0 # Run some ipmiutil command to see if any IPMI interface works. - IPMIret=0 - %{_bindir}/ipmiutil sel -v >/dev/null 2>&1 || IPMIret=1 - # If IPMIret==0, the IPMI cmd was successful, and IPMI is enabled locally. + # Some may not have IPMI on the motherboard, so need to check, but + # some kernels may have IPMI driver partially loaded, which breaks this + %{_bindir}/ipmiutil sel -v >/dev/null 2>&1 && IPMIret=0 if [ $IPMIret -eq 0 ]; then + if [ ! -x %{init_dir}/ipmi ]; then + cp -f %{scr_dir}/ipmi.init.basic %{init_dir}/ipmi + fi # If IPMI is enabled, automate managing the IPMI SEL if [ -d %{_sysconfdir}/cron.daily ]; then cp -f %{_datadir}/%{name}/checksel %{_sysconfdir}/cron.daily @@ -228,9 +236,9 @@ then touch ${scr_dir}/ipmi_port.service elif [ -x /sbin/chkconfig ]; then /sbin/chkconfig --add ipmi_port - /sbin/chkconfig --add ipmiutil_wdt - /sbin/chkconfig --add ipmiutil_evt /sbin/chkconfig --add ipmi_info + # /sbin/chkconfig --add ipmiutil_wdt + # /sbin/chkconfig --add ipmiutil_evt fi fi diff --git a/doc/isensor.8 b/doc/isensor.8 index dcfdd1a..1345f58 100644 --- a/doc/isensor.8 +++ b/doc/isensor.8 @@ -2,7 +2,7 @@ .SH NAME ipmiutil_sensor \- show Sensor Data Records .SH SYNOPSIS -.B "ipmiutil sensor [-abcdefgmpqrstuvwx -i id -n snum -h tval -l tval -NUPREFJTVY]" +.B "ipmiutil sensor [-abcdefgjkmpqrstuvwxL -i id -n snum -h tval -l tval -NUPREFJTVY]" .SH DESCRIPTION .I ipmiutil sensor @@ -29,7 +29,8 @@ Show sensor list in a simpler/Canonical format without uninterpreted binary values. Only the user-friendly interpreted sensor information is shown. (same as \-s). .IP "-d <file>" -Dump the SDRs to a specified binary file. +Dump the SDRs to a specified binary file. This file can be used with -j to +jumpstart getting the sensor readings. .IP "-e" Show Every SDR in a bladed system by traversing the child MCs (same as \-b). .IP "-f <file>" @@ -56,6 +57,15 @@ The ID argument can be one hex number (e.g. 0x0e or 0e), or a range of hex numbers (e.g. 0e-1a or 1a,2a or 0x0e-0x2a). This is useful to repeatedly view just a few sensor readings for changes, or to set just one sensor quickly without reading all of the SDRs. +.IP "-j file" +Jump-start by caching the SDRs from a file. This uses an SDR binary file to +read the SDRs, so that only the sensor readings need to be read from the +firmware. This avoids getting the SDR reservation and reading each SDR, so +it makes getting the sensor readings more efficient. +The SDR binary file can be created using the \-d option to dump the SDRs +to a file, or -j will try to create the file if not there. +.IP "-k K" +When looping with \-L, wait K seconds between loops. Default is 1 second. .IP "-l tval" Lowest threshold value to set for the specified sensor. This tval can be in decimal, or of the form 0x1a, @@ -86,7 +96,7 @@ Persist the threshold being set (as specified via \-l or \-h). This writes a "sensor \-i" script line to the file /usr/share/ipmiutil/thresholds.sh, which can then be executed at each reboot by starting the /etc/init.d/ipmi_port service for the desired runlevels. For Windows, the filename is thresholds.cmd. .IP "-q" -Show any thresholds for each sensor in short format with ':' delimiters, useful as an example for setting thresholds with '\-u'. +Show threshold values in d:d:d format. Thresholds are shown for each sensor in short format with ':' delimiters, which is useful as an example for setting thresholds with '\-u'. .IP "-r" Show Raw SDR bytes also. .IP "-s" @@ -112,7 +122,7 @@ This may be convenient for scripting. .IP "-x" Causes eXtra debug messages to be displayed. .IP "-L n" -Loop n times. This is useful along with \-i. Default is one loop. +Loop n times every K seconds. Default is one loop and K defaults to 1 second. See option \-k to change K seconds if desired. This is useful along with \-i or \-g to read some sensors as they change. Using \-j with this option makes run it quicker. .IP "-N nodename" Nodename or IP address of the remote target system. If a nodename is specified, IPMI LAN interface is used. Otherwise the local system diff --git a/lib/Makefile b/lib/Makefile index e32afa5..3ec415c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -47,12 +47,12 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run aclocal-1.11 -AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run tar +ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run aclocal-1.11 +AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run tar AR = ar -AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoconf -AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoheader -AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run automake-1.11 +AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoconf +AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoheader +AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run automake-1.11 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -101,13 +101,13 @@ LIB_DIR = /usr/lib64 LIPO = LN_S = ln -s LTLIBOBJS = -MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run makeinfo +MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run makeinfo MKDIR_P = /bin/mkdir -p NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o -OS_CFLAGS = -DLINUX -fPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 +OS_CFLAGS = -DLINUX -fPIC -Wno-pointer-sign -Wno-sign-conversion -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 OS_DRIVERS = imbapi.c ipmimv.c ipmild.c ipmidir.c OS_LFLAGS = OTOOL = @@ -115,9 +115,9 @@ OTOOL64 = PACKAGE = ipmiutil PACKAGE_BUGREPORT = PACKAGE_NAME = ipmiutil -PACKAGE_STRING = ipmiutil 2.9.8 +PACKAGE_STRING = ipmiutil 2.9.9 PACKAGE_TARNAME = ipmiutil -PACKAGE_VERSION = 2.9.8 +PACKAGE_VERSION = 2.9.9 PATH_SEPARATOR = : PKG_DIR = /root/rpmbuild RANLIB = ranlib @@ -129,11 +129,11 @@ SHR_LINK = libipmiutil.so.1 STRIP = strip SUBDIR_S = doc scripts lib util SYSTEMD_DIR = /usr/share/ipmiutil -VERSION = 2.9.8 -abs_builddir = /usr/dev/ipmiutil-2.9.8/lib -abs_srcdir = /usr/dev/ipmiutil-2.9.8/lib -abs_top_builddir = /usr/dev/ipmiutil-2.9.8 -abs_top_srcdir = /usr/dev/ipmiutil-2.9.8 +VERSION = 2.9.9 +abs_builddir = /usr/dev/ipmiutil-2.9.9/lib +abs_srcdir = /usr/dev/ipmiutil-2.9.9/lib +abs_top_builddir = /usr/dev/ipmiutil-2.9.9 +abs_top_srcdir = /usr/dev/ipmiutil-2.9.9 ac_ct_CC = gcc ac_ct_DUMPBIN = am__include = include @@ -161,7 +161,7 @@ host_vendor = redhat htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.8/install-sh +install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.9/install-sh libdir = $(iprefix)/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale diff --git a/lib/lanplus/lanplus.c b/lib/lanplus/lanplus.c index 2fab966..e423ede 100644 --- a/lib/lanplus/lanplus.c +++ b/lib/lanplus/lanplus.c @@ -325,25 +325,23 @@ int lanplus_get_requested_ciphers(int cipher_suite_id, *integrity_alg = IPMI_INTEGRITY_MD5_128; *crypt_alg = IPMI_CRYPT_XRC4_40; break; -#if 0 - case 15: // Note: Cipher Suite ID not (yet) confirmed in IPMI Spec or Errata 4 +#ifdef HAVE_SHA256 + case 15: // Note: Cipher Suite ID 15 is in in IPMI Spec or Errata 7 *auth_alg = IPMI_AUTH_RAKP_HMAC_SHA256; *integrity_alg = IPMI_INTEGRITY_NONE; *crypt_alg = IPMI_CRYPT_NONE; break; - case 16: // Note: Cipher Suite ID not (yet) confirmed in IPMI Spec or Errata 4 + case 16: // Note: Cipher Suite ID 16 is in in IPMI Spec or Errata 7 *auth_alg = IPMI_AUTH_RAKP_HMAC_SHA256; *integrity_alg = IPMI_INTEGRITY_HMAC_SHA256_128; *crypt_alg = IPMI_CRYPT_NONE; break; -#endif -#ifdef HAVE_SHA256 - /* based on an MD5_SHA256 patch from Holger Liebig */ case 17: // Note: Cipher Suite Id from DCMI 1.1 Spec *auth_alg = IPMI_AUTH_RAKP_HMAC_SHA256; *integrity_alg = IPMI_INTEGRITY_HMAC_SHA256_128; *crypt_alg = IPMI_CRYPT_AES_CBC_128; break; + /* HAVE_SHA256: based on an MD5_SHA256 patch from Holger Liebig */ #endif default: lprintf(LOG_ERR, "invalid cipher suite id %d",cipher_suite_id); diff --git a/lib/libipmiutil.pc b/lib/libipmiutil.pc index b6e9013..e0a9bc0 100644 --- a/lib/libipmiutil.pc +++ b/lib/libipmiutil.pc @@ -8,6 +8,6 @@ nutuser=@RUN_AS_USER@ Name: libipmiutil Description: Library for ipmiutil -Version: 2.9.8 +Version: 2.9.9 Libs: -L${libdir} -lipmi_lanplus Cflags: -I${includedir} diff --git a/scripts/Makefile b/scripts/Makefile index 77c7fe8..0d8a5d8 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -46,12 +46,12 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run aclocal-1.11 -AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run tar +ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run aclocal-1.11 +AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run tar AR = ar -AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoconf -AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run autoheader -AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run automake-1.11 +AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoconf +AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run autoheader +AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run automake-1.11 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -99,13 +99,13 @@ LIB_DIR = /usr/lib64 LIPO = LN_S = ln -s LTLIBOBJS = -MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.8/missing --run makeinfo +MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.9/missing --run makeinfo MKDIR_P = /bin/mkdir -p NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o -OS_CFLAGS = -DLINUX -fPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 +OS_CFLAGS = -DLINUX -fPIC -Wno-pointer-sign -Wno-sign-conversion -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 OS_DRIVERS = imbapi.c ipmimv.c ipmild.c ipmidir.c OS_LFLAGS = OTOOL = @@ -113,9 +113,9 @@ OTOOL64 = PACKAGE = ipmiutil PACKAGE_BUGREPORT = PACKAGE_NAME = ipmiutil -PACKAGE_STRING = ipmiutil 2.9.8 +PACKAGE_STRING = ipmiutil 2.9.9 PACKAGE_TARNAME = ipmiutil -PACKAGE_VERSION = 2.9.8 +PACKAGE_VERSION = 2.9.9 PATH_SEPARATOR = : PKG_DIR = /root/rpmbuild RANLIB = ranlib @@ -127,11 +127,11 @@ SHR_LINK = libipmiutil.so.1 STRIP = strip SUBDIR_S = doc scripts lib util SYSTEMD_DIR = /usr/share/ipmiutil -VERSION = 2.9.8 -abs_builddir = /usr/dev/ipmiutil-2.9.8/scripts -abs_srcdir = /usr/dev/ipmiutil-2.9.8/scripts -abs_top_builddir = /usr/dev/ipmiutil-2.9.8 -abs_top_srcdir = /usr/dev/ipmiutil-2.9.8 +VERSION = 2.9.9 +abs_builddir = /usr/dev/ipmiutil-2.9.9/scripts +abs_srcdir = /usr/dev/ipmiutil-2.9.9/scripts +abs_top_builddir = /usr/dev/ipmiutil-2.9.9 +abs_top_srcdir = /usr/dev/ipmiutil-2.9.9 ac_ct_CC = gcc ac_ct_DUMPBIN = am__include = include @@ -159,7 +159,7 @@ host_vendor = redhat htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.8/install-sh +install_sh = ${SHELL} /usr/dev/ipmiutil-2.9.9/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale diff --git a/scripts/ipmi.init.basic b/scripts/ipmi.init.basic index f12c743..bff8e55 100755 --- a/scripts/ipmi.init.basic +++ b/scripts/ipmi.init.basic @@ -40,7 +40,11 @@ start() { fi fi modprobe ipmi_devintf - modprobe ipmi_watchdog 2>/dev/null + # do not start ipmi_watchdog for Supermicro + dmidecode |grep -A1 'Base Board' |grep -q -i Supermicro + if [ $? -ne 0 ]; then + modprobe ipmi_watchdog 2>/dev/null + fi fi maj=$(cat /proc/devices | awk '/ipmidev/{print $1}') diff --git a/scripts/ipmiutil_wdt b/scripts/ipmiutil_wdt index 5f75131..b3ffcf1 100755 --- a/scripts/ipmiutil_wdt +++ b/scripts/ipmiutil_wdt @@ -61,7 +61,7 @@ start() { # RETVAL=$? # restart the watchdog every 60 seconds via /etc/cron.d cat - <<%%% >$wdtcron -* * * * * root $prog -r +* * * * * root $prog -r >/dev/null %%% # make crond re-read the /etc/cron.d $crond_sh restart >>$wdtlog diff --git a/util/ialarms.c b/util/ialarms.c index 2519345..f9c80cc 100644 --- a/util/ialarms.c +++ b/util/ialarms.c @@ -75,7 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "ialarms"; static char fdebug = 0; static char fbmctam = 0; diff --git a/util/icmd.c b/util/icmd.c index b481c96..cbd35d1 100644 --- a/util/icmd.c +++ b/util/icmd.c @@ -78,7 +78,7 @@ extern void ipmi_lan_set_timeout(int ipmito, int tries, int pingto); /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "icmd"; static char fdebug = 0; static char fquiet = 0; diff --git a/util/iconfig.c b/util/iconfig.c index 6f7fd83..21eb76e 100644 --- a/util/iconfig.c +++ b/util/iconfig.c @@ -171,7 +171,7 @@ typedef struct /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "iconfig"; static char fdebug = 0; static char fipmilan = 0; @@ -2636,7 +2636,7 @@ main(int argc, char **argv) case SYS_INFO: /* System Info */ if (! fIPMI20) continue; /*skip if not IPMI 2.0*/ /* j = #bytes read into LanRecord */ - ret = set_system_info(bset,LanRecord,j); + ret = set_system_info(bset,(char *)LanRecord,j); break; case LAN_FAILOVER: /* Intel LAN Failover */ if (is_romley(vend_id,prod_id)) diff --git a/util/idcmi.c b/util/idcmi.c index 2786efb..a21ee2a 100644 --- a/util/idcmi.c +++ b/util/idcmi.c @@ -62,7 +62,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "idcmi.h" static char * progname = "idcmi"; -static char * progver = "2.98"; +static char * progver = "2.99"; extern char fdebug; /*from ipmicmd.c*/ static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; @@ -334,7 +334,7 @@ void dcmi_show_power_read(int parm, uchar *cdata, int sdata) printf(" Max Power over sample duration: %d Watts\n",cdata[5]+(cdata[6]<<8)); printf(" Avg Power over sample duration: %d Watts\n",cdata[7]+(cdata[8]<<8)); printf(" Timestamp: %s\n",ctime(&t)); - printf(" Sampling period: %d ms\n",sample_period); + printf(" Sampling period: %lu ms\n",sample_period); printf(" Power reading state is: %s\n",(state&0x40)? "active":"not active"); break; case 2: /* Mode 2 - Enhanced System Power Statistics */ @@ -369,7 +369,7 @@ void dcmi_show_power_limit(uchar *cdata, int sdata, int rv) else printf("OEM defined\n"); printf(" Power Limit: %d Watts %s\n",cdata[4]+(cdata[5]<<8), pstr); - printf(" Correction Time: %d ms\n", correction_time); + printf(" Correction Time: %lu ms\n", correction_time); printf(" Sampling period: %d sec\n", cdata[12]+(cdata[13]<<8)); } @@ -494,6 +494,7 @@ static int dcmi_get_asset_tag(char *pdata, int sdata, int *dlen) if (rv == 0) rv = cc; if (rv == 0) { /* if here, success */ if (n == 0) sz_all = rdata[1]; + if ((rlen - 2) < sz_chunk) sz_chunk = rlen - 2; if ((n + sz_chunk) > sdata) { if (fdebug) printf("dcmi_get_asset(%d): data truncated from %d to %d\n", @@ -535,6 +536,7 @@ static int dcmi_get_mc_id(char *pdata, int sdata, int *dlen) if (rv == 0) rv = cc; if (rv == 0) { /* if here, success */ if (n == 0) sz_all = rdata[1]; + if ((rlen - 2) < sz_chunk) sz_chunk = rlen - 2; if ((n + sz_chunk) > sdata) { if (fdebug) printf("dcmi_get_mc_id(%d): data truncated from %d to %d\n", diff --git a/util/idiscover.c b/util/idiscover.c index 6dd0225..567cf05 100644 --- a/util/idiscover.c +++ b/util/idiscover.c @@ -17,6 +17,7 @@ * 09/20/07 Andy Cress - fixed send/receive thread order * 07/15/08 Andy Cress - added -r for ping repeats * 11/21/08 Andy Cress - detect eth intf and broadcast ip addr + * 01/04/16 Andy Cress - v1.11, allow 0 if fBroadcastOk (-a) */ /*M* Copyright (c) 2006, Intel Corporation @@ -157,7 +158,7 @@ int GetFirstIP(uchar *ipaddr, uchar *macadr, char *ipname, char fdb); /*ilan.c*/ /* * Global variables */ -static char * progver = "1.10"; +static char * progver = "1.11"; static char * progname = "idiscover"; static char fdebug = 0; static char fping = 1; @@ -504,7 +505,7 @@ int sock_init( char *_interface, char *_startIP, char *_endIP) strcpy(ifr.ifr_name, devname); ifr.ifr_addr.sa_family = AF_INET; if (ioctl(g_sockfd, SIOCGIFADDR, &ifr) >= 0) { - /* valid IP address, so active interface, use it */ + /* valid IP address, so active interface, use it */ temp_sockaddr = *((struct sockaddr_in *)&ifr.ifr_addr); memcpy(&_srcaddr.sin_addr.s_addr, &temp_sockaddr.sin_addr.s_addr, sizeof(_srcaddr.sin_addr.s_addr)); @@ -575,14 +576,15 @@ int sock_init( char *_interface, char *_startIP, char *_endIP) if (rv ) { _startAddr.s_addr = ntohl(_startAddr.s_addr); if (fdebug) show_ip(_startAddr.s_addr); - pb = (unsigned char*)&_startAddr.s_addr; - if (pb[0] < 1) + pb = (unsigned char*)&_startAddr.s_addr; + if (!fBroadcastOk && (pb[0] < 1) ) printerr("Malformed begin IP: %s\n", _startIP); else if (!fBroadcastOk && (pb[0] >254) ) printerr("Malformed begin IP: %s\n", _startIP); else if (fBroadcastOk) { - val = pb[0] & 0x0f; - if (val == 0x0f) rv = 0; + val = pb[0] & 0x0f; + if (val == 0x0f) rv = 0; + else if (val == 0x00) rv = 0; else printerr("Malformed begin broadcast IP: %s\n", _startIP); } else rv = 0; } else { @@ -594,8 +596,8 @@ int sock_init( char *_interface, char *_startIP, char *_endIP) if (rv ) { _endAddr.s_addr = ntohl(_endAddr.s_addr); if (fdebug) show_ip(_endAddr.s_addr); - pb = (unsigned char*)&_endAddr.s_addr; - if (pb[0] < 1) + pb = (unsigned char*)&_endAddr.s_addr; + if (!fBroadcastOk && (pb[0] < 1) ) printerr("Malformed end IP: %s\n", _endIP); else if (!fBroadcastOk && (pb[0] >254) ) printerr("Malformed end IP: %s\n", _endIP); diff --git a/util/iekanalyzer.c b/util/iekanalyzer.c index 1f405cc..c6e92eb 100644 --- a/util/iekanalyzer.c +++ b/util/iekanalyzer.c @@ -63,6 +63,7 @@ #include "ipmicmd.h" #include "iekanalyzer.h" +#ifdef HAVE_EK extern int verbose; /*ipmilanplus.c*/ extern void lprintf(int level, const char * format, ...); /*ipmilanplus.c*/ extern void set_loglevel(int level); @@ -4127,5 +4128,15 @@ main(int argc, char **argv) ipmi_close_(); return rc; } +#else +/* ekanalyzer stub */ +#ifdef METACOMMAND +int i_ekanalyzer(int argc, char **argv) +{ + printf("ekanalyzer function is not enabled\n"); + return -1; +} +#endif +#endif /*end iekanalyzer.c*/ diff --git a/util/ievents.c b/util/ievents.c index cc40318..6a34e16 100644 --- a/util/ievents.c +++ b/util/ievents.c @@ -76,7 +76,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define SELprintf printf #define SMS_SA 0x41 #define SMI_SA 0x21 -static char *progver = "2.98"; +static char *progver = "2.99"; static char *progname = "ievents"; static char fsensdesc = 0; /* 1= get extended sensor descriptions*/ static char fcanonical = 0; /* 1= show canonical, delimited output*/ @@ -2221,7 +2221,7 @@ int decode_raw_sel(char *raw_file, int mode) { FILE *fp; char buff[256]; - uchar msg[132]; + char msg[132]; uchar hbuf[50]; int fvalid = 0; int len, i; @@ -2585,7 +2585,7 @@ int i_events(int argc, char **argv) } else i++; } } - decode_sel_entry(buf,msg,sizeof(msg)); + decode_sel_entry(buf,(char *)msg,sizeof(msg)); printf("%s", evt_hdr); /*"RecId Date/Time_______*/ printf("%s", msg); } else if (fnewevt) { @@ -2598,7 +2598,7 @@ int i_events(int argc, char **argv) if (fdebug) printf("decoding standard IPMI event bytes\n"); if (fdebug) dump_buf("IPMI event",buf,16,0); set_sel_opts(2,0, NULL,fdebug,futc); - rv = decode_sel_entry(buf,msg,sizeof(msg)); + rv = decode_sel_entry(buf,(char *)msg,sizeof(msg)); /* show header for the event record */ printf("%s", evt_hdr); /*"RecId Date/Time_______*/ printf("%s", msg); diff --git a/util/ifirewall.c b/util/ifirewall.c index 18dca7a..f81deda 100644 --- a/util/ifirewall.c +++ b/util/ifirewall.c @@ -64,7 +64,7 @@ /* global variables */ static char * progname = "ifirewall"; -static char * progver = "2.98"; +static char * progver = "2.99"; static char fdebug = 0; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; diff --git a/util/ifru.c b/util/ifru.c index b10c42e..5e6acf8 100644 --- a/util/ifru.c +++ b/util/ifru.c @@ -116,7 +116,7 @@ extern int ipmi_kontronoem_main(void * intf, int argc, char ** argv); #endif static char *progname = "ifru"; -static char *progver = "2.98"; +static char *progver = "2.99"; static int vend_id = 0; static int prod_id = 0; static char fdebug = 0; @@ -1521,7 +1521,7 @@ static int test_show_fru(char *infile) int rv = -1; FILE *fp; int len, i, idx, sz, off; - uchar buff[256]; + char buff[256]; uchar sa = 0x20; uchar fruid =0; uchar frutype = 0; @@ -1624,7 +1624,7 @@ int i_fru(int argc, char **argv) { int ret, rv; int c; - char DevRecord[16]; + uchar DevRecord[16]; ushort recid; ushort nextid; ushort rsvid; diff --git a/util/ifruset.c b/util/ifruset.c index b7a894c..8ff4294 100644 --- a/util/ifruset.c +++ b/util/ifruset.c @@ -106,7 +106,7 @@ extern void fmt_time(time_t etime, char *buf, int bufsz); /*see ievents.c*/ #define IPROD_OEM 7 static char *progname = "ifruset"; -static char *progver = "2.98"; +static char *progver = "2.99"; static char fdebug = 0; static char fpicmg = 0; static char fonlybase = 0; diff --git a/util/igetevent.c b/util/igetevent.c index 9d1786c..1c420e2 100644 --- a/util/igetevent.c +++ b/util/igetevent.c @@ -169,7 +169,7 @@ extern void free_sdr_cache(uchar *pret); /*see isensor.c*/ * Global variables */ static char * progname = "igetevent"; -static char * progver = "2.98"; +static char * progver = "2.99"; static char fdebug = 0; static char fipmilan = 0; static char frunonce = 0; @@ -757,7 +757,7 @@ static int startevent_sel(ushort *precid, uint *ptime) if (fdebug) msgout("start: idxfile=%s fd=%p\n",idxfile,fd); if (fd != NULL) { // Read the file, get savtime & savid - rv = fscanf(fd,"%x %x",&t,&r); + rv = fscanf(fd,"%x %x",&t,(uint *)&r); fclose(fd); if (r == LAST_REC) r = 0; rv = 0; /*read it, success*/ diff --git a/util/ihealth.c b/util/ihealth.c index 76f1121..abc7fdb 100644 --- a/util/ihealth.c +++ b/util/ihealth.c @@ -74,7 +74,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern int get_BiosVersion(char *str); extern int get_SystemGuid(uchar *guid); extern int GetSDR(int id, int *next, uchar *recdata, int srecdata, int *rlen); -extern int get_device_guid(char *pbuf, int *sz); /*subs.c*/ +extern int get_device_guid(uchar *pbuf, int *sz); /*subs.c*/ extern int oem_supermicro_get_health(char *pstr, int sz); /*oem_supermicro.c*/ extern int oem_supermicro_get_firmware_str(char *pstr, int sz); /*oem_supermicro.c*/ @@ -82,7 +82,7 @@ extern int oem_supermicro_get_firmware_str(char *pstr, int sz); /*oem_supermicro * Global variables */ static char * progname = "ihealth"; -static char * progver = "2.98"; +static char * progver = "2.99"; static char fdebug = 0; static char fipmilan = 0; static char fcanonical = 0; @@ -604,11 +604,15 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec) if (prod >= 0x200) prodstr = "(iRMC S2)"; else prodstr = ""; break; - case VENDOR_CISCO: /*=0x00168b*/ + case VENDOR_CISCO: /*=0x00168b, 5771.*/ if (prod == 0x0005) prodstr = "(UCS C200)"; else prodstr = ""; if (fipmilan) lan_ch_restrict = 1; /*fw bug, gets 0xC1 on ipmilan*/ break; + case 0x003C0A: /*=15370, Giga-Byte*/ + prodstr = ""; + lan_ch_restrict = 1; /*fw bug, gets 0xC1*/ + break; case VENDOR_INTEL: /*=0x000157*/ if (do_hsc && (dtype == BMC)) /*if HSC option, also show extra*/ sprintf(extraver," (Boot %x.%x PIA %x.%x)", /*BMC extra*/ @@ -796,7 +800,7 @@ int GetPowerOnHours(unsigned int *val) char *decode_selftest(int stat) { - uchar *s; + char *s; uchar b; if (stat == 0x0055) s = "(OK)"; else { diff --git a/util/ilan.c b/util/ilan.c index 3499ed9..c81c7a9 100644 --- a/util/ilan.c +++ b/util/ilan.c @@ -305,7 +305,7 @@ extern char *get_sensor_type_desc(uchar stype); /*from ievents.c*/ /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "ilan"; static char fdebug = 0; static char fipmilan = 0; @@ -721,7 +721,7 @@ SetPasswd(int unum, char *uname, char *upswd) int responseLength = MAX_BUFFER_SIZE; int status, i, psw_len; uchar completionCode; - char inputData[24]; + uchar inputData[24]; int ret = 0; inputData[0] = (uchar)unum; /*user 1 = null user */ @@ -797,7 +797,7 @@ SetPasswd(int unum, char *uname, char *upswd) psw_len = PSW_LEN; /*=16 change if 20-byte passwords supported */ memset(&inputData[2],0,psw_len); if (upswd != NULL) - strcpy(&inputData[2],upswd); + strcpy((char *)&inputData[2],upswd); if (fdebug) { char apsw[PSW_MAX+1]; char c; @@ -824,7 +824,7 @@ SetPasswd(int unum, char *uname, char *upswd) inputData[1] = 0x03; /*test password*/ memset(&inputData[2],0,psw_len); if (upswd != NULL) - strcpy(&inputData[2],upswd); + strcpy((char *)&inputData[2],upswd); responseLength = sizeof(responseData); status = ipmi_cmd(SET_USER_PASSWORD, inputData, 2+psw_len, responseData,&responseLength, &completionCode,fdebug); @@ -870,7 +870,7 @@ DisableUser(int unum) int responseLength = MAX_BUFFER_SIZE; int status; uchar completionCode; - char inputData[24]; + uchar inputData[24]; inputData[0] = 0x80 | lan_ch; /* = 0x87, no IPMI */ inputData[1] = (uchar)unum; /* user 1 */ @@ -931,7 +931,7 @@ int GetUser(uchar user_num) int responseLength = MAX_BUFFER_SIZE; int status; uchar completionCode; - char inputData[24]; + uchar inputData[24]; inputData[0] = lan_ch; inputData[1] = user_num; /* usually = 1 for BMC LAN */ @@ -2070,7 +2070,7 @@ int FindEthNum(uchar *macadrin) #endif { uchar *pb; - pb = get_ifreq_mac(&ifr); + pb = (uchar *)get_ifreq_mac(&ifr); #ifdef DBG if (fdebug) { printf("%s mac: %02x:%02x:%02x:%02x:%02x:%02x\n", @@ -2948,7 +2948,7 @@ int Get_IPMac_Addr() else if (fdebug) printf("ioctl(SIOCGIFADDR,%s) error, errno=%d\n",_ifname,err); } else { /* got the local OS IP successfully */ - pc = &ifr.ifr_addr.sa_data[2]; + pc = (uchar *)&ifr.ifr_addr.sa_data[2]; if (fdebug) printf("%s addr = %d.%d.%d.%d\n",_ifname,pc[0],pc[1],pc[2],pc[3]); memcpy(osmyip, pc, 4); @@ -2962,7 +2962,7 @@ int Get_IPMac_Addr() printf("ioctl(SIOCGIFNETMASK) error, errno=%d\n",get_errno()); /* if leave invalid, will use default rgsubnet */ } else { // sizeof(struct sockaddr) - pc = &ifr.ifr_netmask.sa_data[2]; + pc = (uchar *)&ifr.ifr_netmask.sa_data[2]; if (fdebug) printf("subnet = %d.%d.%d.%d \n", pc[0],pc[1],pc[2],pc[3]); memcpy(ossubnet, pc, 4); @@ -3675,6 +3675,8 @@ main(int argc, char **argv) char mystr[80]; char fpefok = 1; uchar * pc; int sz; + char *pa; + char *pb; // progname = argv[0]; printf("%s ver %s \n",progname,progver); @@ -4188,7 +4190,6 @@ main(int argc, char **argv) { ret = GetPefEntry( 0x06, (ushort)idx, &PefRecord); if (ret == 0) { // Show the PEF record - char *pa; pc = (uchar *)&PefRecord; sz = 21; // sizeof(PEF_RECORD) = 21 if (PefRecord.sensor_type == 0) { @@ -4198,8 +4199,8 @@ main(int argc, char **argv) if (fAdjustPefNum) pefnum = (char)idx; } else { memcpy(pef_array[idx-1], &PefRecord, sz); - if (PefRecord.fconfig & 0x80) pc = "enabled"; - else pc = "disabled"; + if (PefRecord.fconfig & 0x80) pb = "enabled"; + else pb = "disabled"; i = PefRecord.rec_id; switch(PefRecord.action) { case 0x01: pa = "alert"; break; @@ -4212,7 +4213,7 @@ main(int argc, char **argv) } printf("PEFilter(%02d): %02x %s event - %s for %s\n", idx, PefRecord.sensor_type, - PefDesc(i,PefRecord.sensor_type), pc,pa); + PefDesc(i,PefRecord.sensor_type), pb,pa); } if (fdebug) { /* show raw PEFilter record */ pc = &PefRecord.rec_id; @@ -5062,7 +5063,7 @@ main(int argc, char **argv) printf("snmp community \t%s\n",rgcommunity); /* Only need the SNMP community if there is an Alert Destination */ memset(&LanRecord.data[0], 0, 18); /* make sure zero-filled */ - strcpy(&LanRecord.data[0],rgcommunity); + strcpy((char *)&LanRecord.data[0],rgcommunity); ret = SetLanEntry(16, &LanRecord, 18); printf("SetLanEntry(16), ret = %d\n",ret); if (ret != 0) { nerrs++; lasterr = ret; } diff --git a/util/ipicmg.c b/util/ipicmg.c index a920f37..6421f2b 100644 --- a/util/ipicmg.c +++ b/util/ipicmg.c @@ -81,7 +81,7 @@ /* Global data */ static char * progname = "ipicmg"; -static char * progver = "2.98"; +static char * progver = "2.99"; static char fdebug = 0; static char fset_mc = 0; static uint8_t g_bus = PUBLIC_BUS; @@ -91,6 +91,96 @@ static uint8_t g_addrtype = ADDR_SMI; static uint8_t g_fruid = 0; static unsigned char PicmgExtMajorVersion; +/* the LED color capabilities */ +static const char* led_color_str[] = { //__attribute__((unused)) = { + "reserved", + "BLUE", + "RED", + "GREEN", + "AMBER", + "ORANGE", + "WHITE", + "reserved" +}; + + +static const char* amc_link_type_str[] = { // __attribute__((unused)) = { + "RESERVED", + "RESERVED1", + "PCI EXPRESS", + "ADVANCED SWITCHING1", + "ADVANCED SWITCHING2", + "ETHERNET", + "RAPIDIO", + "STORAGE", +}; + +static const char* amc_link_type_ext_str[][16]= { // __attribute__((unused)) + /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */ + { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */ + { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */ + { + "1000BASE-BX (SerDES Gigabit)", + "10GBASE-BX410 Gigabit XAUI", + "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */ + { + "1.25 Gbaud transmission rate", + "2.5 Gbaud transmission rate", + "3.125 Gbaud transmission rate", + "", "", "", "", "", + "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */ + { + "Fibre Channel", + "Serial ATA", + "Serial Attached SCSI", + "", "", "", "", "", + "", "", "", "", "", "", "", "" + } +}; + typedef enum picmg_bused_resource_mode { PICMG_BUSED_RESOURCE_SUMMARY, } t_picmg_bused_resource_mode ; @@ -1297,7 +1387,7 @@ ipmi_picmg_clk_get(void * intf, int clk_id,int clk_res,int mode) val2str( rsp[3], picmg_clk_family_vals)); printf(" - AccLVL: %3d [ %s ]\n", rsp[4], oemval2str(rsp[3],rsp[4],picmg_clk_accuracy_vals)); - printf(" - Freq: %d\n", freq); + printf(" - Freq: %lu\n", freq); } } } @@ -1356,7 +1446,7 @@ printf("## index: %d\n", msg_data[2]); printf("## setting: 0x%02x\n", msg_data[3]); printf("## family: %d\n", msg_data[4]); printf("## acc: %d\n", msg_data[5]); -printf("## freq: %d\n", freq ); +printf("## freq: %lu\n", freq ); printf("## res: %d\n", msg_data[10]); #endif diff --git a/util/ipicmg.h b/util/ipicmg.h index 59fce39..6f6554b 100644 --- a/util/ipicmg.h +++ b/util/ipicmg.h @@ -197,96 +197,6 @@ typedef enum picmg_busres_resource_id { PICMG_BUSRES_SYNC_CLOCK_GROUP_3 } t_picmg_busres_resource_id; -/* the LED color capabilities */ -static const char* led_color_str[] = { //__attribute__((unused)) = { - "reserved", - "BLUE", - "RED", - "GREEN", - "AMBER", - "ORANGE", - "WHITE", - "reserved" -}; - - -static const char* amc_link_type_str[] = { // __attribute__((unused)) = { - "RESERVED", - "RESERVED1", - "PCI EXPRESS", - "ADVANCED SWITCHING1", - "ADVANCED SWITCHING2", - "ETHERNET", - "RAPIDIO", - "STORAGE", -}; - -static const char* amc_link_type_ext_str[][16]= { // __attribute__((unused)) - /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */ - { - "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */ - { - "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */ - { - "Gen 1 - NSSC", - "Gen 1 - SSC", - "Gen 2 - NSSC", - "Gen 2 - SSC", - "", "", "", "", - "", "", "", "", - "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */ - { - "Gen 1 - NSSC", - "Gen 1 - SSC", - "Gen 2 - NSSC", - "Gen 2 - SSC", - "", "", "", "", - "", "", "", "", - "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */ - { - "Gen 1 - NSSC", - "Gen 1 - SSC", - "Gen 2 - NSSC", - "Gen 2 - SSC", - "", "", "", "", - "", "", "", "", - "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */ - { - "1000BASE-BX (SerDES Gigabit)", - "10GBASE-BX410 Gigabit XAUI", - "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */ - { - "1.25 Gbaud transmission rate", - "2.5 Gbaud transmission rate", - "3.125 Gbaud transmission rate", - "", "", "", "", "", - "", "", "", "", "", "", "", "" - }, - /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */ - { - "Fibre Channel", - "Serial ATA", - "Serial Attached SCSI", - "", "", "", "", "", - "", "", "", "", "", "", "", "" - } -}; - struct sAmcPortState { #ifndef WORDS_BIGENDIAN unsigned short lane0 : 1; diff --git a/util/ipmicmd.c b/util/ipmicmd.c index efaadec..369d2e4 100644 --- a/util/ipmicmd.c +++ b/util/ipmicmd.c @@ -409,6 +409,7 @@ char *decode_rv(int rv) /* ipmidir.h: ERGETTINGIPMIMESSAGE -504 */ case ERR_BAD_FORMAT: msg = "bad format"; break; case ERR_BAD_LENGTH: msg = "length less than min"; break; + case ERR_SDR_MALFORMED: msg = "an SDR is malformed"; break; default: sprintf(msgbuf,"error %d",rv); msg = msgbuf; diff --git a/util/ipmicmd.h b/util/ipmicmd.h index 989cd8d..5c41151 100644 --- a/util/ipmicmd.h +++ b/util/ipmicmd.h @@ -245,6 +245,7 @@ struct oemvalstr { #define SEV_CRIT 3 /* Errors returned by ipmiutil functions, lan, etc, see decode_rv() */ +#define ERR_SDR_MALFORMED -25 /*SDR is malformed */ #define ERR_BAD_LENGTH -24 /*length < MIN */ #define ERR_BAD_FORMAT -23 /*bad format*/ #define ERR_USAGE -22 /*usage/help requested*/ @@ -542,7 +543,7 @@ int str2uchar(char *str_in, uchar *uchr_out); uchar atob(char *str_in); /* calls str2uchar*/ void atoip(uchar *array,char *instr); int get_system_info(uchar parm, char *pbuf, int *szbuf); /*subs.c*/ -int set_system_info(uchar parm, uchar *pbuf, int szbuf); /*subs.c*/ +int set_system_info(uchar parm, char *pbuf, int szbuf); /*subs.c*/ int ipmi_reserved_user(int vend, int userid); /*subs.c*/ /* from mem_if.c */ diff --git a/util/ipmilan.c b/util/ipmilan.c index 1f5b949..acea438 100644 --- a/util/ipmilan.c +++ b/util/ipmilan.c @@ -352,8 +352,10 @@ static uchar g_Cipher[ 16 ][ 16 ]; /*SeedCount x CipherHash for SOL 1.5*/ #ifdef WIN32 int econnrefused = WSAECONNREFUSED; /*=10061.*/ +int econnreset = WSAECONNRESET; /*=10054.*/ #else int econnrefused = ECONNREFUSED; /*=111. from Linux asm/errno.h */ +int econnreset = ECONNRESET; /*=104.*/ #endif #ifdef WIN32 @@ -1232,7 +1234,7 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp, fprintf(fpdbg,"ipmilan_cmd timeout, after request, seq=%x itry=%d\n", phdr->seq_num, itry); rv = LAN_ERR_RECV_FAIL; - if (fdopoke2) ipmilan_poke2(s, to, tolen); + if (fdopoke2) ipmilan_poke2(s, to, tolen); os_usleep(0,5000); continue; /* retry */ } @@ -1243,14 +1245,15 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp, if (fdebuglan) { fprintf(fpdbg,"ipmilan_recvfrom rlen=%d, err=%d iseq=%x itry=%d\n", rlen,lasterr,phdr->iseq_num,itry); - show_LastError("ipmilan_recvfrom",lasterr); - } - rv = rlen; /* -3 = LAN_ERR_RECV_FAIL */ - rlen = 0; + show_LastError("ipmilan_recvfrom",lasterr); + } + rv = rlen; /* -3 = LAN_ERR_RECV_FAIL */ + rlen = 0; *sresp = rlen; /* Sometimes the OS sends an ECONNREFUSED error, but * retrying will catch the BMC's reply packet. */ if (lasterr == econnrefused) continue; /*try again*/ + else if (lasterr == econnreset) continue; /*try again*/ else break; /* goto EXIT; */ } else { /* successful receive */ net2h(&phdr->iseq_num,&rbuf[5],4); /*incoming seq_num from hdr*/ diff --git a/util/ipmimv.c b/util/ipmimv.c index accda41..8962ef5 100644 --- a/util/ipmimv.c +++ b/util/ipmimv.c @@ -241,6 +241,23 @@ static void dbgmsg(char *pattn, ...) fflush( fpdbg ); } +int set_cloexec(fd,fdebugcmd) +{ + int flags; + flags = fcntl(ipmi_fd, F_GETFD); + if (flags == -1) { + if (fdebugcmd) printf("fcntl(get) errno = %d\n",errno); + return -1; + } + flags |= FD_CLOEXEC; + if (fcntl(ipmi_fd, F_SETFD, flags) == -1) + { + if (fdebugcmd) printf("fcntl(set) errno = %d\n",errno); + return -1; + } + return 0; +} + int ipmi_open_mv(char fdebugcmd) { char *pdev; @@ -285,6 +302,7 @@ int ipmi_open_mv(char fdebugcmd) } } + set_cloexec(ipmi_fd,fdebugcmd); if (fdebugcmd) { dbgmsg("ipmi_open_mv: successfully opened %s, fd=%d\n",pdev,ipmi_fd); } diff --git a/util/ipmiutil.c b/util/ipmiutil.c index 4c04956..765f5e6 100644 --- a/util/ipmiutil.c +++ b/util/ipmiutil.c @@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ipmiutil.h" static char *progname = "ipmiutil"; -static char *progver = "2.98"; +static char *progver = "2.99"; // static char fdebug = 0; /*int ipmiutil(int argc, char **argv); */ diff --git a/util/ireset.c b/util/ireset.c index a796393..e95b597 100644 --- a/util/ireset.c +++ b/util/ireset.c @@ -108,7 +108,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "ireset"; static uchar ipmi_maj; static uchar ipmi_min; @@ -242,10 +242,10 @@ int set_boot_init_string(char *istr) idata[2] = iana[0]; idata[3] = iana[1]; idata[4] = iana[2]; - strncpy(&idata[5],&istr[n],13); + strncpy((char *)&idata[5],&istr[n],13); n += 13; } else { - strncpy(&idata[2],&istr[n],16); + strncpy((char *)&idata[2],&istr[n],16); n += 16; } rlen = MAX_BUFFER_SIZE; diff --git a/util/isel.c b/util/isel.c index 04c7c97..a6058e6 100644 --- a/util/isel.c +++ b/util/isel.c @@ -162,7 +162,7 @@ typedef struct #define RDATA_OFFSET 13 //byte offset to the record event data static char *progname = "isel"; -static char *progver = "2.98"; +static char *progver = "2.99"; #ifdef WIN32 #define IDXFILE "sel.idx" static char idxfile[80] = IDXFILE; diff --git a/util/iseltime.c b/util/iseltime.c index 9b74231..687db22 100644 --- a/util/iseltime.c +++ b/util/iseltime.c @@ -75,7 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "iseltime"; static char fdebug = 0; static char fset = 0; diff --git a/util/isensor.c b/util/isensor.c index 6aaf3fb..a8694f9 100644 --- a/util/isensor.c +++ b/util/isensor.c @@ -247,7 +247,7 @@ char *decode_entity_id(int id) { * Global Data ************************/ static char *progname = "isensor"; -static char *progver = "2.98"; +static char *progver = "2.99"; #ifdef WIN32 static char savefile[] = "%ipmiutildir%\\thresholds.cmd"; #else @@ -277,6 +277,7 @@ static int fgetmem = 0; static int fprivset = 0; static char fremote = 0; static int nloops = 1; /* num times to show repeated sensor readings */ +static int loopsec = 1; /* wait N sec between loops, default 1 */ static char bdelim = BDELIM; /* delimiter for canonical output */ static char tmpstr[20]; /* temp string */ static char *binfile = NULL; @@ -1298,7 +1299,8 @@ int GetSDR(int r_id, int *r_next, uchar *recdata, int srecdata, int *rlen) if (sresp >= 2) thislen = sresp - 2; else thislen = 0; reclen = off + thislen; /* truncate, stop reading */ - fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",sresp,thislen+2); + fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",r_id,sresp,thislen+2); + rc = ERR_SDR_MALFORMED; } /* successful */ memcpy(&resp[off],&respchunk[2],thislen); @@ -1342,7 +1344,7 @@ int get_sdr_file(char *sdrfile, uchar **sdrlist) FILE *fp = NULL; int i, n, num, nsdr, isdr, len; uchar *sdrbuf; - uchar buff[255]; + char buff[255]; uchar hbuf[85]; char fvalid; @@ -1468,7 +1470,7 @@ int find_nsdrs(uchar *pcache) ulong asz = 0; int i, len; uchar *sdr; - ushort recid; + ushort recid = 0; if (pcache == NULL) return(num); for (i = 0; (int)asz < sz_sdrs; i++) @@ -1559,7 +1561,7 @@ int find_sdr_by_tag(uchar *psdr, uchar *pcache, char *tag, uchar dbg) printf("sdr[%d] idx=%02x%02x num=%x tag: %s\n",i,sdr[1],sdr[0], sdr[7],tmp); } - if (strncmp(tag,&sdr[k],n) == 0) { + if (strncmp(tag,(char *)&sdr[k],n) == 0) { memcpy(psdr,sdr,len); return(0); } @@ -2499,7 +2501,7 @@ ShowSDR(char *tag, uchar *sdr) idstr[ilen] = 0; /* stringify */ if ((sdr01->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/ else brearm = 'a'; /*automatic rearm*/ - if (fdebug) printf("entity %d.%d, idlen=%d sizeof=%d idstr0=%c s0=%x\n", + if (fdebug) printf("entity %d.%d, idlen=%d sizeof=%lu idstr0=%c s0=%x\n", sdr01->entity_id, sdr01->entity_inst, ilen,sizeof(SDR01REC),idstr[0],sdr[ioff]); rc = GetSensorReading(sdr01->sens_num,sdr01,sens); @@ -2508,7 +2510,7 @@ ShowSDR(char *tag, uchar *sdr) val = 0; if (rc == 0xCB) { /*sensor not present*/ i = 10; /* Absent */ - typestr = "na"; + typestr = "na"; } else typestr = decode_rv(rc); } else { j = (sens[2] & 0x3f); /*sensor reading state*/ @@ -2518,6 +2520,10 @@ ShowSDR(char *tag, uchar *sdr) sens[2],i,sens[0],sens[1],sdr01->sens_base, sdr01->sens_units); if ((sens[1] & 0x20) != 0) { i = 7; val = 0; } /* Init state */ + else if (sens[2] == 0xc7) { i = 10; val = 0; /* Absent (Intel) */ + if (fdebug) printf("sensor[%x] is absent (c7), no reading\n", + sdr01->sens_num); + } else val = RawToFloat(sens[0],sdr); typestr = get_unit_type(sdr01->sens_units, sdr01->sens_base, sdr01->sens_mod, fsimple); @@ -2616,7 +2622,7 @@ ShowSDR(char *tag, uchar *sdr) idstr[ilen] = 0; /* stringify */ if ((sdr02->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/ else brearm = 'a'; /*automatic rearm*/ - if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n", + if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n", ilen,idstr[0],sizeof(SDR02REC),sdr[ioff]); memset(sens,0,sizeof(sens)); rc = GetSensorReading(sdr02->sens_num,sdr02,sens); @@ -2792,7 +2798,7 @@ ShowSDR(char *tag, uchar *sdr) if (ilen >= sizeof(idstr)) ilen = sizeof(idstr) - 1; memcpy(idstr,&sdr[ioff],ilen); idstr[ilen] = 0; /* stringify */ - if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n", + if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n", ilen,idstr[0],sizeof(SDR11REC),sdr[ioff]); printf("%s", tag); if (fsimple) @@ -2822,7 +2828,7 @@ ShowSDR(char *tag, uchar *sdr) if (ilen >= sizeof(idstr)) ilen = sizeof(idstr) - 1; memcpy(idstr,&sdr[ioff],ilen); idstr[ilen] = 0; /* stringify */ - if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n", + if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n", ilen,idstr[0],sizeof(SDR12REC),sdr[ioff]); printf("%s", tag); if (fsimple) @@ -2986,6 +2992,31 @@ static int get_filesize(char *fileName, ulong *psize) } #endif +int write_sdr_binfile(char *binfile) +{ + uchar *pbuf = NULL; + FILE *fp; + int len, ret; + ret = get_sdr_cache(&pbuf); /* sets nsdrs, sz_sdrs */ + if (ret == 0) { + fp = fopen(binfile,"wb"); + if (fp == NULL) { + ret = get_LastError(); + printf("Cannot open file %s for writing, error %d\n",binfile,ret); + } else { + printf("Writing SDR size %d to %s ...\n",sz_sdrs,binfile); + len = (int)fwrite(pbuf, 1, sz_sdrs, fp); + fclose(fp); + if (len <= 0) { + ret = get_LastError(); + printf("Error %d writing file %s\n",ret,binfile); + } else ret = 0; + } + free_sdr_cache(pbuf); + } + return(ret); +} + int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen) { uchar *pbuf = NULL; @@ -3006,9 +3037,9 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen) #endif fp = fopen(binfile,"rb"); if (fp == NULL) { - ret = get_LastError(); - printf("Cannot open file %s, error %d\n",binfile,ret); - return(ret); + ret = get_LastError(); + printf("Cannot open file %s, error %d\n",binfile,ret); + return(ret); } fseek(fp, 0L, SEEK_SET); #ifndef WIN32 @@ -3030,29 +3061,29 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen) pbuf = malloc(len); if (fdebug) printf("sdr_binfile: malloc(%d) pbuf=%p\n",len,pbuf); if (pbuf == NULL) { - ret = -1; - fclose(fp); - return(ret); + ret = -2; + fclose(fp); + return(ret); } psdrcache = pbuf; /*ok, so proceed with restore*/ ret = 0; len = (int)fread(pbuf, 1, sz_sdrs, fp); if (len <= 0) { - ret = get_LastError(); - printf("Error %d reading file %s\n",ret,binfile); - sz_sdrs = 0; /*for safety*/ + ret = get_LastError(); + printf("Error %d reading file %s\n",ret,binfile); + sz_sdrs = 0; /*for safety*/ } else if (len < sz_sdrs) { - /* Show error if this happens in Windows */ - ret = get_LastError(); - printf("truncated fread(%s): attempted %d, got %d, error %d\n", - binfile,sz_sdrs,len,ret); + /* Show error if this happens in Windows */ + ret = get_LastError(); + printf("truncated fread(%s): attempted %d, got %d, error %d\n", + binfile,sz_sdrs,len,ret); ret = 0; /*try to keep going*/ } fclose(fp); if (fdebug) { - printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs); - dump_buf("SDR buffer",pbuf,len,1); + printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs); + dump_buf("SDR buffer",pbuf,len,1); } *pbufret = pbuf; *buflen = len; @@ -3086,7 +3117,7 @@ int i_sensor(int argc, char **argv) printf("%s: version %s\n",progname,progver); - while ( (c = getopt( argc, argv,"a:bcd:ef:g:h:i:j:l:m:n:opqrstu:vwxT:V:J:L:EYF:P:N:R:U:Z:?")) != EOF ) + while ( (c = getopt( argc, argv,"a:bcd:ef:g:h:i:j:k:l:m:n:opqrstu:vwxT:V:J:L:EYF:P:N:R:U:Z:?")) != EOF ) switch(c) { case 'a': /* reArm sensor number N */ if (strncmp(optarg,"0x",2) == 0) frearm = htoi(&optarg[2]); @@ -3116,11 +3147,7 @@ int i_sensor(int argc, char **argv) break; case 'j': fjumpstart = 1; /* Load SDR cache from a file*/ binfile = optarg; break; - case 't': fshowthr = 1; break; - case 'v': fshowthr = 1; sens_verbose = 1; break; - case 'p': fsavethresh = 1; break; - case 'q': fshowthr = 2; fwrap = 1; break; - case 'r': frawsdr = 1; break; + case 'k': loopsec = atoi(optarg); break; /*N sec between loops*/ case 'm': /* specific MC, 3-byte address, e.g. "409600" */ g_bus = htoi(&optarg[0]); /*bus/channel*/ g_sa = htoi(&optarg[2]); /*device slave address*/ @@ -3161,6 +3188,11 @@ int i_sensor(int argc, char **argv) fsetthresh = 2; /*indicates float conversion*/ } break; + case 'p': fsavethresh = 1; break; + case 'q': fshowthr = 2; fwrap = 1; break; + case 'r': frawsdr = 1; break; + case 't': fshowthr = 1; break; + case 'v': fshowthr = 1; sens_verbose = 1; break; case 'u': /* specify unique thresholds in hex or float */ /* raw hex format: 0xLNLCLUHNHCHU, all 6 required */ if (strncmp(optarg,"0x",2) == 0) { /*raw hex thresholds*/ @@ -3246,8 +3278,9 @@ int i_sensor(int argc, char **argv) // printf(" -f file Restore SDRs from a binary dump file\n"); printf(" -g fan show only this sensor type group\n"); printf(" -h tval specifies the Highest threshold to set\n"); - printf(" -i id only show these sensor ids\n"); + printf(" -i id only show these sensor id numbers\n"); printf(" -j file Jump-start SDR cache from a binary file\n"); + printf(" -k K If -L, wait K sec between loops (default=1)\n"); printf(" -l tval specifies the Lowest threshold to set\n"); printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -n snum specifies the sensor Number to set hi/lo\n"); @@ -3260,7 +3293,7 @@ int i_sensor(int argc, char **argv) printf(" -u thr set Unique threshold values (e.g. 3:2:1:48:49:50)\n"); printf(" -v Verbose: thresholds, max/min, hysteresis\n"); printf(" -w Wrap thresholds on sensor line\n"); - printf(" -L n Loop n times\n"); + printf(" -L n Loop n times every k seconds (default k=1)\n"); print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; @@ -3374,26 +3407,7 @@ int i_sensor(int argc, char **argv) } if (fdump) { - uchar *pbuf = NULL; - FILE *fp; - int len; - ret = get_sdr_cache(&pbuf); - if (ret == 0) { - fp = fopen(binfile,"wb"); - if (fp == NULL) { - ret = get_LastError(); - printf("Cannot open file %s, error %d\n",binfile,ret); - } else { - printf("Writing SDR size %d to %s ...\n",sz_sdrs,binfile); - len = (int)fwrite(pbuf, 1, sz_sdrs, fp); - fclose(fp); - if (len <= 0) { - ret = get_LastError(); - printf("Error %d writing file %s\n",ret,binfile); - } else ret = 0; - } - free_sdr_cache(pbuf); - } + ret = write_sdr_binfile(binfile); goto do_exit; } /*endif fdump*/ @@ -3405,25 +3419,25 @@ int i_sensor(int argc, char **argv) ret = read_sdr_binfile(binfile,&pbuf,&slen); if (ret == 0) { /*successful, so write SDRs */ - nsdrs = find_nsdrs(pbuf); - printf("Ready to restore %d SDRs\n",nsdrs); - set_reserve(1); - ret = sdr_clear_repo(fdevsdrs); - if (ret != 0) { - printf("SDR Clear Repository error %d\n",ret); - goto do_exit; - } - id = 0; - while(find_sdr_next(sdr,pbuf,id) == 0) { - id = sdr[0] + (sdr[1] << 8); - if (fdebug) printf("adding SDR[%x]\n",id); - set_reserve(1); - ret = sdr_add_record(sdr,fdevsdrs); - if (ret != 0) { - printf("SDR[%x] add error %d\n",id,ret); - break; - } - } /*end while sdr*/ + nsdrs = find_nsdrs(pbuf); + printf("Ready to restore %d SDRs\n",nsdrs); + set_reserve(1); + ret = sdr_clear_repo(fdevsdrs); + if (ret != 0) { + printf("SDR Clear Repository error %d\n",ret); + goto do_exit; + } + id = 0; + while(find_sdr_next(sdr,pbuf,id) == 0) { + id = sdr[0] + (sdr[1] << 8); + if (fdebug) printf("adding SDR[%x]\n",id); + set_reserve(1); + ret = sdr_add_record(sdr,fdevsdrs); + if (ret != 0) { + printf("SDR[%x] add error %d\n",id,ret); + break; + } + } /*end while sdr*/ } if (ret == 0) printf("Restored %d SDRs successfully.\n",nsdrs); free_sdr_cache(pbuf); /* does nothing if (pbuf == NULL) */ @@ -3434,12 +3448,19 @@ int i_sensor(int argc, char **argv) uchar *pbuf = NULL; int slen; ret = read_sdr_binfile(binfile,&pbuf,&slen); - if (ret != 0) fjumpstart = 0; /* use normal method if error*/ - else { /* set this as the SDR cache */ - psdrcache = pbuf; - sz_sdrs = slen; - nsdrs = find_nsdrs(pbuf); - if (fdebug) printf("jumpstart cache: nsdrs=%d size=%d\n",nsdrs,slen); + if (ret != 0) { + /* Try to dump sdrs to this file if not there */ + ret = write_sdr_binfile(binfile); + if (ret == 0) + ret = read_sdr_binfile(binfile,&pbuf,&slen); + if (ret != 0) { + fjumpstart = 0; /*cannot do jumpstart*/ + } + } else { /* set this as the SDR cache */ + psdrcache = pbuf; + sz_sdrs = slen; + nsdrs = find_nsdrs(pbuf); + if (fdebug) printf("jumpstart cache: nsdrs=%d size=%d\n",nsdrs,slen); } } /*endif fjumpstart*/ @@ -3493,9 +3514,9 @@ int i_sensor(int argc, char **argv) printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext); if (ret != 0) { if (ret > 0) { /* ret is a completion code error */ - fprintf(stderr,"%04x GetSDR error 0x%02x %s, rlen=%d\n", + fprintf(stderr,"%04x GetSDR error 0x%02x %s, rlen=%d\n", recid,ret,decode_cc((ushort)0,(uchar)ret),sz); - if (ret == 0xC5) { /* lost Reservation ID, retry */ + if (ret == 0xC5) { /* lost Reservation ID, retry */ /* This means that some other IPMI software has * requested a Reservation before we finished, so * we need to refresh the Reservation ID * retry. */ @@ -3504,11 +3525,12 @@ int i_sensor(int argc, char **argv) if (fdebug) printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret, recnext); - } + if (ret == 0xC5) sz = 0; /*failed to get Reservation ID*/ + } } else fprintf(stderr,"%04x GetSDR error %d, rlen = %d\n", - recid,ret,sz); + recid,ret,sz); if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */ - break; + break; } /* else fall through & continue */ } } /*end-else*/ @@ -3662,6 +3684,7 @@ int i_sensor(int argc, char **argv) } /*endif ok, got full SDR */ NextSdr: + if (ret == ERR_SDR_MALFORMED) break; if (fjumpstart) recid = recnext; else { if (recnext == recid) recid = 0xffff; /*break;*/ @@ -3674,8 +3697,8 @@ NextSdr: irec++; } /*end while recid*/ if (fdoloop && (nloops > 1)) { - printf("\n"); /* output an empty separator line */ - os_usleep(1,0); /*delay 1 sec between loops*/ + printf("\n"); /* output an empty separator line */ + os_usleep(loopsec,0); /*delay 1 sec between loops*/ } } /*end for nloops*/ diff --git a/util/iserial.c b/util/iserial.c index d4fd427..c34d10c 100644 --- a/util/iserial.c +++ b/util/iserial.c @@ -155,7 +155,7 @@ typedef struct /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "iserial"; static int vend_id = 0; static int prod_id = 0; diff --git a/util/isol.c b/util/isol.c index d141452..d76f10d 100644 --- a/util/isol.c +++ b/util/isol.c @@ -165,7 +165,7 @@ void dbglog( char *pattn, ... ); /*local prototype*/ /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "isol"; static char fdebug = 0; static char fpicmg = 0; diff --git a/util/itsol.c b/util/itsol.c index 9aad458..410ce7f 100644 --- a/util/itsol.c +++ b/util/itsol.c @@ -98,7 +98,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz); extern int verbose; extern char fdebug; /*from ipmicmd.c*/ static char * progname = "itsol"; -static char * progver = "2.98"; +static char * progver = "2.99"; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; static uchar g_lun = BMC_LUN; diff --git a/util/iwdt.c b/util/iwdt.c index 552867d..bd06e0c 100644 --- a/util/iwdt.c +++ b/util/iwdt.c @@ -100,7 +100,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* * Global variables */ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "iwdt"; static char fdebug = 0; static char fdontlog = 0; diff --git a/util/oem_dell.c b/util/oem_dell.c index e700ebd..4fa7e5f 100644 --- a/util/oem_dell.c +++ b/util/oem_dell.c @@ -132,7 +132,7 @@ char NIC_Selection_Mode_String_12g[] [50] = { "shared with failover all loms" }; -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "idelloem"; static int verbose = 0; static char fdebug = 0; @@ -399,7 +399,7 @@ ipmi_delloem_password_policy(void * intf, int argc, char ** argv) { int rv = 0; int rsp_len; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; uint8_t rsp[IPMI_RSPBUF_SIZE]; uint8_t bval; @@ -889,7 +889,7 @@ ipmi_lcd_get_platform_model_name (void * intf, { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; IPMI_DELL_LCD_STRING * lcdstringblock; int lcdstring_len = 0; @@ -967,7 +967,7 @@ ipmi_idracvalidator_command (void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; memset (&req,0,sizeof(req)); @@ -1024,7 +1024,7 @@ ipmi_lcd_get_configure_command_wh (void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; req.msg.netfn = IPMI_NETFN_APP; @@ -1068,7 +1068,7 @@ ipmi_lcd_get_configure_command (void * intf, { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; req.msg.netfn = IPMI_NETFN_APP; @@ -1114,7 +1114,7 @@ ipmi_lcd_set_configure_command (void * intf, int command) uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[2]; req.msg.netfn = IPMI_NETFN_APP; @@ -1159,7 +1159,7 @@ ipmi_lcd_set_configure_command_wh (void * intf, uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[13]; ipmi_lcd_get_configure_command_wh(intf); @@ -1248,7 +1248,7 @@ ipmi_lcd_get_single_line_text (void * intf, char* lcdstring, uint8_t max_length) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; IPMI_DELL_LCD_STRING * lcdstringblock; int lcdstring_len = 0; @@ -1322,7 +1322,7 @@ ipmi_lcd_get_info_wh(void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; uint8_t command = 0; IPMI_DELL_LCD_CAPS* lcd_caps; @@ -1449,7 +1449,7 @@ ipmi_lcd_get_info_wh(void * intf) static int ipmi_lcd_get_info(void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; IPMI_DELL_LCD_CAPS * lcd_caps; uint8_t command = 0; @@ -1531,7 +1531,7 @@ static int ipmi_lcd_get_status_val(void * intf, LCD_STATUS* lcdstatus) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; @@ -1588,7 +1588,7 @@ static int IsLCDSupported () static void CheckLCDSupport(void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; LcdSupported = 0; @@ -1695,7 +1695,7 @@ ipmi_lcd_set_kvm(void * intf, char status) LCD_STATUS lcdstatus; int rc=0; uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[5]; rc=ipmi_lcd_get_status_val(intf,&lcdstatus); if (rc < 0) @@ -1737,7 +1737,7 @@ ipmi_lcd_set_lock(void * intf, char lock) LCD_STATUS lcdstatus; int rc =0; uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[5]; rc=ipmi_lcd_get_status_val(intf,&lcdstatus); if (rc < 0) @@ -1777,7 +1777,7 @@ static int ipmi_lcd_set_single_line_text (void * intf, char * text) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[18]; int bytes_to_store = strlen_(text); int bytes_stored = 0; @@ -1858,7 +1858,7 @@ ipmi_lcd_set_text(void * intf, char * text, int line_number) int rc = 0; uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; IPMI_DELL_LCD_CAPS * lcd_caps; @@ -3431,7 +3431,7 @@ static int ipmi_get_power_capstatus_command (void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[2]; req.msg.netfn = IPMI_DELL_OEM_NETFN; @@ -3473,7 +3473,7 @@ static int ipmi_set_power_capstatus_command (void * intf,uint8_t val) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[2]; if(ipmi_get_power_capstatus_command(intf) < 0) return -1; @@ -3767,7 +3767,7 @@ static uint32_t btuphr_to_watt_conversion(uint64_t powerinbtuphr) static int ipmi_get_power_headroom_command (void * intf,uint8_t unit) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint64_t peakpowerheadroombtuphr; uint64_t instantpowerhearoom; @@ -3809,8 +3809,8 @@ static int ipmi_get_power_headroom_command (void * intf,uint8_t unit) } else { - printf ("System Instantaneous Headroom : %ld W\n",powerheadroom.instheadroom); - printf ("System Peak Headroom : %ld W\n",powerheadroom.peakheadroom); + printf ("System Instantaneous Headroom : %d W\n",powerheadroom.instheadroom); + printf ("System Peak Headroom : %d W\n",powerheadroom.peakheadroom); } return 0; @@ -3926,7 +3926,7 @@ static int ipmi_get_instan_power_consmpt_data(void* intf, { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req={0}; + struct ipmi_rq req; uint8_t msg_data[2]; @@ -4056,7 +4056,7 @@ static int ipmi_print_get_power_consmpt_data(void* intf,uint8_t unit) static int ipmi_get_avgpower_consmpt_history(void* intf,IPMI_AVGPOWER_CONSUMP_HISTORY* pavgpower ) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; req.msg.netfn = IPMI_NETFN_APP; @@ -4114,7 +4114,7 @@ static int ipmi_get_peakpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HIST { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; req.msg.netfn = IPMI_NETFN_APP; @@ -4180,7 +4180,7 @@ static int ipmi_get_minpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HISTO { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[4]; req.msg.netfn = IPMI_NETFN_APP; @@ -4207,7 +4207,7 @@ static int ipmi_get_minpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HISTO if (verbose > 1) { - printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n", + printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n", rsp[0], rsp[1], rsp[2], rsp[3], rsp[4], rsp[5], rsp[6], rsp[7], rsp[8], rsp[9], rsp[10], rsp[11], @@ -4401,7 +4401,7 @@ static int ipmi_print_power_consmpt_history(void* intf,int unit ) static int ipmi_get_power_cap(void* intf,IPMI_POWER_CAP* ipmipowercap ) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req={0}; + struct ipmi_rq req; //uint64_t tempbtuphrconv; uint8_t data[4]; @@ -4505,7 +4505,7 @@ static int ipmi_print_power_cap(void* intf,uint8_t unit ) static int ipmi_set_power_cap(void* intf,int unit,int val ) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req={0}; + struct ipmi_rq req; uint8_t data[13]; uint16_t powercapval; uint64_t maxpowerbtuphr; @@ -4552,7 +4552,7 @@ static int ipmi_set_power_cap(void* intf,int unit,int val ) } if (verbose > 1) { - printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ", + printf("power cap Data :%x %x %x %x %x %x %x %x %x %x %x", rsp[1], rsp[2], rsp[3], rsp[4], rsp[5], rsp[6], rsp[7], rsp[8], rsp[9], rsp[10],rsp[11]); @@ -5142,7 +5142,7 @@ static int CheckSetLEDSupport(void * intf) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[10]; SetLEDSupported = 0; @@ -5186,7 +5186,7 @@ static int ipmi_getdrivemap(void * intf, int b, int d, int f, int *bay, int *slot) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[8]; /* Get mapping of BDF to bay:slot */ @@ -5240,7 +5240,7 @@ static int ipmi_setled_state (void * intf, int bayId, int slotId, int state) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[20]; /* Issue Drive Status Update to bay:slot */ @@ -5278,7 +5278,7 @@ ipmi_setled_state (void * intf, int bayId, int slotId, int state) int ipmi_delloem_getled_state (void * intf, uint8_t *state) { uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv; - struct ipmi_rq req = {0}; + struct ipmi_rq req; uint8_t data[2]; uint8_t led_state = 0; diff --git a/util/oem_intel.c b/util/oem_intel.c index f568300..638f08f 100644 --- a/util/oem_intel.c +++ b/util/oem_intel.c @@ -87,7 +87,7 @@ static char fRelayBits = 0; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; static uchar g_lun = BMC_LUN; -static uchar g_addrtype = ADDR_SMI; +//static uchar g_addrtype = ADDR_SMI; #ifdef OLD #ifdef WIN32 diff --git a/util/oem_kontron.c b/util/oem_kontron.c index 263560f..259fbdc 100644 --- a/util/oem_kontron.c +++ b/util/oem_kontron.c @@ -931,7 +931,6 @@ int decode_sel_kontron(uint8_t *evt, char *outbuf, int outsz, char fdesc, int sevid; ushort genid; uchar snum; - int isdr = 0; char *p1, *p2; sevid = SEV_INFO; diff --git a/util/oem_sun.c b/util/oem_sun.c index 7ab480e..4f8e496 100644 --- a/util/oem_sun.c +++ b/util/oem_sun.c @@ -109,7 +109,7 @@ static const struct valstr sunoem_led_mode_optvals[] = { /* global variables */ static char * progname = "isunoem"; -static char * progver = "2.98"; +static char * progver = "2.99"; static char fdebug = 0; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; diff --git a/util/oem_supermicro.c b/util/oem_supermicro.c index 0c4a001..47838da 100644 --- a/util/oem_supermicro.c +++ b/util/oem_supermicro.c @@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #endif #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <time.h> #include "ipmicmd.h" @@ -66,7 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void set_loglevel(int level); /*prototype */ extern char fsm_debug; /*mem_if.c*/ -static char * progver = "2.98"; +static char * progver = "2.99"; static char * progname = "ismcoem"; static int verbose = 0; static char fdebug = 0; @@ -426,34 +427,70 @@ int decode_sensor_supermicro(uchar *sdr,uchar *reading,char *pstring, int slen) return(rv); } +#define NPAIRS 26 +char rgpair[NPAIRS] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int decode_mem_supermicro(int prod, uchar b2, uchar b3, char *desc, int *psz) { - int array, dimm, n; + int cpu, pair, dimm, n; int rv = -1; + int ver = 0; uchar bdata; if ((desc == NULL) || (psz == NULL)) return -1; - if (b2 == 0xff) bdata = b3; /*ff is reserved*/ - else bdata = b2; /* normal case */ - array = (bdata & 0xc0) >> 6; + if (b2 == 0xff) { ver = 1; bdata = b3; } /*ff is reserved*/ + else { ver = 2; bdata = b2; } /* normal case */ +#ifdef SMC_OLD + /* normal method for other vendors */ + cpu = (bdata & 0xc0) >> 6; dimm = bdata & 0x3f; + /* SuperMicro advertised method (wrong) */ /* bdata = 0x10 (16.) means CPU 1, DIMM 6 */ - array = bdata / 10; + cpu = bdata / 10; dimm = bdata % 10; - +#endif #ifdef DMIOK - /* Use DMI if we get confirmation about array/dimm indices. */ + /* Use DMI if we get confirmation about cpu/dimm indices. */ if (! is_remote()) { fsm_debug = fdebug; - rv = get_MemDesc(array,dimm,desc,psz); + rv = get_MemDesc(cpu,dimm,desc,psz); /* if (rv != 0) desc has "DIMM[%d}" */ } #endif - - if (rv != 0) { - n = sprintf(desc,"DIMM%d/CPU%d",dimm,array); - *psz = n; - rv = 0; + /* ver 0 previous SuperMicro firmware returned all zeros here. + * ver 1 returns data3 with some info (X9) + * ver 2 returns data2 with some info (X9,X10) + * There have been bugs in these SuperMicro events, but this + * has been derived from test data by comparing BIOS data. */ + if (ver == 0) { + cpu = (bdata & 0xc0) >> 6; + dimm =bdata & 0x3f; + pair = 0; + n = sprintf(desc,"CPU%d/DIMM%d",cpu,dimm); + } else if (ver == 1) { + cpu = 1; + if (bdata > 0x80) cpu = 2; + pair = (bdata & 0x70) >> 4; + if (pair > NPAIRS) pair = NPAIRS - 1; + dimm = (bdata & 0x07) + 1; /*convert to 1-based*/ + n = sprintf(desc,"P%d_DIMM%c%d",cpu,rgpair[pair],dimm); + } else { + /* ver 2 method: 2A 80 = P1_DIMMB1 */ + /* SuperMicro says: + * pair: %c (data2 >> 4) + 0x40 + (data3 & 0x3) * 3, (='B') + * dimm: %c (data2 & 0xf) + 0x27, + * cpu: %x (data3 & 0x03) + 1); + */ + cpu = (b3 & 0x0F) + 1; /*0x80=CPU1, 0x81=CPU2*/ + pair = ((bdata & 0xF0) >> 4) - 1; /*0x10=pairA, 0x20=pairB*/ + if (pair < 0) pair = 0; + if (pair > NPAIRS) pair = NPAIRS - 1; + dimm = (bdata & 0x0F) - 9; /*0x0A=dimmX1, 0x0B=dimmX2*/ + n = sprintf(desc,"P%d_DIMM%c%d",cpu,rgpair[pair],dimm); } + if (fdebug) + printf("decode_mem_supermicro: v%d bdata=%02x(%d) cpu=%d dimm=%d pair=%d\n",ver,bdata,bdata,cpu,dimm,pair); + + *psz = n; + rv = 0; return(rv); } /*end decode_mem_supermicro*/ @@ -481,6 +518,7 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc, int sevid; ushort genid; uchar snum; + uchar data1, data2, data3; fdebug = fdbg; sevid = SEV_INFO; @@ -489,13 +527,16 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc, snum = evt[11]; timestamp = evt[3] + (evt[4] << 8) + (evt[5] << 16) + (evt[6] << 24); genid = evt[7] | (evt[8] << 8); + data1 = evt[13]; + data2 = evt[14]; + data3 = evt[15]; if (rectype == 0x02) { sprintf(mybuf,"%02x [%02x %02x %02x]", evt[12],evt[13],evt[14],evt[15]); switch(evt[10]) { /*sensor type*/ - case 0xC0: /* CPU Temp Sensor */ + case 0xC0: /* CPU Temp Sensor */ type_str = "OEM_CpuTemp"; - switch((evt[13] &0x0f)) { /*offset/data1 l.o. nibble*/ + switch((evt[13] & 0x0f)) { /*offset/data1 l.o. nibble*/ case 0x02: /* CPU Temp Sensor Overheat event offset */ if (evt[12] & 0x80) { /*EvTyp==0xF0 if deassert*/ pstr = "CpuTemp Overheat OK"; sevid = SEV_INFO; @@ -507,7 +548,7 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc, default: pstr = "CpuTemp Event"; break; } break; - case 0xC2: /* CPLD Event */ + case 0xC2: /* CPLD Event */ type_str = "OEM_CPLD"; switch((evt[13] & 0x0f)) { /* data1 usu 0xa0*/ case 0x00: @@ -519,7 +560,20 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc, default: pstr = "CPLD Event"; break; } break; - default: /*other sensor types*/ + case 0xD0: /* BMC Event */ + type_str = "OEM_BMC"; + pstr = "BMC unknown event"; + sevid = SEV_CRIT; + if (data1 == 0x80 && data3 == 0xFF) { + switch(data2) { + case 0x00: pstr = "BMC unexpected reset"; break; + case 0x01: pstr = "BMC cold reset"; break; + case 0x02: pstr = "BMC warm reset"; break; + } + } + break; + case 0xC8: /* Observed Event */ + default: /*other sensor types*/ break; } } diff --git a/util/subs.c b/util/subs.c index 13e1603..135fcd9 100644 --- a/util/subs.c +++ b/util/subs.c @@ -403,7 +403,7 @@ int get_errno(void) /* For a list of all IANA enterprise mfg vendor numbers, * see http://www.iana.org/assignments/enterprise-numbers * Product numbers are different for each mfg vendor. */ -#define N_MFG 43 +#define N_MFG 44 static struct { int val; char *pstr; } mfgs[N_MFG] = { {0, " "}, {0x0000BA, "Toshiba"}, @@ -424,6 +424,7 @@ static struct { int val; char *pstr; } mfgs[N_MFG] = { { 7154, "IPMI forum"}, { 11129, "Google"}, { 12634, "PICMG"}, + { 15370, "Giga-Byte"}, /*0x3C0A*/ { 16394, "Pigeon Point"}, { 20569, "Inventec ESC"}, { 24673, "ServerEngines"}, @@ -608,7 +609,7 @@ static int sysinfo_has_len(uchar enc, int vendor) return(rv); } -int get_device_guid(char *pbuf, int *szbuf) +int get_device_guid(uchar *pbuf, int *szbuf) { int rv = -1; //uchar idata[8]; @@ -668,7 +669,7 @@ int get_sysinfo(uchar parm, uchar set, uchar block, uchar *pbuf, int *szbuf) return(rv); } -int set_system_info(uchar parm, uchar *pbuf, int szbuf) +int set_system_info(uchar parm, char *pbuf, int szbuf) { uchar idata[32]; uchar rdata[8]; |