summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog29
-rw-r--r--TODO18
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rw-r--r--debian/README.Debian2
-rw-r--r--debian/README.source3
-rw-r--r--debian/changelog4
-rw-r--r--debian/control19
-rw-r--r--debian/copyright68
-rw-r--r--debian/dirs2
-rw-r--r--debian/files1
l---------debian/ipmiutil.ipmi_port.init1
l---------debian/ipmiutil.ipmi_port.service1
l---------debian/ipmiutil.ipmiutil_asy.init1
l---------debian/ipmiutil.ipmiutil_asy.service1
l---------debian/ipmiutil.ipmiutil_evt.init1
l---------debian/ipmiutil.ipmiutil_evt.service1
l---------debian/ipmiutil.ipmiutil_wdt.init1
l---------debian/ipmiutil.ipmiutil_wdt.service1
-rw-r--r--debian/ipmiutil.lintian-overrides4
-rw-r--r--debian/ipmiutil.substvars2
-rw-r--r--debian/libipmiutil.install1
-rw-r--r--debian/patches/001-landesk_test.patch21
-rw-r--r--debian/patches/002-build.patch37
-rw-r--r--debian/patches/005-init.patch80
-rw-r--r--debian/patches/series3
-rwxr-xr-xdebian/rules14
-rw-r--r--doc/Makefile16
-rw-r--r--doc/UserGuide2
-rw-r--r--doc/ipmiutil.spec11
-rw-r--r--lib/lanplus/helper.c7
-rw-r--r--lib/lanplus/lanplus.c2
-rw-r--r--scripts/Makefile16
-rwxr-xr-xsetver10
-rw-r--r--util/Makefile.am1
-rw-r--r--util/Makefile.in1
-rw-r--r--util/ialarms.c2
-rw-r--r--util/icmd.c2
-rw-r--r--util/iconfig.c2
-rw-r--r--util/idcmi.c4
-rw-r--r--util/ievents.c113
-rw-r--r--util/ifirewall.c2
-rwxr-xr-xutil/ifru.c2
-rw-r--r--util/ifruset.c2
-rw-r--r--util/igetevent.c2
-rw-r--r--util/ihealth.c17
-rw-r--r--util/ilan.c47
-rw-r--r--util/ipicmg.c2
-rw-r--r--util/ipmi_sample_evt.c8
-rw-r--r--util/ipmicmd.c129
-rw-r--r--util/ipmicmd.h11
-rw-r--r--util/ipmilan.c43
-rw-r--r--util/ipmilanplus.c23
-rw-r--r--util/ipmild.c2
-rw-r--r--util/ipmiutil.c2
-rw-r--r--util/ireset.c2
-rw-r--r--util/isel.c2
-rw-r--r--util/iseltime.c2
-rw-r--r--util/isensor.c582
-rw-r--r--util/iserial.c5
-rw-r--r--util/isol.c3
-rw-r--r--util/itsol.c2
-rw-r--r--util/iwdt.c2
-rw-r--r--util/md2.h157
-rw-r--r--util/oem_dell.c2
-rw-r--r--util/oem_hp.c12
-rw-r--r--util/oem_sun.c2
-rw-r--r--util/oem_supermicro.c2
-rw-r--r--util/subs.c26
69 files changed, 1023 insertions, 583 deletions
diff --git a/ChangeLog b/ChangeLog
index ebf3c29..a4178e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3939,7 +3939,7 @@ wdt.8 iwdt.8 (ipmiutil wdt)
idiscover (ipmiutil discover) ver 1.9
ipmi_port (ipmi_port) ver 1.4
-03/28/2013 ARCress ipmiutil-2.9.3 changes
+03/28/2014 ARCress ipmiutil-2.9.3 changes
doc/ipmiutil.spec - add 'BuildRequires: systemd' if Fedora >= 15
scripts/install.cmd - split mkdir into two steps
scripts/ipmi_info - return 0 even if sysinfo is not supported
@@ -3979,3 +3979,30 @@ wdt.8 iwdt.8 (ipmiutil wdt)
ihpm (ipmiutil hpm) ver 1.09
idiscover (ipmiutil discover) ver 1.9
ipmi_port (ipmi_port) ver 1.4
+
+06/28/2014 ARCress ipmiutil-2.9.4 changes
+ util/isensor.c - for -j: more debug output & handle if recid=0,
+ longer KCS timeouts for Supermicro
+ util/idcmi.c - cast ulong for << 24
+ util/ipmilan.c - cast ulong for << 24
+ util/oem_hp.c - check unit1 bits last
+ lib/lanplus/lanplus.c - for bridge response change memcpy to memmove
+ lib/lanplus/helper.c - use LANHELPER compile flag
+ util/subs.c - use LANHELPER compile flag
+ util/ilan.c - add -O secure option (disable null user, cipher0=off)
+ util/ipmild.c - fix --enable-landesk build error for support-request 9
+ util/ipmicmd.c,.h - fix set_lan_options memory leak to use LAN_OPT
+ util/ipmilan.c - use LAN_OPT, fix socket leaking if TCP.
+ util/ipmilanplus.c - use LAN_OPT
+ util/ihealth.c - added 2 new SuperMicro product ids
+ util/md2.h - added openssl exception license text also
+ util/Makefile.am - fix error if INS_LIB
+ ipmiutil-2.9.4 contains:
+ ipmiutil (ipmiutil) ver 2.94
+ ...(various subcommands) ver 2.94
+ ismcoem (ipmiutil smcoem) ver 2.94
+ iekanalyzer (ipmiutil ekanalyzer) ver 1.00
+ ifwum (ipmiutil fwum) ver 1.3
+ ihpm (ipmiutil hpm) ver 1.09
+ idiscover (ipmiutil discover) ver 1.9
+ ipmi_port (ipmi_port) ver 1.4
diff --git a/TODO b/TODO
index cec1931..8c97191 100644
--- a/TODO
+++ b/TODO
@@ -4,8 +4,18 @@ IPMIUTIL PROJECT TODO LIST:
IPV6:
. implement IPV6 for Windows
+Change ipmicmd.c/ipmilan.c to be thread-safe if accessing multiple nodes.
+ Currently is only conditionally safe, if threads access the same node.
+ Will require adding a context struct param to the ipmi_cmd*() funcs.
+ Probably need to add new thread-safe functions to retain back-compatibility.
+ PARTIAL in ipmiutil-2.9.0, multiple nodes in sequence is fixed
+ . need to use context structure for ipmilan
+
+stdout/stderr debug messages mixed
+ . have a global variable for stderr and if -x debug, set it to stdout.
+
SuperMicro Users:
- . implement OEM cmd to set user privilege level
+ . implement an OEM cmd to set user privilege level (needs research)
SPD decoding:
. expose SPD decoding from file/buffer, not just FRU
@@ -24,12 +34,6 @@ Add DCMI 1.5 commands for NetFn 0x2C to ipmiutil
Add an option/variant of canonical output for CSV (delimiter = ',')
-Change ipmicmd.c to be thread-safe if accessing multiple nodes.
- Currently is only conditionally safe, if threads access the same node.
- Will require adding a context struct param to the ipmi_cmd*() funcs.
- Probably need to add new thread-safe functions to retain back-compatibility.
- PARTIAL in ipmiutil-2.9.0, multiple nodes in sequence is fixed
-
Add support for MAC OSX AppleBMC.kext driver
not yet implemented, pending some documentation.
diff --git a/configure b/configure
index 9bd7483..47bb9f9 100755
--- a/configure
+++ b/configure
@@ -1808,7 +1808,7 @@ fi
# Define the identity of the package.
PACKAGE=ipmiutil
- VERSION=2.9.3
+ VERSION=2.9.4
cat >>confdefs.h <<_ACEOF
@@ -20647,7 +20647,7 @@ else
echo $sysname | grep BSD >/dev/null 2>&1
if test $? -eq 0; then
os=bsd
- OS_CFLAGS="-DBSD"
+ OS_CFLAGS="-DBSD -fPIC"
OS_LFLAGS=""
OS_DRIVERS="ipmimv.c ipmidir.c"
drivers="open direct"
diff --git a/configure.ac b/configure.ac
index 8f3e301..33e6dab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(util/ipmiutil.c)
-AM_INIT_AUTOMAKE(ipmiutil,2.9.3)
+AM_INIT_AUTOMAKE(ipmiutil,2.9.4)
AM_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr)
@@ -347,7 +347,7 @@ else
echo $sysname | grep BSD >/dev/null 2>&1
if test $? -eq 0; then
os=bsd
- OS_CFLAGS="-DBSD"
+ OS_CFLAGS="-DBSD -fPIC"
OS_LFLAGS=""
OS_DRIVERS="ipmimv.c ipmidir.c"
drivers="open direct"
diff --git a/debian/README.Debian b/debian/README.Debian
index c8059a4..f4058b2 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -1,6 +1,6 @@
ipmiutil for Debian
-------------------
- Please read the README.gz for setup
+ Please read the README.gz for setup.
-- Jörg Frings-Fürst <debian@jff-webhosting.net> Mon, 26 May 2014 13:11:06 +0200
diff --git a/debian/README.source b/debian/README.source
index 61097fc..46283aa 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -2,8 +2,7 @@ ipmiutil for Debian
-------------------
- configure
- parameter enable-landesk=yes does not work
+ parameter enable-landesk=yes does not work:
ipmiapi not found
-- Jörg Frings-Fürst <debian@jff-webhosting.net> Mon, 26 May 2014 13:11:06 +0200
-
diff --git a/debian/changelog b/debian/changelog
index 66a5d88..5824248 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,5 @@
-ipmiutil (2.9.3-1) unstable; urgency=low
+ipmiutil (2.9.4-1) unstable; urgency=low
- * Initial release (Closes: #753881)
+ * Initial release (Closes: #753881).
-- Jörg Frings-Fürst <debian@jff-webhosting.net> Mon, 26 May 2014 13:11:06 +0200
diff --git a/debian/control b/debian/control
index ad0a697..4294212 100644
--- a/debian/control
+++ b/debian/control
@@ -2,22 +2,25 @@ Source: ipmiutil
Section: utils
Priority: optional
Maintainer: Jörg Frings-Fürst <debian@jff-webhosting.net>
-Build-Depends:
+Build-Depends:
autotools-dev,
- debhelper (>= 9),
+ debhelper (>= 9),
dh-autoreconf,
dh-systemd (>= 1.5),
libfreeipmi-dev (>= 1.1.5) | libopenipmi-dev (>=2.0.18),
libssl-dev
Standards-Version: 3.9.5
Homepage: https://sourceforge.net/projects/ipmiutil/
-#Vcs-Git: git://git.debian.org/collab-maint/ipmiutil.git
-#Vcs-Browser: http://git.debian.org/?p=collab-maint/ipmiutil.git;a=summary
+Vcs-Git: git://anonscm.debian.org/collab-maint/ipmiutil.git
+Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/ipmiutil.git
Package: ipmiutil
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: IPMI Management Utilities
- ipmiutil is an easy-to-use set of IPMI server management
- utilities. It can get/set sensor thresholds, automate
- SEL management, do SOL console, etc.
+Description: IPMI management utilities
+ ipmiutil performs a series of common IPMI server management
+ functions to allow administrators to perform management functions
+ without a learning curve. It can gather FRU inventory data,
+ SEL firmware log, sensors, watchdog, power control, health,
+ monitoring, and has an SOL console. It can write sensor thresholds,
+ FRU asset tags, and supports a full IPMI configuration save/restore.
diff --git a/debian/copyright b/debian/copyright
index db951cd..87740a2 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,9 +7,24 @@ Copyright: 2002-2004 Service Availability(TM) Forum
1999-2006 Intel Corporation
2003 Sun Microsystems, Inc
2009-2011 Kontron America, Inc
- 2014 Jörg Frings-Fürst <debian@jff-webhosting.net>
License: BSD-3-clause
+Files: debian/*
+Copyright: 2014 Jörg Frings-Fürst <debian@jff-webhosting.net>
+License: BSD-3-clause
+
+Files: util/AnsiTerm.*
+Copyright: 2009 Robert Nelson <robertnelson@users.sourceforge.net>
+License: BSD-2-clause
+
+Files: util/md2.h
+Copyright: 2003 FreeIPMI Core Team
+License: GPL-2+ with OpenSSL exception
+
+Files: util/md5.c
+Copyright: 1999-2002 Aladdin Enterprises
+License: Zlib
+
License: BSD-3-clause
All rights reserved.
.
@@ -36,10 +51,6 @@ License: BSD-3-clause
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-Files: util/AnsiTerm.*
-Copyright: 2009 Robert Nelson <robertnelson@users.sourceforge.net>
-License: BSD-2-clause
-
License: BSD-2-clause
All rights reserved.
.
@@ -64,6 +75,49 @@ License: BSD-2-clause
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+License: GPL-2+ with OpenSSL exception
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful, but
+ is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
+ NON-INFRINGEMENT. See the GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ The complete text of the GNU General Public License
+ can be found in /usr/share/common-licenses/GPL-2 file.
+ .
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
-
-
+License: Zlib
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+ .
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+ .
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
diff --git a/debian/dirs b/debian/dirs
index 5b14e45..9b64c52 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1 +1 @@
-usr/share/ipmiutil
+#usr/share/ipmiutil
diff --git a/debian/files b/debian/files
deleted file mode 100644
index 793f54c..0000000
--- a/debian/files
+++ /dev/null
@@ -1 +0,0 @@
-ipmiutil_2.9.1_amd64.deb utils optional
diff --git a/debian/ipmiutil.ipmi_port.init b/debian/ipmiutil.ipmi_port.init
new file mode 120000
index 0000000..2ab7329
--- /dev/null
+++ b/debian/ipmiutil.ipmi_port.init
@@ -0,0 +1 @@
+../scripts/ipmi_port.sh \ No newline at end of file
diff --git a/debian/ipmiutil.ipmi_port.service b/debian/ipmiutil.ipmi_port.service
new file mode 120000
index 0000000..f541dda
--- /dev/null
+++ b/debian/ipmiutil.ipmi_port.service
@@ -0,0 +1 @@
+../scripts/ipmi_port.service \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_asy.init b/debian/ipmiutil.ipmiutil_asy.init
new file mode 120000
index 0000000..b710118
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_asy.init
@@ -0,0 +1 @@
+../scripts/ipmiutil_asy \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_asy.service b/debian/ipmiutil.ipmiutil_asy.service
new file mode 120000
index 0000000..2ffb952
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_asy.service
@@ -0,0 +1 @@
+../scripts/ipmiutil_asy.service \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_evt.init b/debian/ipmiutil.ipmiutil_evt.init
new file mode 120000
index 0000000..192ca21
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_evt.init
@@ -0,0 +1 @@
+../scripts/ipmiutil_evt \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_evt.service b/debian/ipmiutil.ipmiutil_evt.service
new file mode 120000
index 0000000..fda1c39
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_evt.service
@@ -0,0 +1 @@
+../scripts/ipmiutil_evt.service \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_wdt.init b/debian/ipmiutil.ipmiutil_wdt.init
new file mode 120000
index 0000000..73359a6
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_wdt.init
@@ -0,0 +1 @@
+../scripts/ipmiutil_wdt \ No newline at end of file
diff --git a/debian/ipmiutil.ipmiutil_wdt.service b/debian/ipmiutil.ipmiutil_wdt.service
new file mode 120000
index 0000000..644b77d
--- /dev/null
+++ b/debian/ipmiutil.ipmiutil_wdt.service
@@ -0,0 +1 @@
+../scripts/ipmiutil_wdt.service \ No newline at end of file
diff --git a/debian/ipmiutil.lintian-overrides b/debian/ipmiutil.lintian-overrides
deleted file mode 100644
index 5667e46..0000000
--- a/debian/ipmiutil.lintian-overrides
+++ /dev/null
@@ -1,4 +0,0 @@
-# The only GPL code in ipmiutil is md2.h, which is excluded
-# by default, so ignore unsafe link with openssl warning
-ipmiutil: possible-gpl-code-linked-with-openssl
-
diff --git a/debian/ipmiutil.substvars b/debian/ipmiutil.substvars
deleted file mode 100644
index 275a91d..0000000
--- a/debian/ipmiutil.substvars
+++ /dev/null
@@ -1,2 +0,0 @@
-shlibs:Depends=libc6 (>= 2.15), libssl1.0.0 (>= 1.0.0)
-misc:Depends=
diff --git a/debian/libipmiutil.install b/debian/libipmiutil.install
deleted file mode 100644
index 87ba95c..0000000
--- a/debian/libipmiutil.install
+++ /dev/null
@@ -1 +0,0 @@
-#usr/lib/*/lib*.so.*
diff --git a/debian/patches/001-landesk_test.patch b/debian/patches/001-landesk_test.patch
deleted file mode 100644
index 150dce8..0000000
--- a/debian/patches/001-landesk_test.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Description: remove ifdef TEST & endif
-Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
-Last-Update: 2014-06-04
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: trunk/util/ipmild.c
-===================================================================
---- trunk.orig/util/ipmild.c 2014-05-26 14:23:52.000000000 +0200
-+++ trunk/util/ipmild.c 2014-05-26 19:07:45.000000000 +0200
-@@ -87,9 +87,9 @@
- extern FILE *fperr; /*defined in ipmicmd.c*/
- extern FILE *fpdbg; /*defined in ipmicmd.c*/
- extern ipmi_cmd_t ipmi_cmds[NCMDS];
--#ifdef TEST
-+//#ifdef TEST
- static int ipmi_fd = -1;
--#endif
-+//#endif
-
- int ipmi_open_ld(char fdebugcmd)
- {
diff --git a/debian/patches/002-build.patch b/debian/patches/002-build.patch
deleted file mode 100644
index dc1799e..0000000
--- a/debian/patches/002-build.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Description: add @INS_LIB@ to Makefiles
-Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
-Last-Update: 2014-06-04
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: trunk/util/Makefile.am
-===================================================================
---- trunk.orig/util/Makefile.am 2014-03-31 16:10:19.000000000 +0200
-+++ trunk/util/Makefile.am 2014-05-26 19:11:11.998725060 +0200
-@@ -189,9 +189,9 @@
- @INS_LIB@ cp -f isensor.h ievents.h $(DESTDIR)$(extradir)
- @INS_LIB@ cp -f Makefile.sample $(DESTDIR)$(extradir)/Makefile
- @INS_LIB@ cp -f $(DEV_LIB) $(DESTDIR)$(LIBDIR)
-- if [ "x$(SHRLINK)" != "x" ]; then \
-+ @INS_LIB@ if [ "x$(SHRLINK)" != "x" ]; then \
- @INS_LIB@ cp -f $(SHR_LIB) $(DESTDIR)$(LIBDIR) ; \
-- fi
-+ @INS_LIB@ fi
-
- clean-generic:
- rm -f $(DEV_LIB) $(EXTRA_PROGRAMS) $(OLDPROGS) $(TESTPROGS) $(SHRLINK)
-Index: trunk/util/Makefile.in
-===================================================================
---- trunk.orig/util/Makefile.in 2014-03-31 16:10:24.000000000 +0200
-+++ trunk/util/Makefile.in 2014-05-26 19:11:25.698992815 +0200
-@@ -752,9 +752,9 @@
- @INS_LIB@ cp -f isensor.h ievents.h $(DESTDIR)$(extradir)
- @INS_LIB@ cp -f Makefile.sample $(DESTDIR)$(extradir)/Makefile
- @INS_LIB@ cp -f $(DEV_LIB) $(DESTDIR)$(LIBDIR)
-- if [ "x$(SHRLINK)" != "x" ]; then \
-+ @INS_LIB@ if [ "x$(SHRLINK)" != "x" ]; then \
- @INS_LIB@ cp -f $(SHR_LIB) $(DESTDIR)$(LIBDIR) ; \
-- fi
-+ @INS_LIB@ fi
-
- clean-generic:
- rm -f $(DEV_LIB) $(EXTRA_PROGRAMS) $(OLDPROGS) $(TESTPROGS) $(SHRLINK)
diff --git a/debian/patches/005-init.patch b/debian/patches/005-init.patch
new file mode 100644
index 0000000..d6131e4
--- /dev/null
+++ b/debian/patches/005-init.patch
@@ -0,0 +1,80 @@
+Description: include lsb/init-functions
+Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
+Last-Update: 2014-08-09
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/scripts/ipmi_port.sh
+===================================================================
+--- trunk.orig/scripts/ipmi_port.sh 2014-08-09 11:00:23.096102828 +0200
++++ trunk/scripts/ipmi_port.sh 2014-08-09 11:00:40.716468044 +0200
+@@ -25,6 +25,7 @@
+ #. /etc/init.d/functions
+ #fi
+
++
+ name=ipmi_port
+ progdir=/usr/sbin
+ prog="$progdir/$name"
+@@ -46,6 +47,8 @@
+ echo $p
+ }
+
++. /lib/lsb/init-functions
++
+ start()
+ {
+ echo -n $"Starting $name: "
+Index: trunk/scripts/ipmiutil_asy
+===================================================================
+--- trunk.orig/scripts/ipmiutil_asy 2014-08-09 11:00:23.096102828 +0200
++++ trunk/scripts/ipmiutil_asy 2014-08-09 11:00:23.088102663 +0200
+@@ -37,6 +37,8 @@
+ echo $p
+ }
+
++. /lib/lsb/init-functions
++
+ start()
+ {
+ echo -n $"Starting $dname: "
+Index: trunk/scripts/ipmiutil_wdt
+===================================================================
+--- trunk.orig/scripts/ipmiutil_wdt 2014-08-09 11:00:23.096102828 +0200
++++ trunk/scripts/ipmiutil_wdt 2014-08-09 11:00:23.088102663 +0200
+@@ -33,6 +33,8 @@
+ #tmpcron=/tmp/wdtcron.$$
+ # tmpcron2=/tmp/wdtcron2.$$
+
++. /lib/lsb/init-functions
++
+ start() {
+ echo -n $"Starting $prog: "
+ echo
+@@ -137,10 +139,13 @@
+ restart)
+ restart
+ ;;
++ force-reload)
++ restart
++ ;;
+ reload)
+ restart
+ ;;
+ *)
+- echo $"Usage: $0 {start|stop|status|restart|reload}"
++ echo $"Usage: $0 {start|stop|status|restart|reload|restart}"
+ exit 1
+ esac
+Index: trunk/scripts/ipmiutil_evt
+===================================================================
+--- trunk.orig/scripts/ipmiutil_evt 2014-08-09 11:00:23.096102828 +0200
++++ trunk/scripts/ipmiutil_evt 2014-08-09 11:00:23.092102746 +0200
+@@ -40,6 +40,8 @@
+ echo $p
+ }
+
++. /lib/lsb/init-functions
++
+ start()
+ {
+ echo -n $"Starting $name: "
diff --git a/debian/patches/series b/debian/patches/series
index 5084afc..9f3fe5c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,2 @@
+005-init.patch
003-typo-man.patch
-001-landesk_test.patch
-002-build.patch
diff --git a/debian/rules b/debian/rules
index 44ad232..88a9b40 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,14 +5,6 @@
#export DH_VERBOSE=1
-#
-# Hardening
-#
-#
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-
-
%:
dh $@ --with autotools-dev --with systemd
@@ -29,3 +21,9 @@ override_dh_installchangelogs:
override_dh_installman:
dh_installman doc/iseltime.8
dh_installman
+
+override_dh_installinit:
+ dh_installinit --name=ipmi_port
+ dh_installinit --name=ipmiutil_asy
+ dh_installinit --name=ipmiutil_evt
+ dh_installinit --name=ipmiutil_wdt
diff --git a/doc/Makefile b/doc/Makefile
index 3c9c43a..4ec983d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -47,14 +47,14 @@ CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run aclocal-1.9
+ACLOCAL = ${SHELL} /home/acress/ipmiutil/src/missing --run aclocal-1.9
AMDEP_FALSE = #
AMDEP_TRUE =
-AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run tar
+AMTAR = ${SHELL} /home/acress/ipmiutil/src/missing --run tar
AR = ar
-AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run autoconf
-AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run autoheader
-AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run automake-1.9
+AUTOCONF = ${SHELL} /home/acress/ipmiutil/src/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/acress/ipmiutil/src/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/acress/ipmiutil/src/missing --run automake-1.9
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
@@ -101,7 +101,7 @@ LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIB_DIR = /usr/lib64
LN_S = ln -s
LTLIBOBJS =
-MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/acress/ipmiutil/src/missing --run makeinfo
OBJEXT = o
OS_CFLAGS = -DLINUX -fPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2
OS_DRIVERS = imbapi.c ipmimv.c ipmild.c ipmidir.c
@@ -122,7 +122,7 @@ SHR_LINK = libipmiutil.so
STRIP = strip
SUBDIR_S = doc scripts lib util
SYSTEMD_DIR = /usr/share/ipmiutil
-VERSION = 2.9.3
+VERSION = 2.9.4
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_CXX = g++
@@ -153,7 +153,7 @@ host_os = linux-gnu
host_vendor = redhat
includedir = ${prefix}/include
infodir = ${prefix}/info
-install_sh = /usr/dev/ipmiutil-2.9.3/install-sh
+install_sh = /home/acress/ipmiutil/src/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localstatedir = ${prefix}/var
diff --git a/doc/UserGuide b/doc/UserGuide
index d1b1090..d7eb67c 100644
--- a/doc/UserGuide
+++ b/doc/UserGuide
@@ -1,6 +1,6 @@
IPMIUTIL USER GUIDE
- VERSION 2.9.3
+ VERSION 2.9.4
An easy-to-use IPMI server management utility
diff --git a/doc/ipmiutil.spec b/doc/ipmiutil.spec
index cd849f2..245eb44 100644
--- a/doc/ipmiutil.spec
+++ b/doc/ipmiutil.spec
@@ -3,7 +3,7 @@
# Copyright (c) 2012 Andy Cress
#
Name: ipmiutil
-Version: 2.9.3
+Version: 2.9.4
Release: 1%{?dist}
Summary: Easy-to-use IPMI server management utilities
License: BSD
@@ -19,13 +19,18 @@ Requires: systemd-units
%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}
-BuildRequires: openssl-devel gcc gcc-c++ libtool systemd
+BuildRequires: gcc gcc-c++ libtool systemd
%define unit_dir %{_unitdir}
%define systemd_fls %{unit_dir}
# Requires: %{?systemd_requires}
%else
-BuildRequires: openssl-devel gcc gcc-c++ libtool
+BuildRequires: gcc gcc-c++ libtool
%if 0%{?fedora} == 16
%define unit_dir /lib/systemd/system
%else
diff --git a/lib/lanplus/helper.c b/lib/lanplus/helper.c
index 51e39c8..38ce28f 100644
--- a/lib/lanplus/helper.c
+++ b/lib/lanplus/helper.c
@@ -72,8 +72,9 @@
extern int verbose;
-#ifdef MOVED
-/* moved to subs.c */
+/* By default, moved to util/subs.c for more global access.
+ * Define LANHELPER to define these here for ipmi_lanplus.a */
+#ifdef LANHELPER
uint32_t buf2long(uint8_t * buf)
{
return (uint32_t)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
@@ -102,7 +103,7 @@ const char * buf2str(uint8_t * buf, int len)
return (const char *)str;
}
-/* moved to util/ipmilanplus.c for better control */
+/* moved to util/subs.c for better control (e.g. ipmilanplus.c) */
#ifdef STATIC
extern FILE *fplog; /*see util/ipmicmd.c ++++*/
#endif
diff --git a/lib/lanplus/lanplus.c b/lib/lanplus/lanplus.c
index 40d3ab4..b695837 100644
--- a/lib/lanplus/lanplus.c
+++ b/lib/lanplus/lanplus.c
@@ -904,7 +904,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
if (rsp->data_len &&
rsp->payload.ipmi_response.cmd== 0x34) {
- memcpy(rsp->data, &rsp->data[offset],
+ memmove(rsp->data, &rsp->data[offset],
(rsp->data_len-offset));
printbuf( &rsp->data[offset],
(rsp->data_len-offset),
diff --git a/scripts/Makefile b/scripts/Makefile
index 53fd363..d214ac7 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -47,14 +47,14 @@ CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run aclocal-1.9
+ACLOCAL = ${SHELL} /home/acress/ipmiutil/src/missing --run aclocal-1.9
AMDEP_FALSE = #
AMDEP_TRUE =
-AMTAR = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run tar
+AMTAR = ${SHELL} /home/acress/ipmiutil/src/missing --run tar
AR = ar
-AUTOCONF = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run autoconf
-AUTOHEADER = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run autoheader
-AUTOMAKE = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run automake-1.9
+AUTOCONF = ${SHELL} /home/acress/ipmiutil/src/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/acress/ipmiutil/src/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/acress/ipmiutil/src/missing --run automake-1.9
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
@@ -101,7 +101,7 @@ LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIB_DIR = /usr/lib64
LN_S = ln -s
LTLIBOBJS =
-MAKEINFO = ${SHELL} /usr/dev/ipmiutil-2.9.3/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/acress/ipmiutil/src/missing --run makeinfo
OBJEXT = o
OS_CFLAGS = -DLINUX -fPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2
OS_DRIVERS = imbapi.c ipmimv.c ipmild.c ipmidir.c
@@ -122,7 +122,7 @@ SHR_LINK = libipmiutil.so
STRIP = strip
SUBDIR_S = doc scripts lib util
SYSTEMD_DIR = /usr/share/ipmiutil
-VERSION = 2.9.3
+VERSION = 2.9.4
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_CXX = g++
@@ -153,7 +153,7 @@ host_os = linux-gnu
host_vendor = redhat
includedir = ${prefix}/include
infodir = ${prefix}/info
-install_sh = /usr/dev/ipmiutil-2.9.3/install-sh
+install_sh = /home/acress/ipmiutil/src/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localstatedir = ${prefix}/var
diff --git a/setver b/setver
index 054798a..1e127a4 100755
--- a/setver
+++ b/setver
@@ -6,7 +6,7 @@
# [doinc?] is 'n'.
# if [doinc?] is 'r', reverse increment (decrement).
#
-ver=2.9.3
+ver=2.9.4
rel=1
tmped=/tmp/edver.tmp
tmpspec=/tmp/edspec.tmp
@@ -117,9 +117,7 @@ then
ed ../buildipmiutil.sh <$tmped
fi
-if [ -f ../win32/src/mkzip.bat ]
-then
- cat - <<%%% >$tmped
+cat - <<%%% >$tmped
1
/^set pkgver
c
@@ -128,8 +126,12 @@ set pkgver=${ver}
w
q
%%%
+if [ -f ../win32/src/mkzip.bat ]; then
ed ../win32/src/mkzip.bat <$tmped
fi
+if [ -f ../win32/src/mkzip32.bat ]; then
+ ed ../win32/src/mkzip32.bat <$tmped
+fi
if [ -f ../win32/src/mkzip64.bat ]; then
ed ../win32/src/mkzip64.bat <$tmped
fi
diff --git a/util/Makefile.am b/util/Makefile.am
index 3726107..d7ed5eb 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -190,6 +190,7 @@ install-data-am: $(EXTRA_PROGRAMS) $(DEV_LIB) $(SHRLINK)
@INS_LIB@ cp -f Makefile.sample $(DESTDIR)$(extradir)/Makefile
@INS_LIB@ cp -f $(DEV_LIB) $(DESTDIR)$(LIBDIR)
if [ "x$(SHRLINK)" != "x" ]; then \
+ touch $(SHRLINK) ; \
@INS_LIB@ cp -f $(SHR_LIB) $(DESTDIR)$(LIBDIR) ; \
fi
diff --git a/util/Makefile.in b/util/Makefile.in
index a8eb9b9..e18d0ac 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -753,6 +753,7 @@ install-data-am: $(EXTRA_PROGRAMS) $(DEV_LIB) $(SHRLINK)
@INS_LIB@ cp -f Makefile.sample $(DESTDIR)$(extradir)/Makefile
@INS_LIB@ cp -f $(DEV_LIB) $(DESTDIR)$(LIBDIR)
if [ "x$(SHRLINK)" != "x" ]; then \
+ touch $(SHRLINK) ; \
@INS_LIB@ cp -f $(SHR_LIB) $(DESTDIR)$(LIBDIR) ; \
fi
diff --git a/util/ialarms.c b/util/ialarms.c
index dbbdf0c..6f9f15b 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.93";
+static char * progver = "2.94";
static char * progname = "ialarms";
static char fdebug = 0;
static char fbmctam = 0;
diff --git a/util/icmd.c b/util/icmd.c
index 5911262..20949be 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.93";
+static char * progver = "2.94";
static char * progname = "icmd";
static char fdebug = 0;
static char fquiet = 0;
diff --git a/util/iconfig.c b/util/iconfig.c
index 0bb54e9..cbbe78d 100644
--- a/util/iconfig.c
+++ b/util/iconfig.c
@@ -171,7 +171,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "2.93";
+static char * progver = "2.94";
static char * progname = "iconfig";
static char fdebug = 0;
static char fipmilan = 0;
diff --git a/util/idcmi.c b/util/idcmi.c
index 1e53ae8..1ba08cd 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.93";
+static char * progver = "2.94";
extern char fdebug; /*from ipmicmd.c*/
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
@@ -356,7 +356,7 @@ void dcmi_show_power_limit(uchar *cdata, int sdata, int rv)
correction_time = cdata[6];
correction_time += (cdata[7] << 8);
correction_time += (cdata[8] << 16);
- correction_time += (cdata[9] << 24);
+ correction_time += (ulong)(cdata[9] << 24);
if (rv == 0) pstr = "(active)";
else if (rv == 0x80) pstr = "(inactive)";
diff --git a/util/ievents.c b/util/ievents.c
index 72c0b24..cbc7622 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.93";
+static char *progver = "2.94";
static char *progname = "ievents";
static char fsensdesc = 0; /* 1= get extended sensor descriptions*/
static char fcanonical = 0; /* 1= show canonical, delimited output*/
@@ -607,6 +607,115 @@ static char *mem_str(int off)
return(pstr);
}
+#ifdef NEW
+#define OEM_CODE_IN_BYTE2 0x80
+#define OEM_CODE_IN_BYTE3 0x20
+static int decode_mem_default(uchar data1, uchar data2, uchar data3,
+ char *desc, int *psz)
+{
+ char tmpdesc[80];
+ int tmpsz = sizeof(tmpdesc);
+ int dsz, incr;
+ if ((psz == NULL) || (desc == NULL)) return -1;
+ dsz = *psz;
+ /*
+ * Based on the above error, we need to find whcih memory slot or
+ * Card has got the Errors/Sel Generated.
+ */
+ if(data1 & OEM_CODE_IN_BYTE2 ) {
+ /* Find the Card Type */
+ if((0x0F != (data2 >> 4)) && ((data2 >> 4) < 0x08))
+ {
+ tmpData = ('A'+ (data2 >> 4));
+ if( (sensor_type == SENSOR_TYPE_MEMORY ) && (0x0B == rec->sel_type.standard_type.event_type) )
+ {
+ snprintf(tmpdesc, tmpsz, "Bad Card %c", tmpData);
+ } else {
+ snprintf(tmpdesc, tmpsz, "Card %c", tmpData);
+ }
+ strcat(desc, tmpdesc);
+ } /* Find the Bank Number of the DIMM */
+ if (0x0F != (data2 & MASK_LOWER_NIBBLE))
+ {
+ if(0x51 == version)
+ {
+ snprintf(tmpdesc, tmpsz, "Bank %d", ((data2 & 0x0F)+1));
+ strcat(desc, tmpdesc);
+ } else {
+ incr = (data2 & 0x0f) << 3;
+ }
+ }
+
+ }
+ /* Find the DIMM Number of the Memory which has Generated the Fault or Sel */
+ if(data1 & OEM_CODE_IN_BYTE3 )
+ {
+ // Based on the IPMI Spec Need Identify the DIMM Details.
+ // For the SPEC 1.5 Only the DIMM Number is Valid.
+ if(0x51 == version)
+ {
+ snprintf(tmpdesc, tmpsz, "DIMM %c", ('A'+ data3));
+ strcat(desc, tmpdesc);
+ }
+ /* For the SPEC 2.0 Decode the DIMM Number as it supports more*/
+ else if( ((data2 >> 4) > 0x07) && (0x0F != (data2 >> 4) ))
+ {
+ strcpy(dimmStr, " DIMM");
+ str = desc+strlen(desc);
+ dimmsPerNode = 4;
+ if(0x09 == (data2 >> 4)) dimmsPerNode = 6;
+ else if(0x0A == (data2 >> 4)) dimmsPerNode = 8;
+ else if(0x0B == (data2 >> 4)) dimmsPerNode = 9;
+ else if(0x0C == (data2 >> 4)) dimmsPerNode = 12;
+ else if(0x0D == (data2 >> 4)) dimmsPerNode = 24;
+ else if(0x0E == (data2 >> 4)) dimmsPerNode = 3;
+ count = 0;
+ for (i = 0; i < 8; i++)
+ {
+ if (BIT(i) & data3)
+ {
+ if(count)
+ {
+ strcat(str,",");
+ count = 0x00;
+ }
+ node = (incr + i)/dimmsPerNode;
+ dimmNum = ((incr + i)%dimmsPerNode)+1;
+ dimmStr[5] = node + 'A';
+ sprintf(tmpdesc,"%d",dimmNum);
+ for(j = 0; j < strlen(tmpdesc);j++)
+ dimmStr[6+j] = tmpdesc[j];
+ dimmStr[6+j] = '\0';
+ strcat(str,dimmStr); // final DIMM Details.
+ count++;
+ }
+ }
+ } else {
+ strcpy(dimmStr, " DIMM");
+ str = desc+strlen(desc);
+ count = 0;
+ for (i = 0; i < 8; i++)
+ {
+ if (BIT(i) & data3)
+ {
+ // check if more than one DIMM, if so add a comma to the string.
+ sprintf(tmpdesc,"%d",(i + incr + 1));
+ if(count)
+ {
+ strcat(str,",");
+ count = 0x00;
+ }
+ for(j = 0; j < strlen(tmpdesc);j++)
+ dimmStr[5+j] = tmpdesc[j];
+ dimmStr[5+j] = '\0';
+ strcat(str, dimmStr);
+ count++;
+ }
+ }
+ }
+ }
+}
+#endif
#if defined(METACOMMAND)
/* METACOMMAND is defined for ipmiutil meta-command build. */
@@ -974,7 +1083,7 @@ int file_grep(char *fname, char *pattn, char *line, int sline,
int nstart = 0;
int bufsz;
- if (bmode == 2) nstart = *nret;
+ if ((bmode == 2) && (nret != NULL)) nstart = *nret;
bufsz = sizeof(buff);
fp = fopen(fname,"r");
if (fp == NULL) {
diff --git a/util/ifirewall.c b/util/ifirewall.c
index b92d7d5..3956668 100644
--- a/util/ifirewall.c
+++ b/util/ifirewall.c
@@ -64,7 +64,7 @@
/* global variables */
static char * progname = "ifirewall";
-static char * progver = "2.93";
+static char * progver = "2.94";
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 ba834e6..b1ac4ba 100755
--- 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.93";
+static char *progver = "2.94";
static int vend_id = 0;
static int prod_id = 0;
static char fdebug = 0;
diff --git a/util/ifruset.c b/util/ifruset.c
index 3e0299a..ee0fac8 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.93";
+static char *progver = "2.94";
static char fdebug = 0;
static char fpicmg = 0;
static char fonlybase = 0;
diff --git a/util/igetevent.c b/util/igetevent.c
index 6e2fe27..e2eb587 100644
--- a/util/igetevent.c
+++ b/util/igetevent.c
@@ -168,7 +168,7 @@ extern void free_sdr_cache(uchar *pret); /*see isensor.c*/
* Global variables
*/
static char * progname = "igetevent";
-static char * progver = "2.93";
+static char * progver = "2.94";
static char fdebug = 0;
static char fipmilan = 0;
static char frunonce = 0;
diff --git a/util/ihealth.c b/util/ihealth.c
index 6f6f0e1..466131e 100644
--- a/util/ihealth.c
+++ b/util/ihealth.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.93";
+static char * progver = "2.94";
static char fdebug = 0;
static char fipmilan = 0;
static char fcanonical = 0;
@@ -725,8 +725,10 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
case 1603: prodstr = "(X9SPU)"; break; /*0x0643*/
case 1643: prodstr = "(X9SRL)"; break; /*0x066b*/
case 1797: prodstr = "(X9DR7)"; break; /*0x0705*/
- case 43025: prodstr = "(H8DGU)"; break;
+ case 4520: prodstr = "(H8DGU)"; break;
+ case 43025: prodstr = "(H8DGU-F)"; break;
case 43707: prodstr = "(X8DTH)"; break;
+ case 48145: prodstr = "(H8DG6)"; break;
default: prodstr = ""; break;
}
if (!fipmilan) lan_ch_restrict = 1; /*fw bug, gets 0xd4 locally*/
@@ -737,6 +739,14 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
default: prodstr = ""; break;
}
break;
+ case VENDOR_IBM: /*=0x0002*/
+ switch(prod) { /* show product names for some */
+ case 0x000e: prodstr = "(x3755)"; break;
+ case 0x00dc: prodstr = "(x3650)"; break;
+ case 0x8848: prodstr = "(eServer 360S)"; break;
+ default: prodstr = ""; break;
+ }
+ break;
default:
prodstr = "";
break;
@@ -771,7 +781,8 @@ int GetPowerOnHours(unsigned int *val)
if (rc == 0 && cc == 0) {
/* show the hours (32-bits) */
hrs = resp[1] | (resp[2] << 8) | (resp[3] << 16) | (resp[4] << 24);
- if (resp[0] == 60) /*normal*/ i = 1;
+ /* 60=normal, more is OOB, so avoid div-by-zero*/
+ if ((resp[0] <= 0) || (resp[0] >= 60)) i = 1;
else {
i = 60 / resp[0];
hrs = hrs / i;
diff --git a/util/ilan.c b/util/ilan.c
index a1ed76a..8415b07 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.93";
+static char * progver = "2.94";
static char * progname = "ilan";
static char fdebug = 0;
static char fipmilan = 0;
@@ -317,6 +317,7 @@ static char fAdjustPefNum = 0; /* =1 adjust pefnum to first empty index */
static char fUserPefNum = 0; /* =1 if user specified a valid pefnum value*/
static char freadonly = 1; /* =1 to only read LAN & PEF parameters */
static char fcanonical = 0; /* =1 to show only canonical output */
+static char flansecure = 0; /* =1 set lan security: no null, cipher0 off*/
static char bdelim = BCOLON; /* delimiter ':' or '|' if canonical output*/
static char ftestonly = 0;
static char fprivset = 0;
@@ -368,6 +369,9 @@ static uchar rggwymac[6] = {0xff,0,0,0,0,0};
static uchar rggwy2mac[6] = {0xff,0,0,0,0,0};
static uchar rgdestmac[6] = {0xff,0,0,0,0,0};
static uchar rgdhcpmac[6] = {0xff,0,0,0,0,0};
+static int nciphers = 16;
+static int ncipher0 = 0;
+static uchar rgciphers[16] = {0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static char rghostname[32] = {'\0'};
static uchar custPEF[20]; /* max used = 18 bytes */
static char rgcommunity[19] = "public"; /* default community */
@@ -774,7 +778,7 @@ SetPasswd(int unum, char *uname, char *upswd)
if ((unum != 1) && (uname == NULL)) {
; /* if no username, do not enable user */
} else {
- inputData[0] = (uchar)unum; /*user 1 = null user */
+ inputData[0] = (uchar)unum;
inputData[1] = 0x01; /*enable user*/
responseLength = sizeof(responseData);
status = ipmi_cmd(SET_USER_PASSWORD, inputData, 2, responseData,
@@ -786,7 +790,7 @@ SetPasswd(int unum, char *uname, char *upswd)
if (status != 0) ret = status;
}
- inputData[0] = (uchar)unum; /*user 1 = null user */
+ inputData[0] = (uchar)unum;
inputData[1] = 0x02; /*set password*/
psw_len = PSW_LEN; /*=16 change if 20-byte passwords supported */
memset(&inputData[2],0,psw_len);
@@ -888,7 +892,7 @@ static char *parse_priv(uchar c)
case 4: p = "Admin "; break;
case 5: p = "OEM "; break;
case 0x0f: p = "No access"; break;
- default: p = "Reserved";
+ default: p = "Reserved"; /*usually =0*/
}
return(p);
}
@@ -3666,7 +3670,6 @@ main(int argc, char **argv)
uchar bset;
int ndest = 4;
int idest;
- int nciphers = 16;
char mystr[80];
char fpefok = 1;
uchar * pc; int sz;
@@ -3676,7 +3679,7 @@ main(int argc, char **argv)
j = 0; freadonly = FLAG_INIT;
idx = argc; /*getopt loop counter*/
/* available opt chars: y O Q + = ~ _ */
- while ((c = getopt(argc, argv,"a:b:cdef:gh:i:j:klm:n:op:q:rstu:v:w:xy:z#::A:B:C:DEF:G:H:I:J:K:L:M:N:P:Q:R:S:T:U:V:X:YZ:?")) != EOF) {
+ while ((c = getopt(argc, argv,"a:b:cdef:gh:i:j:klm:n:op:q:rstu:v:w:xy:z#::A:B:C:DEF:G:H:I:J:K:L:M:N:OP:Q:R:S:T:U:V:X:YZ:?")) != EOF) {
switch(c) {
case 'a': /* alert dest number (usu 1 thru 4) */
alertnum = atob(optarg);
@@ -3787,6 +3790,7 @@ main(int argc, char **argv)
case 'x': fdebug = 1; break;
case 'z': flanstats = 1; break;
case 'D': lan_dhcp = 1; j++; break;
+ case 'O': flansecure = 1; j++; break;
case 'I': /* My BMC IP Address */
fset_ip |= MYIP;
atoip(rgmyip,optarg);
@@ -3919,6 +3923,7 @@ main(int argc, char **argv)
printf(" -D Use DHCP instead of static IP (-I for server)\n");
printf(" -K (Kontron) IPMI hostname to set\n");
printf(" -Q VLAN Priority (default =0)\n");
+ printf(" -O Force LAN security: no null user, cipher 0 off\n");
print_lan_opt_usage();
ret = ERR_USAGE;
goto do_exit;
@@ -4096,6 +4101,7 @@ main(int argc, char **argv)
/* set the lan_user appropriately */
if (myuser == NULL) { /* if no -u param */
if (ipmi_reserved_user(vend_id, 1)) lan_user = 2;
+ else if (flansecure) lan_user = 2;
else lan_user = 1; /*use default null user */
} else if (usernum != 0) lan_user = usernum; /*use -q specified usernum*/
/* else use default lan_user (=2) if -u and not -q */
@@ -4541,8 +4547,12 @@ main(int argc, char **argv)
|| ival == 192) {
printf("%d.%d.%d.%d",pc[0], pc[1], pc[2], pc[3]);
} else if (ival == 23) { /*Cipher Suites*/
- for (i = 1; i <= nciphers; i++) printf("%2d ",pc[i]);
+ for (i = 1; i <= nciphers; i++) {
+ if (pc[i] == 0) ncipher0 = pc[i];
+ printf("%2d ",pc[i]);
+ }
} else if (ival == 24) { /*Cipher Suite Privi Levels*/
+ j = 0;
for (i = 1; i < 9; i++) {
char c1, c2;
char *p;
@@ -4550,6 +4560,8 @@ main(int argc, char **argv)
c1 = p[0];
p = parse_priv((pc[i] & 0xf0) >> 4);
c2 = p[0];
+ rgciphers[j++] = (pc[i] & 0x0f);
+ rgciphers[j++] = ((pc[i] & 0xf0) >> 4);
if ((i*2) >= nciphers) c2 = ' ';
printf(" %c %c ",c1,c2);
if ((i*2) > nciphers) break;
@@ -4770,6 +4782,10 @@ main(int argc, char **argv)
if (fdebug) printf("SetChanAcc(lan/nonvol), ret = %d\n",ret);
if (ret != 0) { nerrs++; lasterr = ret; }
else ngood++;
+ if (flansecure) {
+ j = DisableUser(0); /*disable the default null user*/
+ printf("DisableUser(0), ret = %d\n",j);
+ }
ret = SetUser(lan_user,myuser,passwordData);
printf("SetUser(%d), ret = %d\n",lan_user,ret);
if (ret != 0) { nerrs++; lasterr = ret; }
@@ -4985,6 +5001,23 @@ main(int argc, char **argv)
else ngood++;
}
} /* end-else static IP */
+ if (flansecure) { /* disable cipher 0 */
+ char c1, c2;
+ memset(&LanRecord,0,12);
+ j = 1;
+ for (i = 0; i < nciphers; i+=2) {
+ c1 = rgciphers[i];
+ c2 = rgciphers[i+1];
+ /* 0x0f may be vendor-specific, 0x00 = Reserved/Unused */
+ if (i == ncipher0) c1 = 0x00;
+ if ((i+1) == ncipher0) c2 = 0x00;
+ LanRecord.data[j++] = (c2 << 4) | c1;
+ }
+ ret = SetLanEntry(24, &LanRecord, 9);
+ printf("SetLanEntry(24) disable cipher0, ret = %d\n",ret);
+ if (ret != 0) { nerrs++; lasterr = ret; }
+ else ngood++;
+ }
ret = SetupSerialOverLan(1); /*enable*/
SELprintf("SetupSerialOverLan: ret = %d\n",ret);
if (ret != 0) { nerrs++; lasterr = ret; }
diff --git a/util/ipicmg.c b/util/ipicmg.c
index c549151..73bed68 100644
--- a/util/ipicmg.c
+++ b/util/ipicmg.c
@@ -81,7 +81,7 @@
/* Global data */
static char * progname = "ipicmg";
-static char * progver = "2.93";
+static char * progver = "2.94";
static char fdebug = 0;
static char fset_mc = 0;
static uint8_t g_bus = PUBLIC_BUS;
diff --git a/util/ipmi_sample_evt.c b/util/ipmi_sample_evt.c
index b51ba24..eada5eb 100644
--- a/util/ipmi_sample_evt.c
+++ b/util/ipmi_sample_evt.c
@@ -321,7 +321,7 @@ main(int argc, char **argv)
uchar event[32]; /*usu 16 bytes */
char outbuf[160];
char *s1;
- int rlen;
+ int i, rlen;
uchar ccode;
uchar sensor_type;
@@ -411,12 +411,13 @@ main(int argc, char **argv)
ievt_siginit();
finit_ok = 1;
ret = 0; /*ignore any earlier errors, keep going*/
+ i = 0;
while (ret == 0)
{ /*wait for bmc message events*/
if (fdebug)
- msgout("%s: Polling every %d sec for a new event after id %x...\n",
- progname, wait_interval, sel_recid);
+ msgout("%s: %d Polling every %d sec for a new event after id %x\n",
+ progname, i, wait_interval, sel_recid);
rlen = sizeof(event);
ret = getevent_sel(event,&rlen,&ccode);
if (ret == 0) ret = ccode;
@@ -433,6 +434,7 @@ main(int argc, char **argv)
msgout("get_event error: ret = 0x%x\n",ret);
break;
}
+ i++;
os_usleep(wait_interval,0);
} /*end while loop*/
diff --git a/util/ipmicmd.c b/util/ipmicmd.c
index dd2268b..8501359 100644
--- a/util/ipmicmd.c
+++ b/util/ipmicmd.c
@@ -260,21 +260,22 @@ int fjustpass = 0;
FILE *fperr = NULL;
FILE *fpdbg = NULL;
FILE *fplog = NULL;
+int fauth_type_set = 0;
+char fdebug = 0;
char log_name[60] = {'\0'}; /*log_name global*/
-char *gnode = "localhost"; /* used for IPMI LAN, specified with option -N */
-char *guser = NULL;
-char *gpswd = NULL;
-char gnodename[SZGNODE] = {0}; /*the node name returned after a connection */
-int gcipher_suite = 3; /*used in ipmilanplus.c*/
-int gshutdown = 0;
-int fauth_type_set = 0;
-int gauth_type = IPMI_SESSION_AUTHTYPE_MD5; /*if 0, use any: MD5, MD2, etc.*/
-int gpriv_level = IPMI_PRIV_LEVEL_USER; /*or IPMI_PRIV_LEVEL_ADMIN */
-int gaddr_len = 0;
-uchar gaddr[128]; /* sizeof(struct sockaddr_storage) = 128 */
- /* struct sockaddr_in/_in6 gaddr; _in6=28, _in=16 bytes */
uchar my_devid[20] = {0,0,0,0,0,0,0,0}; /*saved devid, only needs 16 bytes*/
-char fdebug = 0;
+int gshutdown = 0; /* see ipmilan.c ipmilanplus.c */
+
+LAN_OPT lanp = { "localhost","","", IPMI_SESSION_AUTHTYPE_MD5,
+ IPMI_PRIV_LEVEL_USER, 3, "", 0 };
+static char *gnode = lanp.node;
+//char *guser = lanp.user;
+//char *gpswd = lanp.pswd;
+//uchar *gaddr = lanp.addr;
+//int gaddr_len = 0;
+//int gcipher_suite = 3; /*used in ipmilanplus.c*/
+//int gauth_type = IPMI_SESSION_AUTHTYPE_MD5; /*if 0, use any: MD5, MD2, etc.*/
+//int gpriv_level = IPMI_PRIV_LEVEL_USER;
typedef struct {
uchar adrtype;
@@ -525,7 +526,7 @@ int set_driver_type(char *tag)
if (fDriverTyp == DRV_HP) { /*LAN2 HP ++++*/
set_iana(VENDOR_HP);
fDriverTyp = DRV_LAN2;
- gauth_type = IPMI_SESSION_AUTHTYPE_NONE; /*HP default*/
+ lanp.auth_type = IPMI_SESSION_AUTHTYPE_NONE; /*HP default*/
}
break;
}
@@ -654,13 +655,13 @@ int ipmi_open(char fdebugcmd)
/* first time, so try each */
if (fipmi_lan) {
/* Try IPMI LAN 1.5 first */
- rc = ipmi_open_lan(gnode,guser,gpswd,fdebugcmd);
+ rc = ipmi_open_lan(gnode,lanp.user,lanp.pswd,fdebugcmd);
fDriverTyp = DRV_LAN;
if (rc == LAN_ERR_V2) {
/* Use IPMI LAN 2.0 if BMC said it only supports LAN2 */
/* This is a violation of IPMI 2.0 Spec section 13.4,
* but some HP firmware behaves this way, so handle it. */
- rc = ipmi_open_lan2(gnode,guser,gpswd,fdebugcmd);
+ rc = ipmi_open_lan2(gnode,lanp.user,lanp.pswd,fdebugcmd);
fDriverTyp = DRV_LAN2;
}
} else { /* local, not lan */
@@ -1283,14 +1284,14 @@ int get_lan_options(char *node, char *user, char *pswd, int *auth, int *priv,
int *cipher, void *addr, int *addr_len)
{
if (fipmi_lan == 0) return(-1);
- if (node != NULL) strcpy(node,gnode);
- if (user != NULL) strcpy(user,guser);
- if (pswd != NULL) strcpy(pswd,gpswd);
- if (auth != NULL) *auth = gauth_type;
- if (priv != NULL) *priv = gpriv_level;
- if (cipher != NULL) *cipher = gcipher_suite;
- if (addr != NULL && gaddr_len != 0) memcpy(addr,gaddr,gaddr_len);
- if (addr_len != NULL) *addr_len = gaddr_len;
+ if (node != NULL) strcpy(node,lanp.node);
+ if (user != NULL) strcpy(user,lanp.user);
+ if (pswd != NULL) strcpy(pswd,lanp.pswd);
+ if (auth != NULL) *auth = lanp.auth_type;
+ if (priv != NULL) *priv = lanp.priv;
+ if (cipher != NULL) *cipher = lanp.cipher;
+ if (addr != NULL && lanp.addr_len != 0) memcpy(addr,lanp.addr,lanp.addr_len);
+ if (addr_len != NULL) *addr_len = lanp.addr_len;
return(0);
}
@@ -1298,18 +1299,29 @@ int set_lan_options(char *node, char *user, char *pswd, int auth, int priv,
int cipher, void *addr, int addr_len)
{
int rv = 0;
- if (node != NULL) { gnode = strdup_(node); fipmi_lan = 1; }
- if (user != NULL) guser = strdup_(user);
- if (pswd != NULL) gpswd = strdup_(pswd);
- if (auth > 0 && auth <= 5) gauth_type = auth;
+ if (node != NULL) {
+ strncpy(lanp.node,node,SZGNODE);
+ lanp.node[SZGNODE] = '\0';
+ gnode = lanp.node;
+ fipmi_lan = 1;
+ }
+ if (user != NULL) {
+ strncpy(lanp.user,user,SZGNODE);
+ lanp.user[SZGNODE] = '\0';
+ }
+ if (pswd != NULL) {
+ strncpy(lanp.pswd,pswd,PSW_MAX);
+ lanp.pswd[PSW_MAX] = '\0';
+ }
+ if (auth > 0 && auth <= 5) { lanp.auth_type = auth; }
else rv = ERR_BAD_PARAM;
- if (priv > 0 && priv <= 5) gpriv_level = priv;
+ if (priv > 0 && priv <= 5) { lanp.priv = priv; }
else rv = ERR_BAD_PARAM;
- if (cipher >= 0 && cipher <= 17) gcipher_suite = cipher;
+ if (cipher >= 0 && cipher <= 17) { lanp.cipher = cipher; }
else rv = ERR_BAD_PARAM;
- if ((addr != NULL) && (addr_len > 15) && (addr_len <= sizeof(gaddr))) {
- memcpy(gaddr,addr,addr_len);
- gaddr_len = addr_len;
+ if ((addr != NULL) && (addr_len > 15) && (addr_len <= sizeof(lanp.addr))) {
+ memcpy(lanp.addr,addr,addr_len);
+ lanp.addr_len = addr_len;
}
ipmi_flush_lan(gnode);
return(rv);
@@ -1324,6 +1336,7 @@ void parse_lan_options(int c, char *popt, char fdebugcmd)
size_t len;
static int fset_dtype = 0;
uchar sa;
+ char *p = NULL;
switch(c)
{
@@ -1333,52 +1346,52 @@ void parse_lan_options(int c, char *popt, char fdebugcmd)
break;
case 'T': /* auth type */
i = atoi(popt);
- if (i >= 0 && i <= 5) gauth_type = i;
+ if (i >= 0 && i <= 5) lanp.auth_type = i;
fauth_type_set = 1;
break;
case 'V': /* priv level */
i = atoi(popt);
- if (i > 0 && i <= 5) gpriv_level = i;
+ if (i > 0 && i <= 5) lanp.priv = i;
break;
case 'J':
i = atoi(popt);
- if (i >= 0 && i <= 17) gcipher_suite = i;
+ if (i >= 0 && i <= 17) lanp.cipher = i;
else printf("-J cipher suite %d > 17, defaults to %d\n",
- i,gcipher_suite);
+ i,lanp.cipher);
if (fset_dtype == 0) i = set_driver_type("lan2");
break;
- case 'N': gnode = popt; /* nodename */
- fipmi_lan = 1;
- break;
+ case 'N':
+ strncpy(lanp.node,popt,SZGNODE); /*remote nodename */
+ lanp.node[SZGNODE] = '\0';
+ fipmi_lan = 1;
+ break;
case 'U':
- guser = strdup_(popt); /*remote username */
- if (!guser) perror("strdup_");
- else { /* Hide username from 'ps' */
- memset(popt, ' ', strlen(popt));
- }
+ strncpy(lanp.user,popt,SZGNODE); /*remote username */
+ lanp.user[SZGNODE] = '\0';
+ /* Hide username from 'ps' */
+ memset(popt, ' ', strlen(popt));
break;
case 'R':
case 'P':
- gpswd = strdup_(popt); /*remote password */
- if (!gpswd) perror("strdup_");
- else { /* Hide password from 'ps' */
- len = strlen(popt);
- memset(popt, ' ', len);
- if (len > PSW_MAX) gpswd[PSW_MAX] = '\0';
- }
+ strncpy(lanp.pswd,popt,PSW_MAX); /*remote password */
+ lanp.pswd[PSW_MAX] = '\0';
+ /* Hide password from 'ps' */
+ memset(popt, ' ', strlen(popt));
break;
case 'E': /* get password from IPMI_PASSWORD environment var */
- gpswd = getenv("IPMI_PASSWORD");
- if (gpswd == NULL) perror("getenv(IPMI_PASSWORD)");
+ p = getenv("IPMI_PASSWORD");
+ if (p == NULL) perror("getenv(IPMI_PASSWORD)");
else {
- if (strlen(gpswd) > PSW_MAX) gpswd[PSW_MAX] = '\0';
+ strncpy(lanp.pswd,p,PSW_MAX); /*remote password */
+ if (strlen(p) > PSW_MAX) lanp.pswd[PSW_MAX] = '\0';
if (fdebugcmd) printf("using IPMI_PASSWORD\n");
}
break;
case 'Y': /* prompt for remote password */
- gpswd = getline_wipe("Enter IPMI LAN Password: ");
- if (gpswd != NULL) {
- if (strlen(gpswd) > PSW_MAX) gpswd[PSW_MAX] = '\0';
+ p = getline_wipe("Enter IPMI LAN Password: ");
+ if (p != NULL) {
+ strncpy(lanp.pswd,p,PSW_MAX); /*remote password */
+ if (strlen(p) > PSW_MAX) lanp.pswd[PSW_MAX] = '\0';
}
break;
case 'Z': /* set local MC address */
diff --git a/util/ipmicmd.h b/util/ipmicmd.h
index b65e949..bf735ef 100644
--- a/util/ipmicmd.h
+++ b/util/ipmicmd.h
@@ -335,6 +335,17 @@ struct oemvalstr {
#define LOG_DEBUG 7 // debug-level messages
#endif
+typedef struct {
+ char node[SZGNODE+1];
+ char user[SZGNODE+1];
+ char pswd[PSW_MAX+1];
+ int auth_type; /* if 0, use any: MD5, MD2, etc.*/
+ int priv; /* IPMI_PRIV_LEVEL_USER or IPMI_PRIV_LEVEL_ADMIN */
+ int cipher;
+ unsigned char addr[128]; /* sizeof(struct sockaddr_storage) = 128 */
+ int addr_len; /* struct sockaddr_in/_in6 gaddr; _in6=28, _in=16 bytes*/
+} LAN_OPT; /* used for IPMI LAN, specified with option -NUP, etc. */
+
#ifndef _IPMI_RQ_
#define _IPMI_RQ_ 1
/* structure used in ipmi_sendrecv, maps to ipmitool syntax. */
diff --git a/util/ipmilan.c b/util/ipmilan.c
index 64b6425..b852f3a 100644
--- a/util/ipmilan.c
+++ b/util/ipmilan.c
@@ -216,13 +216,13 @@ extern char * get_iana_str(int mfg); /*subs.c*/
extern FILE *fperr; /*defined in ipmicmd.c, usu stderr */
extern FILE *fpdbg; /*defined in ipmicmd.c, usu stdout */
extern int gshutdown; /* from ipmicmd.c */
-extern char gnodename[]; /* from ipmicmd.c */
-extern char *gnode; /* from ipmicmd.c */
-extern char *guser; /* from ipmicmd.c */
-extern char *gpswd; /* from ipmicmd.c */
extern int fauth_type_set; /* from ipmicmd.c */
-extern int gauth_type; /* from ipmicmd.c */
-extern int gpriv_level; /* from ipmicmd.c */
+extern LAN_OPT lanp; /* from ipmicmd.c */
+//extern char *gnode; /* from ipmicmd.c */
+//extern char *guser; /* from ipmicmd.c */
+//extern char *gpswd; /* from ipmicmd.c */
+//extern int gauth_type; /* from ipmicmd.c */
+//extern int gpriv_level; /* from ipmicmd.c */
extern ipmi_cmd_t ipmi_cmds[NCMDS];
static IPMI_HDR ipmi_hdr = { 0x06, 0, 0xFF, 0x07, 0x00, 0, 0,
@@ -294,6 +294,7 @@ typedef struct {
// static uchar fMsgAuth = 1;
static uchar auth_type = AUTHTYPE_INIT; /*initial value, not set*/
static char nodename[SZGNODE+1] = "";
+ static char gnodename[SZGNODE+1] = ""; /*nodename returned after connection*/
#if defined(AI_NUMERICSERV)
static int my_ai_flags = AI_NUMERICSERV; /*0x0400 Dont use name resolution NEW*/
// static int my_ai_flags = AI_NUMERICHOST; /*0x0004 Dont use name resolution*/
@@ -579,11 +580,11 @@ int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr,
* and) try the next address.
*/
for (res0 = res; res0 != NULL; res0 = res0->ai_next) {
+ /* valid protocols are IPPROTO_UDP, IPPROTO_IPV6 */
+ if (res0->ai_protocol == IPPROTO_TCP) continue; /*IPMI != TCP*/
s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol);
if (s == SockInvalid) continue;
else _sockfd = s;
- /* valid protocols are IPPROTO_UDP, IPPROTO_IPV6 */
- if (res0->ai_protocol == IPPROTO_TCP) continue; /*IPMI != TCP*/
pconn->connect_state = CONN_STATE_SOCK;
rv = connect(_sockfd, res0->ai_addr, res0->ai_addrlen);
if (fdebuglan) printf("socket(%d,%d,%d), connect(%d) rv = %d\n",
@@ -737,12 +738,12 @@ static void h2net(uint h, uchar *net, int n)
return;
}
-static void net2h(uint *h, uchar *net, int n)
+static void net2h(uint32 *h, uchar *net, int n)
{
- uint v;
+ uint32 v;
v = (net[1] << 8) | net[0];
if (n == 2) { *h = v; return; }
- v |= (net[3] << 24) | (net[2] << 16);
+ v |= (uint32)(net[3] << 24) | (net[2] << 16);
*h = v;
return;
}
@@ -1065,7 +1066,7 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp,
memcpy(&pdata[5],&sess_id_tmp,4);
if (fdebuglan > 2)
dbglog("auth_type=%x/%x fdoauth=%d hlen=%d seq_num=%x\n", /*SOL*/
- phdr->auth_type,gauth_type,fdoauth,hlen,phdr->seq_num);
+ phdr->auth_type,lanp.auth_type,fdoauth,hlen,phdr->seq_num);
if (fdoauth) {
psessid = (uchar *)&sess_id_tmp;
do_hash(phdr->password, psessid, &cbuf[hlen],msglen,
@@ -1434,7 +1435,7 @@ static int ipmilan_open_session(SockType sfd, struct sockaddr *destaddr,
else pconn->fMsgAuth = 0; /*no auth support*/
iauthcap = rbuf[2] & 0x3f;
if (fauth_type_set) {
- iauthtype = (uchar)gauth_type; // set by user
+ iauthtype = (uchar)lanp.auth_type; // set by user
auth_type = iauthtype;
} else {
iauthtype = AUTHTYPE_INIT; /*initial value, not set*/
@@ -1769,8 +1770,8 @@ int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd)
}
{
- auth_type = (uchar)gauth_type;
- priv_level = (uchar)gpriv_level;
+ auth_type = (uchar)lanp.auth_type;
+ priv_level = (uchar)lanp.priv;
username = user;
authcode = pswd;
authcode_len = (pswd) ? strlen_(authcode) : 0;
@@ -1834,6 +1835,8 @@ int ipmi_close_lan(char *node)
int rv = 0;
/* could match node via pconn = find_conn(node); */
+ if (fdebuglan) fprintf(fpdbg,"ipmi_close_lan(%s) entry, sockfd=%d\n",
+ node,pconn->sockfd);
if (!nodeislocal(node)) { /* ipmilan, need to close & cleanup */
if (pconn->sockfd != 0) { /* socket is open */
if (gshutdown) pconn->session_id = 0;
@@ -1856,6 +1859,8 @@ int ipmi_close_lan(char *node)
signal(SIGALRM,SIG_DFL);
#endif
} /* endif */
+ if (fdebuglan) fprintf(fpdbg,"ipmi_close_lan(%s) rv=%d sockfd=%d\n",
+ node,rv,pconn->sockfd);
return (rv);
}
@@ -1899,7 +1904,7 @@ int ipmicmd_lan(char *node,
if (pconn->sockfd == 0) { /* closed, do re-open */
if (fdebugcmd)
fprintf(fpdbg,"sockfd==0, node %s needs re-open\n",node);
- rv = ipmi_open_lan(gnode, guser, gpswd, fdebugcmd);
+ rv = ipmi_open_lan(lanp.node, lanp.user, lanp.pswd, fdebugcmd);
if (rv != 0) goto EXIT;
}
if (fdebugcmd) {
@@ -2057,7 +2062,7 @@ void lan_get_sol_data(uchar fEnc, uchar seed_cnt, uint32 *seed)
sol_seed_cnt = seed_cnt;
pconn->start_out_seq = ipmi_hdr.seq_num;
sol_snd_seq = (uchar)pconn->start_out_seq;
- sol15_cipherinit(sol_seed_cnt, gpswd, pconn->start_out_seq);
+ sol15_cipherinit(sol_seed_cnt, lanp.pswd, pconn->start_out_seq);
*seed = g_Seed[sol_seed_cnt];
if (fdebuglan > 2)
dbglog("lan_get_sol_data: %02x %02x %02x\n", /*SOL*/
@@ -2084,7 +2089,7 @@ void lan_set_sol_data(uchar fenc, uchar auth, uchar seed_cnt,
if (seed_cnt != sol_seed_cnt && (seed_cnt < 16)) {
/* if seed count changed, re-init the cipher. */
sol_seed_cnt = seed_cnt;
- sol15_cipherinit(sol_seed_cnt, gpswd, pconn->start_out_seq);
+ sol15_cipherinit(sol_seed_cnt, lanp.pswd, pconn->start_out_seq);
}
}
@@ -2150,7 +2155,7 @@ int lan_send_sol( uchar *buffer, int len, SOL_RSP_PKT *rsp)
if (fdebuglan > 2) { /*SOL*/
dbg_dump("lan_send_sol input", buffer,len,1);
dbglog("auth_type=%x/%x fdoauth=%d hlen=%d seq_num=%x enc=%d\n",
- phdr->auth_type,gauth_type,fdoauth,hlen,phdr->seq_num,
+ phdr->auth_type,lanp.auth_type,fdoauth,hlen,phdr->seq_num,
sol_Encryption);
dbg_dump("send_sol buf", pdata,msglen,1);
}
diff --git a/util/ipmilanplus.c b/util/ipmilanplus.c
index 771c7e7..13ed2bc 100644
--- a/util/ipmilanplus.c
+++ b/util/ipmilanplus.c
@@ -92,13 +92,14 @@ static void sol_output_handler(void *rsp) { return; }
static void dbg_dump(char *tag, uchar *pdata, int len, int fascii) { return; }
#endif
int ipmi_close_lan2(char *node); /*prototype*/
-extern char *gnode; /* from ipmicmd.c */
-extern char *guser; /* from ipmicmd.c */
-extern char *gpswd; /* from ipmicmd.c */
-extern int gauth_type; /* from ipmicmd.c */
-extern int gpriv_level; /* from ipmicmd.c */
+extern LAN_OPT lanp; /* from ipmicmd.c */
+//extern char *gnode; /* from ipmicmd.c */
+//extern char *guser; /* from ipmicmd.c */
+//extern char *gpswd; /* from ipmicmd.c */
+//extern int gauth_type; /* from ipmicmd.c */
+//extern int gpriv_level; /* from ipmicmd.c */
+//extern int gcipher_suite; /*from ipmicmd.c, see table 22-19 IPMI 2.0 spec*/
extern int gshutdown; /* from ipmicmd.c */
-extern int gcipher_suite; /*from ipmicmd.c, see table 22-19 IPMI 2.0 spec*/
extern FILE *fpdbg; /* == stdout, from ipmicmd.c */
extern FILE *fperr; /* == stderr, from ipmicmd.c */
extern FILE *fplog; /* from ipmicmd.c */
@@ -299,9 +300,9 @@ int ipmi_open_lan2(char *node, char *puser, char *pswd, int fdebugcmd)
if (rv == 0) {
if (intf->open == NULL) return(-1);
if (intf->session == NULL) return(-1);
- intf->session->authtype_set = (uchar)gauth_type;
- intf->session->privlvl = (uchar)gpriv_level;
- intf->session->cipher_suite_id = (uchar)gcipher_suite;
+ intf->session->authtype_set = (uchar)lanp.auth_type;
+ intf->session->privlvl = (uchar)lanp.priv;
+ intf->session->cipher_suite_id = (uchar)lanp.cipher;
if (node != NULL) { strcpy(intf->session->hostname,node); }
if (user != NULL) { strcpy(intf->session->username,user); }
if (pswd == NULL || pswd[0] == 0)
@@ -316,7 +317,7 @@ int ipmi_open_lan2(char *node, char *puser, char *pswd, int fdebugcmd)
rv = intf->open(intf);
if (fdebugcmd)
printf("lan2 open.intf(auth=%d,priv=%d,cipher=%d) returned %d\n",
- gauth_type,gpriv_level,gcipher_suite, rv);
+ lanp.auth_type,lanp.priv,lanp.cipher, rv);
if (rv != -1) { /*success is >= 0*/
sol_seq = 0; /*init new session, will call inc_sol_seq*/
sol_len = 0;
@@ -373,7 +374,7 @@ int ipmi_cmdraw_lan2(char *node, uchar cmd, uchar netfn, uchar lun,
if (fdebugcmd) verbose = 8;
#endif
if (intf == NULL || (intf->opened == 0)) {
- rc = ipmi_open_lan2(node,guser,gpswd,fdebugcmd);
+ rc = ipmi_open_lan2(node,lanp.user,lanp.pswd,fdebugcmd);
if (rc != 0) {
if (fdebugcmd)
fprintf(fperr, "ipmi_cmd_lan2: interface open error %d\n",rc);
diff --git a/util/ipmild.c b/util/ipmild.c
index 5ad54f2..8e05e21 100644
--- a/util/ipmild.c
+++ b/util/ipmild.c
@@ -87,7 +87,7 @@ static int ipmi_timeout_ld = 100000; /*100 * 1000 ms = 100 sec */
extern FILE *fperr; /*defined in ipmicmd.c*/
extern FILE *fpdbg; /*defined in ipmicmd.c*/
extern ipmi_cmd_t ipmi_cmds[NCMDS];
-#ifdef TEST
+#ifdef LINK_LANDESK
static int ipmi_fd = -1;
#endif
diff --git a/util/ipmiutil.c b/util/ipmiutil.c
index 4094cab..dc54f41 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.93";
+static char *progver = "2.94";
// static char fdebug = 0;
/*int ipmiutil(int argc, char **argv); */
diff --git a/util/ireset.c b/util/ireset.c
index 8116b7d..08794e0 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.93";
+static char * progver = "2.94";
static char * progname = "ireset";
static uchar ipmi_maj;
static uchar ipmi_min;
diff --git a/util/isel.c b/util/isel.c
index c974b24..d4914d5 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.93";
+static char *progver = "2.94";
#ifdef WIN32
#define IDXFILE "sel.idx"
static char idxfile[80] = IDXFILE;
diff --git a/util/iseltime.c b/util/iseltime.c
index 2562202..e72c93b 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.93";
+static char * progver = "2.94";
static char * progname = "iseltime";
static char fdebug = 0;
static char fset = 0;
diff --git a/util/isensor.c b/util/isensor.c
index ac93411..e24eea0 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.93";
+static char *progver = "2.94";
#ifdef WIN32
static char savefile[] = "%ipmiutildir%\\thresholds.cmd";
#else
@@ -1571,7 +1571,7 @@ int find_sdr_next(uchar *psdr, uchar *pcache, ushort id)
// if (fdebug) printf("SDR[%x] len=%d id=%x i=%d imatch=%d\n",
// recid,len,id,i,imatch);
if (recid == id) imatch = i + 1; /*matches prev, return next one*/
- if (id == 0) { rv = 0; break; }
+ else if (id == 0) { rv = 0; break; } /* 0000 = first one */
if (i == imatch) { rv = 0; break; }
}
if (rv == 0) memcpy(psdr,sdr,len);
@@ -2861,20 +2861,20 @@ ShowPowerOnHours(void)
if (rc == 0 && cc == 0) {
/* show the hours (32-bits) */
hrs = resp[1] | (resp[2] << 8) | (resp[3] << 16) | (resp[4] << 24);
- if (resp[0] == 0) /*avoid div-by-zero*/ i = 1;
- else if (resp[0] == 60) /*normal*/ i = 1;
+ /*60=normal, more is OOB, so avoid div-by-zero*/
+ if ((resp[0] <= 0) || (resp[0] >= 60)) i = 1;
else {
i = 60 / resp[0];
hrs = hrs / i;
}
- printf(" SDR IPMI sensor: Power On Hours \t = %d hours\n",
- hrs);
+ printf(" SDR IPMI sensor: Power On Hours \t = %d hours\n",
+ hrs);
}
if (fdebug) {
- printf("PowerOnHours (rc=%d cc=%x len=%d): ",rc,cc,sresp);
- if (rc == 0)
- for (i = 0; i < sresp; i++) printf("%02x ",resp[i]);
- printf("\n");
+ printf("PowerOnHours (rc=%d cc=%x len=%d): ",rc,cc,sresp);
+ if (rc == 0)
+ for (i = 0; i < sresp; i++) printf("%02x ",resp[i]);
+ printf("\n");
}
return(rc);
}
@@ -2895,16 +2895,16 @@ int SaveThreshold(int id, int sensor_num, int sensor_lo, int sensor_hi,
histr[0] = 0; /*empty string*/
} else {
if (sensor_lo != 0xff) {
- sprintf(lostr,"-l 0x%02x",sensor_lo);
+ sprintf(lostr,"-l 0x%02x",sensor_lo);
} else lostr[0] = 0;
if (sensor_hi != 0xff) {
- sprintf(histr,"-h 0x%02x",sensor_hi);
+ sprintf(histr,"-h 0x%02x",sensor_hi);
} else histr[0] = 0;
}
fd = fopen(savefile,"a+");
if (fd == NULL) return(-1);
fprintf(fd, "ipmiutil sensor -i 0x%04x -n 0x%02x %s %s\n", id, sensor_num,
- lostr,histr);
+ lostr,histr);
fclose(fd);
return(rv);
}
@@ -2932,8 +2932,8 @@ static int get_picmg_addrinfo(uchar a1, uchar a2, uchar *addrdata)
if (rv == 0 && cc != 0) rv = cc;
if (rv == 0) {
if (fdebug) {
- printf("picmg_addr(%02x,%02x)",a1,a2);
- dump_buf("picmg_addr",rdata,rlen,0);
+ printf("picmg_addr(%02x,%02x)",a1,a2);
+ dump_buf("picmg_addr",rdata,rlen,0);
}
memcpy(addrdata,rdata,rlen);
}
@@ -2965,32 +2965,32 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen)
#ifdef WIN32
{
ulong flen;
- ret = get_filesize(binfile, &flen);
+ ret = get_filesize(binfile, &flen);
if (ret == 0) len = flen;
else {
- ret = get_LastError();
- printf("Cannot get file size for %s, error %d\n",binfile,ret);
+ ret = get_LastError();
+ printf("Cannot get file size for %s, error %d\n",binfile,ret);
return(ret);
- }
+ }
}
#endif
fp = fopen(binfile,"r");
if (fp == NULL) {
- ret = get_LastError();
- printf("Cannot open file %s, error %d\n",binfile,ret);
+ ret = get_LastError();
+ printf("Cannot open file %s, error %d\n",binfile,ret);
return(ret);
}
#ifndef WIN32
{
- struct stat st;
- /* use fstat to get file size and allocate buffer */
- ret = fstat(fileno(fp), &st);
- len = st.st_size; /*file size in bytes*/
- if (ret != 0) {
- ret = get_LastError();
- printf("Cannot stat file %s, error %d\n",binfile,ret);
+ struct stat st;
+ /* use fstat to get file size and allocate buffer */
+ ret = fstat(fileno(fp), &st);
+ len = st.st_size; /*file size in bytes*/
+ if (ret != 0) {
+ ret = get_LastError();
+ printf("Cannot stat file %s, error %d\n",binfile,ret);
return(ret);
- }
+ }
}
#endif
// len = nsdrs * SDR_SZ; /*estimate max size for n sdrs*/
@@ -3006,14 +3006,14 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen)
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*/
}
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;
@@ -3053,17 +3053,17 @@ int i_sensor(int argc, char **argv)
if (strncmp(optarg,"0x",2) == 0) frearm = htoi(&optarg[2]);
else frearm = htoi(optarg); /*was atoi()*/
break;
- case 'c': fsimple = 1; break; /* Canonical/simple output*/
- case 'd': fdump = 1; /* Dump SDRs to a file*/
+ case 'c': fsimple = 1; break; /* Canonical/simple output*/
+ case 'd': fdump = 1; /* Dump SDRs to a file*/
binfile = optarg; break;
- case 'b': fchild = 1; break; /* Bladed, so get child SDRs */
- case 'e': fchild = 1; break; /* Extra bladed child SDRs */
- case 'f': frestore = 1; /* Restore SDRs from a file*/
+ case 'b': fchild = 1; break; /* Bladed, so get child SDRs */
+ case 'e': fchild = 1; break; /* Extra bladed child SDRs */
+ case 'f': frestore = 1; /* Restore SDRs from a file*/
binfile = optarg; break;
case 's': fsimple = 1; break; /* Simple/canonical output */
/*fcanonical==fsimple*/
case 'g':
- rv = get_group_id(optarg);
+ rv = get_group_id(optarg);
if (rv < 0) {
printf("Unrecognized sensor type group (%s)\n",optarg);
ret = ERR_BAD_PARAM;
@@ -3072,27 +3072,27 @@ int i_sensor(int argc, char **argv)
if (fdebug) printf("num sensor type groups = %d\n",fshowgrp);
break;
case 'i':
- fshowidx = 1;
- get_idx_range(optarg);
+ fshowidx = 1;
+ get_idx_range(optarg);
break;
- case 'j': fjumpstart = 1; /* Load SDR cache from a file*/
+ 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 'q': fshowthr = 2; fwrap = 1; break;
case 'r': frawsdr = 1; break;
- 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*/
- g_lun = htoi(&optarg[4]); /*LUN*/
+ 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*/
+ g_lun = htoi(&optarg[4]); /*LUN*/
if (optarg[6] == 's') {
- g_addrtype = ADDR_SMI; s1 = "SMI";
+ g_addrtype = ADDR_SMI; s1 = "SMI";
} else { g_addrtype = ADDR_IPMB; s1 = "IPMB"; }
fset_mc = 1;
printf("set MC at %s bus=%x sa=%x lun=%x\n",
- s1,g_bus,g_sa,g_lun);
- break;
+ s1,g_bus,g_sa,g_lun);
+ break;
case 'o':
fgetmem = 1;
break;
@@ -3125,22 +3125,22 @@ int i_sensor(int argc, char **argv)
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*/
- sensor_thr[0] = htoi(&optarg[2]); /*lo noncrit*/
- sensor_thr[1] = htoi(&optarg[4]); /*lo crit*/
- sensor_thr[2] = htoi(&optarg[6]); /*lo unrec*/
- sensor_thr[3] = htoi(&optarg[8]); /*hi noncrit*/
- sensor_thr[4] = htoi(&optarg[10]); /*hi crit*/
- sensor_thr[5] = htoi(&optarg[12]); /*hi unrec*/
+ sensor_thr[0] = htoi(&optarg[2]); /*lo noncrit*/
+ sensor_thr[1] = htoi(&optarg[4]); /*lo crit*/
+ sensor_thr[2] = htoi(&optarg[6]); /*lo unrec*/
+ sensor_thr[3] = htoi(&optarg[8]); /*hi noncrit*/
+ sensor_thr[4] = htoi(&optarg[10]); /*hi crit*/
+ sensor_thr[5] = htoi(&optarg[12]); /*hi unrec*/
/* validate sensor threshold ordering */
rv = validate_thresholds(&sensor_thr[0],0,NULL);
- if (rv == 0) {
- sensor_lo = sensor_thr[0];
- sensor_hi = sensor_thr[3];
+ if (rv == 0) {
+ sensor_lo = sensor_thr[0];
+ sensor_hi = sensor_thr[3];
fsetthresh = 3; /*indicates unique raw thresholds */
- } else {
+ } else {
ret = ERR_BAD_PARAM;
goto do_exit;
- }
+ }
} else {
/* assume float input thresholds, with ':' separator*/
/* format LN:LC:LU:HN:HC:HU */
@@ -3166,64 +3166,64 @@ int i_sensor(int argc, char **argv)
}
/* validate sensor threshold ordering later */
// rv = validate_thresholds(&sensor_thrf[0],1,NULL);
- // if (rv == 0) {
- sensor_lo_f = sensor_thrf[0];
- sensor_hi_f = sensor_thrf[3];
+ // if (rv == 0) {
+ sensor_lo_f = sensor_thrf[0];
+ sensor_hi_f = sensor_thrf[3];
fsetthresh = 4; /*indicates unique float thresholds */
- // } else {
+ // } else {
// ret = ERR_BAD_PARAM;
// goto do_exit;
- // }
+ // }
} /*end-else -u float thresholds*/
break;
- case 'w': fwrap = 1; break;
- case 'x': fdebug = 1; break;
+ case 'w': fwrap = 1; break;
+ case 'x': fdebug = 1; break;
case 'L': /* Loop */
- nloops = atoi(optarg);
- fdoloop = 1;
- break;
- case 'V': /* priv level */
+ nloops = atoi(optarg);
+ fdoloop = 1;
+ break;
+ case 'V': /* priv level */
fprivset = 1;
- case 'N': /* nodename */
- case 'U': /* remote username */
- case 'P': /* remote password */
- case 'R': /* remote password */
- case 'E': /* get password from IPMI_PASSWORD environment var */
- case 'F': /* force driver type */
- case 'T': /* auth type */
- case 'J': /* cipher suite */
- case 'Y': /* prompt for remote password */
- case 'Z': /* set local MC address */
- parse_lan_options(c,optarg,fdebug);
- break;
- default: /*usage*/
- printf("Usage: %s [-abcdefghijlmnprstuvwxL -NUPREFTVY]\n",progname);
- printf("where -x shows eXtra debug messages\n");
- printf(" -a snum reArms the sensor (snum) for events\n");
- printf(" -b show Bladed child MCs for PICMG (same as -e)\n");
- printf(" -c displays a simpler, Canonical output fmt\n");
- printf(" -d file Dump SDRs to a binary file\n");
+ case 'N': /* nodename */
+ case 'U': /* remote username */
+ case 'P': /* remote password */
+ case 'R': /* remote password */
+ case 'E': /* get password from IPMI_PASSWORD environment var */
+ case 'F': /* force driver type */
+ case 'T': /* auth type */
+ case 'J': /* cipher suite */
+ case 'Y': /* prompt for remote password */
+ case 'Z': /* set local MC address */
+ parse_lan_options(c,optarg,fdebug);
+ break;
+ default: /*usage*/
+ printf("Usage: %s [-abcdefghijlmnprstuvwxL -NUPREFTVY]\n",progname);
+ printf("where -x shows eXtra debug messages\n");
+ printf(" -a snum reArms the sensor (snum) for events\n");
+ printf(" -b show Bladed child MCs for PICMG (same as -e)\n");
+ printf(" -c displays a simpler, Canonical output fmt\n");
+ printf(" -d file Dump SDRs to a binary file\n");
printf(" -e show Every bladed child MC for PICMG\n");
// 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(" -j file Jump-start SDR cache from a binary file\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");
- printf(" -o output memory DIMM information\n");
- printf(" -p persist the threshold being set\n");
- printf(" -q shows threshold values in d:d:d format\n");
- printf(" -r show Raw SDR bytes\n");
- printf(" -s displays a Simpler output format\n");
- printf(" -t shows Threshold values in text format\n");
- 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(" -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(" -j file Jump-start SDR cache from a binary file\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");
+ printf(" -o output memory DIMM information\n");
+ printf(" -p persist the threshold being set\n");
+ printf(" -q shows threshold values in d:d:d format\n");
+ printf(" -r show Raw SDR bytes\n");
+ printf(" -s displays a Simpler output format\n");
+ printf(" -t shows Threshold values in text format\n");
+ 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");
print_lan_opt_usage();
- ret = ERR_USAGE;
+ ret = ERR_USAGE;
goto do_exit;
}
if (fjumpstart && fchild) {
@@ -3234,19 +3234,19 @@ int i_sensor(int argc, char **argv)
fremote = is_remote();
#ifndef WIN32
if (fremote == 0) {
- /* only run this as superuser for accessing IPMI devices. */
- i = geteuid();
- if (i > 1) {
- printf("Not superuser (%d)\n", i);
- ret = ERR_NOT_ALLOWED;
+ /* only run this as superuser for accessing IPMI devices. */
+ i = geteuid();
+ if (i > 1) {
+ printf("Not superuser (%d)\n", i);
+ ret = ERR_NOT_ALLOWED;
goto do_exit;
- }
+ }
}
#endif
if (fremote) {
if (!fprivset) {
/* on many systems, getting the SDR Reservation ID requires admin */
- /* if ((fsetthresh != 0) || (frearm != 0)) also require admin */
+ /* if ((fsetthresh != 0) || (frearm != 0)) also require admin */
parse_lan_options('V',"4",0);
}
}
@@ -3259,8 +3259,8 @@ int i_sensor(int argc, char **argv)
ipmi_maj = devrec[4] & 0x0f;
ipmi_min = devrec[4] >> 4;
if ((devrec[1] & 0x80) == 0x80) fdevsdrs = 1;
- vend_id = devrec[6] + (devrec[7] << 8) + (devrec[8] << 16);
- prod_id = devrec[9] + (devrec[10] << 8);
+ vend_id = devrec[6] + (devrec[7] << 8) + (devrec[8] << 16);
+ prod_id = devrec[9] + (devrec[10] << 8);
if (vend_id == VENDOR_NSC) { /*NSC mBMC*/
pstr = "mBMC";
fmBMC = 1;
@@ -3271,11 +3271,14 @@ int i_sensor(int argc, char **argv)
fmBMC = 0;
if (is_romley(vend_id,prod_id)) fRomley = 1;
if (prod_id == 0x003E || fRomley) /*Urbanna NSN2U,CG2100*/
- set_max_kcs_loops(URNLOOPS); /*longer KCS timeout*/
+ set_max_kcs_loops(URNLOOPS); /*longer KCS timeout*/
+ } else if ((vend_id == VENDOR_SUPERMICRO)
+ || (vend_id == VENDOR_SUPERMICROX)) {
+ set_max_kcs_loops(URNLOOPS); /*longer KCS timeout*/
} else { /* Other products */
pstr = "BMC";
fmBMC = 0;
- if (vend_id == VENDOR_NEC) fdevsdrs = 0;
+ if (vend_id == VENDOR_NEC) fdevsdrs = 0;
}
show_devid( devrec[2], devrec[3], ipmi_maj, ipmi_min);
// "-- %s version %x.%x, IPMI version %d.%d \n", pstr,
@@ -3298,8 +3301,8 @@ int i_sensor(int argc, char **argv)
/* fchild set above if -b is specified to get Blade child SDRs */
/* npass = 2 will get both SdrRep & DevSdr passes on CMM */
if (fpicmg && fdevsdrs) {
- npass = 2;
- g_addrtype = ADDR_IPMB;
+ npass = 2;
+ g_addrtype = ADDR_IPMB;
}
#endif
g_sa = BMC_SA;
@@ -3309,23 +3312,23 @@ int i_sensor(int argc, char **argv)
if (fremote) printf("Cannot get memory DIMM information remotely.\n");
else {
int msz;
- char desc[80];
- char szstr[25];
+ char desc[80];
+ char szstr[25];
ret = -1;
- for (j = 0; j < 1; j++) {
- for (i = 0; i < 16; i++) {
- rv = get_MemDesc(j, i, desc,&msz);
- if (rv == 0) {
- if (msz == 0) strcpy(szstr,"not present");
- else if (msz & 0x8000)
- sprintf(szstr,"size=%dKB",(msz & 0x7FFF));
- else sprintf(szstr,"size=%dMB",msz);
- printf("Memory Device (%d,%d): %s : %s\n",
- j,i,desc,szstr);
+ for (j = 0; j < 1; j++) {
+ for (i = 0; i < 16; i++) {
+ rv = get_MemDesc(j, i, desc,&msz);
+ if (rv == 0) {
+ if (msz == 0) strcpy(szstr,"not present");
+ else if (msz & 0x8000)
+ sprintf(szstr,"size=%dKB",(msz & 0x7FFF));
+ else sprintf(szstr,"size=%dMB",msz);
+ printf("Memory Device (%d,%d): %s : %s\n",
+ j,i,desc,szstr);
ret = 0;
- }
- }
- }
+ }
+ }
+ }
} /*end-else*/
goto do_exit;
}
@@ -3336,20 +3339,20 @@ int i_sensor(int argc, char **argv)
int len;
ret = get_sdr_cache(&pbuf);
if (ret == 0) {
- fp = fopen(binfile,"w");
- 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);
+ fp = fopen(binfile,"w");
+ 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);
}
goto do_exit;
} /*endif fdump*/
@@ -3363,17 +3366,17 @@ 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);
+ 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;
+ printf("SDR Clear Repository error %d\n",ret);
+ goto do_exit;
}
id = 0;
- while(find_sdr_next(sdr,pbuf,id) == 0) {
+ while(find_sdr_next(sdr,pbuf,id) == 0) {
id = sdr[0] + (sdr[1] << 8);
- if (fdebug) printf("adding SDR[%x]\n",id);
+ if (fdebug) printf("adding SDR[%x]\n",id);
set_reserve(1);
ret = sdr_add_record(sdr,fdevsdrs);
if (ret != 0) {
@@ -3394,7 +3397,7 @@ int i_sensor(int argc, char **argv)
if (ret != 0) fjumpstart = 0; /* use normal method if error*/
else { /* set this as the SDR cache */
psdrcache = pbuf;
- sz_sdrs = slen;
+ sz_sdrs = slen;
nsdrs = find_nsdrs(pbuf);
if (fdebug) printf("jumpstart cache: nsdrs=%d size=%d\n",nsdrs,slen);
}
@@ -3404,13 +3407,13 @@ int i_sensor(int argc, char **argv)
{
if (fjumpstart) ; /*already got this above*/
else {
- ret = GetSDRRepositoryInfo(&j,&fdevsdrs);
- if (fdebug) printf("GetSDRRepositoryInfo: ret=%x nSDRs=%d\n",ret,j);
- if (ret == 0 && j == 0) {
- printf("SDR Repository is empty\n");
- goto do_exit;
- }
- nsdrs = j;
+ ret = GetSDRRepositoryInfo(&j,&fdevsdrs);
+ if (fdebug) printf("GetSDRRepositoryInfo: ret=%x nSDRs=%d\n",ret,j);
+ if (ret == 0 && j == 0) {
+ printf("SDR Repository is empty\n");
+ goto do_exit;
+ }
+ nsdrs = j;
}
/* show header for SDR records */
@@ -3427,43 +3430,48 @@ int i_sensor(int argc, char **argv)
else recid = 0;
while (recid != 0xffff)
{
- if (fjumpstart) {
- ret = find_sdr_next(sdrdata,psdrcache,recid);
- if (ret != 0) { ret = 0; break; } /*end of sdrs*/
- recnext = sdrdata[0] + (sdrdata[1] << 8); /*same as recid*/
+ if (fjumpstart) {
+ ret = find_sdr_next(sdrdata,psdrcache,recid);
+ if (ret != 0) { /*end of sdrs*/
+ if (fdebug) printf("find_sdr_next(%04x): ret = %d\n", recid,ret);
+ ret = 0; break;
+ }
+ recnext = sdrdata[0] + (sdrdata[1] << 8); /*same as recid*/
+ if (fdebug) printf("find_sdr_next(%04x): ret = %d, next=%04x\n",
+ recid,ret,recnext);
sz = sdrdata[4] + 5;
- } else {
- ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
- if (fdebug)
- printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext);
- if (ret != 0) {
- if (ret > 0) { /* ret is a completion code error */
- printf("%04x GetSDR error 0x%02x %s, rlen=%d\n",recid,ret,
+ } else {
+ ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
+ if (fdebug)
+ printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext);
+ if (ret != 0) {
+ if (ret > 0) { /* ret is a completion code error */
+ printf("%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 */
- /* This means that some other IPMI software has
- * requested a Reservation before we finished, so
- * we need to refresh the Reservation ID * retry. */
- fDoReserve = 1; /* get a new SDR Reservation ID */
- ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
- if (fdebug)
- printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,
+ /* This means that some other IPMI software has
+ * requested a Reservation before we finished, so
+ * we need to refresh the Reservation ID * retry. */
+ fDoReserve = 1; /* get a new SDR Reservation ID */
+ ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
+ if (fdebug)
+ printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,
recnext);
- }
- } else printf("%04x GetSDR error %d, rlen = %d\n", recid,ret,sz);
- if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */
- break;
- } /* else fall through & continue */
- }
- } /*end-else*/
- if (ret == 0) { /* (ret == 0) OK, got full SDR */
- if (fdebug) {
- dump_buf("got SDR",sdrdata,sz,0);
- }
- if (sz < MIN_SDR_SZ) goto NextSdr;
+ }
+ } else printf("%04x GetSDR error %d, rlen = %d\n", recid,ret,sz);
+ if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */
+ break;
+ } /* else fall through & continue */
+ }
+ } /*end-else*/
+ if (ret == 0) { /* (ret == 0) OK, got full SDR */
+ if (fdebug) {
+ dump_buf("got SDR",sdrdata,sz,0);
+ }
+ if (sz < MIN_SDR_SZ) goto NextSdr;
/* if recid == 0, get real record id */
if (recid == 0) recid = sdrdata[0] + (sdrdata[1] << 8);
- if (fshowgrp > 0) {
+ if (fshowgrp > 0) {
for (i = 0; i < fshowgrp; i++) {
uchar styp;
if (sdrdata[3] == 0x03) styp = sdrdata[10]; /*EvtOnly*/
@@ -3479,64 +3487,64 @@ int i_sensor(int argc, char **argv)
if ((sensor_num == INIT_SNUM) || (sdrdata[7] == sensor_num)
|| fsetthresh) {
/* if -n not set or if -n matches, parse and show the SDR */
- ShowSDR("",sdrdata);
+ ShowSDR("",sdrdata);
} /* else filter SDRs if not matching -n sensor_num */
#ifdef PICMG_CHILD
- /*
- * Special logic for blade child MCs in PICMG ATCA systems
- * if fchild, try all child MCs within the chassis.
- * SDR type 12 capabilities bits (sdrdata[8]):
- * 80 = Chassis Device
- * 40 = Bridge
- * 20 = IPMB Event Generator
- * 10 = IPMB Event Receiver
- * 08 = FRU Device
- * 04 = SEL Device
- * 02 = SDR Repository Device
- * 01 = Sensor Device
- * But all child MCs use Device SDRs anyway.
- */
- if (fpicmg && fchild && (sdrdata[3] == 0x12)) { /* PICMG MC DLR */
- int _recid, _recnext, _sz;
- uchar _sdrdata[MAX_SDR_SIZE];
- int devsdrs_save;
- uchar cc;
-
- /* save the BMC globals, use IPMB MC */
- devsdrs_save = fdevsdrs;
- fdevsdrs = 1; /* use Device SDRs for the children*/
- if (fdebug)
- printf(" --- IPMB MC (sa=%02x cap=%02x id=%02x devsdrs=%d):\n",
- sdrdata[5],sdrdata[8],sdrdata[12],fdevsdrs);
- fDoReserve = 1; /* get a new SDR Reservation ID */
- ipmi_set_mc(PICMG_SLAVE_BUS,sdrdata[5],sdrdata[6],g_addrtype);
-
- _sz = 16;
- ret = ipmi_cmd_mc(GET_DEVICE_ID,NULL,0,_sdrdata,&_sz,&cc,fdebug);
- if (ret == 0 && cc == 0) {
- /* Get the SDRs from the IPMB MC */
- _recid = 0;
- while (_recid != 0xffff)
- {
- ret = GetSDR(_recid,&_recnext,_sdrdata,sizeof(_sdrdata),&_sz);
- if (ret != 0) {
- printf("%04x GetSDR error %d, rlen = %d\n",_recid,ret,_sz);
- break;
- }
- else if (_sz >= MIN_SDR_SZ)
+ /*
+ * Special logic for blade child MCs in PICMG ATCA systems
+ * if fchild, try all child MCs within the chassis.
+ * SDR type 12 capabilities bits (sdrdata[8]):
+ * 80 = Chassis Device
+ * 40 = Bridge
+ * 20 = IPMB Event Generator
+ * 10 = IPMB Event Receiver
+ * 08 = FRU Device
+ * 04 = SEL Device
+ * 02 = SDR Repository Device
+ * 01 = Sensor Device
+ * But all child MCs use Device SDRs anyway.
+ */
+ if (fpicmg && fchild && (sdrdata[3] == 0x12)) { /* PICMG MC DLR */
+ int _recid, _recnext, _sz;
+ uchar _sdrdata[MAX_SDR_SIZE];
+ int devsdrs_save;
+ uchar cc;
+
+ /* save the BMC globals, use IPMB MC */
+ devsdrs_save = fdevsdrs;
+ fdevsdrs = 1; /* use Device SDRs for the children*/
+ if (fdebug)
+ printf(" --- IPMB MC (sa=%02x cap=%02x id=%02x devsdrs=%d):\n",
+ sdrdata[5],sdrdata[8],sdrdata[12],fdevsdrs);
+ fDoReserve = 1; /* get a new SDR Reservation ID */
+ ipmi_set_mc(PICMG_SLAVE_BUS,sdrdata[5],sdrdata[6],g_addrtype);
+
+ _sz = 16;
+ ret = ipmi_cmd_mc(GET_DEVICE_ID,NULL,0,_sdrdata,&_sz,&cc,fdebug);
+ if (ret == 0 && cc == 0) {
+ /* Get the SDRs from the IPMB MC */
+ _recid = 0;
+ while (_recid != 0xffff)
+ {
+ ret = GetSDR(_recid,&_recnext,_sdrdata,sizeof(_sdrdata),&_sz);
+ if (ret != 0) {
+ printf("%04x GetSDR error %d, rlen = %d\n",_recid,ret,_sz);
+ break;
+ }
+ else if (_sz >= MIN_SDR_SZ)
ShowSDR(" ",_sdrdata);
- if (_recnext == _recid) _recid = 0xffff;
- else _recid = _recnext;
- } /*end while*/
- } /*endif ret==0*/
+ if (_recnext == _recid) _recid = 0xffff;
+ else _recid = _recnext;
+ } /*end while*/
+ } /*endif ret==0*/
- /* restore BMC globals */
- fdevsdrs = devsdrs_save;
- ipmi_restore_mc();
- fDoReserve = 1; /* get a new SDR Reservation ID */
- } /*endif fpicmg && fchild*/
+ /* restore BMC globals */
+ fdevsdrs = devsdrs_save;
+ ipmi_restore_mc();
+ fDoReserve = 1; /* get a new SDR Reservation ID */
+ } /*endif fpicmg && fchild*/
#endif
if (fdebug) printf("fsetthresh=%d snum=%02x(%02x) sa=%02x(%02x)\n",
@@ -3546,21 +3554,21 @@ int i_sensor(int argc, char **argv)
{
/* setting threshold, compute threshold raw values */
if (fsetthresh == 2) { /*set from float*/
- if (fdebug)
+ if (fdebug)
printf("lof=%.2f hif=%.2f\n", sensor_lo_f,sensor_hi_f);
- if (sensor_lo_f != 0)
- sensor_lo = FloatToRaw(sensor_lo_f,sdrdata,0);
- if (sensor_hi_f != 0)
- sensor_hi = FloatToRaw(sensor_hi_f,sdrdata,0);
+ if (sensor_lo_f != 0)
+ sensor_lo = FloatToRaw(sensor_lo_f,sdrdata,0);
+ if (sensor_hi_f != 0)
+ sensor_hi = FloatToRaw(sensor_hi_f,sdrdata,0);
} else if (fsetthresh == 1) { /*raw thresholds*/
- if (sensor_hi != 0xff)
+ if (sensor_hi != 0xff)
sensor_hi_f = RawToFloat(sensor_hi,sdrdata);
- if (sensor_lo != 0xff)
+ if (sensor_lo != 0xff)
sensor_lo_f = RawToFloat(sensor_lo,sdrdata);
} else if (fsetthresh == 3) { /*unique raw thresholds*/
- if (sensor_hi != 0xff)
+ if (sensor_hi != 0xff)
sensor_hi_f = RawToFloat(sensor_hi,sdrdata);
- if (sensor_lo != 0xff)
+ if (sensor_lo != 0xff)
sensor_lo_f = RawToFloat(sensor_lo,sdrdata);
} else if (fsetthresh == 4) { /*set unique from float*/
i = fill_thresholds(&sensor_thrf[0], sdrdata);
@@ -3575,23 +3583,23 @@ int i_sensor(int argc, char **argv)
sensor_hi_f = sensor_thrf[j]; break; }
}
}
- if (fdebug)
+ if (fdebug)
printf("lof=%.2f hif=%.2f\n", sensor_lo_f,sensor_hi_f);
/* convert thrf (float) to thr (raw) */
- if (sensor_lo_f != 0) {
- sensor_lo = FloatToRaw(sensor_lo_f,sdrdata,0);
- sensor_thr[0] = FloatToRaw(sensor_thrf[0],sdrdata,0);
- sensor_thr[1] = FloatToRaw(sensor_thrf[1],sdrdata,0);
- sensor_thr[2] = FloatToRaw(sensor_thrf[2],sdrdata,0);
+ if (sensor_lo_f != 0) {
+ sensor_lo = FloatToRaw(sensor_lo_f,sdrdata,0);
+ sensor_thr[0] = FloatToRaw(sensor_thrf[0],sdrdata,0);
+ sensor_thr[1] = FloatToRaw(sensor_thrf[1],sdrdata,0);
+ sensor_thr[2] = FloatToRaw(sensor_thrf[2],sdrdata,0);
}
- if (sensor_hi_f != 0) {
- sensor_hi = FloatToRaw(sensor_hi_f,sdrdata,0);
- sensor_thr[3] = FloatToRaw(sensor_thrf[3],sdrdata,0);
- sensor_thr[4] = FloatToRaw(sensor_thrf[4],sdrdata,0);
- sensor_thr[5] = FloatToRaw(sensor_thrf[5],sdrdata,0);
+ if (sensor_hi_f != 0) {
+ sensor_hi = FloatToRaw(sensor_hi_f,sdrdata,0);
+ sensor_thr[3] = FloatToRaw(sensor_thrf[3],sdrdata,0);
+ sensor_thr[4] = FloatToRaw(sensor_thrf[4],sdrdata,0);
+ sensor_thr[5] = FloatToRaw(sensor_thrf[5],sdrdata,0);
}
- /* validate threshold ordering */
- if (validate_thresholds(sensor_thrf,1,sdrdata) != 0) {
+ /* validate threshold ordering */
+ if (validate_thresholds(sensor_thrf,1,sdrdata) != 0) {
ret = ERR_BAD_PARAM;
goto do_exit;
}
@@ -3603,30 +3611,30 @@ int i_sensor(int argc, char **argv)
else fsetfound = recid;
}
} /*endif fsetthresh */
- } /*endif ok, got full SDR */
+ } /*endif ok, got full SDR */
NextSdr:
- if (fshowidx) {
+ if (fshowidx) {
/* if we have already read the last in the range, done. */
if (recid >= sensor_idxN) break; // recnext = 0xffff; // break;
}
if (fjumpstart) recid = recnext;
else {
- if (recnext == recid) recid = 0xffff; /*break;*/
+ if (recnext == recid) recid = 0xffff; /*break;*/
else recid = recnext;
}
} /*end while recid*/
if (fdoloop && (nloops > 1)) {
printf("\n"); /* output an empty separator line */
- os_usleep(1,0); /*delay 1 sec between loops*/
+ os_usleep(1,0); /*delay 1 sec between loops*/
}
} /*end for nloops*/
if (npass > 1) { /* npass==2 for PICMG */
- /* Switch fdevsdrs from Device to Repository */
- if (fdevsdrs == 0) fdevsdrs = 1;
- else fdevsdrs = 0;
- fDoReserve = 1; /* get a new SDR Reservation ID */
+ /* Switch fdevsdrs from Device to Repository */
+ if (fdevsdrs == 0) fdevsdrs = 1;
+ else fdevsdrs = 0;
+ fDoReserve = 1; /* get a new SDR Reservation ID */
}
} /*end for npass*/
@@ -3654,19 +3662,19 @@ NextSdr:
printf(" set(%02x): %02x %02x \n",
sensor_num,sensor_lo,sensor_hi);
#endif
- if (fsetthresh == 3 || fsetthresh == 4) {
+ if (fsetthresh == 3 || fsetthresh == 4) {
/* apply unique sensor thresholds */
pset = &sensor_thr[0];
- } else pset = NULL; /* use just hi/lo */
+ } else pset = NULL; /* use just hi/lo */
ret = SetSensorThresholds(sensor_num,sensor_hi,sensor_lo,tdata,pset);
printf("SetSensorThreshold[%02x] to lo=%02x(%4.3f) hi=%02x(%4.3f), ret = %d\n",
sensor_num,sensor_lo,sensor_lo_f,sensor_hi,sensor_hi_f,ret);
- if (fsavethresh && ret == 0) {
+ if (fsavethresh && ret == 0) {
recid = fsetfound;
- rv = SaveThreshold(recid,sensor_num,sensor_lo,sensor_hi,pset);
- if (rv == 0)
- printf("Saved thresholds for sensor %02x\n",sensor_num);
- }
+ rv = SaveThreshold(recid,sensor_num,sensor_lo,sensor_hi,pset);
+ if (rv == 0)
+ printf("Saved thresholds for sensor %02x\n",sensor_num);
+ }
fsetthresh = 0; /*only set threshold once*/
}
diff --git a/util/iserial.c b/util/iserial.c
index ce00ed3..a7f722c 100644
--- a/util/iserial.c
+++ b/util/iserial.c
@@ -155,7 +155,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "2.93";
+static char * progver = "2.94";
static char * progname = "iserial";
static int vend_id = 0;
static int prod_id = 0;
@@ -1237,8 +1237,7 @@ main(int argc, char **argv)
#ifdef TEST
/* This MUX reading is volatile and may not be accurate */
else if (ival == CMDID_MUX) {
- /* Apparently this always shows 0x01 even if System. */
- if (pc[0] & 0x01 == 1) printf("%c BMC",bdelim);
+ if ((pc[0] & 0x01) == 1) printf("%c BMC",bdelim);
else printf("%c System",bdelim); /*BIOS*/
}
#endif
diff --git a/util/isol.c b/util/isol.c
index 381668e..460411e 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.93";
+static char * progver = "2.94";
static char * progname = "isol";
static char fdebug = 0;
static char fpicmg = 0;
@@ -1307,7 +1307,6 @@ main(int argc, char **argv)
/*
* Spawn a console raw terminal thread now, which will wait for the
* "Activating cmd (0x02)" on success
- * Using globals: gnode,guser,gpswd, gauth_type, gpriv_level
*/
if (fdeactivate) {
/* Request admin privilege by default, since deactivate requires it. */
diff --git a/util/itsol.c b/util/itsol.c
index dc4d9fb..ce3f98c 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.93";
+static char * progver = "2.94";
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 96d21c0..dbc6f9a 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.93";
+static char * progver = "2.94";
static char * progname = "iwdt";
static char fdebug = 0;
static char fdontlog = 0;
diff --git a/util/md2.h b/util/md2.h
index 29c77fd..5973d2a 100644
--- a/util/md2.h
+++ b/util/md2.h
@@ -6,26 +6,149 @@
* added md2_sum() subroutine, added WIN32 flag
* 08/14/2008 ARCress - moved md2 routines from md2.c to md2.h
*/
-/*
- Copyright (C) 2003 FreeIPMI Core Team
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+/*
+ * (c) (C) 2003 FreeIPMI Core Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
+ * NON-INFRINGEMENT. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ * In addition, as a special exception, the copyright holders give
+ * permission to link the code of portions of this program with the
+ * OpenSSL library under certain conditions as described in each
+ * individual source file, and distribute linked combinations
+ * including the two.
+ * You must obey the GNU General Public License in all respects
+ * for all of the code used other than OpenSSL. If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so. If you
+ * do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source
+ * files in the program, then also delete it here.
+ */
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- A copy of the GNU General Public License is available as
- /usr/share/common-licenses/GPL-2 in the Debian distribution or on
- the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You can
- also obtain it by writing to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+/* ====================================================================
+ * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
-*/
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
/* only include this file if MD2OK was defined */
diff --git a/util/oem_dell.c b/util/oem_dell.c
index 1911d96..aab64d9 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.93";
+static char * progver = "2.94";
static char * progname = "idelloem";
static int verbose = 0;
static char fdebug = 0;
diff --git a/util/oem_hp.c b/util/oem_hp.c
index 29a813f..4c5b4f9 100644
--- a/util/oem_hp.c
+++ b/util/oem_hp.c
@@ -86,12 +86,6 @@ int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring, int slen)
if ((reading[2] & 0x40) == 0x40) { /*Init/Unavail state*/
strncpy(pstring,"Init",slen);
rv = 0;
- } else if ((sdr[20] & 0xC0) == 0xC0) { /*unit1==discrete*/
- b = reading[2] & 0x3f;
- pstr = "DiscreteUnit";
- if (evtype == 0x0b) pstr = redund_str(b);
- snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr);
- rv = 0;
} else if (evtype == 0x6f) { /*evtype==0x6f special*/
pstr = "DiscreteEvt";
if (stype == 0x08) { /*Power Supply presence*/
@@ -127,6 +121,12 @@ int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring, int slen)
else pstr = "Unknown";
snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr);
rv = 0;
+ } else if ((sdr[20] & 0xC0) == 0xC0) { /*unit1==discrete*/
+ b = reading[2] & 0x3f;
+ pstr = "DiscreteUnit";
+ if (evtype == 0x0b) pstr = redund_str(b);
+ snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr);
+ rv = 0;
}
}
return(rv);
diff --git a/util/oem_sun.c b/util/oem_sun.c
index da413a8..25686c0 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.93";
+static char * progver = "2.94";
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 528e4f7..5da8614 100644
--- a/util/oem_supermicro.c
+++ b/util/oem_supermicro.c
@@ -66,7 +66,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.93";
+static char * progver = "2.94";
static char * progname = "ismcoem";
static int verbose = 0;
static char fdebug = 0;
diff --git a/util/subs.c b/util/subs.c
index 9f11423..c5f9308 100644
--- a/util/subs.c
+++ b/util/subs.c
@@ -163,6 +163,23 @@ void lperror(int level, const char * format, ...)
return;
}
+#ifdef LANHELPER
+uint32_t buf2long(uint8_t * buf);
+uint16_t buf2short(uint8_t * buf);
+void printbuf(const uint8_t * buf, int len, const char * desc);
+const char * buf2str(uint8_t * buf, int len);
+const char * oemval2str(uint16_t oem, uint16_t val, const struct oemvalstr *vs);
+const char * val2str(uint16_t val, const struct valstr *vs);
+uint16_t str2val(const char *str, const struct valstr *vs);
+#else
+ulong buf2long(uchar * buf)
+{
+ return (ulong)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
+}
+ushort buf2short(uchar * buf)
+{
+ return (ushort)(buf[1] << 8 | buf[0]);
+}
void printbuf(const uchar * buf, int len, const char * desc)
{
int i;
@@ -190,14 +207,6 @@ const char * buf2str(uchar * buf, int len)
str[len*2] = '\0';
return (const char *)str;
}
-ushort buf2short(uchar * buf)
-{
- return (ushort)(buf[1] << 8 | buf[0]);
-}
-ulong buf2long(uchar * buf)
-{
- return (ulong)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
-}
#define IPMI_OEM_PICMG 12634
#define SZUN 32
@@ -237,6 +246,7 @@ ushort str2val( char *str, struct valstr *vs)
}
return vs[i].val;
}
+#endif
void dump_buf(char *tag, uchar *pbuf, int sz, char fshowascii)