Compare commits

..

28 Commits

Author SHA1 Message Date
7dcb8d3b02 This commit was manufactured by cvs2svn to create tag 'IPMITOOL_1_8_8'. 2006-05-12 15:37:46 +00:00
4433696ae4 fix tsol on big-endian 2006-05-12 15:37:45 +00:00
c9b2eb04f6 Implemented sdr_convert_sensor_tolerance
- uses y = L[Mx/2 * 10K2 ] formula as per IPMI spec
This function is now used instead of sdr_convert_sensor_reading when it
 comes to tolerance.
2006-05-12 14:07:31 +00:00
be79973194 remove fclose that happened before fopen 2006-05-03 22:05:24 +00:00
8e12bc0299 - Fix flag in StartFirmwareImage 2006-05-03 13:34:59 +00:00
b253fd5da3 - Remove write number of bytes in function SaveFirwwareImage
- Use this extra byte for payload transfer
2006-05-02 19:05:39 +00:00
811c894d78 added "--with-rpm-release" configure option to set the RPM release number
the distro tag, if supplied, is still part of the release value
2006-05-02 16:26:13 +00:00
65d1b0a623 ipmi_sdr.c: Fix ipmi_sdr_get_sensor_reading_ipmb() to keep track of device lun.
ipmi_sdr.c: Better error handling to avoid coredump when sensor description is missing.
ipmi_sensor.c: use new ipmi_sdr_get_sensor_reading_ipmb() interface
ipmi_sunoem.c: keep track of device lun
ipmi_sel.h: add "OEM Specific" device description
ipmi_sdr.h: modify ipmi_sdr_get_sensor_reading_ipmb() prototype
2006-05-01 23:57:01 +00:00
e667785bd3 update changelogs, prepare for 1.8.8 2006-05-01 23:33:33 +00:00
cf74129ba8 grr last time 2006-05-01 23:22:44 +00:00
3a30f4d0b8 intf -> eintf 2006-05-01 23:20:49 +00:00
ac40435a4a connect before fork to return error to initscript if needed 2006-05-01 23:15:38 +00:00
b800400c41 clear password if authtype NONE specified on command line 2006-05-01 22:33:21 +00:00
9132b30b6c fix cipher suite display bug 2006-05-01 22:28:45 +00:00
dd29a141ed add kontronoem header to package build 2006-05-01 22:23:53 +00:00
9f86c0601a fix typo in sol output when sending break 2006-04-27 18:08:30 +00:00
f7cfe44ce7 add missing MD2 authtype 2006-04-27 18:05:57 +00:00
1ad5d3d0b2 remove a few straggling nuclear clauses 2006-04-27 18:04:09 +00:00
9b4766a767 - Add lun consideration in ipmi_openipmi_send_cmd 2006-04-21 19:57:25 +00:00
a43c37e6ce - Add kontron oem file 2006-04-21 19:28:01 +00:00
ee044f0169 Remove static keyword to read_fru_area, write_fru_area, get_fru_area_str to be used in other files 2006-04-21 19:15:12 +00:00
a089b441f9 Upgrade to new protocol version
Faster Upgrade
2006-04-21 16:36:51 +00:00
adef82354e Fix compiling error 2006-04-21 16:34:30 +00:00
ee59c4d0f1 fix segfaults 2006-04-11 01:43:59 +00:00
9fd9b29cb5 clear ipmi_rq before using to remove garbage data like LUN. throttle keystroke errors unless verbose 2006-04-11 00:47:49 +00:00
35a7fad915 use find_lan_channel() for printing when no channel specified on command line 2006-04-11 00:47:10 +00:00
905892b5a7 ipmi_user.c: only allocated needed 3 bytes in ipmi_user_set_userpriv() 2006-03-28 17:01:16 +00:00
8fd02275a0 conditionally include config.h only if it is present 2006-03-28 16:56:56 +00:00
31 changed files with 3089 additions and 1975 deletions

View File

@ -1,3 +1,14 @@
version 1.8.8
* Fix segfaults in sensor data repository list
* Fix ipmievd to open interface before daemonizing
* Fix IPMIv1.5 authtype NONE to ignore supplied password
* Fix cipher suite display bug in lan print
* Fix typo in IPMIv2 SOL output when sending break
* Fix improper LUN handling with Tyan SOL
* Add LUN support to OpenIPMI interface
* Add support for Kontron OEM commands
* Update to Kontron Firmware Update command
version 1.8.7
* Remove nuclear clause from license
* Add Sun OEM command for blades

View File

@ -3,7 +3,7 @@ dnl autoconf for ipmitool
dnl
AC_INIT([src/ipmitool.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([ipmitool], [1.8.7])
AM_INIT_AUTOMAKE([ipmitool], [1.8.8])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_PREREQ(2.50)
@ -221,6 +221,13 @@ AC_ARG_WITH([rpm-distro],
[set Linux distribution tag for use in RPM version string])],
[AC_SUBST(DISTRO, $with_rpm_distro)])
dnl set RPM release tag
AC_ARG_WITH([rpm-release],
[AC_HELP_STRING([--with-rpm-release=RELEASE],
[set release number for RPM release field])],
[], [with_rpm_release=1])
AC_SUBST(RPM_RELEASE, $with_rpm_release)
dnl enable Linux OpenIPMI interface
AC_ARG_ENABLE([intf-open],
[AC_HELP_STRING([--enable-intf-open],

View File

@ -1,7 +1,7 @@
Name: ipmitool
Summary: ipmitool - Utility for IPMI control
Version: @VERSION@
Release: 1%{?_distro:.%{_distro}}
Release: @RPM_RELEASE@%{?_distro:.%{_distro}}
License: BSD
Group: Utilities
Packager: Duncan Laurie <duncan@iceblink.org>
@ -62,6 +62,17 @@ rm -rf $RPM_BUILD_DIR/ipmitool-@VERSION@
%doc %{_datadir}/doc/ipmitool/*
%changelog
* Tue May 02 2006 <duncan@iceblink.org> 1.8.8-1
- Fix segfaults in sensor data repository list
- Fix ipmievd to open interface before daemonizing
- Fix IPMIv1.5 authtype NONE to ignore supplied password
- Fix cipher suite display bug in lan print
- Fix typo in IPMIv2 SOL output when sending break
- Fix improper LUN handling with Tyan SOL
- Add LUN support to OpenIPMI interface
- Add support for Kontron OEM commands
- Update to Kontron Firmware Update command
* Sun Mar 19 2006 <duncan@iceblink.org> 1.8.7-1
- Add Sun OEM command for blades
- Increase argument size for raw commands in shell/exec

View File

@ -1,3 +1,23 @@
ipmitool (1.8.7-2) unstable; urgency=low
* Fix typo in init.d/ipmievd. (Closes: #361309)
-- Petter Reinholdtsen <pere@debian.org> Sat, 8 Apr 2006 06:44:31 +0200
ipmitool (1.8.7-1) unstable; urgency=low
* New upstream version.
- Dropped nuclear clause from the copyright. Updated debian/copyright
to reflect this.
- ipmievd now store pid in /var/run/ipmievd.pid. Adjust init.d
script to use it.
* Rename /etc/default/ipmievd variable IPMIEVD_OPTS is renamed to
IPMIEVD_OPTIONS to stay compatible with upstream and other
distributions. Add backwards compatibility code with a warning to
the users of the old variable.
-- Petter Reinholdtsen <pere@debian.org> Sun, 26 Mar 2006 21:11:08 +0200
ipmitool (1.8.6-2) unstable; urgency=low
* Add ia64 as an supported arch. (Closes: #355930)

View File

@ -46,6 +46,13 @@ IPMIEVD_OPTIONS="open daemon"
# Read config file if it is present.
[ -f /etc/default/$NAME ] && . /etc/default/$NAME
# Backwards compatibility with version 1.8.6-2 and 1.8.6-1. The
# variable was renamed to be compatible with upstream, SuSe and RedHat.
if [ -n "$IPMIEVD_OPTS" ]; then
echo "warning: /etc/default/$NAME variable IPMIEVD_OPTS should be renamed to IPMIEVD_OPTIONS"
IPMIEVD_OPTIONS="$IPMIEVD_OPTS"
fi
#
# Function that starts the daemon/service.
#

View File

@ -46,7 +46,7 @@ Prompt for the remote server password.
.TP
\fB\-A\fR <\fIauthtype\fP>
Specify an authentication type to use during IPMIv1.5 \fIlan\fP
session activation. Supported types are NONE, PASSWORD, MD5, or OEM.
session activation. Supported types are NONE, PASSWORD, MD2, MD5, or OEM.
.TP
\fB\-c\fR
Present output in CSV (comma separated variable) format.

View File

@ -51,7 +51,7 @@ Prompt for the remote server password.
.TP
\fB\-A\fR <\fIauthtype\fP>
Specify an authentication type to use during IPMIv1.5 \fIlan\fP
session activation. Supported types are NONE, PASSWORD, MD5, or OEM.
session activation. Supported types are NONE, PASSWORD, MD2, MD5, or OEM.
.TP
\fB\-c\fR
Present output in CSV (comma separated variable) format.

View File

@ -36,5 +36,6 @@ noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_intf.h \
ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \
ipmi_strings.h ipmi_constants.h ipmi_user.h ipmi_pef.h \
ipmi_oem.h ipmi_isol.h ipmi_sunoem.h ipmi_picmg.h \
ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h
ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \
ipmi_kontronoem.h

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_FIREWALL_H
@ -108,4 +104,3 @@ static inline void bit_set(unsigned char * bf, int n, int v) {
}
#endif /*IPMI_FIREWALL_H */

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
*
* Base on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KONTRONOEM_H
#define IPMI_KONTRONOEM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KONTRONOEM_H */

View File

@ -803,7 +803,8 @@ struct ipmi_rs *ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf,
uint8_t sensor);
struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf,
uint8_t sensor,
uint8_t target);
uint8_t target,
uint8_t lun);
struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf,
uint8_t sensor);
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,

View File

@ -516,7 +516,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0xF2, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Opened" },
{ 0xF2, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Quiesced" },
{ 0xC0, 0x00, 0xff, 0x00, "OEM", NULL },
{ 0xC0, 0x00, 0xff, 0x00, "OEM", "OEM Specific" },
{ 0x00, 0x00, 0x00, 0x00, NULL, NULL },
};

View File

@ -37,7 +37,7 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
dimm_spd.c ipmi_sensor.c ipmi_channel.c ipmi_event.c \
ipmi_session.c ipmi_strings.c ipmi_user.c ipmi_raw.c \
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
ipmi_main.c ipmi_tsol.c ipmi_firewall.c
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c
libipmitool_la_LDFLAGS = -export-dynamic
libipmitool_la_LIBADD = -lm

View File

@ -49,7 +49,9 @@
#endif
#ifdef HAVE_PATHS_H
# include <paths.h> /* For _PATH_TTY */
# include <paths.h>
#else
# define _PATH_VARRUN "/var/run/"
#endif
#include <ipmitool/helper.h>

View File

@ -29,10 +29,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
@ -877,6 +873,7 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
ret = _gather_info(intf, &p, bmc_fn_support);
if (p.command >= 0) {
struct command_support * cmd;
if (!((p.lun < 0 || bmc_fn_support->lun[p.lun].support) &&
(p.netfn < 0 || bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].support) &&
bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].command[p.command].support))
@ -886,7 +883,7 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
free(bmc_fn_support);
return 0;
}
struct command_support * cmd =
cmd =
&bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].command[p.command];
c = cmd->support;
printf("(A)vailable, (C)onfigurable, (E)nabled: | A | C | E |\n");

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,587 @@
/*
* Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
*
* Base on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
/*
* Tue Mar 7 14:36:12 2006
* <stephane.filion@ca.kontron.com>
*
* This code implements an Kontron OEM proprietary commands.
*/
#include <string.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_fru.h>
extern int verbose;
extern int read_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
uint8_t id, uint32_t offset, uint32_t length,
uint8_t *frubuf);
extern int write_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
unsigned char id, unsigned int soffset,
unsigned int doffset, unsigned int length,
unsigned char *pFrubuf);
extern char * get_fru_area_str(uint8_t * data, uint32_t * offset);
static void ipmi_kontron_help(void);
static int ipmi_kontron_set_serial_number(struct ipmi_intf * intf);
static int ipmi_kontron_set_mfg_date (struct ipmi_intf * intf);
int
ipmi_kontronoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc == 0)
ipmi_kontron_help();
else if (strncmp(argv[0], "help", 4) == 0)
ipmi_kontron_help();
else if(!strncmp(argv[0], "setsn", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_serial_number(intf) > 0)
{
printf("FRU serial number setted successfully\n");
}
else
{
printf("FRU serial number set failed\n");
}
}
else
{
printf("fru setsn\n");
}
}
else if(!strncmp(argv[0], "setmfgdate", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_mfg_date(intf) > 0)
{
printf("FRU manufacturing date setted successfully\n");
}
else
{
printf("FRU manufacturing date set failed\n");
}
}
else
{
printf("fru setmfgdate\n");
}
}
else
{
printf("Invalid Kontron command: %s", argv[0]);
ipmi_kontron_help();
rc = -1;
}
return rc;
}
static void ipmi_kontron_help(void)
{
printf("Kontron Commands: setsn setmfgdate\n");
}
/* ipmi_fru_set_serial_number - Set the Serial Number in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_serial_number(struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
char *sn;
uint8_t sn_size, checksum,prev_lun;
int ret = 0;
uint8_t *fru_data, *fru_area;
uint32_t fru_data_offset, fru_data_offset_tmp, board_sec_len, prod_sec_len, i;
sn = NULL;
fru_data = NULL;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0C;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return -11;
}
if (rsp->ccode > 0)
{
printf(" This option is not implemented for this board\n");
return -1;
}
sn_size = rsp->data_len;
sn = malloc(sn_size + 1);
if(sn == NULL)
{
printf("Out of memory!");
return;
}
memset(sn, 0, sn_size + 1);
memcpy(sn, rsp->data, sn_size);
if(verbose >= 1)
{
printf("Original serial number is : [%s]\n", sn);
}
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
free(sn);
return -1;
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
free(sn);
return -1;
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
free(sn);
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
free(sn);
return(-1);
}
/* Set the Board Section */
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
printf("Out of memory!");
free(sn);
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/*Position at Board Manufacturer*/
fru_data_offset = (header.offset.board * 8) + 6;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Board Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
printf("The length of the serial number in the FRU Board Area is wrong.\n");
free(sn);
free(fru_data);
return(-1);
}
/* Copy the new serial number in the board section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/* Set the Product Section */
prod_sec_len = (header.offset.multi * 8) - (header.offset.product * 8);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.product * 8) ,prod_sec_len , fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/*Position at Product Manufacturer*/
fru_data_offset = (header.offset.product * 8) + 3;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Part*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Version*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
free(sn);
free(fru_data);
printf("The length of the serial number in the FRU Product Area is wrong.\n");
return(-1);
}
/* Copy the new serial number in the product section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.product * 8); i < (((header.offset.product * 8)+prod_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.product * 8)+prod_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.product * 8), (header.offset.product * 8), prod_sec_len, fru_data) < 0)
{
free(sn);
free(fru_data);
return -1;
}
free(sn);
free(fru_data);
return(1);
}
/* ipmi_fru_set_mfg_date - Set the Manufacturing Date in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_mfg_date (struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
uint8_t mfg_date[3];
uint32_t board_sec_len, i;
uint8_t *fru_data, checksum;
int ret = 0;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0E;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun temporary, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf("Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf("This option is not implemented for this board\n");
return(-1);
}
if(rsp->data_len != 3)
{
printf("Invalid response for the Manufacturing date\n");
return(-1);
}
memset(mfg_date, 0, 3);
memcpy(mfg_date, rsp->data, 3);
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
return(-1);
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
return(-1);
}
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
lprintf("Out of memory!");
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(fru_data);
return(-1);
}
/* Copy the new manufacturing date in the board section saved in memory*/
memcpy(fru_data + (header.offset.board * 8) + 3, mfg_date, 3);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(fru_data);
return(-1);
}
free(fru_data);
return(1);
}

View File

@ -752,6 +752,7 @@ ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
return -1;
else if (p->data != NULL)
{
unsigned char cipher_suite_count = p->data[0];
p = get_lan_param(intf, chan, IPMI_LANP_RMCP_CIPHERS);
if (p == NULL)
return -1;
@ -760,9 +761,8 @@ ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
/* Now we're dangerous. There are only 15 fixed cipher
suite IDs, but the spec allows for 16 in the return data.*/
if ((p->data != NULL) && (p->data_len <= 16))
if ((p->data != NULL) && (p->data_len <= 17))
{
unsigned char cipher_suite_count = p->data[0];
unsigned int i;
for (i = 0; (i < 16) && (i < cipher_suite_count); ++i)
{
@ -778,7 +778,6 @@ ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
}
}
/* RMCP+ Messaging Cipher Suite Privilege Levels */
/* These are the privilege levels for the 15 fixed cipher suites */
p = get_lan_param(intf, chan, IPMI_LANP_RMCP_PRIV_LEVELS);
@ -2063,63 +2062,59 @@ int
ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
uint8_t chan = 0x0e;
uint8_t chan = find_lan_channel(intf, 1);
if (argc == 0 || (strncmp(argv[0], "help", 4) == 0)) {
print_lan_usage();
return -1;
return -1;
}
if (
(strncmp(argv[0], "printconf", 9) == 0)
||
(strncmp(argv[0], "print", 5) == 0)
)
{
if (strncmp(argv[0], "printconf", 9) == 0 ||
strncmp(argv[0], "print", 5) == 0)
{
if (argc > 1)
chan = (uint8_t)strtol(argv[1], NULL, 0);
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
{
lprintf(LOG_ERR, "Invalid channel: %d", chan);
{
lprintf(LOG_ERR, "Invalid channel: %d", chan);
return -1;
}
}
else
rc = ipmi_lan_print(intf, chan);
}
else if (strncmp(argv[0], "set", 3) == 0)
{
rc = ipmi_lan_set(intf, argc-1, &(argv[1]));
rc = ipmi_lan_set(intf, argc-1, &(argv[1]));
}
else if (strncmp(argv[0], "alert", 5) == 0)
{
rc = ipmi_lan_alert(intf, argc-1, &(argv[1]));
}
else if (strncmp(argv[0], "stats", 5) == 0)
{
if(argc == 1)
{
print_lan_usage();
return -1;
}
else if (argc > 2)
chan = (uint8_t)strtol(argv[2], NULL, 0);
if (chan < 2 || chan > IPMI_CHANNEL_NUMBER_MAX)
{
lprintf(LOG_ERR, "Invalid channel: %d", chan);
return -1;
}
else if (strncmp(argv[1], "get", 3) == 0)
rc = ipmi_lan_stats_get(intf, chan);
else if (strncmp(argv[1], "clear", 5) == 0)
rc = ipmi_lan_stats_clear(intf, chan);
else
print_lan_usage();
rc = ipmi_lan_alert(intf, argc-1, &(argv[1]));
}
else
else if (strncmp(argv[0], "stats", 5) == 0)
{
lprintf(LOG_NOTICE, "Invalid LAN command: %s", argv[0]);
}
if(argc == 1)
{
print_lan_usage();
return -1;
}
else if (argc > 2)
chan = (uint8_t)strtol(argv[2], NULL, 0);
if (chan < 2 || chan > IPMI_CHANNEL_NUMBER_MAX)
{
lprintf(LOG_ERR, "Invalid channel: %d", chan);
return -1;
}
else if (strncmp(argv[1], "get", 3) == 0)
rc = ipmi_lan_stats_get(intf, chan);
else if (strncmp(argv[1], "clear", 5) == 0)
rc = ipmi_lan_stats_clear(intf, chan);
else
print_lan_usage();
}
else
{
lprintf(LOG_NOTICE, "Invalid LAN command: %s", argv[0]);
}
return rc;
}

View File

@ -278,12 +278,13 @@ ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf, uint8_t sensor)
* @intf: ipmi interface
* @sensor: sensor id
* @target: IPMB target address
* @lun: sensor lun
*
* returns ipmi response structure
*/
struct ipmi_rs *
ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
uint8_t target)
uint8_t target, uint8_t lun)
{
struct ipmi_rq req;
struct ipmi_rs *rsp;
@ -493,6 +494,9 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
}
}
if (!rsp)
return NULL;
lprintf(LOG_DEBUG, "SDR record ID : 0x%04x", itr->next);
memcpy(&sdr_rs, rsp->data, sizeof (sdr_rs));
@ -943,7 +947,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
desc, sensor->keys.sensor_num);
validread = 0;
}
if (rsp->ccode > 0) {
else if (rsp->ccode > 0) {
if (rsp->ccode == 0xcb) {
/* sensor not found */
validread = 0;
@ -1069,7 +1073,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
i += snprintf(sval, sizeof (sval), "%.*f %s",
(val == (int) val) ? 0 : 2, val,
do_unit ? unitstr : "");
else if (IS_SCANNING_DISABLED(rsp->data[1]))
else if (rsp && IS_SCANNING_DISABLED(rsp->data[1]))
i += snprintf(sval, sizeof (sval), "disabled ");
else
i += snprintf(sval, sizeof (sval), "no reading ");
@ -1103,7 +1107,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
i += snprintf(sval, sizeof (sval), "%.*f %s",
(val == (int) val) ? 0 : 2, val,
do_unit ? unitstr : "");
else if (IS_SCANNING_DISABLED(rsp->data[1]))
else if (rsp && IS_SCANNING_DISABLED(rsp->data[1]))
i += snprintf(sval, sizeof (sval), "Disabled");
else
i += snprintf(sval, sizeof (sval), "No Reading");
@ -1129,7 +1133,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
printf(" Sensor Reading : ");
if (validread)
printf("%xh\n", (uint32_t) val);
else if (IS_SCANNING_DISABLED(rsp->data[1]))
else if (rsp && IS_SCANNING_DISABLED(rsp->data[1]))
printf("Disabled\n");
else
printf("Not Reading\n");
@ -1152,8 +1156,9 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
ipmi_sdr_print_discrete_state("States Asserted",
sensor->sensor.type,
sensor->event_type, rsp->data[2],
rsp->data[3]);
sensor->event_type,
rsp ? rsp->data[2] : 0,
rsp ? rsp->data[3] : 0);
ipmi_sdr_print_sensor_mask(&sensor->mask, sensor->sensor.type,
sensor->event_type, DISCRETE_SENSOR);
ipmi_sdr_print_sensor_event_status(intf,
@ -1182,7 +1187,7 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
printf("%.*f (+/- %.*f) %s\n",
(val == (int) val) ? 0 : 3,
val, (tol == (int) tol) ? 0 : 3, tol, unitstr);
} else if (IS_SCANNING_DISABLED(rsp->data[1]))
} else if (rsp && IS_SCANNING_DISABLED(rsp->data[1]))
printf("Disabled\n");
else
printf("No Reading\n");
@ -1445,13 +1450,27 @@ ipmi_sdr_print_discrete_state(const char *desc,
}
if (evt->offset > 7) {
if ((1 << (evt->offset - 8)) & state2)
printf(" [%s]\n",
evt->desc);
if ((1 << (evt->offset - 8)) & state2) {
if (evt->desc) {
printf(" "
"[%s]\n",
evt->desc);
} else {
printf(" "
"[no description]\n");
}
}
} else {
if ((1 << evt->offset) & state1)
printf(" [%s]\n",
evt->desc);
if ((1 << evt->offset) & state1) {
if (evt->desc) {
printf(" "
"[%s]\n",
evt->desc);
} else {
printf(" "
"[no description]\n");
}
}
}
c++;
}
@ -1486,21 +1505,30 @@ ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf,
desc, sensor->keys.sensor_num);
validread = 0;
}
if (rsp->ccode > 0 && rsp->ccode != 0xcd) {
/* completion code 0xcd is special case */
lprintf(LOG_DEBUG, "Error reading sensor %s (#%02x): %s",
desc, sensor->keys.sensor_num,
val2str(rsp->ccode, completion_code_vals));
validread = 0;
else if (rsp->ccode > 0) {
/* completion code 0xcd is special case */
if (rsp->ccode == 0xcd) {
/* sensor not found */
validread = 0;
} else {
lprintf(LOG_DEBUG, "Error reading sensor %s (#%02x): %s",
desc, sensor->keys.sensor_num,
val2str(rsp->ccode, completion_code_vals));
validread = 0;
}
} else {
if (IS_READING_UNAVAILABLE(rsp->data[1])) {
/* sensor reading unavailable */
validread = 0;
} else if (IS_SCANNING_DISABLED(rsp->data[1])) {
validread = 0;
/* check for sensor scanning disabled bit */
lprintf(LOG_DEBUG, "Sensor %s (#%02x) scanning disabled",
desc, sensor->keys.sensor_num);
}
}
/* check for sensor scanning disabled bit */
if (IS_SCANNING_DISABLED(rsp->data[1])) {
lprintf(LOG_DEBUG, "Sensor %s (#%02x) scanning disabled",
desc, sensor->keys.sensor_num);
validread = 0;
}
if (verbose) {
printf("Sensor ID : %s (0x%x)\n",
(sensor->id_code) ? desc : "", sensor->keys.sensor_num);
@ -2379,7 +2407,8 @@ ipmi_sdr_start(struct ipmi_intf *intf)
* IPMIv2.0 == 0x02
*/
if ((sdr_info.version != 0x51) &&
(sdr_info.version != 0x01) && (sdr_info.version != 0x02)) {
(sdr_info.version != 0x01) &&
(sdr_info.version != 0x02)) {
lprintf(LOG_WARN, "WARNING: Unknown SDR repository "
"version 0x%02x", sdr_info.version);
}
@ -3377,10 +3406,13 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
if (header.length == 0)
continue;
if (header.version != 0x51) {
if (header.version != 0x51 &&
header.version != 0x01 &&
header.version != 0x02) {
lprintf(LOG_WARN, "invalid sdr header version %02x",
header.version);
continue;
ret = -1;
break;
}
sdrr = malloc(sizeof (struct sdr_record_list));
@ -3738,7 +3770,6 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
itr = ipmi_sdr_start(intf);
if (itr == NULL) {
lprintf(LOG_ERR, "Unable to open SDR for reading");
fclose(fp);
return -1;
}

View File

@ -102,7 +102,8 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf *intf,
*/
rsp = ipmi_sdr_get_sensor_reading_ipmb(intf,
sensor->keys.sensor_num,
sensor->keys.owner_id);
sensor->keys.owner_id,
sensor->keys.lun);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error reading sensor %s (#%02x)",
id, sensor->keys.sensor_num);
@ -181,7 +182,8 @@ ipmi_sensor_print_full_analog(struct ipmi_intf *intf,
*/
rsp = ipmi_sdr_get_sensor_reading_ipmb(intf,
sensor->keys.sensor_num,
sensor->keys.owner_id);
sensor->keys.owner_id,
sensor->keys.lun);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error reading sensor %s (#%02x)",
id, sensor->keys.sensor_num);
@ -417,7 +419,8 @@ ipmi_sensor_print_compact(struct ipmi_intf *intf,
*/
rsp = ipmi_sdr_get_sensor_reading_ipmb(intf,
sensor->keys.sensor_num,
sensor->keys.owner_id);
sensor->keys.owner_id,
sensor->keys.lun);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error reading sensor %s (#%02x)",
id, sensor->keys.sensor_num);
@ -758,7 +761,8 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
}
rsp = ipmi_sdr_get_sensor_reading_ipmb(intf,
sdr->record.full->keys.sensor_num,
sdr->record.full->keys.owner_id);
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error reading sensor \"%s\"", argv[i]);
rc = -1;

View File

@ -42,13 +42,15 @@
#include <signal.h>
#include <unistd.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined(HAVE_TERMIOS_H)
# include <termios.h>
#elif defined (HAVE_SYS_TERMIOS_H)
# include <sys/termios.h>
#endif
#endif
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
@ -1206,7 +1208,7 @@ processSolUserInput(
continue;
case 'B':
printf("%cb [send break]\r\n",
printf("%cB [send break]\r\n",
intf->session->sol_escape_char);
sendBreak(intf);
continue;

View File

@ -221,6 +221,7 @@ sunoem_led_get(struct ipmi_intf * intf,
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_GET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
@ -273,6 +274,7 @@ sunoem_led_set(struct ipmi_intf * intf,
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_SET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;

View File

@ -49,13 +49,15 @@
#include <sys/time.h>
#include <sys/ioctl.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined(HAVE_TERMIOS_H)
# include <termios.h>
#elif defined (HAVE_SYS_TERMIOS_H)
# include <sys/termios.h>
#endif
#endif
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
@ -71,6 +73,8 @@ static struct winsize _saved_winsize;
static int _in_raw_mode = 0;
static int _altterm = 0;
extern int verbose;
static int
ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char cmd)
{
@ -78,31 +82,25 @@ ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char
struct ipmi_rq req;
unsigned char data[6];
unsigned ip1, ip2, ip3, ip4;
uint16_t portin;
#if WORDS_BIGENDIAN
portin = BSWAP_16(port);
#else
portin = port;
#endif
if (sscanf(recvip, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
lprintf(LOG_ERR, "Invalid IP address: %s", recvip);
return -1;
}
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = cmd;
req.msg.data_len = 6;
req.msg.data = data;
memset(data, 0, sizeof(data));
data[0] = ip1;
data[1] = ip2;
data[0] = ip1;
data[1] = ip2;
data[2] = ip3;
data[3] = ip4;
data[4] = (portin & 0xff00) >> 8;
data[5] = (portin & 0xff);
data[4] = (port & 0xff00) >> 8;
data[5] = (port & 0xff);
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
@ -130,14 +128,15 @@ ipmi_tsol_stop(struct ipmi_intf * intf, char *recvip, int port)
return ipmi_tsol_command(intf, recvip, port, IPMI_TSOL_CMD_STOP);
}
static int
static int
ipmi_tsol_send_keystroke(struct ipmi_intf * intf, char *buff, int length)
{
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char data[16];
static unsigned char keyseq = 0;
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = IPMI_TSOL_CMD_SENDKEY;
req.msg.data_len = length + 2;
@ -147,26 +146,28 @@ ipmi_tsol_send_keystroke(struct ipmi_intf * intf, char *buff, int length)
data[0] = length + 1;
memcpy(data + 1, buff, length);
data[length + 1] = keyseq++;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to send keystroke");
return -1;
if (verbose) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to send keystroke");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to send keystroke: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to send keystroke: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
return length;
}
}
static int
tsol_keepalive(struct ipmi_intf * intf)
{
struct timeval end;
gettimeofday(&end, 0);
if (end.tv_sec - _start_keepalive.tv_sec <= 30)
@ -360,7 +361,7 @@ static void
print_tsol_usage(void)
{
struct winsize winsize;
lprintf(LOG_NOTICE, "Usage: tsol [recvip] [port=NUM] [ro|rw] [rows=NUM] [cols=NUM] [altterm]");
lprintf(LOG_NOTICE, " recvip Receiver IP Address [default=local]");
lprintf(LOG_NOTICE, " port=NUM Receiver UDP Port [default=%d]",
@ -421,7 +422,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
}
}
/* create udp socket to receive the packet */
/* create udp socket to receive the packet */
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
@ -475,7 +476,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
enter_raw_mode();
/*
* talk to smdc to start Console redirect - IP address and port as parameter
* talk to smdc to start Console redirect - IP address and port as parameter
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x06 0xC0 0xA8 0xA8 0x78 0x1A 0x0A
*/
result = ipmi_tsol_start(intf, recvip, port);
@ -487,7 +488,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
printf("[SOL Session operational. Use %c? for help]\r\n",
intf->session->sol_escape_char);
gettimeofday(&_start_keepalive, 0);
gettimeofday(&_start_keepalive, 0);
fds_wait[0].fd = fd_socket;
fds_wait[0].events = POLLIN;
@ -498,7 +499,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
fds_wait[2].fd = -1;
fds_wait[2].events = 0;
fds_wait[2].revents = 0;
fds_data_wait[0].fd = fd_socket;
fds_data_wait[0].events = POLLIN | POLLOUT;
fds_data_wait[0].revents = 0;
@ -508,11 +509,11 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
fds_data_wait[2].fd = fileno(stdout);
fds_data_wait[2].events = POLLOUT;
fds_data_wait[2].revents = 0;
out_buff_fill = 0;
in_buff_fill = 0;
fds = fds_wait;
for (;;) {
result = poll(fds, 3, 15*1000);
if (result < 0)
@ -551,7 +552,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
do_terminal_cleanup();
return result;
}
if (read_only)
if (read_only)
bytes = 0;
in_buff_fill += bytes;
}
@ -567,7 +568,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
}
if ((fds[0].revents & POLLOUT) && in_buff_fill) {
/*
* translate key and send that to SMDC using IPMI
* translate key and send that to SMDC using IPMI
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x03 0x04 0x1B 0x5B 0x43
*/
result = ipmi_tsol_send_keystroke(intf, in_buff, __min(in_buff_fill,14));
@ -579,9 +580,9 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
fds = (in_buff_fill || out_buff_fill )?
fds = (in_buff_fill || out_buff_fill )?
fds_data_wait : fds_wait;
}
return 0;
}

View File

@ -354,7 +354,7 @@ ipmi_user_set_userpriv(
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[17];
uint8_t msg_data[3];
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */

View File

@ -42,7 +42,9 @@
#include <sys/stat.h>
#include <signal.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#ifdef HAVE_PATHS_H
# include <paths.h>
@ -638,6 +640,16 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
}
}
/*
* We need to open interface before forking daemon
* so error messages are not lost to syslog and
* return code is successfully returned to initscript
*/
if (eintf->intf->open(eintf->intf) < 0) {
lprintf(LOG_ERR, "Unable to open interface");
return -1;
}
if (daemon) {
FILE *fp;
struct stat st1;

View File

@ -49,7 +49,6 @@
#include <ipmitool/ipmi_sensor.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_session.h>
#include <ipmitool/ipmi_firewall.h>
#include <ipmitool/ipmi_event.h>
#include <ipmitool/ipmi_user.h>
#include <ipmitool/ipmi_raw.h>
@ -58,6 +57,7 @@
#include <ipmitool/ipmi_sunoem.h>
#include <ipmitool/ipmi_fwum.h>
#include <ipmitool/ipmi_picmg.h>
#include <ipmitool/ipmi_kontronoem.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
@ -94,8 +94,8 @@ struct ipmi_cmd ipmitool_cmd_list[] = {
{ ipmi_user_main, "user", "Configure Management Controller users" },
{ ipmi_channel_main, "channel", "Configure Management Controller channels" },
{ ipmi_session_main, "session", "Print session information" },
{ ipmi_firewall_main,"firewall","Configure firmware firewall (IPMIv2.0)"},
{ ipmi_sunoem_main, "sunoem", "OEM Commands for Sun servers" },
{ ipmi_kontronoem_main, "kontronoem", "OEM Commands for Kontron devices"},
{ ipmi_picmg_main, "picmg", "Run a PICMG/ATCA extended cmd"},
{ ipmi_fwum_main, "fwum", "Update IPMC using Kontron OEM Firmware Update Manager" },
#ifdef HAVE_READLINE

View File

@ -33,8 +33,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
@ -259,6 +260,12 @@ ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype)
if (intf->session == NULL)
return;
/* clear password field if authtype NONE specified */
if (authtype == IPMI_SESSION_AUTHTYPE_NONE) {
memset(intf->session->authcode, 0, IPMI_AUTHCODE_BUFFER_SIZE);
intf->session->password = 0;
}
intf->session->authtype_set = authtype;
}

View File

@ -2456,14 +2456,16 @@ ipmi_lanplus_recv_sol(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp = ipmi_lan_poll_recv(intf);
ack_sol_packet(intf, rsp);
/*
* Remembers the data sent, and alters the data to just
* include the new stuff.
*/
check_sol_packet_for_new_data(intf, rsp);
if(rsp->session.authtype != 0)
{
ack_sol_packet(intf, rsp);
/*
* Remembers the data sent, and alters the data to just
* include the new stuff.
*/
check_sol_packet_for_new_data(intf, rsp);
}
return rsp;
}

View File

@ -32,7 +32,9 @@
#include <assert.h>
#include <string.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#include <ipmitool/bswap.h>
#include <ipmitool/log.h>
#include "lanplus.h"

View File

@ -45,7 +45,9 @@
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <config.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined(HAVE_OPENIPMI_H)
# include <linux/compiler.h>
@ -180,6 +182,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
intf->target_addr != intf->my_addr) {
/* use IPMB address if needed */
ipmb_addr.slave_addr = intf->target_addr;
ipmb_addr.lun = req->msg.lun;
_req.addr = (unsigned char *) &ipmb_addr;
_req.addr_len = sizeof(ipmb_addr);
lprintf(LOG_DEBUG, "Sending request to "