fix gcc4 + buildcheck compile problems

This commit is contained in:
Duncan Laurie 2006-03-19 21:15:06 +00:00
parent c65b206144
commit 21fb127ce2
19 changed files with 225 additions and 253 deletions

View File

@ -11,6 +11,7 @@ version 1.8.7
* Add support for setting VLAN id and priority
* Add support for FreeBSD OpenIPMI-compatible driver
* Add support for IPMIv2 Firmware Firewall
* Fix gcc4 compile warnings
version 1.8.6
* Fix memory corruption when sending encrypted SOL traffic

View File

@ -104,7 +104,7 @@ static inline int bit_test(const unsigned char * bf, int n) {
return !!(bf[n>>3]&(1<<(n%8)));
}
static inline void bit_set(unsigned char * bf, int n, int v) {
bf[n>>3] = bf[n>>3] & ~(1<<(n%8)) | (v?1:0)<<(n%8);
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
}
#endif /*IPMI_FIREWALL_H */

View File

@ -57,7 +57,7 @@ struct picmg_set_fru_activation_cmd {
/* the LED color capabilities */
static const char* led_color_str[] = {
static const char* led_color_str[] __attribute__((unused)) = {
"reserved",
"BLUE",
"RED",

View File

@ -148,7 +148,7 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
if (title != NULL) {
if (loglevel < 0)
printf("\n%s:\n\n");
printf("\n%s:\n\n", title);
else
lprintf(loglevel, "\n%s:\n", title);
}
@ -197,7 +197,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
if (title != NULL) {
if (loglevel < 0)
printf("\n%s:\n\n");
printf("\n%s:\n\n", title);
else
lprintf(loglevel, "\n%s:\n", title);
}

View File

@ -497,6 +497,8 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f,
(rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked");
printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2));
return 0;
}
static int

View File

@ -53,7 +53,7 @@
#include <ipmitool/ipmi_sdr.h>
static int
static void
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
{
struct sel_event_record sel_event;

View File

@ -555,7 +555,6 @@ _get_subfn_support(struct ipmi_intf * intf,
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[4];
unsigned int c;
if (!p || !cmd) {
lprintf(LOG_ERR, "_get_subfn_support: p or cmd is NULL");
@ -603,7 +602,6 @@ _get_subfn_configurable(struct ipmi_intf * intf,
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[4];
unsigned int c;
if (!p || !cmd) {
lprintf(LOG_ERR, "_get_subfn_configurable: p or cmd is NULL");
@ -651,7 +649,6 @@ _get_subfn_enables(struct ipmi_intf * intf,
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[4];
unsigned int c;
if (!p || !cmd) {
lprintf(LOG_ERR, "_get_subfn_enables: p or cmd is NULL");
@ -700,7 +697,7 @@ _set_subfn_enables(struct ipmi_intf * intf,
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char * d, rqdata[8];
unsigned char rqdata[8];
unsigned int c;
if (!p || !cmd) {
@ -762,76 +759,78 @@ _set_subfn_enables(struct ipmi_intf * intf,
*/
static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p, struct bmc_fn_support * bmc)
{
int ret, i, l, n;
unsigned char lun[MAX_LUN], netfn[16];
int ret, l, n;
unsigned char lun[MAX_LUN], netfn[16];
ret = _get_netfn_support(intf, p->channel, lun, netfn);
if (!ret) {
for (l=0; l<MAX_LUN; l++) {
if (p->lun >= 0 && p->lun != l)
continue;
bmc->lun[l].support = lun[l];
if (lun[l]) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
int offset = l*MAX_NETFN_PAIR+n;
bmc->lun[l].netfn[n].support =
!!(netfn[offset>>3] & (1<<(offset%8)));
}
}
}
}
if (p->netfn >= 0) {
if (!((p->lun < 0 || bmc->lun[p->lun].support) &&
(p->netfn < 0 || bmc->lun[p->lun].netfn[p->netfn>>1].support))) {
lprintf(LOG_ERR, "LUN or LUN/NetFn pair %d,%d not supported", p->lun, p->netfn);
return 0;
}
ret = _get_command_support(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
ret |= _get_command_enables(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
if (!ret && p->command >= 0) {
ret = _get_subfn_support(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
ret |= _get_subfn_configurable(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
ret |= _get_subfn_enables(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
}
}
else if (p->lun >= 0) {
l = p->lun;
if (bmc->lun[l].support) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
p->netfn = n*2;
if (bmc->lun[l].netfn[n].support) {
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
}
if (ret)
bmc->lun[l].netfn[n].support = 0;
}
}
p->netfn = -1;
} else {
for (l=0; l<4; l++) {
p->lun = l;
if (bmc->lun[l].support) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
p->netfn = n*2;
if (bmc->lun[l].netfn[n].support) {
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
}
if (ret)
bmc->lun[l].netfn[n].support = 0;
}
}
}
p->lun = -1;
p->netfn = -1;
}
ret = _get_netfn_support(intf, p->channel, lun, netfn);
if (!ret) {
for (l=0; l<MAX_LUN; l++) {
if (p->lun >= 0 && p->lun != l)
continue;
bmc->lun[l].support = lun[l];
if (lun[l]) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
int offset = l*MAX_NETFN_PAIR+n;
bmc->lun[l].netfn[n].support =
!!(netfn[offset>>3] & (1<<(offset%8)));
}
}
}
}
if (p->netfn >= 0) {
if (!((p->lun < 0 || bmc->lun[p->lun].support) &&
(p->netfn < 0 || bmc->lun[p->lun].netfn[p->netfn>>1].support))) {
lprintf(LOG_ERR, "LUN or LUN/NetFn pair %d,%d not supported", p->lun, p->netfn);
return 0;
}
ret = _get_command_support(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
ret |= _get_command_enables(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
if (!ret && p->command >= 0) {
ret = _get_subfn_support(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
ret |= _get_subfn_configurable(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
ret |= _get_subfn_enables(intf, p,
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
}
}
else if (p->lun >= 0) {
l = p->lun;
if (bmc->lun[l].support) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
p->netfn = n*2;
if (bmc->lun[l].netfn[n].support) {
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
}
if (ret)
bmc->lun[l].netfn[n].support = 0;
}
}
p->netfn = -1;
} else {
for (l=0; l<4; l++) {
p->lun = l;
if (bmc->lun[l].support) {
for (n=0; n<MAX_NETFN_PAIR; n++) {
p->netfn = n*2;
if (bmc->lun[l].netfn[n].support) {
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
}
if (ret)
bmc->lun[l].netfn[n].support = 0;
}
}
}
p->lun = -1;
p->netfn = -1;
}
return 0;
}
/* ipmi_firewall_info - print out info for firewall functions
@ -846,7 +845,7 @@ static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p
static int
ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
{
int ret, i;
int ret = 0;
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
struct bmc_fn_support * bmc_fn_support;
unsigned int l, n, c;
@ -968,8 +967,6 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
static int
ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
struct bmc_fn_support * bmc_fn_support;
unsigned int l, n, c, ret;
@ -1058,8 +1055,6 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
static int
ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
struct bmc_fn_support * bmc_fn_support;
unsigned int l, n, c, ret;

View File

@ -834,7 +834,7 @@ static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int leng
case FRU_PICMG_BACKPLANE_P2P:
{
unsigned char index, index2;
unsigned char index;
struct fru_picmgext_slot_desc * slot_d
= (struct fru_picmgext_slot_desc*) &fru_data[offset];
@ -1026,7 +1026,7 @@ static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int leng
{
unsigned int index;
for(offset; offset < off + length; )
for(; offset < off + length; )
{
struct fru_picmgext_carrier_p2p_record * h =
(struct fru_picmgext_carrier_p2p_record *) &fru_data[offset];
@ -1427,13 +1427,9 @@ static void ipmi_fru_read_to_bin(struct ipmi_intf * intf, char * pFileName, unsi
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char * fru_data;
struct fru_info fru;
unsigned char msg_data[4];
unsigned char * pFruBuf;
unsigned int counter;
unsigned int len;
msg_data[0] = fruId;
@ -1496,7 +1492,6 @@ static void ipmi_fru_write_from_bin(struct ipmi_intf * intf,
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
unsigned char *fru_data;
struct fru_info fru;
unsigned char msg_data[4];
@ -1560,34 +1555,34 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
unsigned int retStatus = 0;
unsigned long offFruMultiRec;
unsigned long fruMultiRecSize = 0;
unsigned long offFileMultiRec;
unsigned long offFileMultiRec = 0;
unsigned long fileMultiRecSize = 0;
struct fru_info fruInfo;
unsigned char *buf = NULL;
retStatus =
ipmi_fru_get_multirec_location_from_fru(intf, fruId, &fruInfo,
&offFruMultiRec,
&fruMultiRecSize);
ipmi_fru_get_multirec_location_from_fru(intf, fruId, &fruInfo,
&offFruMultiRec,
&fruMultiRecSize);
if (verbose) {
printf("FRU Size : %u\n\r", fruMultiRecSize);
printf("Multi Rec offset: %u\n\r", offFruMultiRec);
printf("FRU Size : %lu\n\r", fruMultiRecSize);
printf("Multi Rec offset: %lu\n\r", offFruMultiRec);
}
if (retStatus == 0) {
retStatus =
ipmi_fru_get_multirec_size_from_file(pFileName,
&fileMultiRecSize,
&offFileMultiRec);
ipmi_fru_get_multirec_size_from_file(pFileName,
&fileMultiRecSize,
&offFileMultiRec);
}
if (retStatus == 0) {
buf = malloc(fileMultiRecSize);
if (buf) {
retStatus =
ipmi_fru_get_multirec_from_file(pFileName, buf,
fileMultiRecSize,
offFileMultiRec);
ipmi_fru_get_multirec_from_file(pFileName, buf,
fileMultiRecSize,
offFileMultiRec);
} else {
printf("Error allocating memory for multirec buffer\n");
@ -1595,10 +1590,10 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
}
}
if(retStatus == 0)
{
ipmi_fru_get_adjust_size_from_buffer(buf, &fileMultiRecSize);
}
if(retStatus == 0)
{
ipmi_fru_get_adjust_size_from_buffer(buf, &fileMultiRecSize);
}
if ((retStatus == 0) && (buf)) {
write_fru_area(intf, &fruInfo, fruId, 0, offFruMultiRec,
@ -1608,14 +1603,16 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
if (buf) {
free(buf);
}
if(retStatus == 0 )
{
lprintf(LOG_INFO, "Done");
}
else
{
lprintf(LOG_ERR, "Failed");
}
if(retStatus == 0 )
{
lprintf(LOG_INFO, "Done");
}
else
{
lprintf(LOG_ERR, "Failed");
}
return 0;
}
static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
@ -1625,7 +1622,7 @@ static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
struct fru_header header;
FILE * pFile;
unsigned char len = 0;
unsigned long end;
unsigned long end = 0;
*pSize = 0;
@ -1642,7 +1639,7 @@ static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
if(verbose)
{
printf("File Size = %lu\n", end);
printf("Len = %lu\n", len);
printf("Len = %d\n", len);
}
@ -1698,7 +1695,6 @@ static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * fru_data,
unsigned long *pSize)
{
struct fru_multirec_header * head;
unsigned int last_off;
#define CHUNK_SIZE (255 + sizeof(struct fru_multirec_header))
unsigned int count = 0;
unsigned int status = 0;
@ -1766,7 +1762,7 @@ static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * fru_data,
if (verbose > 1)
{
printf("Size of multirec: %u\n\r", *pSize);
printf("Size of multirec: %lu\n\r", *pSize);
}
}
@ -1776,10 +1772,8 @@ static int ipmi_fru_get_multirec_from_file(char * pFileName,
unsigned long size,
unsigned long offset)
{
struct fru_header header;
FILE * pFile;
unsigned long len = 0;
pFile = fopen(pFileName,"rb");
if(pFile!=NULL)
@ -1812,12 +1806,8 @@ static int ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char * fru_data;
unsigned char msg_data[4];
int i, len;
unsigned long end;
struct fru_header header;
*pRetLocation = 0;

View File

@ -50,6 +50,7 @@
#include <string.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
@ -111,8 +112,6 @@ typedef struct sKFWUM_InFirmwareInfo {
extern int verbose;
static char fileName[512];
static unsigned char firmBuf[1024 * 512];
static unsigned char firmMaj;
static unsigned char firmMinSub;
static void KfwumOutputHelp(void);
static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task);
@ -264,8 +263,8 @@ KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task)
{
tKFWUM_Status status = KFWUM_STATUS_OK;
tKFWUM_BoardInfo boardInfo;
tKFWUM_InFirmwareInfo firmInfo;
unsigned long fileSize;
tKFWUM_InFirmwareInfo firmInfo = { 0 };
unsigned long fileSize = 0;
static unsigned short padding;
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_INFO)) {
@ -444,7 +443,7 @@ KfwumShowProgress(const char *task, unsigned long current,
spaces[(PROG_LENGTH - hash)] = '\0';
printf("%s", spaces);
printf(" %3d %%\r", progress); /* total 7 bytes */
printf(" %3ld %%\r", progress); /* total 7 bytes */
if (progress == 100) {
printf("\n");
@ -557,8 +556,6 @@ KfwumGetDeviceInfo(struct ipmi_intf *intf,
}
if (status == KFWUM_STATUS_OK) {
unsigned long manufId;
unsigned short boardId;
pGetDevId = (struct ipm_devid_rsp *) rsp->data;
pBoardInfo->iana =
IPM_DEV_MANUFACTURER_ID(pGetDevId->manufacturer_id);
@ -654,7 +651,7 @@ KfwumGetStatus(struct ipmi_intf *intf)
firmLength |= pGetStatus->firmLengthLSB;
printf
("Firmware Length : %d bytes\n",
("Firmware Length : %ld bytes\n",
firmLength);
printf
("Firmware Revision : %u.%u%u SDR %u\n",
@ -741,7 +738,6 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf,
struct KfwumSaveFirmwareDownloadReq thisReq;
unsigned char out = 0;
unsigned char retry = 0;
unsigned char counter;
do {
thisReq.addressLSB = address & 0x000000ff;
@ -849,9 +845,6 @@ KfwumUploadFirmware(struct ipmi_intf *intf,
unsigned char retry = 0;
do {
unsigned char bytes;
unsigned char chksum = 0;
writeSize = KFWUM_BUFFER - KFWUM_CMD_OVERHEAD; /* Max */
/* Reach the end */
@ -1128,8 +1121,10 @@ KfwumOutputInfo(tKFWUM_BoardInfo boardInfo, tKFWUM_InFirmwareInfo firmInfo)
printf("Target Board Id : %u\n", boardInfo.boardId);
printf("Target IANA number : %u\n", boardInfo.iana);
printf("File Size : %u bytes\n", firmInfo.fileSize);
printf("File Size : %lu bytes\n", firmInfo.fileSize);
printf("Firmware Version : %d.%d%d SDR %d\n",
firmInfo.versMajor, firmInfo.versMinor, firmInfo.versSubMinor,
firmInfo.sdrRev);
return KFWUM_STATUS_OK;
}

View File

@ -1644,6 +1644,7 @@ ipmi_lan_alert_print(struct ipmi_intf * intf, uint8_t channel, uint8_t alert)
paddr->data[10], paddr->data[11], paddr->data[12]);
printf("\n");
return 0;
}
static int
@ -1837,7 +1838,6 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
{
uint8_t alert;
uint8_t channel = 1;
struct lan_param * p;
if (argc < 1 ||
strncasecmp(argv[0], "help", 4) == 0) {
@ -1908,9 +1908,12 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
static int
ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
{
struct lan_param * p;
uint8_t medium;
int rc = 0;
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[2];
uint16_t statsTemp;
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
lprintf(LOG_ERR, "Invalid Channel %d", chan);
@ -1926,76 +1929,67 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
return -1;
}
{
/* From here, we are ready to get the stats */
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[2];
uint16_t statsTemp;
uint16_t * pStatsTemp;
/* From here, we are ready to get the stats */
msg_data[0] = chan;
msg_data[1] = 0; /* Don't clear */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_STAT;
req.msg.data = msg_data;
req.msg.data_len = 2;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_INFO, "Get LAN Stats command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
if (verbose > 1)
{
uint8_t counter;
printf("--- Rx Stats ---\n");
for(counter=0;counter<18;counter+=2)
{
printf("%02X", *(rsp->data + counter));
printf(" %02X - ", *(rsp->data + counter+1));
}
printf("\n");
}
msg_data[0] = chan;
msg_data[1] = 0; /* Don't clear */
statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1));
printf("IP Rx Packet : %d\n", statsTemp);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_STAT;
req.msg.data = msg_data;
req.msg.data_len = 2;
statsTemp = ((*(rsp->data + 2)) << 8) | (*(rsp->data + 3));
printf("IP Rx Header Errors : %u\n", statsTemp);
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_INFO, "Get LAN Stats command failed");
return 0;
}
statsTemp = ((*(rsp->data + 4)) << 8) | (*(rsp->data + 5));
printf("IP Rx Address Errors : %u\n", statsTemp);
if (rsp->ccode > 0) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
if (verbose > 1)
{
uint8_t counter;
printf("--- Rx Stats ---\n");
for(counter=0;counter<18;counter+=2)
{
printf("%02X", *(rsp->data + counter));
printf(" %02X - ", *(rsp->data + counter+1));
}
printf("\n");
}
statsTemp = ((*(rsp->data + 6)) << 8) | (*(rsp->data + 7));
printf("IP Rx Fragmented : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1));
printf("IP Rx Packet : %d\n", statsTemp);
statsTemp = ((*(rsp->data + 8)) << 8) | (*(rsp->data + 9));
printf("IP Tx Packet : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 2)) << 8) | (*(rsp->data + 3));
printf("IP Rx Header Errors : %u\n", statsTemp);
statsTemp = ((*(rsp->data +10)) << 8) | (*(rsp->data +11));
printf("UDP Rx Packet : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 4)) << 8) | (*(rsp->data + 5));
printf("IP Rx Address Errors : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 12)) << 8) | (*(rsp->data + 13));
printf("RMCP Rx Valid : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 6)) << 8) | (*(rsp->data + 7));
printf("IP Rx Fragmented : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 14)) << 8) | (*(rsp->data + 15));
printf("UDP Proxy Packet Received : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 8)) << 8) | (*(rsp->data + 9));
printf("IP Tx Packet : %u\n", statsTemp);
statsTemp = ((*(rsp->data +10)) << 8) | (*(rsp->data +11));
printf("UDP Rx Packet : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 12)) << 8) | (*(rsp->data + 13));
printf("RMCP Rx Valid : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 14)) << 8) | (*(rsp->data + 15));
printf("UDP Proxy Packet Received : %u\n", statsTemp);
statsTemp = ((*(rsp->data + 16)) << 8) | (*(rsp->data + 17));
printf("UDP Proxy Packet Dropped : %u\n", statsTemp);
}
statsTemp = ((*(rsp->data + 16)) << 8) | (*(rsp->data + 17));
printf("UDP Proxy Packet Dropped : %u\n", statsTemp);
return rc;
}
@ -2004,9 +1998,11 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
static int
ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
{
struct lan_param * p;
uint8_t medium;
int rc = 0;
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[2];
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
lprintf(LOG_ERR, "Invalid Channel %d", chan);
@ -2022,36 +2018,27 @@ ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
return -1;
}
{
/* From here, we are ready to get the stats */
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[2];
uint16_t statsTemp;
uint16_t * pStatsTemp;
/* From here, we are ready to get the stats */
msg_data[0] = chan;
msg_data[1] = 1; /* Clear */
msg_data[0] = chan;
msg_data[1] = 1; /* Clear */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_STAT;
req.msg.data = msg_data;
req.msg.data_len = 2;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_STAT;
req.msg.data = msg_data;
req.msg.data_len = 2;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_INFO, "Get LAN Stats command failed");
return 0;
}
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_INFO, "Get LAN Stats command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
}
if (rsp->ccode > 0) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
return rc;
}

View File

@ -9,7 +9,7 @@
#include <ipmitool/ipmi_fru.h> /* for access to link descriptor defines */
int
void
ipmi_picmg_help (void)
{
printf(" properties - get PICMG properties\n");
@ -120,6 +120,8 @@ ipmi_picmg_properties(struct ipmi_intf * intf)
printf("PICMG Ext. Version : %i.%i\n", rsp->data[1]&0x0f, (rsp->data[1]&0xf0) >> 4);
printf("Max FRU Device ID : 0x%02x\n", rsp->data[2]);
printf("FRU Device ID : 0x%02x\n", rsp->data[3]);
return 0;
}
@ -190,7 +192,7 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
}
printf("Activation Policy for FRU %x: ", atoi(argv[0]) );
printf(" %s\n",(*(rsp->data+3)&0x01 == 0x01)?"is locked":"is not locked");
printf(" %s\n",(((*(rsp->data+3))&0x01) == 0x01)?"is locked":"is not locked");
return 0;
}
@ -410,7 +412,7 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
printf("LED Color Capabilities: ", rsp->data[1] );
printf("LED Color Capabilities: ");
for ( i=0 ; i<8 ; i++ ) {
if ( rsp->data[1] & (0x01 << i) ) {
printf("%s, ", led_color_str[ i ]);
@ -428,7 +430,6 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
int
ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
{
int i;
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -482,7 +483,6 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
int
ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
{
int i;
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -566,7 +566,7 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
int
ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
{
int rc;
int rc = 0;
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
ipmi_picmg_help();

View File

@ -215,8 +215,6 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
struct ipmi_rq req;
uint8_t netfn, cmd, lun;
int i;
unsigned long ufn;
uint8_t data[256];
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {

View File

@ -922,7 +922,6 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
int i = 0, validread = 1, do_unit = 1;
double val = 0.0, creading = 0.0;
struct ipmi_rs *rsp;
uint8_t min_reading, max_reading;
if (sensor == NULL)
return -1;

View File

@ -34,6 +34,7 @@
#include <math.h>
#define __USE_XOPEN /* glibc2 needs this for strptime */
#include <time.h>
#include <ctype.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
@ -46,11 +47,9 @@
#include <ipmitool/ipmi_sensor.h>
extern int verbose;
static int sel_extended = 0;
static FILE * fp;
static int sel_oem_nrecs = 0;
struct ipmi_sel_oem_msg_rec {
int value[14];
char *string[14];
@ -112,15 +111,17 @@ int ipmi_sel_oem_init(const char * filename)
fp = ipmi_open_file_read(filename);
if (fp == NULL) {
lprintf(LOG_ERR, "Could not open %s file", filename);
return;
return -1;
}
/* count number of records (lines) in input file */
sel_oem_nrecs = 0;
while (fscanf(fp, "%*[^\n]\n", buf[0]) == 0) {
while (fscanf(fp, "%*[^\n]\n") == 0) {
sel_oem_nrecs++;
}
printf("nrecs=%d\n", sel_oem_nrecs);
rewind(fp);
sel_oem_msg = (struct ipmi_sel_oem_msg_rec *)calloc(sel_oem_nrecs,
sizeof(struct ipmi_sel_oem_msg_rec));
@ -149,7 +150,7 @@ int ipmi_sel_oem_init(const char * filename)
}
}
free (sel_oem_msg);
return;
return -1;
}
for (byte = 3; byte < 17; byte++) {
@ -164,8 +165,10 @@ int ipmi_sel_oem_init(const char * filename)
sel_oem_msg[i].text = (char *)malloc(strlen(buf[SEL_BYTE(17)]) + 1);
strcpy(sel_oem_msg[i].text, buf[SEL_BYTE(17)]);
}
fclose(fp);
fp = NULL;
return 0;
}
static void ipmi_sel_oem_message(struct sel_event_record * evt, int verbose)
@ -267,8 +270,6 @@ ipmi_get_oem(struct ipmi_intf * intf)
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipm_devid_rsp *devid;
uint32_t manufacturer_id;
int i;
if (intf->fd == 0)
return IPMI_OEM_UNKNOWN;
@ -475,6 +476,8 @@ ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
case IPMI_OEM_NEWISYS:
desc = get_newisys_evt_desc(intf, rec);
break;
default:
break;
}
return desc;
@ -1086,12 +1089,13 @@ ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_
{
struct sdr_record_list * sdr;
char * description;
int data_count;
if (!evt)
return;
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.sensor_num, evt->sel_type.standard_type.sensor_type);
sdr = ipmi_sdr_find_sdr_bynumtype(intf,
evt->sel_type.standard_type.sensor_num,
evt->sel_type.standard_type.sensor_type);
if (sdr == NULL) {
ipmi_sel_print_std_entry_verbose(intf, evt);
return;
@ -1635,7 +1639,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
msg_data[0] = id & 0xff;
msg_data[1] = id >> 8;
for (argc; argc != 0; argc--)
for (; argc != 0; argc--)
{
id = atoi(argv[argc-1]);
msg_data[2] = id & 0xff;

View File

@ -732,7 +732,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
{
struct sdr_record_list *sdr;
struct ipmi_rs *rsp;
int i, v, rc=0;
int i, rc=0;
double val = 0.0;
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {

View File

@ -1243,7 +1243,7 @@ processSolUserInput(
*/
if (length)
{
struct ipmi_rs * rsp;
struct ipmi_rs * rsp = NULL;
int try = 0;
while (try < intf->session->retry) {

View File

@ -47,9 +47,11 @@
#include <sys/select.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#ifdef __linux__
# include <linux/termios.h>
# include <termios.h>
//# include <linux/termios.h>
#else
# include <sys/termios.h>
#endif
@ -381,7 +383,6 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
struct pollfd fds_wait[3], fds_data_wait[3], *fds;
struct sockaddr_in sin, myaddr;
socklen_t mylen;
char recvip_c[] = "0.0.0.0";
char *recvip = NULL;
char out_buff[IPMI_BUF_SIZE * 8], in_buff[IPMI_BUF_SIZE];
char buff[IPMI_BUF_SIZE + 4];

View File

@ -367,7 +367,7 @@ openipmi_read(struct ipmi_event_intf * eintf)
uint8_t data[80];
int rv;
recv.addr = (char *) &addr;
recv.addr = (unsigned char *) &addr;
recv.addr_len = sizeof(addr);
recv.msg.data = data;
recv.msg.data_len = sizeof(data);

View File

@ -211,7 +211,7 @@ ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
#endif /* HAVE_READLINE */
int ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv)
void ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int i;