mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Compare commits
No commits in common. "master" and "IPMITOOL_1_8_19" have entirely different histories.
master
...
IPMITOOL_1
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,37 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: AlexanderAmelkin
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
*Please **DO NOT** report ANYTHING about 1.8.18, it is outdated. Please first check your alleged bug with the latest code from the top of the master branch here.*
|
||||
|
||||
**IPMITOOL Version**
|
||||
|
||||
Make sure you're reporting a bug in the latest code taken from `master` branch here, NOT a bug
|
||||
that you've found in some version that you've got from your OS vendor or any source other than this repository.
|
||||
|
||||
```none
|
||||
$ ipmitool -V
|
||||
<output here>
|
||||
```
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Using hardware/BMC '...'
|
||||
2. Run `ipmitool ...`
|
||||
3. Observe the abnormal reply:
|
||||
```none
|
||||
abnormal output example
|
||||
```
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
linux:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04 ]
|
||||
os: [ ubuntu-18.04, ubuntu-20.04 ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: install dependencies
|
||||
@ -53,10 +53,10 @@ jobs:
|
||||
- name: make distcheck
|
||||
run: make distcheck
|
||||
|
||||
macos:
|
||||
macos-catalina:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos-10.15, macos-11, macos-12 ]
|
||||
os: [ macos-10.15, macos-11 ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
@ -77,11 +77,9 @@ jobs:
|
||||
- name: make distcheck
|
||||
run: make distcheck
|
||||
|
||||
windows:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ windows-2019, windows-2022 ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
win-srv-2019:
|
||||
|
||||
runs-on: windows-2019
|
||||
|
||||
steps:
|
||||
- name: install dependencies
|
||||
|
11
INSTALL
11
INSTALL
@ -18,14 +18,11 @@ library and development headers are required. As of July 2020, the
|
||||
project is tested automatically to build cleanly for the following
|
||||
64-bit operating systems using GitHub Actions workflow:
|
||||
|
||||
- Ubuntu 16.04 Xenial Xerus
|
||||
- Ubuntu 18.04 Bionic Beaver
|
||||
- Ubuntu 20.04 Focal Fossa
|
||||
- Ubuntu 22.04 Jammy Jellyfish
|
||||
- MacOS X 10.15 Catalina
|
||||
- MacOS 11 Big Sur
|
||||
- MacOS 12 Monterey
|
||||
- Microsoft Windows Server 2019
|
||||
- Microsoft Windows Server 2022
|
||||
|
||||
It is also known to build successfully on Ubuntu 14.04 and Fedora 31,
|
||||
but that is not automatically verified.
|
||||
@ -44,8 +41,8 @@ but that is not automatically verified.
|
||||
$ sudo dnf install automake gcc git libtool make openssl-devel \
|
||||
readline-devel wget
|
||||
|
||||
For MacOS with Xcode and homebrew installed, it is recommended to do the
|
||||
following before building:
|
||||
For MacOS X 10.15 with Xcode and homebrew installed, it is
|
||||
recommended to do the following before building:
|
||||
|
||||
$ brew install automake openssl libtool freeipmi wget
|
||||
$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
|
||||
@ -185,7 +182,7 @@ architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS and later systems, you can create libraries and
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
|
@ -28,7 +28,7 @@
|
||||
# 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.
|
||||
|
||||
DOCDIR = $(docdir)
|
||||
DOCDIR = $(datadir)/doc/$(PACKAGE)
|
||||
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
|
||||
|
||||
EXTRA_DIST = $(DOCLIST) bootstrap
|
||||
@ -41,7 +41,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \
|
||||
$(distdir).tar.gz $(distdir).tar.bz2
|
||||
|
||||
SUBDIRS = lib src include doc contrib control
|
||||
IANA_PEN = http://www.iana.org/assignments/enterprise-numbers.txt
|
||||
IANA_PEN = http://www.iana.org/assignments/enterprise-numbers
|
||||
|
||||
dist-hook:
|
||||
cp control/ipmitool.spec $(distdir)
|
||||
|
36
configure.ac
36
configure.ac
@ -18,6 +18,8 @@ AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_CHECK_PROG([RPMBUILD], [rpmbuild], [rpmbuild], [rpm])
|
||||
AC_CHECK_PROG([SED], [sed], [sed])
|
||||
AC_CHECK_PROG([WGET], [wget], [wget])
|
||||
AC_CHECK_PROG([CURL], [curl], [curl])
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h])
|
||||
@ -54,33 +56,21 @@ if test "x$exec_prefix" = "xNONE"; then
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
|
||||
dnl allow enabling/disabling the fetching of the IANA PEN registry
|
||||
AC_ARG_ENABLE([registry-download],
|
||||
[AC_HELP_STRING([--enable-registry-download],
|
||||
[download/install the IANA PEN registry [default=yes]])],
|
||||
[xenable_registry_download=$enableval],
|
||||
[xenable_registry_download=yes])
|
||||
|
||||
AM_CONDITIONAL([DOWNLOAD], [false])
|
||||
|
||||
if test "x$xenable_registry_download" = "xyes"; then
|
||||
AC_CHECK_PROG([WGET], [wget], [wget])
|
||||
AC_CHECK_PROG([CURL], [curl], [curl])
|
||||
|
||||
if test "x$WGET" = "x" && test "x$CURL" = "x"; then
|
||||
if test "x$WGET" = "x"; then
|
||||
if test "x$CURL" = "x"; then
|
||||
AC_MSG_WARN([** Neither wget nor curl could be found.])
|
||||
AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
|
||||
else
|
||||
DOWNLOAD="$CURL --location --progress-bar"
|
||||
AM_CONDITIONAL([DOWNLOAD], [true])
|
||||
if test "x$WGET" != "x"; then
|
||||
DOWNLOAD="$WGET -c -nd -O -"
|
||||
else
|
||||
DOWNLOAD="$CURL --location --progress-bar"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
DOWNLOAD="$WGET -c -nd -O -"
|
||||
AM_CONDITIONAL([DOWNLOAD], [true])
|
||||
fi
|
||||
|
||||
AC_MSG_WARN([** Download is: $DOWNLOAD])
|
||||
AC_MSG_WARN([** Download is:])
|
||||
AC_MSG_WARN($DOWNLOAD)
|
||||
AC_SUBST(DOWNLOAD, $DOWNLOAD)
|
||||
|
||||
dnl
|
||||
@ -634,11 +624,7 @@ AC_ARG_ENABLE([ipmishell],
|
||||
|
||||
dnl check for readline library to enable ipmi shell
|
||||
if test "x$xenable_ipmishell" = "xyes"; then
|
||||
PKG_PROG_PKG_CONFIG
|
||||
PKG_CHECK_MODULES([READLINE], [readline],
|
||||
[LIBS="$LIBS $READLINE_LIBS" have_readline=yes],
|
||||
[AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])]
|
||||
)
|
||||
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
|
||||
if test "x$have_readline" != "xyes"; then
|
||||
AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
|
||||
xenable_ipmishell=no
|
||||
|
@ -89,16 +89,10 @@ struct channel_info_t {
|
||||
uint8_t aux_info[2];
|
||||
};
|
||||
|
||||
|
||||
/* (22.22 / 22.23) Set/Get Channel Access */
|
||||
typedef enum {
|
||||
ALERTING_ENABLED = 0,
|
||||
ALERTING_DISABLED = (1 << 5) /* See Table 22 */
|
||||
} alerting_t;
|
||||
|
||||
/* (22.23) Get Channel Access */
|
||||
struct channel_access_t {
|
||||
uint8_t access_mode;
|
||||
alerting_t alerting;
|
||||
uint8_t alerting;
|
||||
uint8_t channel;
|
||||
uint8_t per_message_auth;
|
||||
uint8_t privilege_limit;
|
||||
|
@ -343,6 +343,10 @@ typedef struct _power_headroom
|
||||
uint16_t peakheadroom;
|
||||
} __attribute__ ((packed)) POWER_HEADROOM;
|
||||
|
||||
struct vFlashstr {
|
||||
uint8_t val;
|
||||
const char * str;
|
||||
};
|
||||
typedef struct ipmi_vFlash_extended_info
|
||||
{
|
||||
uint8_t vflashcompcode;
|
||||
|
@ -127,7 +127,6 @@ struct fru_area_product {
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
/* See Table 16-1 of "IPMI FRU Information Storage Specification" */
|
||||
struct fru_multirec_header {
|
||||
#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00
|
||||
#define FRU_RECORD_TYPE_DC_OUTPUT 0x01
|
||||
@ -137,8 +136,6 @@ struct fru_multirec_header {
|
||||
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
|
||||
#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0
|
||||
uint8_t type;
|
||||
#define FRU_RECORD_FORMAT_EOL_MASK 0x80
|
||||
#define FRU_RECORD_FORMAT_VER_MASK 0x0F
|
||||
uint8_t format;
|
||||
uint8_t len;
|
||||
uint8_t record_checksum;
|
||||
@ -244,43 +241,6 @@ struct fru_multirec_dcload {
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
/*
|
||||
* In accordance with Table 18-7 of "IPMI Platform Management FRU Information
|
||||
* Storage Definition v1.0"
|
||||
*/
|
||||
struct fru_multirec_mgmt {
|
||||
#define FRU_MULTIREC_MGMT_SUBTYPE_MIN 0x01
|
||||
#define FRU_MULTIREC_MGMT_SUBTYPE_MAX 0x07
|
||||
uint8_t subtype;
|
||||
#define FRU_MULTIREC_MGMT_SYSURL 0x01
|
||||
#define FRU_MULTIREC_MGMT_CMPURL 0x04
|
||||
#define FRU_MULTIREC_MGMT_URL_MINLEN 16
|
||||
#define FRU_MULTIREC_MGMT_URL_MAXLEN 256
|
||||
|
||||
#define FRU_MULTIREC_MGMT_SYSNAME 0x02
|
||||
#define FRU_MULTIREC_MGMT_CMPNAME 0x05
|
||||
#define FRU_MULTIREC_MGMT_NAME_MINLEN 8
|
||||
#define FRU_MULTIREC_MGMT_NAME_MAXLEN 64
|
||||
|
||||
#define FRU_MULTIREC_MGMT_SYSPINGADDR 0x03
|
||||
#define FRU_MULTIREC_MGMT_CMPPINGADDR 0x06
|
||||
#define FRU_MULTIREC_MGMT_PINGADDR_MINLEN 8
|
||||
#define FRU_MULTIREC_MGMT_PINGADDR_MAXLEN 64
|
||||
|
||||
#define FRU_MULTIREC_MGMT_UUID 0x07
|
||||
#define FRU_MULTIREC_MGMT_UUID_LEN 16
|
||||
|
||||
#define FRU_MULTIREC_MGMT_DATA_MAXLEN FRU_MULTIREC_MGMT_URL_MAXLEN
|
||||
uint8_t data[];
|
||||
} ATTRIBUTE_PACKING;
|
||||
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
@ -211,21 +211,6 @@ typedef struct {
|
||||
|
||||
parsed_guid_t ipmi_parse_guid(void *guid, ipmi_guid_mode_t guid_mode);
|
||||
|
||||
/**
|
||||
* Convert a binary GUID/UUID to a canonical hex string form.
|
||||
* If the version/encoding of the source data is unknown,
|
||||
* dump the source data as a simple hex string.
|
||||
*
|
||||
* @param[out] str The string representation of GUID
|
||||
* @param[in] data The source binary GUID data
|
||||
* @param[in] mode The conversion mode, use GUID_AUTO for automatic detection
|
||||
*
|
||||
* @returns The parsed GUID structure
|
||||
*/
|
||||
parsed_guid_t
|
||||
ipmi_guid2str(char *str, const void *data, ipmi_guid_mode_t mode);
|
||||
#define GUID_STR_MAXLEN 36 /* 8+4+4+4+12 bytes plus the dashes */
|
||||
|
||||
int _ipmi_mc_get_guid(struct ipmi_intf *intf, ipmi_guid_t *guid);
|
||||
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
|
@ -55,7 +55,7 @@ extern const struct valstr ipmi_integrity_algorithms[];
|
||||
extern const struct valstr ipmi_encryption_algorithms[];
|
||||
extern const struct valstr ipmi_user_enable_status_vals[];
|
||||
extern const struct valstr *ipmi_oem_info;
|
||||
void ipmi_oem_info_init();
|
||||
int ipmi_oem_info_init();
|
||||
void ipmi_oem_info_free();
|
||||
|
||||
extern const struct valstr picmg_frucontrol_vals[];
|
||||
|
@ -115,7 +115,7 @@ char NIC_Selection_Mode_String_12g[] [50] = {
|
||||
"shared with failover all loms"
|
||||
};
|
||||
|
||||
const struct valstr vFlash_completion_code_vals[] = {
|
||||
const struct vFlashstr vFlash_completion_code_vals[] = {
|
||||
{0x00, "SUCCESS"},
|
||||
{0x01, "NO_SD_CARD"},
|
||||
{0x63, "UNKNOWN_ERROR"},
|
||||
@ -232,6 +232,8 @@ static void ipmi_powermonitor_usage(void);
|
||||
/* vFlash Function prototypes */
|
||||
static int ipmi_delloem_vFlash_main(struct ipmi_intf *intf, int argc,
|
||||
char **argv);
|
||||
const char *get_vFlash_compcode_str(uint8_t vflashcompcode,
|
||||
const struct vFlashstr *vs);
|
||||
static int ipmi_get_sd_card_info(struct ipmi_intf *intf);
|
||||
static int ipmi_delloem_vFlash_process(struct ipmi_intf *intf, int current_arg,
|
||||
char **argv);
|
||||
@ -3754,6 +3756,28 @@ ipmi_delloem_vFlash_main(struct ipmi_intf * intf, int __UNUSED__(argc), char **
|
||||
rc = ipmi_delloem_vFlash_process(intf, current_arg, argv);
|
||||
return rc;
|
||||
}
|
||||
/*
|
||||
* Function Name: get_vFlash_compcode_str
|
||||
*
|
||||
* Description: This function maps the vFlash completion code
|
||||
* to a string
|
||||
* Input : vFlash completion code and static array of codes vs strings
|
||||
* Output: -
|
||||
* Return: returns the mapped string
|
||||
*/
|
||||
const char *
|
||||
get_vFlash_compcode_str(uint8_t vflashcompcode, const struct vFlashstr *vs)
|
||||
{
|
||||
static char un_str[32];
|
||||
int i;
|
||||
for (i = 0; vs[i].str; i++) {
|
||||
if (vs[i].val == vflashcompcode)
|
||||
return vs[i].str;
|
||||
}
|
||||
memset(un_str, 0, 32);
|
||||
snprintf(un_str, 32, "Unknown (0x%02X)", vflashcompcode);
|
||||
return un_str;
|
||||
}
|
||||
/*
|
||||
* Function Name: ipmi_get_sd_card_info
|
||||
*
|
||||
@ -3798,7 +3822,7 @@ ipmi_get_sd_card_info(struct ipmi_intf * intf) {
|
||||
return -1;
|
||||
} else if (sdcardinfoblock->vflashcompcode != 0x00) {
|
||||
lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)",
|
||||
val2str(sdcardinfoblock->vflashcompcode,
|
||||
get_vFlash_compcode_str(sdcardinfoblock->vflashcompcode,
|
||||
vFlash_completion_code_vals));
|
||||
return -1;
|
||||
}
|
||||
|
163
lib/ipmi_fru.c
163
lib/ipmi_fru.c
@ -42,7 +42,6 @@
|
||||
#include <ipmitool/ipmi_time.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@ -141,50 +140,6 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
|
||||
uint32_t offset, uint32_t length, uint8_t *frubuf);
|
||||
void free_fru_bloc(t_ipmi_fru_bloc *bloc);
|
||||
|
||||
/**
|
||||
* Caclculate the simple FRU checksum as per IPMI FRU specification.
|
||||
* Works both for the whole FRU image and for separate areas.
|
||||
*
|
||||
* @param[in] area Pointer to the start of checksummed area,
|
||||
* the area must end with the checksum byte
|
||||
* @param[in[ len Length of the checksummed area, including
|
||||
* the trailing checksum byte
|
||||
* @returns The calculated checksum byte
|
||||
*/
|
||||
static
|
||||
uint8_t fru_calc_checksum(void *area, size_t len)
|
||||
{
|
||||
uint8_t checksum = 0;
|
||||
uint8_t * data = area;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len - 1; i++)
|
||||
checksum += data[i];
|
||||
|
||||
return -checksum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if FRU checksum is valid. Works both on the
|
||||
* whole FRU image and on separate areas.
|
||||
*
|
||||
* @param[in] area Pointer to the start of checksummed area,
|
||||
* the area must end with the checksum byte
|
||||
* @param[in[ len Length of the checksummed area, including
|
||||
* the trailing checksum byte
|
||||
* @returns The boolean state of checksum validity
|
||||
* @retval true Checksum is valid
|
||||
* @retval false Checsum in invalid
|
||||
*/
|
||||
static
|
||||
bool fru_checksum_is_valid(void *area, size_t len)
|
||||
{
|
||||
uint8_t * data = area;
|
||||
|
||||
/* Checksum is valid when the stored checksum equals calculated */
|
||||
return data[len - 1] == fru_calc_checksum(area, len);
|
||||
}
|
||||
|
||||
/* get_fru_area_str - Parse FRU area string from raw data
|
||||
*
|
||||
* @data: raw FRU data
|
||||
@ -1092,12 +1047,6 @@ fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check area checksum */
|
||||
printf(" Chassis Area Checksum : %s\n",
|
||||
fru_checksum_is_valid(fru_data, fru_len)
|
||||
? "OK"
|
||||
: "INVALID");
|
||||
|
||||
free_n(&fru_data);
|
||||
}
|
||||
|
||||
@ -1209,12 +1158,6 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check area checksum */
|
||||
printf(" Board Area Checksum : %s\n",
|
||||
fru_checksum_is_valid(fru_data, fru_len)
|
||||
? "OK"
|
||||
: "INVALID");
|
||||
|
||||
free_n(&fru_data);
|
||||
}
|
||||
|
||||
@ -1337,35 +1280,9 @@ fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check area checksum */
|
||||
printf(" Product Area Checksum : %s\n",
|
||||
fru_checksum_is_valid(fru_data, fru_len)
|
||||
? "OK"
|
||||
: "INVALID");
|
||||
|
||||
free_n(&fru_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take n bytes from src and convert them into hex doublets in dst
|
||||
*
|
||||
* The function is invoked from a place where the dst is known to
|
||||
* have enough space to accomodate the hex string representation
|
||||
* of a UUID.
|
||||
*
|
||||
* @param[out] dst The destination buffer (at least 33 bytes long)
|
||||
* @param[in] src The source binary data
|
||||
* @param[in] n The length of the source data, for compatibility
|
||||
* with strncpy() on calls from fru_area_print_multirec()
|
||||
*/
|
||||
static
|
||||
char *
|
||||
uuidstrncpy(char *dst, const char *src, size_t n)
|
||||
{
|
||||
(void)ipmi_guid2str(dst, src, GUID_AUTO);
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* fru_area_print_multirec - Print FRU Multi Record Area
|
||||
*
|
||||
* @intf: ipmi interface
|
||||
@ -1550,86 +1467,8 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRU_RECORD_TYPE_MANAGEMENT_ACCESS:
|
||||
{
|
||||
struct fru_multirec_mgmt *mmh =
|
||||
(struct fru_multirect_mgmt *)
|
||||
&fru_data[sizeof(struct fru_multirec_header)];
|
||||
size_t datalen = h->len - sizeof(*mmh);
|
||||
struct {
|
||||
unsigned char *name;
|
||||
size_t minlen;
|
||||
size_t maxlen;
|
||||
char * (*convert)(char *, const char *, size_t);
|
||||
} subtypes[FRU_MULTIREC_MGMT_SUBTYPE_MAX + 1] = {
|
||||
[FRU_MULTIREC_MGMT_SYSURL] = {
|
||||
"System Management URL",
|
||||
FRU_MULTIREC_MGMT_URL_MINLEN,
|
||||
FRU_MULTIREC_MGMT_URL_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_SYSNAME] = {
|
||||
"System Name",
|
||||
FRU_MULTIREC_MGMT_NAME_MINLEN,
|
||||
FRU_MULTIREC_MGMT_NAME_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_SYSPINGADDR] = {
|
||||
"System Ping Address",
|
||||
FRU_MULTIREC_MGMT_PINGADDR_MINLEN,
|
||||
FRU_MULTIREC_MGMT_PINGADDR_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_CMPURL] = {
|
||||
"Component Management URL",
|
||||
FRU_MULTIREC_MGMT_URL_MINLEN,
|
||||
FRU_MULTIREC_MGMT_URL_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_CMPNAME] = {
|
||||
"Component Name",
|
||||
FRU_MULTIREC_MGMT_NAME_MINLEN,
|
||||
FRU_MULTIREC_MGMT_NAME_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_CMPPINGADDR] = {
|
||||
"Component Ping Address",
|
||||
FRU_MULTIREC_MGMT_PINGADDR_MINLEN,
|
||||
FRU_MULTIREC_MGMT_PINGADDR_MAXLEN,
|
||||
strncpy
|
||||
},
|
||||
[FRU_MULTIREC_MGMT_UUID] = {
|
||||
"System Unique ID",
|
||||
FRU_MULTIREC_MGMT_UUID_LEN,
|
||||
FRU_MULTIREC_MGMT_UUID_LEN,
|
||||
uuidstrncpy
|
||||
}
|
||||
};
|
||||
unsigned char string[FRU_MULTIREC_MGMT_DATA_MAXLEN + 1] = { 0 };
|
||||
|
||||
if (mmh->subtype < FRU_MULTIREC_MGMT_SUBTYPE_MIN ||
|
||||
mmh->subtype > FRU_MULTIREC_MGMT_SUBTYPE_MAX)
|
||||
{
|
||||
lprintf(LOG_WARN, "Unsupported subtype 0x%02x found for "
|
||||
"multi-record area management record\n",
|
||||
mmh->subtype);
|
||||
break;
|
||||
}
|
||||
|
||||
if (datalen < subtypes[mmh->subtype].minlen ||
|
||||
datalen > subtypes[mmh->subtype].maxlen)
|
||||
{
|
||||
lprintf(LOG_WARN,
|
||||
"Wrong data length %zu, must be %zu < X < %zu\n",
|
||||
datalen,
|
||||
subtypes[mmh->subtype].minlen,
|
||||
subtypes[mmh->subtype].maxlen);
|
||||
}
|
||||
subtypes[mmh->subtype].convert(string, mmh->data, datalen);
|
||||
printf(" %-22s: %s\n", subtypes[mmh->subtype].name, string);
|
||||
}
|
||||
}
|
||||
} while (!(h->format & FRU_RECORD_FORMAT_EOL_MASK));
|
||||
} while (!(h->format & 0x80));
|
||||
|
||||
lprintf(LOG_DEBUG ,"Multi-Record area ends at: %i (%xh)", last_off, last_off);
|
||||
|
||||
|
@ -1026,10 +1026,10 @@ ipmi_set_alert_enable(struct ipmi_intf *intf, uint8_t channel, uint8_t enable)
|
||||
channel);
|
||||
return (-1);
|
||||
}
|
||||
if (enable) {
|
||||
channel_access.alerting = ALERTING_ENABLED;
|
||||
if (enable != 0) {
|
||||
channel_access.alerting = 1;
|
||||
} else {
|
||||
channel_access.alerting = ALERTING_DISABLED;
|
||||
channel_access.alerting = 0;
|
||||
}
|
||||
/* non-volatile */
|
||||
ccode = _ipmi_set_channel_access(intf, channel_access, 1, 0);
|
||||
|
@ -853,7 +853,10 @@ ipmi_main(int argc, char ** argv,
|
||||
}
|
||||
|
||||
/* load the IANA PEN registry */
|
||||
ipmi_oem_info_init();
|
||||
if (ipmi_oem_info_init()) {
|
||||
lprintf(LOG_ERR, "Failed to initialize the OEM info dictionary");
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* run OEM setup if found */
|
||||
if (oemtype &&
|
||||
|
@ -696,27 +696,6 @@ out:
|
||||
return parsed_guid;
|
||||
}
|
||||
|
||||
parsed_guid_t
|
||||
ipmi_guid2str(char *str, const void *data, ipmi_guid_mode_t mode)
|
||||
{
|
||||
parsed_guid_t guid;
|
||||
guid = ipmi_parse_guid(data, mode);
|
||||
|
||||
if (GUID_DUMP == guid.mode) {
|
||||
sprintf(str, "%s", buf2str(data, sizeof(ipmi_guid_t)));
|
||||
return guid;
|
||||
}
|
||||
|
||||
sprintf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
|
||||
(int)guid.time_low,
|
||||
(int)guid.time_mid,
|
||||
(int)guid.time_hi_and_version,
|
||||
(int)guid.clock_seq_and_rsvd,
|
||||
(int)guid.node[0], (int)guid.node[1], (int)guid.node[2],
|
||||
(int)guid.node[3], (int)guid.node[4], (int)guid.node[5]);
|
||||
return guid;
|
||||
}
|
||||
|
||||
/* ipmi_mc_print_guid - print-out given BMC GUID
|
||||
*
|
||||
* @param[in] intf - The IPMI interface to request GUID from
|
||||
@ -761,11 +740,24 @@ ipmi_mc_print_guid(struct ipmi_intf *intf, ipmi_guid_mode_t guid_mode)
|
||||
|
||||
printf("System GUID : ");
|
||||
|
||||
char buf[GUID_STR_MAXLEN + 1];
|
||||
guid = ipmi_guid2str(buf, guid_data, guid_mode);
|
||||
printf("%s\n", buf);
|
||||
guid = ipmi_parse_guid(guid_data, guid_mode);
|
||||
if (GUID_DUMP == guid.mode) {
|
||||
size_t i;
|
||||
for (i = 0; i < sizeof(guid_data); ++i) {
|
||||
printf("%02X", guid_data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x\n",
|
||||
(int)guid.time_low,
|
||||
(int)guid.time_mid,
|
||||
(int)guid.time_hi_and_version,
|
||||
guid.clock_seq_and_rsvd,
|
||||
guid.node[0], guid.node[1], guid.node[2],
|
||||
guid.node[3], guid.node[4], guid.node[5]);
|
||||
|
||||
/* Print the GUID properties */
|
||||
if (GUID_AUTO == guid_mode) {
|
||||
/* ipmi_parse_guid() returns only valid modes in guid.ver */
|
||||
printf("GUID Encoding : %s", guid_mode_str[guid.mode]);
|
||||
|
@ -1719,30 +1719,39 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
void ipmi_oem_info_init()
|
||||
int ipmi_oem_info_init()
|
||||
{
|
||||
oem_valstr_list_t terminator = { { -1, NULL}, NULL }; /* Terminator */
|
||||
oem_valstr_list_t *oemlist = &terminator;
|
||||
bool free_strings = true;
|
||||
int count;
|
||||
size_t count;
|
||||
int rc = -4;
|
||||
|
||||
lprintf(LOG_INFO, "Loading IANA PEN Registry...");
|
||||
|
||||
if (ipmi_oem_info) {
|
||||
lprintf(LOG_INFO, "IANA PEN Registry is already loaded");
|
||||
rc = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((count = oem_info_list_load(&oemlist)) < 1) {
|
||||
lprintf(LOG_WARN, "Failed to load entries from IANA PEN Registry");
|
||||
count = 0;
|
||||
if (!(count = oem_info_list_load(&oemlist))) {
|
||||
/*
|
||||
* We can't identify OEMs without a loaded registry.
|
||||
* Set the pointer to dummy and return.
|
||||
*/
|
||||
ipmi_oem_info = ipmi_oem_info_dummy;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* In the array was allocated, don't free the strings at cleanup */
|
||||
free_strings = !oem_info_init_from_list(oemlist, count);
|
||||
|
||||
rc = IPMI_CC_OK;
|
||||
|
||||
out:
|
||||
oem_info_list_free(&oemlist, free_strings);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void ipmi_oem_info_free()
|
||||
|
@ -1727,7 +1727,6 @@ ipmi_lanplus_build_v2x_msg(
|
||||
*/
|
||||
if (session->v2_data.session_state == LANPLUS_STATE_ACTIVE)
|
||||
{
|
||||
uint16_t old_payload_length = payload->payload_length;
|
||||
/* Payload len is adjusted as necessary by lanplus_encrypt_payload */
|
||||
lanplus_encrypt_payload(session->v2_data.crypt_alg, /* input */
|
||||
session->v2_data.k2, /* input */
|
||||
@ -1736,24 +1735,6 @@ ipmi_lanplus_build_v2x_msg(
|
||||
msg + IPMI_LANPLUS_OFFSET_PAYLOAD, /* output */
|
||||
&(payload->payload_length)); /* output */
|
||||
|
||||
if (old_payload_length != payload->payload_length)
|
||||
{
|
||||
len =
|
||||
IPMI_LANPLUS_OFFSET_PAYLOAD +
|
||||
payload->payload_length +
|
||||
IPMI_MAX_INTEGRITY_PAD_SIZE +
|
||||
IPMI_LANPLUS_PAD_LENGTH_SIZE +
|
||||
IPMI_LANPLUS_NEXT_HEADER_SIZE +
|
||||
IPMI_MAX_AUTH_CODE_SIZE;
|
||||
|
||||
uint8_t * new_msg = realloc(msg, len);
|
||||
if (!new_msg) {
|
||||
free(msg);
|
||||
lprintf(LOG_ERR, "ipmitool: realloc failure");
|
||||
return;
|
||||
}
|
||||
msg = new_msg;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we know the payload length */
|
||||
|
@ -86,8 +86,6 @@
|
||||
#define IPMI_LANPLUS_OFFSET_PAYLOAD_SIZE 0x0E
|
||||
#define IPMI_LANPLUS_OFFSET_PAYLOAD 0x10
|
||||
|
||||
#define IPMI_LANPLUS_PAD_LENGTH_SIZE 1
|
||||
#define IPMI_LANPLUS_NEXT_HEADER_SIZE 1
|
||||
|
||||
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user