diff options
Diffstat (limited to 'util')
45 files changed, 1600 insertions, 930 deletions
diff --git a/util/AnsiTerm.cpp b/util/AnsiTerm.cpp index be94465..750fd52 100644 --- a/util/AnsiTerm.cpp +++ b/util/AnsiTerm.cpp @@ -22,6 +22,8 @@ * 10/17/09 Robert Nelson * - Use GetProcAddress for (Get/Set)ConsoleScreenBufferInfoEx since they * are only available on Vista and beyond. + * 01/27/2015 Andy Cress + * - handle ProcessRM asserts * * Todo: * - Implement soft tabs @@ -1089,6 +1091,7 @@ CAnsiTerm::OutputText(void) if (WriteConsoleW(m_hConsole, &m_OutputBuffer[m_dwOutputCount - 1], 1, &dwWritten, NULL)) { + dbglog("OutputTest: WriteConsoleW error1\n"); assert(dwWritten == 1); } @@ -1102,6 +1105,7 @@ CAnsiTerm::OutputText(void) if (WriteConsoleW(m_hConsole, pwszCurrent, dwPartialCount, &dwWritten, NULL)) { + dbglog("OutputTest: WriteConsoleW error2\n"); assert(dwWritten == dwPartialCount); } else @@ -1530,6 +1534,8 @@ CAnsiTerm::ProcessRIS(void) bool CAnsiTerm::ProcessRM(void) { + bool bret = true; + if (m_bPrivateParameters) { for (int index = 0; index < m_ParameterCount; index++) @@ -1538,7 +1544,8 @@ CAnsiTerm::ProcessRM(void) { case 0: default: - assert(false); + dbglog("ProcessRM: illegal private param %d\n",m_Parameters[index]); + bret = false; break; case DECCKM: m_bCursorKeyMode = false; @@ -1584,11 +1591,13 @@ CAnsiTerm::ProcessRM(void) switch (m_Parameters[index]) { case 20: m_bLineFeedNewLineMode = false; break; // LNM - default: assert(false); break; + default: + dbglog("ProcessRM: illegal public param %d\n",m_Parameters[index]); + bret = false; break; } } } - return true; + return bret; } bool diff --git a/util/Makefile.am b/util/Makefile.am index 3726107..16a8665 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -22,9 +22,9 @@ CMDMOD += md5.c md2.c ipmilan.c CMDMOD += ipmilanplus.c # CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@ # am: configure substitutions are not allowed in _SOURCES variables -LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o +LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@ OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c iekanalyzer.c - +L2OBJ = @SAM2OBJ@ AM_CPPFLAGS += -I. -I.. -DMETACOMMAND METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c $(OEMMOD) $(CMDMOD) @@ -77,7 +77,7 @@ libimbapi.a: imbapi.c # Build a lib to support all of the IPMI drivers (libipmiutil.a) # If LANPLUS_SAM = yes, include LANPLUS_OBJ, else do not. # See configure --enable-liblanplus to change this -$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ +$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ mkdir -p $(tmpobj) if [ "x@LANPLUS_SAM@" = "xyes" ]; then \ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ @@ -92,7 +92,7 @@ $(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ $(RANLIB) $(DEV_LIB) ; \ fi -$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ +$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ mkdir -p $(tmpobj) if [ "x@LANPLUS_SAM@" = "xyes" ]; then \ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ @@ -125,24 +125,26 @@ ialarms_enc: $(DEV_LIB) ialarms.c oem_intel.c $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) +isensor2.o: isensor.c + $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c + +ievents2.o: ievents.c + $(CC) $(CFLAGS_SAM) -DSENSORS_OK -o ievents2.o -c ievents.c + ifru_picmg2.o: ifru_picmg.c $(CC) $(CFLAGS_SAM) -o ifru_picmg2.o -c ifru_picmg.c # To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o # Note that this does not include oem_intel, etc. for OEM SEL decoding. -ipmi_sample2: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c ifru.c isel.c ifru_picmg2.o +ipmi_sample2: $(DEV_LIB) ipmi_sample.c ifru.c isel.c ifru_picmg2.o $(L2OBJ) $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -o ievents2.o -c ievents.c $(CC) $(CFLAGS_SAM) -o ifru2.o -c ifru.c $(CC) $(CFLAGS_SAM) -o isel2.o -c isel.c - $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o isensor2.o ievents2.o ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) + $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) -ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c isensor.c ievents.c +ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c $(L2OBJ) $(CC) $(CFLAGS_SAM) -o ipmi_sample_evt.o -c ipmi_sample_evt.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -DSENSORS_OK -o ievents2.o -c ievents.c - $(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o isensor2.o ievents2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) + $(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o $(L2OBJ) $(DEV_LIB) $(LDFLAGS) $(LDSAM) ifruset: $(DEV_LIB) ifruset.c ifru_picmg2.o $(CC) $(CFLAGS_SAM) -c ifruset.c @@ -190,6 +192,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.am-so b/util/Makefile.am-so deleted file mode 100644 index 97d9c34..0000000 --- a/util/Makefile.am-so +++ /dev/null @@ -1,241 +0,0 @@ - -localedir = $(datadir)/locale -INCLUDES = -I. -I.. -OS_CF = @OS_CFLAGS@ @CROSS_CFLAGS@ -OS_LF = @OS_LFLAGS@ @CROSS_LFLAGS@ -AM_CPPFLAGS = $(OS_CF) -DLOCALEDIR=\"$(localedir)\" -AM_CPPFLAGS += @IA64_CFLAGS@ @GPL_CFLAGS@ -LDADD = $(OS_LF) -LDSAM = $(OS_LF) @LD_SAMX@ -CFLAGS_SAMX = -O2 -g -I. -I.. $(OS_CF) @LANPLUS_CFLAGS@ -CFLAGS_SAM = -O2 -g -I. -I.. $(OS_CF) -# May be /usr/bin/install or /bin/install -INSTALLBIN = install -c -extradir = $(datadir)/ipmiutil -inc_dir = $(includedir) -tmpobj = obj -tmpwin = tmp -LIBDIR = @LIB_DIR@ - -CMDSRC = ipmicmd.c mem_if.c ipmidir.c imbapi.c ipmimv.c ipmild.c ipmibmc.c ipmilipmi.c subs.c -CMDSRC += md5.c md2.c ipmilan.c -CMDSRC += ipmilanplus.c -# CMDSRC = ipmicmd.c mem_if.c @OS_DRIVERS@ -# am: configure substitutions are not allowed in _SOURCES variables -CMDOBJ = $(tmpobj)/ipmicmd.o $(tmpobj)/mem_if.o $(tmpobj)/ipmidir.o $(tmpobj)/imbapi.o $(tmpobj)/ipmimv.o $(tmpobj)/ipmild.o $(tmpobj)/ipmibmc.o $(tmpobj)/ipmilipmi.o $(tmpobj)/subs.o $(tmpobj)/md5.o $(tmpobj)/md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o -LIBOBJ = $(CMDOBJ) -OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c iekanalyzer.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c - - -AM_CPPFLAGS += -I. -I.. -DMETACOMMAND -METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c $(OEMMOD) -LDADD += -lpthread - -# The LanDesk library is proprietary, so it is incompatible with ALLOW_GPL. -# To build with LanDesk support: -# First copy the library to ../lib/libipmiapi.a -# Then ./configure --enable-landesk -# Result: -# AM_CPPFLAGS += -DLINK_LANDESK -# LDADD += -lipmiapi -L../lib -AM_CPPFLAGS += @LANDESK_CFLAGS@ -LDADD += @LANDESK_LDADD@ - -# For lanplus plugin support (IPMI LAN 2.0 RMCP+) required by SOL: -# If ./configure --disable-lanplus -# AM_CPPFLAGS += -# LDADD += -# LANPLUS_SRC = -# Otherwise default result is lanplus enabled: -# AM_CPPFLAGS += -DHAVE_LANPLUS -# LDADD += -L../lib -lipmi_lanplus -L/usr/local/lib -lcrypto -# LDADD += -L../lib -lintf_lanplus -L/usr/local/lib -lcrypto (older) -# LANPLUS_SRC = $(LANPLUS_DIR)/lanplus.c ... -AM_CPPFLAGS += @LANPLUS_CFLAGS@ -I../lib/lanplus -I../lib/lanplus/inc -LDADD += @LANPLUS_LIB@ @LANPLUS_CRYPTO@ -LANPLUS_OBJ = $(shell ar t @LANPLUS_LIB@ 2>/dev/null) -LANPLUS_DIR = ../lib/lanplus -LANPLUS_SRC = $(LANPLUS_DIR)/lanplus.c $(LANPLUS_DIR)/lanplus_dump.c \ - $(LANPLUS_DIR)/lanplus_strings.c $(LANPLUS_DIR)/lanplus_crypt.c \ - $(LANPLUS_DIR)/lanplus_crypt_impl.c $(LANPLUS_DIR)/helper.c \ - $(LANPLUS_DIR)/ipmi_strings.c - -# sbin_PROGRAMS are built by default and copied to /usr/sbin at install time -# EXTRA_PROGRAMS are built by default but not included in the install package -# TESTPROGS are not built by default. To build, do 'make ifruset', for example. -bin_PROGRAMS = ipmiutil ievents idiscover -sbin_PROGRAMS = ipmi_port -DEV_LIB = libipmiutil.a -EXTRA_PROGRAMS = ipmi_sample ipmi_sample_evt -TESTPROGS = libimbapi.a iconfig ipmimv ifruset ipmi_sample2 ialarms_enc iseltime -# OLDPROGS are old/previous binaries that may exist and need to be deleted. -OLDPROGS = alarms bmchealth fruconfig getevent hwreset icmd isolconsole pefconfig sensor showsel tmconfig wdt - -lib_LTLIBRARIES = libipmiutil.la -libipmiutil_la_SOURCES = $(CMDSRC) $(LANPLUS_SRC) -libipmiutil_la_LDFLAGS = -export-dynamic - -# To build an imb api library (libimbapi.a): -libimbapi.a: imbapi.c - mkdir -p $(tmpobj) - $(CC) -I. -I.. $(OS_CF) -fPIC $(CFLAGS) -o $(tmpobj)/imbapi.o -c imbapi.c - $(AR) cru libimbapi.a $(tmpobj)/imbapi.o - $(RANLIB) libimbapi.a - rm -f $(tmpobj)/imbapi.o - -# Build a lib to support all of the IPMI drivers (libipmiutil.a) -# If LANPLUS_SAM = yes, include LANPLUS_OBJ, else do not. -# See configure --enable-liblanplus to change this -$(DEV_LIB): $(CMDOBJ) @LANPLUS_LIB@ - mkdir -p $(tmpobj) - if [ "x@LANPLUS_SAM@" = "xyes" ]; then \ - $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ - $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \ - ar x @LANPLUS_LIB@ ; \ - $(AR) cru $(DEV_LIB) $(LIBOBJ) $(LANPLUS_OBJ); \ - $(RANLIB) $(DEV_LIB); \ - else \ - $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ - $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \ - $(AR) cru $(DEV_LIB) $(LIBOBJ) ; \ - $(RANLIB) $(DEV_LIB) ; \ - fi - rm -f $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o - -# To build ipmiutil, need to use METACFLAGS for each .c/.o - -idiscover: idiscover.c - $(CC) $(OS_CF) $(CFLAGS) $(LDFLAGS) $(OS_LF) -o idiscover idiscover.c - -ipmimv: ipmimv.c - $(CC) $(OS_CF) $(CFLAGS) $(LDFLAGS) -DTEST_BIN -o ipmimv ipmimv.c - -ievents: ievents.c - $(CC) $(OS_CF)$(CFLAGS) $(LDFLAGS) -DALONE -o ievents ievents.c - -ipmi_sample: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c - $(CC) $(CFLAGS_SAM) -c ipmi_sample.c - $(CC) -g -O2 -o ipmi_sample ipmi_sample.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) - -ialarms_enc: $(DEV_LIB) ialarms.c oem_intel.c - $(CC) $(CFLAGS_SAM) -DTEST_ENC -o ialarms2.o -c ialarms.c - $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c - $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) - -ifru_picmg2.o: ifru_picmg.c - $(CC) $(CFLAGS_SAM) -o ifru_picmg2.o -c ifru_picmg.c - -# To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o -# Note that this does not include oem_intel, etc. for OEM SEL decoding. -ipmi_sample2: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c ifru.c isel.c ifru_picmg2.o - $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -o ievents2.o -c ievents.c - $(CC) $(CFLAGS_SAM) -o ifru2.o -c ifru.c - $(CC) $(CFLAGS_SAM) -o isel2.o -c isel.c - $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o isensor2.o ievents2.o ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) - -ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c isensor.c ievents.c - $(CC) $(CFLAGS_SAM) -o ipmi_sample_evt.o -c ipmi_sample_evt.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -DSENSORS_OK -o ievents2.o -c ievents.c - $(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o isensor2.o ievents2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) - -ifruset: $(DEV_LIB) ifruset.c ifru_picmg2.o - $(CC) $(CFLAGS_SAM) -c ifruset.c - $(CC) -g -O2 -o ifruset ifruset.o ifru_picmg2.o $(DEV_LIB) $(LDFLAGS) $(LDADD) - -iseltime: $(DEV_LIB) iseltime.c - $(CC) $(CFLAGS_SAM) -c iseltime.c - $(CC) -g -O2 -o iseltime iseltime.o $(DEV_LIB) $(LDFLAGS) $(LDADD) - -ipmi_port: ipmi_port.c - $(CC) $(CFLAGS) $(LDFLAGS) -o ipmi_port ipmi_port.c - -#xmlconfig: xmlconfig.c $(DEV_LIB) -# $(CC) $(CFLAGS) $(LDFLAGS) -o xmlconfig xmlconfig.c libipmiutil.a @LANPLUS_CRYPTO@ - -iconfig: iconfig.c $(DEV_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o iconfig iconfig.c $(DEV_LIB) @LANPLUS_CRYPTO@ - -# @LANPLUS_LIB@ is ../lib/libipmi_lanplus.a -../lib/libipmi_lanplus.a: - cd ../lib; make - -ipmiutil_SOURCES = $(METASOURCE) - -ipmiutil: $(METASOURCE:.c=.o) $(CMDOBJ) @LANPLUS_LIB@ - $(CC) $(CFLAGS) $(LDFLAGS) -o ipmiutil $(METASOURCE:.c=.o) $(CMDOBJ) $(LDADD) - -$(tmpobj)/ipmicmd.o: ipmicmd.c - mkdir -p $(tmpobj) - @$(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmicmd.o -c ipmicmd.c - -$(tmpobj)/subs.o: subs.c - @$(CC) $(CFLAGS_SAMX) -o $(tmpobj)/subs.o -c subs.c - -$(tmpobj)/mem_if.o: mem_if.c - @$(CC) $(CFLAGS_SAMX) -o $(tmpobj)/mem_if.o -c mem_if.c - -$(tmpobj)/ipmidir.o: ipmidir.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmidir.c - -$(tmpobj)/imbapi.o: imbapi.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c imbapi.c - -$(tmpobj)/ipmimv.o: ipmimv.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmimv.c - -$(tmpobj)/ipmild.o: ipmild.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmild.c - -$(tmpobj)/ipmibmc.o: ipmibmc.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmibmc.c - -$(tmpobj)/ipmilipmi.o: ipmilipmi.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmilipmi.c - -$(tmpobj)/ipmilan.o: ipmilan.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmilan.c - -$(tmpobj)/ipmilanplus.o: ipmilanplus.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c ipmilanplus.c - -$(tmpobj)/md5.o: md5.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c md5.c - -$(tmpobj)/md2.o: md2.c - @$(CC) $(CFLAGS_SAMX) -o $@ -c md2.c - -#%.o: %.c -# $(CC) -c $(OS_CF) $(CFLAGS) $(AM_CPPFLAGS) -o $@ $< - -ievents_SOURCES = ievents.c - -idiscover_SOURCES = idiscover.c - -ipmi_port_SOURCES = ipmi_port.c - -# xmlconfig_SOURCES = xmlconfig.c $(CMDSRC) - -EXTRA_DIST = imb_api.h ipmicmd.h ipmidir.h ipmilan.h ipmilanplus.h AnsiTerm.h iekanalyzer.h ifirewall.h ifwum.h ihpm.h ipicmg.h ipmiutil.h md2.h oem_dell.h oem_fujitsu.h oem_intel.h oem_kontron.h oem_sun.h idcmi.h isensor.h - -all-am: Makefile $(DEV_LIB) $(bin_PROGRAMS) $(sbin_PROGRAMS) $(EXTRA_PROGRAMS) - -install-data-am: $(EXTRA_PROGRAMS) $(DEV_LIB) - @INS_LIB@ mkdir -p $(DESTDIR)$(extradir) - @INS_LIB@ mkdir -p $(DESTDIR)$(LIBDIR) - @INS_LIB@ mkdir -p $(DESTDIR)$(inc_dir) - @INS_LIB@ cp -f ipmi_sample.c $(DESTDIR)$(extradir) - @INS_LIB@ cp -f ipmi_sample_evt.c $(DESTDIR)$(extradir) - @INS_LIB@ cp -f ipmicmd.h $(DESTDIR)$(inc_dir) - @INS_LIB@ cp -f isensor.c ievents.c $(DESTDIR)$(extradir) - @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) - -clean-generic: - rm -f $(DEV_LIB) $(EXTRA_PROGRAMS) $(OLDPROGS) $(TESTPROGS) - if [ -d $(tmpobj) ]; then rm -rf $(tmpobj) ; fi - if [ -d $(tmpwin) ]; then rm -rf $(tmpwin) ; fi - rm -f *.log *.tmp debug*.list *.o *.pdb *.lo *.so *.la diff --git a/util/Makefile.in b/util/Makefile.in index a8eb9b9..466c530 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +15,12 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -48,9 +46,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) am_idiscover_OBJECTS = idiscover.$(OBJEXT) idiscover_OBJECTS = $(am_idiscover_OBJECTS) @@ -99,17 +96,19 @@ iseltime_SOURCES = iseltime.c iseltime_OBJECTS = iseltime.$(OBJEXT) iseltime_LDADD = $(LDADD) iseltime_DEPENDENCIES = $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(idiscover_SOURCES) $(ievents_SOURCES) $(ipmi_port_SOURCES) \ ipmi_sample.c ipmi_sample_evt.c $(ipmiutil_SOURCES) iseltime.c DIST_SOURCES = $(idiscover_SOURCES) $(ievents_SOURCES) \ @@ -119,8 +118,6 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -134,24 +131,22 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CROSS_CFLAGS = @CROSS_CFLAGS@ CROSS_LFLAGS = @CROSS_LFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ GPL_CFLAGS = @GPL_CFLAGS@ +GREP = @GREP@ IA64_CFLAGS = @IA64_CFLAGS@ INIT_DIR = @INIT_DIR@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -164,19 +159,28 @@ LANPLUS_CRYPTO = @LANPLUS_CRYPTO@ LANPLUS_LDADD = @LANPLUS_LDADD@ LANPLUS_LIB = @LANPLUS_LIB@ LANPLUS_SAM = @LANPLUS_SAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_SAMX = @LD_SAMX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSENSORS = @LIBSENSORS@ LIBTOOL = @LIBTOOL@ LIB_DIR = @LIB_DIR@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_CFLAGS = @OS_CFLAGS@ OS_DRIVERS = @OS_DRIVERS@ OS_LFLAGS = @OS_LFLAGS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -186,6 +190,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_DIR = @PKG_DIR@ RANLIB = @RANLIB@ +SAM2OBJ = @SAM2OBJ@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -194,16 +199,12 @@ STRIP = @STRIP@ SUBDIR_S = @SUBDIR_S@ SYSTEMD_DIR = @SYSTEMD_DIR@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -215,29 +216,42 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = $(datadir)/locale localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -localedir = $(datadir)/locale +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ INCLUDES = -I.. OS_CF = @OS_CFLAGS@ @CROSS_CFLAGS@ OS_LF = @OS_LFLAGS@ @CROSS_LFLAGS@ @@ -279,8 +293,9 @@ CMDMOD = ipmicmd.c mem_if.c ipmidir.c imbapi.c ipmimv.c ipmild.c \ ipmilanplus.c # CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@ # am: configure substitutions are not allowed in _SOURCES variables -LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o +LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@ OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c iekanalyzer.c +L2OBJ = @SAM2OBJ@ METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c $(OEMMOD) $(CMDMOD) LANPLUS_OBJ = $(shell ar t @LANPLUS_LIB@ 2>/dev/null) DEV_LIB = libipmiutil.a @@ -302,14 +317,14 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign util/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign util/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign util/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign util/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -327,62 +342,93 @@ $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ - else :; fi; \ - done + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ - rm -f "$(DESTDIR)$(sbindir)/$$f"; \ - done + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -442,22 +488,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subs.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -468,82 +514,85 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -552,7 +601,7 @@ check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -572,6 +621,7 @@ mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -585,7 +635,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -593,16 +643,36 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-binPROGRAMS install-sbinPROGRAMS +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -623,21 +693,24 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-sbinPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-sbinPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-sbinPROGRAMS install-strip \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-sbinPROGRAMS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am uninstall-sbinPROGRAMS + uninstall-sbinPROGRAMS # To build an imb api library (libimbapi.a): @@ -651,7 +724,7 @@ libimbapi.a: imbapi.c # Build a lib to support all of the IPMI drivers (libipmiutil.a) # If LANPLUS_SAM = yes, include LANPLUS_OBJ, else do not. # See configure --enable-liblanplus to change this -$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ +$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ mkdir -p $(tmpobj) if [ "x@LANPLUS_SAM@" = "xyes" ]; then \ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ @@ -666,7 +739,7 @@ $(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ $(RANLIB) $(DEV_LIB) ; \ fi -$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ +$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ mkdir -p $(tmpobj) if [ "x@LANPLUS_SAM@" = "xyes" ]; then \ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \ @@ -699,24 +772,26 @@ ialarms_enc: $(DEV_LIB) ialarms.c oem_intel.c $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) +isensor2.o: isensor.c + $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c + +ievents2.o: ievents.c + $(CC) $(CFLAGS_SAM) -DSENSORS_OK -o ievents2.o -c ievents.c + ifru_picmg2.o: ifru_picmg.c $(CC) $(CFLAGS_SAM) -o ifru_picmg2.o -c ifru_picmg.c # To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o # Note that this does not include oem_intel, etc. for OEM SEL decoding. -ipmi_sample2: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c ifru.c isel.c ifru_picmg2.o +ipmi_sample2: $(DEV_LIB) ipmi_sample.c ifru.c isel.c ifru_picmg2.o $(L2OBJ) $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -o ievents2.o -c ievents.c $(CC) $(CFLAGS_SAM) -o ifru2.o -c ifru.c $(CC) $(CFLAGS_SAM) -o isel2.o -c isel.c - $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o isensor2.o ievents2.o ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) + $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) -ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c isensor.c ievents.c +ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c $(L2OBJ) $(CC) $(CFLAGS_SAM) -o ipmi_sample_evt.o -c ipmi_sample_evt.c - $(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c - $(CC) $(CFLAGS_SAM) -DSENSORS_OK -o ievents2.o -c ievents.c - $(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o isensor2.o ievents2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM) + $(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o $(L2OBJ) $(DEV_LIB) $(LDFLAGS) $(LDSAM) ifruset: $(DEV_LIB) ifruset.c ifru_picmg2.o $(CC) $(CFLAGS_SAM) -c ifruset.c @@ -753,6 +828,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 @@ -761,6 +837,7 @@ clean-generic: if [ -d $(tmpobj) ]; then rm -rf $(tmpobj) ; fi if [ -d $(tmpwin) ]; then rm -rf $(tmpwin) ; fi rm -f *.log *.tmp debug*.list *.o *.pdb *.lo *.la *.so + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/util/ialarms.c b/util/ialarms.c index dbbdf0c..68f69b4 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.96"; static char * progname = "ialarms"; static char fdebug = 0; static char fbmctam = 0; @@ -434,7 +434,7 @@ main(int argc, char **argv) printf(" -o sets all Alarms off\n"); printf(" -w21b writes picmg LED 2 on(1) color=blue(b)\n"); printf(" -x show eXtra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } diff --git a/util/icmd.c b/util/icmd.c index 5911262..c12de8a 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.96"; static char * progname = "icmd"; static char fdebug = 0; static char fquiet = 0; @@ -175,7 +175,7 @@ main(int argc, char **argv) char *s1; istart = 1; - while ( (c = getopt( argc, argv,"djkm:qst:xN:P:R:U:EF:J:T:V:YZ:?")) != EOF ) + while ( (c = getopt( argc, argv,"djkm:qst:xp:N:P:R:U:EF:J:T:V:YZ:?")) != EOF ) switch(c) { case 'j': /* just pass the bytes to KCS */ fjustpass = 1; @@ -209,6 +209,7 @@ main(int argc, char **argv) case 'x': fdebug = 1; break; /* debug messages */ case 'V': /* priv level */ fprivset = 1; + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -230,7 +231,7 @@ main(int argc, char **argv) printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -q quiet mode, with minimal headers\n"); printf(" -s skips the GetDeviceID command\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); ret = ERR_USAGE; goto do_exit; } diff --git a/util/iconfig.c b/util/iconfig.c index 0bb54e9..6bdb104 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.96"; static char * progname = "iconfig"; static char fdebug = 0; static char fipmilan = 0; @@ -1765,7 +1765,7 @@ int SerialIsOptional(int bparam) int optvals[9] = { 5, 9, 10, 11, 12, 13, 14, 20, 21 }; int rv = 0; int i; - for (i = 0; i < sizeof(optvals); i++) { + for (i = 0; i < (sizeof(optvals) / sizeof(int)); i++) { if (optvals[i] == bparam) { rv = 1; break; } } return(rv); @@ -1898,7 +1898,7 @@ main(int argc, char **argv) printf(" -x show eXtra debug messages\n"); printf(" -p <psw> specify a user password to set\n"); printf(" -L 3 specify lan channel number 3\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } diff --git a/util/idcmi.c b/util/idcmi.c index 1e53ae8..9ab1c82 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.96"; extern char fdebug; /*from ipmicmd.c*/ static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; @@ -109,7 +109,7 @@ static int dcmi_usage(void) printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -s Get DCMI sensor info\n"); printf(" -x Display extra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); printf("where <function> is one of:\n"); printf(" info Get DCMI Capabilities, MC ID, asset tag (default)\n"); printf(" power [get] Get Power reading & limit\n"); @@ -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)"; @@ -747,7 +747,7 @@ main(int argc, char **argv) printf("%s ver %s\n", progname,progver); parse_lan_options('V',"4",0); /*default to admin priv*/ - while ( (c = getopt( argc, argv,"a:d:m:sT:V:J:EYF:P:N:R:U:Z:x?")) != EOF ) + while ( (c = getopt( argc, argv,"a:d:m:p:sT:V:J:EYF:P:N:R:U:Z:x?")) != EOF ) switch (c) { case 'a': set_asset = 1; asset_new = optarg; break; case 'd': set_mcid = 1; mcid_new = optarg; break; @@ -765,6 +765,7 @@ main(int argc, char **argv) break; case 's': do_sensors = 1; break; case 'x': fdebug = 1; break; /* debug messages */ + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ diff --git a/util/iekanalyzer.c b/util/iekanalyzer.c index ddeeba8..1f405cc 100644 --- a/util/iekanalyzer.c +++ b/util/iekanalyzer.c @@ -4086,7 +4086,7 @@ main(int argc, char **argv) printf("%s ver %s\n", progname,progver); - while ( (c = getopt( argc, argv,"m:T:V:J:EYF:P:N:R:U:Z:x?")) != EOF ) + while ( (c = getopt( argc, argv,"m:p:T:V:J:EYF:P:N:R:U:Z:x?")) != EOF ) switch (c) { case 'm': /* specific IPMB MC, 3-byte address, e.g. "409600" */ g_bus = htoi(&optarg[0]); /*bus/channel*/ diff --git a/util/ievents.c b/util/ievents.c index 72c0b24..f0034b2 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.96"; static char *progname = "ievents"; static char fsensdesc = 0; /* 1= get extended sensor descriptions*/ static char fcanonical = 0; /* 1= show canonical, delimited output*/ @@ -193,10 +193,10 @@ static const char *sensor_types[NSTYPES] = { /* 2Eh */ "ME" /* 0xDC == ME Node Manager */ }; -#define NFWERRS 15 +#define NFWERRS 14 static struct { /* See Table 36-3, type 0Fh, offset 00h */ int code; char *msg; - } fwerrs[NFWERRS] = { + } fwerrs[NFWERRS + 1] = { { 0x00, "Unspecified"}, { 0x01, "No system memory"}, { 0x02, "No usable memory"}, @@ -214,10 +214,10 @@ static struct { /* See Table 36-3, type 0Fh, offset 00h */ { 0x0E, "Reserved" } }; -#define NFWSTAT 27 +#define NFWSTAT 26 static struct { /* See Table 36-3, type 0Fh, offset 01h & 02h */ int code; char *msg; - } fwstat[NFWSTAT] = { + } fwstat[NFWSTAT + 1] = { { 0x00, "Unspecified"}, { 0x01, "Memory init"}, { 0x02, "Hard disk init"}, @@ -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..f9da95d 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.96"; static char fdebug = 0; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; diff --git a/util/ifirewall.h b/util/ifirewall.h index 14a04f4..3953b09 100644 --- a/util/ifirewall.h +++ b/util/ifirewall.h @@ -82,7 +82,7 @@ struct lun_netfn_support { }; struct lun_support { unsigned char support; - struct lun_netfn_support netfn[MAX_NETFN_PAIR]; + struct lun_netfn_support netfn[MAX_NETFN]; }; struct bmc_fn_support { struct lun_support lun[MAX_LUN]; diff --git a/util/ifru.c b/util/ifru.c index ba834e6..5b5192f 100755..100644 --- a/util/ifru.c +++ b/util/ifru.c @@ -116,7 +116,7 @@ extern int ipmi_kontronoem_main(void * intf, int argc, char ** argv); #endif static char *progname = "ifru"; -static char *progver = "2.93"; +static char *progver = "2.96"; static int vend_id = 0; static int prod_id = 0; static char fdebug = 0; @@ -1779,7 +1779,7 @@ int i_fru(int argc, char **argv) printf(" -s snum Sets the Product Serial Number\n"); printf(" -v pver Sets the Product Version Number\n"); printf(" -x Display extra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } diff --git a/util/ifruset.c b/util/ifruset.c index 3e0299a..472b71f 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.96"; static char fdebug = 0; static char fpicmg = 0; static char fonlybase = 0; @@ -1378,7 +1378,7 @@ main(int argc, char **argv) printf(" -i 00 Get/Set a specific FRU ID\n"); printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -x Display extra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } diff --git a/util/igetevent.c b/util/igetevent.c index 6e2fe27..96f5442 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.96"; static char fdebug = 0; static char fipmilan = 0; static char frunonce = 0; @@ -1047,7 +1047,7 @@ main(int argc, char **argv) fdout = stdout; msgout("%s ver %s\n", progname,progver); - while ( (c = getopt(argc,argv,"abce:lmn:or:st:uvT:V:J:YEF:P:N:R:U:Z:x?")) != EOF ) + while ( (c = getopt(argc,argv,"abce:lmn:op:r:st:uvT:V:J:YEF:P:N:R:U:Z:x?")) != EOF ) switch(c) { case 'a': fAsync = 1; /* imb async message method */ /* chenge the output log filename */ @@ -1086,6 +1086,7 @@ main(int argc, char **argv) case 'u': futc = 1; break; case 'x': fdebug = 1; break; /* debug messages */ case 'v': fdebug = 3; break; /* verbose debug with lan */ + case 'p': case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -1112,7 +1113,7 @@ main(int argc, char **argv) printf(" -t N set timeout to N seconds\n"); printf(" -u use raw UTC time\n"); printf(" -x show eXtra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); ret = ERR_USAGE; goto do_exit; } diff --git a/util/ihealth.c b/util/ihealth.c index 6f6f0e1..5167950 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.96"; static char fdebug = 0; static char fipmilan = 0; static char fcanonical = 0; @@ -723,10 +723,13 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec) case 1576: prodstr = "(X9DRi)"; break; case 1585: prodstr = "(X9SCA)"; break; case 1603: prodstr = "(X9SPU)"; break; /*0x0643*/ + case 1636: prodstr = "(X9DRH)"; break; /*0x0664*/ 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 +740,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 +782,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; @@ -894,7 +906,7 @@ main(int argc, char **argv) printf(" -o set Operating System to this string\n"); printf(" -p1 set restore policy: 0=off, 1=last, 2=on\n"); printf(" -s get the IPMI Session info also\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto health_end; } diff --git a/util/ilan.c b/util/ilan.c index a1ed76a..2458fbb 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.96"; 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; @@ -361,6 +362,8 @@ static uchar osmyip[4] = {0,0,0,0}; static uchar bmcmyip[4] = {0,0,0,0}; static uchar bmcdestip[4] = {0,0,0,0}; static uchar bmcdestmac[6]= {0xff,0,0,0,0,0}; +static uchar bmcgwyip[4] = {0,0,0,0}; +static uchar bmcgwymac[6]= {0xff,0,0,0,0,0}; static uchar bmcmymac[6] = {0xff,0,0,0,0,0}; static uchar rgmymac[6] = {0xff,0,0,0,0,0}; static uchar osmymac[6] = {0xff,0,0,0,0,0}; @@ -368,6 +371,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 +780,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 +792,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 +894,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 +3672,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 +3681,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 +3792,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,7 +3925,8 @@ 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"); - print_lan_opt_usage(); + printf(" -O Force LAN security: no null user, cipher 0 off\n"); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } /*end switch*/ @@ -4096,6 +4103,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 */ @@ -4486,6 +4494,10 @@ main(int argc, char **argv) // if (pc[0] >= 30) memcpy(bparm7,pc,3); } else if (ival == 17) { /* num dest */ ndest = pc[0]; /* save the number of destinations */ + } else if (ival == 12) { /* gateway addr */ + if (IpIsValid(pc)) memcpy(bmcgwyip,pc,4); + } else if (ival == 13) { /* gateway mac */ + if (MacIsValid(pc)) memcpy(bmcgwymac,pc,MAC_LEN); } else if (ival == 19) { /* dest addr */ if (IpIsValid(&pc[3])) memcpy(bmcdestip,&pc[3],4); if (MacIsValid(&pc[7])) memcpy(bmcdestmac,&pc[7],MAC_LEN); @@ -4541,8 +4553,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 +4566,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 +4788,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; } @@ -4948,8 +4970,12 @@ main(int argc, char **argv) rggwyip[0], rggwyip[1], rggwyip[2], rggwyip[3], rggwymac[0], rggwymac[1], rggwymac[2], rggwymac[3], rggwymac[4], rggwymac[5]); - if (!SubnetIsSame(rgmyip,rggwyip,rgsubnet)) - printf("WARNING: IP Address and Gateway are not on the same subnet.\n"); + if (!SubnetIsSame(rgmyip,rggwyip,rgsubnet)) { + printf("WARNING: IP Address and Gateway are not on the same subnet," + " setting Gateway to previous value\n"); + memcpy(rggwyip,bmcgwyip,4); + memcpy(rggwymac,bmcgwymac,6); + } /* Set the Default Gateway IP & MAC */ memcpy(&LanRecord,rggwyip,4); @@ -4961,13 +4987,14 @@ main(int argc, char **argv) printf(" Warning: Gateway MAC address was not resolved! " "Check %s interface, use -i ethN, or use -H gwymac.\n", ifname); + memcpy(&LanRecord,bmcgwymac,6); } else { memcpy(&LanRecord,rggwymac,6); + } ret = SetLanEntry(13, &LanRecord, 6); printf("SetLanEntry(13), ret = %d\n",ret); if (ret != 0) { nerrs++; lasterr = ret; } else ngood++; - } } if (IpIsValid(rggwy2ip)) { if (!MacIsValid(rggwy2mac)) /* if gwy2 MAC not set by user */ @@ -4985,6 +5012,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..634fb16 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.96"; static char fdebug = 0; static char fset_mc = 0; static uint8_t g_bus = PUBLIC_BUS; diff --git a/util/ipmi_sample.c b/util/ipmi_sample.c index ddda7f3..faa0d51 100644 --- a/util/ipmi_sample.c +++ b/util/ipmi_sample.c @@ -115,7 +115,7 @@ main(int argc, char **argv) printf("%s ver %s\n", progname,progver); - while ((c = getopt( argc, argv,"i:l:m:f:s:t:xEF:N:P:R:T:U:V:YZ:?")) != EOF ) + while ((c = getopt( argc, argv,"i:l:m:p:f:s:t:xEF:N:P:R:T:U:V:YZ:?")) != EOF ) switch(c) { case 'm': /* specific IPMB MC, 3-byte address, e.g. "409600" */ g_bus = htoi(&optarg[0]); /*bus/channel*/ @@ -136,6 +136,7 @@ main(int argc, char **argv) case 's': sdrfile = optarg; break; case 't': mytag = optarg; break; /* specific sensor tag */ case 'x': fdebug = 1; break; /* debug messages */ + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -158,7 +159,7 @@ main(int argc, char **argv) printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -s File loads SDRs from File\n"); printf(" -t tag search for 'tag' in SDRs\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); exit(1); } /* Rather than parse_lan_options above, the set_lan_options function diff --git a/util/ipmi_sample_evt.c b/util/ipmi_sample_evt.c index b51ba24..f0f8e97 100644 --- a/util/ipmi_sample_evt.c +++ b/util/ipmi_sample_evt.c @@ -321,14 +321,14 @@ 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; fdout = stderr; printf("%s ver %s\n", progname,progver); - while ( (c = getopt( argc, argv,"m:s:t:xEF:N:P:R:T:U:V:YZ:?")) != EOF ) + while ( (c = getopt( argc, argv,"m:p:s:t:xEF:N:P:R:T:U:V:YZ:?")) != EOF ) switch(c) { case 'm': /* specific IPMB MC, 3-byte address, e.g. "409600" */ g_bus = htoi(&optarg[0]); /*bus/channel*/ @@ -346,6 +346,7 @@ main(int argc, char **argv) case 's': sdrfile = optarg; break; case 't': mytag = optarg; break; /* specific sensor tag */ case 'x': fdebug = 1; break; /* debug messages */ + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -364,7 +365,7 @@ main(int argc, char **argv) printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n"); printf(" -s File loads SDRs from File\n"); printf(" -t tag search for 'tag' in SDRs\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); exit(1); } /* Rather than parse_lan_options above, the set_lan_options function @@ -411,12 +412,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 +435,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..858d062 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, RMCP_PRI_RMCP_PORT }; +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.port,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 */ @@ -1124,9 +1125,15 @@ int ipmi_sendrecv(struct ipmi_rq * req, uchar *rsp, int *rsp_len) rlen = IPMI_RSPBUF_SIZE; *rsp_len = 0; - rv = ipmi_cmdraw_mc(req->msg.cmd, req->msg.netfn, - req->msg.data, (uchar)req->msg.data_len, - rsp, &rlen, &ccode, fdebug); + if ((fDriverTyp != DRV_MV) && (mc->adrtype == ADDR_IPMB) && !fipmi_lan) { + rv = ipmi_cmd_ipmb( req->msg.cmd, req->msg.netfn, mc->sa,mc->bus, + req->msg.lun, req->msg.data, (uchar)req->msg.data_len, + rsp, &rlen, &ccode, fdebug); + } else { /* use ADDR_SMI */ + rv = ipmi_cmdraw(req->msg.cmd, req->msg.netfn, mc->sa,mc->bus, + req->msg.lun, req->msg.data, (uchar)req->msg.data_len, + rsp, &rlen, &ccode, fdebug); + } if (rv == 0 && ccode != 0) rv = ccode; if (rv == 0) { /*success*/ *rsp_len = rlen; @@ -1283,14 +1290,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 +1305,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); @@ -1321,64 +1339,70 @@ void parse_lan_options(int c, char *popt, char fdebugcmd) return; #else int i; - size_t len; static int fset_dtype = 0; uchar sa; + char *p = NULL; switch(c) { + case 'p': + i = atoi(popt); + if (i > 0) lanp.port = i; + else printf("-p port %d < 0, defaults to %d\n", + i,RMCP_PRI_RMCP_PORT); + break; case 'F': /* force driver type */ i = set_driver_type(popt); if (i == 0) fset_dtype = 1; 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 */ @@ -1393,11 +1417,13 @@ void parse_lan_options(int c, char *popt, char fdebugcmd) #endif } /*end parse_lan_options*/ -void print_lan_opt_usage(void) +void print_lan_opt_usage(int opt) { #if defined(EFI) | defined(DOS) return; #else + if (opt == 1) /*port ok*/ + printf(" -p port UDP Port of target system\n"); printf(" -N node Nodename or IP address of target system\n"); printf(" -U user Username for remote node\n"); printf(" -P/-R pswd Remote Password\n"); diff --git a/util/ipmicmd.h b/util/ipmicmd.h index b65e949..a4c911b 100644 --- a/util/ipmicmd.h +++ b/util/ipmicmd.h @@ -335,13 +335,25 @@ 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*/ + int port; +} 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. */ struct ipmi_rq { struct { - uchar netfn:6; - uchar lun:2; + uchar netfn:6; + uchar lun:2; uchar cmd; uchar target_cmd; ushort data_len; @@ -410,17 +422,18 @@ int ipmi_close(void); /*ditto*/ * parse_lan_options * Parse the IPMI LAN options from the command-line getopt. * int c (input): command-line option from getopt, one of: + case 'p': UDP port case 'F': force driver type - case 'T': auth type - case 'V': priv level - case 'J': cipher suite - case 'N': nodename + case 'T': auth type + case 'V': priv level + case 'J': cipher suite + case 'N': nodename case 'U': username case 'R': remote password - case 'P': remote password - case 'E': get password from IPMI_PASSWORD environment var - case 'Y': prompt for remote password - case 'Z': set local MC address + case 'P': remote password + case 'E': get password from IPMI_PASSWORD environment var + case 'Y': prompt for remote password + case 'Z': set local MC address * char *optarg (input): command-line argument from getopt * char fdebug (input): show debug messages if =1, default=0 */ @@ -456,7 +469,7 @@ int set_lan_options(char *node, char *user, char *pswd, int auth, int priv, int cipher, void *addr, int addr_len); int get_lan_options(char *node, char *user, char *pswd, int *auth, int *priv, int *cipher, void *addr, int *addr_len); -void print_lan_opt_usage(void); +void print_lan_opt_usage(int opt); int ipmi_getdeviceid(uchar *presp, int sresp, char fdebugcmd); /* int ipmi_open(void); * embedded in ipmi_cmd() */ int ipmi_getpicmg(uchar *presp, int sresp, char fdebug); diff --git a/util/ipmilan.c b/util/ipmilan.c index 64b6425..814092e 100644 --- a/util/ipmilan.c +++ b/util/ipmilan.c @@ -215,14 +215,14 @@ extern char * get_iana_str(int mfg); /*subs.c*/ #define dbg_dump dump_buf 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 gshutdown; /* from ipmicmd.c, usu =0 */ 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, @@ -236,7 +236,7 @@ static int vend_id = 0; static int prod_id = 0; #if defined(DOS) || defined(EFI) -int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) +int ipmi_open_lan(char *node, char *user, int port, char *pswd, int fdebugcmd) { printf("IPMI LAN is not supported under DOS.\n"); return(-1); @@ -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*/ @@ -519,9 +520,9 @@ void close_sockfd(SockType sfd) pconn->sockfd = 0; /*set global to zero */ } -int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, +int open_sockfd(char *node, int port, SockType *sfd, SOCKADDR_T *daddr, int *daddr_len, int foutput); -int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, +int open_sockfd(char *node, int port, SockType *sfd, SOCKADDR_T *daddr, int *daddr_len, int foutput) { int rv = 0; @@ -559,7 +560,7 @@ int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, #ifdef HAVE_IPV6 memset(&_srcaddr, 0, sizeof(_srcaddr)); memset(daddr, 0, sizeof(_destaddr)); - sprintf(service, "%d", RMCP_PRI_RMCP_PORT); + sprintf(service, "%d", port); /* Obtain address(es) matching host/port */ memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ @@ -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", @@ -622,7 +623,7 @@ int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, memset(daddr, 0, sizeof(SOCKADDR_T)); daddr->sin_family = AF_INET; - daddr->sin_port = htons(RMCP_PRI_RMCP_PORT); /*0x26f = 623.*/ + daddr->sin_port = htons(port); /*RMCP_PRI_RMCP_PORT 0x26f = 623.*/ if (StrIsIp(node)) { /* the node string is an IP address */ uchar in_ip[4]; atoip(in_ip,node); @@ -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*/ @@ -1644,7 +1645,7 @@ int ping_bmc(char *node, int fdebugcmd) SockType sfd; int rv; - rv = open_sockfd(node,&sfd, &toaddr, &toaddr_len, fdebugcmd); + rv = open_sockfd(node, RMCP_PRI_RMCP_PORT, &sfd, &toaddr, &toaddr_len, fdebugcmd); if (rv != 0) return(rv); rv = rmcp_ping(sfd, (struct sockaddr *)&toaddr,toaddr_len, fdebugcmd); @@ -1675,7 +1676,7 @@ static int get_rand(void *data, int len) /* * ipmi_open_lan */ -int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) +int ipmi_open_lan(char *node, int port, char *user, char *pswd, int fdebugcmd) { char *username; uchar priv_level; @@ -1696,21 +1697,21 @@ int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) goto EXIT; } else { - if ((gshutdown==0) || fdebugcmd) + if (fdebugcmd) fprintf(fpdbg,"Opening lan connection to node %s ...\n",node); /* save nodename for sig_abort later */ if (strlen(node) > SZGNODE) { strncpy(nodename, node, SZGNODE); nodename[SZGNODE] = 0; } else strcpy(nodename, node); - - rv = open_sockfd(node, &(pconn->sockfd), &_destaddr, &_destaddr_len, 1); + rv = open_sockfd(node, port, &(pconn->sockfd), &_destaddr, &_destaddr_len, 1); if (fdebugcmd) printf("open_sockfd returned %d, fd=%d\n", rv, pconn->sockfd); if (rv != 0) goto EXIT; #ifdef HAVE_IPV6 strcpy(gnodename,nodename); - fprintf(fpdbg,"Connecting to node %s\n",gnodename); + if (fdebugcmd) + fprintf(fpdbg,"Connecting to node %s\n",gnodename); #else #ifdef WIN32 /* check for ws2_32.lib(getnameinfo) resolution */ @@ -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.port, 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/ipmilan.h b/util/ipmilan.h index 9e92e55..9a47efe 100644 --- a/util/ipmilan.h +++ b/util/ipmilan.h @@ -65,7 +65,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* see ipmicmd.h for LAN_ERR definitions */ -int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd); +int ipmi_open_lan(char *node, int port, char *user, char *pswd, int fdebugcmd); int ipmi_close_lan(char *node); int ipmi_flush_lan(char *node); int ipmi_cmd_lan(char *node, ushort cmd, uchar *pdata, int sdata, 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..05c13db 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.96"; // static char fdebug = 0; /*int ipmiutil(int argc, char **argv); */ @@ -110,7 +110,7 @@ static void show_usage() for (i=0; i<NSUBCMDS; i++) printf("\t%s\t%s\n",subcmds[i].tag,subcmds[i].desc); printf(" common IPMI LAN options:\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); printf("%s", helpmsg); } diff --git a/util/ipmiutil.mak b/util/ipmiutil.mak index 83a23c1..40daaf8 100644 --- a/util/ipmiutil.mak +++ b/util/ipmiutil.mak @@ -1,4 +1,4 @@ -# This makefile will build the ipmiutil util directory
+# This makefile will build the ipmiutil util directory (x32)
#
# First download getopt.c getopt.h
# Then download and build openssl for Windows
@@ -119,12 +119,14 @@ clean: $(RM) $(TARG_EXE) 2>NUL
$(RM) *.exe 2>NUL
-$(RM) $(TMP_D)\*.obj 2>NUL
+ -$(RM) *.manifest 2>NUL
distclean:
$(RM) *.obj 2>NUL
$(RM) $(TARG_EXE) 2>NUL
$(RM) *.exe 2>NUL
-$(RM) $(TMP_D)\*.* 2>NUL
+ -$(RM) *.manifest 2>NUL
rmdir $(TMP_D) 2>NUL
$(RM) *.rc 2>NUL
$(RM) *.bin 2>NUL
@@ -386,6 +388,8 @@ $(TMP_D)\iwdt.obj: iwdt.c $(E_EXE): $(E_OBJ)
$(LINK) $(LFLAGS) /OUT:$(E_EXE) $(E_OBJ) $(LF_LANPLUS) $(LIBS_PEF) $(LIBS_EX)
+
+# mt.exe -manifest $(E_EXE).manifest -outputresource:$(E_EXE);1
ipmi_sample.obj: ipmi_sample.c
$(CC) /c $(CFLAGS_SAM) ipmi_sample.c
@@ -400,8 +404,7 @@ $(SAMP_DLL): $(CMD_OBJ) mem_if.obj $(LINK) /DLL $(LFLAGS) /OUT:$(SAMP_DLL) /def:ipmiutillib.def $(CMD_OBJ) mem_if.obj $(LIBS_PEF) $(LIBS_EX)
del ipmilanplus.obj
-ipmi_sample.exe: $(SAMP_LIB) ipmi_sample.c
- $(CC) /c $(CFLAGS_SAM) ipmi_sample.c
+ipmi_sample.exe: $(SAMP_LIB) ipmi_sample.obj
$(LINK) $(LFLAGS) /OUT:ipmi_sample.exe ipmi_sample.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
ipmi_sample2.exe: $(SAMP_LIB) ipmi_sample.c isensor.c ievents.c
diff --git a/util/ipmiutil.mak.orig b/util/ipmiutil.mak.orig new file mode 100644 index 0000000..f98cd66 --- /dev/null +++ b/util/ipmiutil.mak.orig @@ -0,0 +1,423 @@ +# This makefile will build the ipmiutil util directory
+#
+# First download getopt.c getopt.h
+# Then download and build openssl for Windows
+#
+LIBC_RT=libcmt.lib /NODEFAULTLIB:"msvcirt.lib"
+# LIBC_RT=msvcrt.lib /NODEFAULTLIB:"msvcirt.lib"
+
+MARCH=X64
+#MARCH=IX86
+# The ipmiutil directory
+SRC_D=.
+LIB_D=..\lib
+L2_D=$(LIB_D)\lanplus
+L3_D=$(LIB_D)\lanplus\inc
+INSTALLTOP=install
+TMP_D=tmp
+INC=/I$(SRC_D) /I$(L2_D) /I$(L3_D)
+CMD_OBJ = getopt.obj ipmicmd.obj imbapi.obj md5.obj md2.obj \
+ ipmilan.obj ipmims.obj subs.obj
+CMD_OBJ = $(CMD_OBJ) ipmilanplus.obj
+# To remove lanplus support use the empty LANPLUS variables
+# L2_OBJ=
+# LF_LANPLUS=
+# CF_LANPLUS=
+L2_OBJ = $(L2_D)\helper.obj $(L2_D)\ipmi_strings.obj $(L2_D)\lanplus.obj \
+ $(L2_D)\lanplus_crypt_impl.obj $(L2_D)\lanplus_dump.obj \
+ $(L2_D)\lanplus_strings.obj $(L2_D)\lanplus_crypt.obj
+LF_LANPLUS=/LIBPATH:$(LIB_D) $(L2_OBJ) ssleay32.lib libeay32.lib
+CF_LANPLUS=/D HAVE_LANPLUS
+
+# Set your compiler options
+# To remove any GPL dependencies, use the CF_EX line with NON_GPL
+# CFLAGS_O=/W3 /O2 /Zi /MD /GF /Gy /nologo
+# CFLAGS_O=/W3 /O2 /Zi /MD /nologo
+# CFLAGS_O=/W3 /O2 /Zi /MT /nologo
+CFLAGS_O=/W3 /O2 /Zi /MT /nologo
+CF_EX=/DWIN32 $(CF_LANPLUS) $(INC) /D_CONSOLE /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DHAVE_STRING_H
+CF_SAM=/DWIN32 $(INC) /D_CONSOLE /D_CRT_SECURE_NO_DEPRECATE /DHAVE_STRING_H
+CFLAGS=$(CFLAGS_O) $(CF_EX) /DSKIP_MD2
+CFLAGS_M=$(CFLAGS_O) $(CF_EX) /DSKIP_MD2 /DMETACOMMAND
+CFLAGS_SAM=$(CFLAGS_O) $(CF_SAM)
+LFLAGS=/nologo /subsystem:console /machine:$(MARCH) /opt:ref
+#LFLAGS=/nologo /subsystem:console /machine:IX86 /opt:ref
+#LFLAGS=/nologo /subsystem:console /machine:IX86 /opt:ref /debug
+# LFLAGS_D=/nologo /subsystem:console /machine:I386 /opt:ref /dll
+
+# CFLAGS_W=/O2 /D_CONSOLE /D_MBCS /EHsc /ML /W3 /Zi /TP
+CFLAGS_W=/TP /EHsc $(CFLAGS)
+LFLAGS_W=/nologo /subsystem:console /machine:$(MARCH) /opt:ref
+LIBS_W=comsuppw.lib wbemuuid.lib
+# gdi32.lib comdlg32.lib shell32.lib uuid.lib
+
+CC=cl
+LINK=link
+MKDIR=-mkdir
+MKLIB=lib
+RM=del
+CP=copy
+
+LIBS_EX = advapi32.lib kernel32.lib wsock32.lib $(LIBS_W) $(LIBC_RT)
+LIBS_PEF = /LIBPATH:$(LIB_D) iphlpapi.lib
+# LIBS_EX+=wsock32.lib user32.lib gdi32.lib
+
+HEADER=ipmicmd.h imb_api.h ipmilan.h ipmidir.h ipmi_ioctls.h ipmilanplus.h \
+ ipmiutil.h
+
+SHOWSEL = showsel
+TARG_EXE=ievents.exe $(SHOWSEL)msg.dll ipmi_sample.exe ipmi_sample_evt.exe $(SAMP_DLL)
+# alarms.exe ihealth.exe $(SHOWSEL).exe $(SHOWSEL)msg.dll \
+# ireset.exe ifru.exe ilan.exe iserial.exe wdt.exe \
+# getevent.exe sensor.exe icmd.exe isolconsole.exe idiscover.exe \
+# ievents.exe
+SAMP_LIB = ipmiutil.lib
+SAMP_DLL = ipmiutillib.dll
+
+E_EXE=ipmiutil.exe
+E_OBJ=$(TMP_D)\ipmiutil.obj \
+ $(TMP_D)\ialarms.obj $(TMP_D)\ihealth.obj $(TMP_D)\iwdt.obj \
+ $(TMP_D)\ireset.obj $(TMP_D)\ifru.obj $(TMP_D)\ilan.obj \
+ $(TMP_D)\iserial.obj $(TMP_D)\icmd.obj $(TMP_D)\isol.obj \
+ $(TMP_D)\isolwin.obj $(TMP_D)\AnsiTerm.obj $(TMP_D)\idiscover.obj \
+ $(TMP_D)\iconfig.obj $(TMP_D)\igetevent.obj $(TMP_D)\isensor.obj \
+ $(TMP_D)\isel.obj $(TMP_D)\ievents.obj \
+ $(TMP_D)\ipicmg.obj $(TMP_D)\ifirewall.obj \
+ $(TMP_D)\iekanalyzer.obj $(TMP_D)\ifru_picmg.obj \
+ $(TMP_D)\oem_kontron.obj $(TMP_D)\ihpm.obj $(TMP_D)\ifwum.obj \
+ $(TMP_D)\oem_fujitsu.obj $(TMP_D)\oem_intel.obj \
+ $(TMP_D)\oem_sun.obj $(TMP_D)\oem_dell.obj $(TMP_D)\oem_hp.obj \
+ $(TMP_D)\oem_supermicro.obj $(TMP_D)\itsol.obj $(TMP_D)\idcmi.obj \
+ $(TMP_D)\oem_quanta.obj $(TMP_D)\oem_newisys.obj $(CMD_OBJ) mem_if.obj
+
+###################################################################
+all: banner $(TMP_D) exe
+
+banner:
+ @echo Building ipmiutil
+
+$(TMP_D):
+ $(MKDIR) $(TMP_D)
+ @echo created $(TMP_D)
+
+lib: $(L2_OBJ)
+ cd $(LIB_D)
+ nmake /nologo -f ipmilib.mak
+ cd ../util
+
+exe: $(E_EXE) $(TARG_EXE)
+
+install:
+ $(MKDIR) $(INSTALLTOP)
+ $(MKDIR) $(INSTALLTOP)\bin
+ $(CP) $(E_EXE) $(INSTALLTOP)\bin
+ xcopy $(TARG_EXE) $(INSTALLTOP)\bin
+ xcopy *.dll $(INSTALLTOP)\bin
+
+clean:
+ $(RM) *.obj 2>NUL
+ $(RM) $(TARG_EXE) 2>NUL
+ $(RM) *.exe 2>NUL
+ $(RM) $(TMP_D)\*.obj 2>NUL
+
+distclean:
+ $(RM) *.obj 2>NUL
+ $(RM) $(TARG_EXE) 2>NUL
+ $(RM) *.exe 2>NUL
+ $(RM) $(TMP_D)\*.* 2>NUL
+ rmdir $(TMP_D) 2>NUL
+ $(RM) *.rc 2>NUL
+ $(RM) *.bin 2>NUL
+ $(RM) *.RES 2>NUL
+ $(RM) getopt.* 2>NUL
+
+getopt.obj: getopt.c
+ $(CC) /c $(CFLAGS) getopt.c
+
+imbapi.obj: imbapi.c
+ $(CC) /c $(CFLAGS_M) imbapi.c
+
+ipmicmd.obj: ipmicmd.c
+ $(CC) /c $(CFLAGS) ipmicmd.c
+
+ipmilan.obj: ipmilan.c
+ $(CC) /c $(CFLAGS) ipmilan.c
+
+ipmilanplus.obj: ipmilanplus.c
+ $(CC) /c $(CFLAGS_M) ipmilanplus.c
+
+md5.obj: md5.c
+ $(CC) /c $(CFLAGS) md5.c
+
+md2.obj: md2.c
+ $(CC) /c $(CFLAGS) md2.c
+
+ievents.obj: ievents.c
+ $(CC) /c $(CFLAGS) ievents.c
+
+ialarms.obj: ialarms.c
+ $(CC) /c $(CFLAGS) ialarms.c
+
+ihealth.obj: ihealth.c
+ $(CC) /c $(CFLAGS) ihealth.c
+
+igetevent.obj: igetevent.c
+ $(CC) /c $(CFLAGS) igetevent.c
+
+mem_if.obj: mem_if.c
+ $(CC) /c $(CFLAGS_W) mem_if.c
+
+ipmims.obj: ipmims.cpp
+ $(CC) /c $(CFLAGS_W) ipmims.cpp
+
+isel.obj: isel.c
+ $(CC) /c $(CFLAGS) isel.c
+
+ireset.obj: ireset.c
+ $(CC) /c $(CFLAGS) ireset.c
+
+ireset.exe: ireset.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:ireset.exe ireset.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+ifru.obj: ifru.c
+ $(CC) /c $(CFLAGS) ifru.c
+
+ifru.exe: ifru.obj mem_if.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:ifru.exe ifru.obj mem_if.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+ilan.obj: ilan.c
+ $(CC) /c $(CFLAGS) ilan.c
+
+ilan.exe: ilan.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:ilan.exe ilan.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_PEF) $(LIBS_EX)
+
+iserial.obj: iserial.c
+ $(CC) /c $(CFLAGS) iserial.c
+
+iserial.exe: iserial.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:iserial.exe iserial.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+isensor.obj: isensor.c
+ $(CC) /c $(CFLAGS) isensor.c
+
+isensor.exe: isensor.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:isensor.exe isensor.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+iwdt.obj: iwdt.c
+ $(CC) /c $(CFLAGS) iwdt.c
+
+iwdt.exe: iwdt.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:iwdt.exe iwdt.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+isol.obj: isol.c
+ $(CC) /c $(CFLAGS) isol.c
+
+isolwin.obj: isolwin.c
+ $(CC) /c $(CFLAGS) isolwin.c
+
+isol.exe: isol.obj isolwin.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:isol.exe isol.obj isolwin.obj \
+ $(CMD_OBJ) $(LF_LANPLUS) $(LIBS_EX)
+
+icmd.obj: icmd.c
+ $(CC) /c $(CFLAGS) icmd.c
+
+icmd.exe: icmd.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:icmd.exe icmd.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+idiscover.obj: idiscover.c
+ $(CC) /c $(CFLAGS) idiscover.c
+
+idiscover.exe: idiscover.obj getopt.obj
+ $(LINK) $(LFLAGS) /OUT:idiscover.exe idiscover.obj getopt.obj \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+ialarms.exe: ialarms.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:ialarms.exe ialarms.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+ihealth.exe: ihealth.obj mem_if.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:ihealth.exe ihealth.obj mem_if.obj $(CMD_OBJ) \
+ $(LF_LANPLUS) $(LIBS_EX)
+
+igetevent.exe: igetevent.obj ievents.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:igetevent.exe igetevent.obj ievents.obj \
+ $(CMD_OBJ) $(LF_LANPLUS) $(LIBS_EX)
+
+isel.exe: isel.obj ievents.obj $(CMD_OBJ)
+ $(LINK) $(LFLAGS) /OUT:isel.exe isel.obj ievents.obj \
+ $(CMD_OBJ) $(LF_LANPLUS) $(LIBS_EX)
+
+$(SHOWSEL).mc:
+ $(CP) ..\scripts\$(SHOWSEL).mc .
+
+$(SHOWSEL)msg.dll: $(SHOWSEL).mc
+ mc -U $(SHOWSEL).mc
+ rc -r $(SHOWSEL).rc
+ $(LINK) /machine:$(MARCH) -dll -noentry -out:$(SHOWSEL)msg.dll $(SHOWSEL).res
+
+mem_if.exe: $(TMP_D)\mem_if.obj
+ $(LINK) $(LFLAGS_W) /OUT:mem_if.exe $(TMP_D)\mem_if.obj $(LIBS_EX)
+
+$(TMP_D)\mem_if.obj: mem_if.c
+ $(CC) /c $(CFLAGS_W) /DCOMP_BIN /Fo$(TMP_D)\mem_if.obj mem_if.c
+
+ievents.exe: ievents.c
+ $(CC) /c $(CFLAGS) /DALONE ievents.c
+ $(LINK) $(LFLAGS) /OUT:ievents.exe ievents.obj $(LIBS_EX)
+ $(RM) ievents.obj
+
+ipmims.exe: ipmims.cpp
+ $(CC) /c $(CFLAGS_W) /DALONE /DTEST_BIN ipmims.cpp
+ $(LINK) $(LFLAGS_W) /OUT:ipmims.exe ipmims.obj $(LIBS_EX)
+ $(RM) ipmims.obj
+
+$(TMP_D)\ievents.obj: ievents.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ievents.obj ievents.c
+
+$(TMP_D)\ipmiutil.obj: ipmiutil.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ipmiutil.obj ipmiutil.c
+
+$(TMP_D)\ialarms.obj: ialarms.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ialarms.obj ialarms.c
+
+$(TMP_D)\ihealth.obj: ihealth.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ihealth.obj ihealth.c
+
+$(TMP_D)\iconfig.obj: iconfig.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\iconfig.obj iconfig.c
+
+$(TMP_D)\ipicmg.obj: ipicmg.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ipicmg.obj ipicmg.c
+
+$(TMP_D)\ifirewall.obj: ifirewall.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ifirewall.obj ifirewall.c
+
+$(TMP_D)\ifwum.obj: ifwum.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ifwum.obj ifwum.c
+
+$(TMP_D)\ihpm.obj: ihpm.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ihpm.obj ihpm.c
+
+$(TMP_D)\idcmi.obj: idcmi.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\idcmi.obj idcmi.c
+
+$(TMP_D)\oem_fujitsu.obj: oem_fujitsu.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_fujitsu.obj oem_fujitsu.c
+
+$(TMP_D)\oem_kontron.obj: oem_kontron.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_kontron.obj oem_kontron.c
+
+$(TMP_D)\oem_intel.obj: oem_intel.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_intel.obj oem_intel.c
+
+$(TMP_D)\oem_sun.obj: oem_sun.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_sun.obj oem_sun.c
+
+$(TMP_D)\oem_dell.obj: oem_dell.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_dell.obj oem_dell.c
+
+$(TMP_D)\oem_hp.obj: oem_hp.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_hp.obj oem_hp.c
+
+$(TMP_D)\oem_supermicro.obj: oem_supermicro.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_supermicro.obj oem_supermicro.c
+
+$(TMP_D)\oem_quanta.obj: oem_quanta.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_quanta.obj oem_quanta.c
+
+$(TMP_D)\oem_newisys.obj: oem_newisys.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_newisys.obj oem_newisys.c
+
+$(TMP_D)\iekanalyzer.obj: iekanalyzer.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\iekanalyzer.obj iekanalyzer.c
+
+$(TMP_D)\ifru_picmg.obj: ifru_picmg.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ifru_picmg.obj ifru_picmg.c
+
+$(TMP_D)\ifru.obj: ifru.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ifru.obj ifru.c
+
+$(TMP_D)\ireset.obj: ireset.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ireset.obj ireset.c
+
+$(TMP_D)\ilan.obj: ilan.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\ilan.obj ilan.c
+
+$(TMP_D)\iserial.obj: iserial.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\iserial.obj iserial.c
+
+$(TMP_D)\isensor.obj: isensor.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\isensor.obj isensor.c
+
+$(TMP_D)\icmd.obj: icmd.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\icmd.obj icmd.c
+
+$(TMP_D)\igetevent.obj: igetevent.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\igetevent.obj igetevent.c
+
+$(TMP_D)\isel.obj: isel.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\isel.obj isel.c
+
+$(TMP_D)\isol.obj: isol.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\isol.obj isol.c
+
+$(TMP_D)\isolwin.obj: isolwin.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\isolwin.obj isolwin.c
+
+$(TMP_D)\itsol.obj: itsol.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\itsol.obj itsol.c
+
+$(TMP_D)\AnsiTerm.obj: AnsiTerm.cpp
+ $(CC) /c $(CFLAGS_W) /Fo$(TMP_D)\AnsiTerm.obj AnsiTerm.cpp
+
+$(TMP_D)\idiscover.obj: idiscover.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\idiscover.obj idiscover.c
+
+$(TMP_D)\iwdt.obj: iwdt.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\iwdt.obj iwdt.c
+
+$(E_EXE): $(E_OBJ)
+ $(LINK) $(LFLAGS) /OUT:$(E_EXE) $(E_OBJ) $(LF_LANPLUS) $(LIBS_PEF) $(LIBS_EX)
+
+ipmi_sample.obj: ipmi_sample.c
+ $(CC) /c $(CFLAGS_SAM) ipmi_sample.c
+
+$(SAMP_LIB): $(CMD_OBJ) mem_if.obj
+ $(CC) /c $(CFLAGS_SAM) ipmilanplus.c
+ $(MKLIB) /OUT:$(SAMP_LIB) /nologo $(CMD_OBJ) mem_if.obj
+ del ipmilanplus.obj
+
+$(SAMP_DLL): $(CMD_OBJ) mem_if.obj
+ $(CC) /D_WINDLL /D_USRDLL /c $(CFLAGS_SAM) ipmilanplus.c
+ $(LINK) /DLL $(LFLAGS) /OUT:$(SAMP_DLL) /def:ipmiutillib.def $(CMD_OBJ) mem_if.obj $(LIBS_PEF) $(LIBS_EX)
+ del ipmilanplus.obj
+
+ipmi_sample.exe: $(SAMP_LIB) ipmi_sample.obj
+ $(LINK) $(LFLAGS) /OUT:ipmi_sample.exe ipmi_sample.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
+
+ipmi_sample2.exe: $(SAMP_LIB) ipmi_sample.c isensor.c ievents.c
+ $(CC) /c $(CFLAGS_SAM) /DGET_SENSORS ipmi_sample.c
+ $(CC) /c $(CFLAGS_SAM) isensor.c
+ $(CC) /c $(CFLAGS_SAM) ievents.c
+ $(LINK) $(LFLAGS) /OUT:ipmi_sample2.exe ipmi_sample.obj isensor.obj ievents.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
+ del isensor.obj ievents.obj
+
+ipmi_sample_evt.obj: ipmi_sample_evt.c $(HEADER)
+ $(CC) /c $(CFLAGS_SAM) ipmi_sample_evt.c
+
+isensor2.obj: isensor.c isensor.h $(HEADER)
+ $(CC) /c /Foisensor2.obj $(CFLAGS_SAM) isensor.c
+
+ievents2.obj: ievents.c ievents.h $(HEADER)
+ $(CC) /c /Foievents2.obj $(CFLAGS_SAM) /DSENSORS_OK ievents.c
+
+ipmi_sample_evt.exe: $(SAMP_LIB) ipmi_sample_evt.obj ievents2.obj isensor2.obj
+ $(LINK) $(LFLAGS) /OUT:ipmi_sample_evt.exe ipmi_sample_evt.obj ievents2.obj isensor2.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
diff --git a/util/ipmiutil2.mak b/util/ipmiutil2.mak index 8ed0155..8d41f50 100644 --- a/util/ipmiutil2.mak +++ b/util/ipmiutil2.mak @@ -120,7 +120,8 @@ clean: $(RM) *.obj 2>NUL
$(RM) $(TARG_EXE) 2>NUL
$(RM) *.exe 2>NUL
- $(RM) $(TMP_D)\*.obj 2>NUL
+ -$(RM) $(TMP_D)\*.obj 2>NUL
+ -$(RM) *.manifest 2>NUL
distclean:
$(RM) *.obj 2>NUL
diff --git a/util/ipmiutil64.mak b/util/ipmiutil64.mak index 4c7b315..fa6b88e 100644 --- a/util/ipmiutil64.mak +++ b/util/ipmiutil64.mak @@ -410,6 +410,12 @@ ipmi_sample2.exe: $(SAMP_LIB) ipmi_sample.c isensor.c ievents.c $(LINK) $(LFLAGS) /OUT:ipmi_sample2.exe ipmi_sample.obj isensor.obj ievents.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
del isensor.obj ievents.obj
+ifruset.obj: ifruset.c
+ $(CC) /c $(CFLAGS_SAM) ifruset.c
+
+ifruset.exe: $(SAMP_LIB) ifruset.obj ifru_picmg.obj
+ $(LINK) $(LFLAGS) /OUT:ifruset.exe ifruset.obj ifru_picmg.obj $(SAMP_LIB) $(LIBS_PEF) $(LIBS_EX)
+
ipmi_sample_evt.obj: ipmi_sample_evt.c $(HEADER)
$(CC) /c $(CFLAGS_SAM) ipmi_sample_evt.c
diff --git a/util/ireset.c b/util/ireset.c index 8116b7d..0bfdeb0 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.96"; static char * progname = "ireset"; static uchar ipmi_maj; static uchar ipmi_min; @@ -486,7 +486,7 @@ static void show_usage(void) printf(" -w Wait for BMC ready after reset\n"); printf(" -x show eXtra debug messages\n"); printf(" -y Yes, persist boot options [-befhpms]\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); } #ifdef METACOMMAND diff --git a/util/isel.c b/util/isel.c index c974b24..723ae48 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.96"; #ifdef WIN32 #define IDXFILE "sel.idx" static char idxfile[80] = IDXFILE; @@ -651,7 +651,7 @@ int i_sel(int argc, char **argv) char *s1; printf("%s: version %s\n",progname,progver); - while ((c = getopt(argc,argv,"a:b:cdef:h:l:m:nprs:uwvx:T:V:J:EYF:P:N:U:R:Z:?")) != EOF) + while ((c = getopt(argc,argv,"a:b:cdef:h:l:m:np:rs:uwvx:T:V:J:EYF:P:N:U:R:Z:?")) != EOF) switch(c) { case 'a': faddsel = 1; /*undocumented option, to prevent misuse*/ addstr = optarg; /*text string, max 13 bytes*/ @@ -686,13 +686,14 @@ int i_sel(int argc, char **argv) fsensdesc = 1; /*extended sensor descriptions*/ /* Note that this option does not show event data bytes */ break; - case 'p': fall = 0; break; /*crit stop (panic) only*/ + // case 'p': fall = 0; break; /*crit stop (panic) only*/ case 'r': fshowraw = 1; break; case 's': min_sev = atob(optarg); break; /*show sev >= value*/ case 'u': futc = 1; break; case 'v': fonlyver = 1; break; case 'w': fwritesel = 1; break; case 'x': fdebug = 1; break; + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -717,13 +718,13 @@ int i_sel(int argc, char **argv) printf(" -l5 Show last 5 SEL records (reverse order)\n"); printf(" -r Show uninterpreted raw SEL records in ascii hex\n"); printf(" -n Show nominal/canonical output (same as -c)\n"); - printf(" -p Show only Panic/Critical Stop records\n"); + //printf(" -p Show only Panic/Critical Stop records\n"); printf(" -s1 Show only Severity >= value (0,1,2,3)\n"); printf(" -u use raw UTC time\n"); printf(" -v Only show version information\n"); printf(" -w Writes new SEL records to syslog\n"); printf(" -x Display extra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); ret = ERR_USAGE; goto do_exit; } @@ -866,10 +867,10 @@ int i_sel(int argc, char **argv) /* PEF alerts and other log messages fail if low free space, so show a warning. */ if (vfree < MIN_FREE) { - printf("WARNING: free space is very low (=%d), need to clear with -c\n", + printf("WARNING: free space is very low (=%d), need to clear with -d\n", vfree); } else if ((vfree/vsize) < ((vtotal * 20)/100)) { - printf("WARNING: free space is low (=%d), need to clear with -c\n", + printf("WARNING: free space is low (=%d), need to clear with -d\n", vfree); } } diff --git a/util/iseltime.c b/util/iseltime.c index 2562202..0d82c90 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.96"; static char * progname = "iseltime"; static char fdebug = 0; static char fset = 0; @@ -139,14 +139,15 @@ time_t utc2local(time_t t) } #define TIMESTR_SZ 30 -void show_time(time_t etime) +void show_time(time_t etime, int doutc) { char buf[TIMESTR_SZ]; int bufsz = TIMESTR_SZ; time_t t; strcpy(buf,"00/00/00 00:00:00"); - t = utc2local(etime); + if (doutc) t = utc2local(etime); + else t = etime; strftime(buf,bufsz, "%x %H:%M:%S", gmtime(&t)); /*or "%x %T"*/ printf("%s\n",buf); return; @@ -195,7 +196,7 @@ main(int argc, char **argv) printf("Usage: %s [-sx -NUPRETVF]\n", progname); printf(" where -s Set SEL time (usually once a day)\n"); printf(" -x show eXtra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); exit(1); } @@ -220,10 +221,10 @@ main(int argc, char **argv) exit(1); } time(<ime2); - printf("Current System time: "); show_time(ltime2); + printf("Current System time: "); show_time(ltime2,1); ltime1 = timebuf[0] + (timebuf[1] << 8) + (timebuf[2] << 16) + (timebuf[3] << 24); - printf("Current SEL time: "); show_time(ltime1); + printf("Current SEL time: "); show_time(ltime1,0); // if (fdebug) ltime3 = utc2local(ltime1); @@ -239,7 +240,7 @@ main(int argc, char **argv) else { ltime3 = timebuf[0] + (timebuf[1] << 8) + (timebuf[2] << 16) + (timebuf[3] << 24); - printf("New SEL time: "); show_time(ltime3); + printf("New SEL time: "); show_time(ltime3,0); } } } diff --git a/util/isensor.c b/util/isensor.c index ac93411..e5a80e0 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.96"; #ifdef WIN32 static char savefile[] = "%ipmiutildir%\\thresholds.cmd"; #else @@ -1354,6 +1354,9 @@ int get_sdr_file(char *sdrfile, uchar **sdrlist) num = 0; while (fgets(buff, 255, fp)) { num++; } if (fdebug) printf("Reading %d SDRs from file %s\n",num,sdrfile); + if ((psdrcache != NULL) && (nsdrs > 0)) { /*already have sdrcache*/ + printf("get_sdr_file: Already have cache\n"); /*++++*/ + } sdrbuf = malloc(num * SDR_SZ); if (sdrbuf == NULL) { fclose(fp); @@ -1402,8 +1405,10 @@ int get_sdr_cache(uchar **pret) if ((psdrcache != NULL) && (nsdrs > 0)) { /*already have sdrcache*/ *pret = psdrcache; if (fdebug) printf("get_sdr_cache: already have cache (%p)\n",*pret); + printf("get_sdr_cache: Already have cache\n"); /*++++*/ return(0); } + else printf("get_sdr_cache: Allocating cache\n"); /*++++*/ rv = GetSDRRepositoryInfo(&n,&fdevsdrs); if (rv != 0) return(rv); @@ -1434,6 +1439,12 @@ int get_sdr_cache(uchar **pret) if (rv == 0xC5) { set_reserve(1); i--; } /*retry*/ else break; } else { /*success*/ + /* if sdrlen!=len, adjust */ + if ((len > 5) && (len != (psdr[4] + 5)) ) { + if (fdebug) printf("SDR[%x] adjust len from %d to %d\n", + recid,psdr[4]+5,len); + psdr[4] = len - 5; + } asz += len; if (recnext == recid) recid = 0xffff; else recid = recnext; @@ -1451,19 +1462,23 @@ int get_sdr_cache(uchar **pret) int find_nsdrs(uchar *pcache) { int num = 0; - int asz = 0; + ulong asz = 0; int i, len; uchar *sdr; ushort recid; if (pcache == NULL) return(num); - for (i = 0; asz < sz_sdrs; i++) + for (i = 0; (int)asz < sz_sdrs; i++) { sdr = &pcache[asz]; + if (sdr[2] != 0x51) { /* Dell SDR length error */ + printf("SDR[%x] length error at %ld\n",recid,asz); + sdr = &pcache[++asz]; /*try it if off-by-one*/ + } len = sdr[4] + 5; recid = sdr[0] + (sdr[1] << 8); + if (fdebug) printf("SDR[%x] len=%d i=%d offset=%lx\n",recid,len,i,asz); asz += len; - if (fdebug) printf("SDR[%x] len=%d i=%d\n", recid,len,i); } num = i; return(num); @@ -1565,13 +1580,15 @@ int find_sdr_next(uchar *psdr, uchar *pcache, ushort id) { // sdr = &pcache[i * SDR_SZ]; sdr = &pcache[asz]; + if (sdr[2] != 0x51) /* Dell SDR off-by-one error */ + sdr = &pcache[++asz]; len = sdr[4] + 5; recid = sdr[0] + (sdr[1] << 8); asz += len; // 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 +2878,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 +2912,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 +2949,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,55 +2982,64 @@ 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"); + fp = fopen(binfile,"rb"); 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); } + fseek(fp, 0L, SEEK_SET); #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); + { /*not windows but Linux, etc.*/ + 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*/ + /* Could estimate size for nsdrs*SDR_SZ, but we don't yet know nsdrs. + * It is better to use the real file size detected above. */ sz_sdrs = len; pbuf = malloc(len); - if (fdebug) printf("restore: malloc(%d) pbuf=%p\n",len,pbuf); + if (fdebug) printf("sdr_binfile: malloc(%d) pbuf=%p\n",len,pbuf); if (pbuf == NULL) { ret = -1; fclose(fp); return(ret); } + psdrcache = pbuf; /*ok, so proceed with restore*/ ret = 0; len = (int)fread(pbuf, 1, sz_sdrs, fp); if (len <= 0) { - ret = get_LastError(); - printf("Error %d reading file %s\n",ret,binfile); - sz_sdrs = 0; /*for safety*/ + ret = get_LastError(); + printf("Error %d reading file %s\n",ret,binfile); + sz_sdrs = 0; /*for safety*/ + } else if (len < sz_sdrs) { + /* Show error if this happens in Windows */ + ret = get_LastError(); + printf("truncated fread(%s): attempted %d, got %d, error %d\n", + binfile,sz_sdrs,len,ret); + ret = 0; /*try to keep going*/ } fclose(fp); if (fdebug) { - printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs); - dump_buf("SDR buffer",pbuf,len,1); + printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs); + dump_buf("SDR buffer",pbuf,len,1); } *pbufret = pbuf; *buflen = len; @@ -3053,17 +3079,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 +3098,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 +3151,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 +3192,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"); - print_lan_opt_usage(); - ret = ERR_USAGE; + 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(0); + ret = ERR_USAGE; goto do_exit; } if (fjumpstart && fchild) { @@ -3234,19 +3260,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 +3285,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 +3297,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 +3327,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 +3338,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 +3365,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,"wb"); + if (fp == NULL) { + ret = get_LastError(); + printf("Cannot open file %s, error %d\n",binfile,ret); + } else { + printf("Writing SDR size %d to %s ...\n",sz_sdrs,binfile); + len = (int)fwrite(pbuf, 1, sz_sdrs, fp); + fclose(fp); + if (len <= 0) { + ret = get_LastError(); + printf("Error %d writing file %s\n",ret,binfile); + } else ret = 0; + } + free_sdr_cache(pbuf); } goto do_exit; } /*endif fdump*/ @@ -3363,17 +3392,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 +3423,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 +3433,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 +3456,52 @@ 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); + if (recid > 0 && recnext == 0) { + if (fdebug) printf("Error recid=%04x recnext=%04x\n",recid,recnext); + ret = 0; break; + } 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 +3517,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 +3584,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 +3613,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 +3641,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 +3692,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..07fc3cc 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.96"; static char * progname = "iserial"; static int vend_id = 0; static int prod_id = 0; @@ -942,7 +942,7 @@ main(int argc, char **argv) printf(" -t Configure serial port for shared Terminal Mode & Console (same as -c)\n"); printf(" -v4 access priVilege: 4=Admin, 3=Operator, 2=User\n"); printf(" -x eXtra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } @@ -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..50b0caf 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.96"; static char * progname = "isol"; static char fdebug = 0; static char fpicmg = 0; @@ -1114,7 +1114,7 @@ static void show_usage(void) printf(" -v debug log filename (default=isoldbg.log)\n"); printf(" -x show eXtra debug messages in debug log\n"); printf(" -z show even more debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(1); } #ifdef METACOMMAND @@ -1138,7 +1138,7 @@ main(int argc, char **argv) parse_lan_options('V',"2",0); /*default to user priv*/ - while ( (c = getopt( argc, argv,"ac:dei:k:ln:o:rs:t:u:wv:xzEF:J:N:P:R:T:U:V:YZ:?")) != EOF ) + while ( (c = getopt( argc, argv,"ac:dei:k:ln:o:p:rs:t:u:wv:xzEF:J:N:P:R:T:U:V:YZ:?")) != EOF ) switch(c) { case 'a': factivate = 1; break; /*activate*/ case 'd': fdeactivate = 1; break; /*deactivate*/ @@ -1183,6 +1183,7 @@ main(int argc, char **argv) case 'z': fdebug = 3; break; /*full debug messages */ case 'V': /* priv level */ fprivset = 1; + case 'p': /* port */ case 'N': /* nodename */ case 'U': /* remote username */ case 'P': /* remote password */ @@ -1307,7 +1308,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..21e5f6c 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.96"; 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..0e6d932 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.96"; static char * progname = "iwdt"; static char fdebug = 0; static char fdontlog = 0; @@ -335,7 +335,7 @@ main(int argc, char **argv) printf(" -q N set watchdog pretimeout to N sec\n"); printf(" -t N set timeout to N seconds\n"); printf(" -x show eXtra debug messages\n"); - print_lan_opt_usage(); + print_lan_opt_usage(0); ret = ERR_USAGE; goto do_exit; } @@ -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..0e16d95 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.96"; 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..65a3522 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.96"; 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..5d7dee9 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.96"; 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) |