mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Refactor string comparisons
Clean up use of strcmp/strncmp/strncasecmp for command line arguments. Never use anything but `strcmp()` unless absolutely neccessary. Partialy resolves ipmitool/ipmitool#104
This commit is contained in:
parent
9d5ea21df7
commit
6e037d6bfb
@ -647,7 +647,7 @@ uint32_t str2val32(const char *str, const struct valstr *vs)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; vs[i].str; i++) {
|
for (i = 0; vs[i].str; i++) {
|
||||||
if (strncasecmp(vs[i].str, str, __maxlen(str, vs[i].str)) == 0)
|
if (strcasecmp(vs[i].str, str) == 0)
|
||||||
return vs[i].val;
|
return vs[i].val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = sizeof(rqdata);
|
req.msg.data_len = sizeof(rqdata);
|
||||||
|
|
||||||
rqdata[0] = channel;
|
rqdata[0] = channel;
|
||||||
rqdata[1] = ((strncmp(payload_type, "ipmi", 4) == 0)? 0: 1);
|
rqdata[1] = ((strcmp(payload_type, "ipmi") == 0)? 0: 1);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Always ask for cipher suite format */
|
/* Always ask for cipher suite format */
|
||||||
@ -805,7 +805,7 @@ ipmi_set_user_access(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
uint8_t channel = 0;
|
uint8_t channel = 0;
|
||||||
uint8_t priv = 0;
|
uint8_t priv = 0;
|
||||||
uint8_t user_id = 0;
|
uint8_t user_id = 0;
|
||||||
if (argc > 0 && strncmp(argv[0], "help", 4) == 0) {
|
if (argc > 0 && strcmp(argv[0], "help") == 0) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argc < 3) {
|
} else if (argc < 3) {
|
||||||
@ -827,25 +827,25 @@ ipmi_set_user_access(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
for (i = 2; i < argc; i ++) {
|
for (i = 2; i < argc; i ++) {
|
||||||
if (strncmp(argv[i], "callin=", 7) == 0) {
|
if (strcmp(argv[i], "callin=") == 0) {
|
||||||
if (strncmp(argv[i] + 7, "off", 3) == 0) {
|
if (strcmp(argv[i] + strlen("callin="), "off") == 0) {
|
||||||
user_access.callin_callback = 1;
|
user_access.callin_callback = 1;
|
||||||
} else {
|
} else {
|
||||||
user_access.callin_callback = 0;
|
user_access.callin_callback = 0;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[i], "link=", 5) == 0) {
|
} else if (strcmp(argv[i], "link=") == 0) {
|
||||||
if (strncmp(argv[i] + 5, "off", 3) == 0) {
|
if (strcmp(argv[i] + strlen("link="), "off") == 0) {
|
||||||
user_access.link_auth = 0;
|
user_access.link_auth = 0;
|
||||||
} else {
|
} else {
|
||||||
user_access.link_auth = 1;
|
user_access.link_auth = 1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[i], "ipmi=", 5) == 0) {
|
} else if (strcmp(argv[i], "ipmi=") == 0) {
|
||||||
if (strncmp(argv[i] + 5, "off", 3) == 0) {
|
if (strcmp(argv[i] + strlen("ipmi="), "off") == 0) {
|
||||||
user_access.ipmi_messaging = 0;
|
user_access.ipmi_messaging = 0;
|
||||||
} else {
|
} else {
|
||||||
user_access.ipmi_messaging = 1;
|
user_access.ipmi_messaging = 1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[i], "privilege=", 10) == 0) {
|
} else if (strcmp(argv[i], "privilege=") == 0) {
|
||||||
if (str2uchar(argv[i] + 10, &priv) != 0) {
|
if (str2uchar(argv[i] + 10, &priv) != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Numeric value expected, but '%s' given.",
|
"Numeric value expected, but '%s' given.",
|
||||||
@ -880,10 +880,10 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strncmp(argv[0], "help", 4) == 0) {
|
} else if (strcmp(argv[0], "help") == 0) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(argv[0], "authcap", 7) == 0) {
|
} else if (strcmp(argv[0], "authcap") == 0) {
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -893,7 +893,7 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
retval = ipmi_get_channel_auth_cap(intf, channel, priv);
|
retval = ipmi_get_channel_auth_cap(intf, channel, priv);
|
||||||
} else if (strncmp(argv[0], "getaccess", 10) == 0) {
|
} else if (strcmp(argv[0], "getaccess") == 0) {
|
||||||
uint8_t user_id = 0;
|
uint8_t user_id = 0;
|
||||||
if ((argc < 2) || (argc > 3)) {
|
if ((argc < 2) || (argc > 3)) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
@ -909,9 +909,9 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_get_user_access(intf, channel, user_id);
|
retval = ipmi_get_user_access(intf, channel, user_id);
|
||||||
} else if (strncmp(argv[0], "setaccess", 9) == 0) {
|
} else if (strcmp(argv[0], "setaccess") == 0) {
|
||||||
return ipmi_set_user_access(intf, (argc - 1), &(argv[1]));
|
return ipmi_set_user_access(intf, (argc - 1), &(argv[1]));
|
||||||
} else if (strncmp(argv[0], "info", 4) == 0) {
|
} else if (strcmp(argv[0], "info") == 0) {
|
||||||
channel = 0xE;
|
channel = 0xE;
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
@ -923,11 +923,11 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_get_channel_info(intf, channel);
|
retval = ipmi_get_channel_info(intf, channel);
|
||||||
} else if (strncmp(argv[0], "getciphers", 10) == 0) {
|
} else if (strcmp(argv[0], "getciphers") == 0) {
|
||||||
/* channel getciphers <ipmi|sol> [channel] */
|
/* channel getciphers <ipmi|sol> [channel] */
|
||||||
channel = 0xE;
|
channel = 0xE;
|
||||||
if ((argc < 2) || (argc > 3) ||
|
if ((argc < 2) || (argc > 3) ||
|
||||||
(strncmp(argv[1], "ipmi", 4) && strncmp(argv[1], "sol", 3))) {
|
(strcmp(argv[1], "ipmi") && strcmp(argv[1], "sol"))) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1071,7 @@ get_bootparam_options(char *optstring,
|
|||||||
{NULL} /* End marker */
|
{NULL} /* End marker */
|
||||||
}, *op;
|
}, *op;
|
||||||
|
|
||||||
if (strncmp(optstring, "options=", 8) != 0) {
|
if (strcmp(optstring, "options=") != 0) {
|
||||||
lprintf(LOG_ERR, "No options= keyword found \"%s\"", optstring);
|
lprintf(LOG_ERR, "No options= keyword found \"%s\"", optstring);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1082,12 +1082,12 @@ get_bootparam_options(char *optstring,
|
|||||||
optionError = 1;
|
optionError = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(token, "no-", 3) == 0) {
|
if (strcmp(token, "no-") == 0) {
|
||||||
setbit = 1;
|
setbit = 1;
|
||||||
token += 3;
|
token += 3;
|
||||||
}
|
}
|
||||||
for (op = options; op->name; ++op) {
|
for (op = options; op->name; ++op) {
|
||||||
if (strncmp(token, op->name, strlen(op->name)) == 0) {
|
if (strcmp(token, op->name) == 0) {
|
||||||
if (setbit) {
|
if (setbit) {
|
||||||
*set_flag |= op->value;
|
*set_flag |= op->value;
|
||||||
} else {
|
} else {
|
||||||
@ -2046,7 +2046,7 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
unsigned char clr_flag=0;
|
unsigned char clr_flag=0;
|
||||||
if (!strcmp(argv[2], "help") ||
|
if (!strcmp(argv[2], "help") ||
|
||||||
argc < 4 || (argc >= 4 &&
|
argc < 4 || (argc >= 4 &&
|
||||||
strncmp(argv[2], "bootflag", 8) != 0)) {
|
strcmp(argv[2], "bootflag") != 0)) {
|
||||||
ipmi_chassis_set_bootflag_help();
|
ipmi_chassis_set_bootflag_help();
|
||||||
} else {
|
} else {
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
@ -2076,7 +2076,6 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, " floppy: Force boot from Floppy/primary removable media");
|
lprintf(LOG_NOTICE, " floppy: Force boot from Floppy/primary removable media");
|
||||||
} else {
|
} else {
|
||||||
static const char *kw = "options=";
|
static const char *kw = "options=";
|
||||||
static const int kw_len = 8;
|
|
||||||
char *optstr = NULL;
|
char *optstr = NULL;
|
||||||
uint8_t flags[BF_BYTE_COUNT];
|
uint8_t flags[BF_BYTE_COUNT];
|
||||||
bool use_flags = false;
|
bool use_flags = false;
|
||||||
@ -2086,8 +2085,8 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/* Exclusive clear-cmos, no other flags */
|
/* Exclusive clear-cmos, no other flags */
|
||||||
optstr = "clear-cmos";
|
optstr = "clear-cmos";
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[2], kw, kw_len)) {
|
else if (!strcmp(argv[2], kw)) {
|
||||||
optstr = argv[2] + kw_len;
|
optstr = argv[2] + strlen(kw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optstr) {
|
if (optstr) {
|
||||||
|
@ -655,7 +655,7 @@ str2val2(const char *str, const struct dcmi_cmd *vs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (i = 0; vs[i].str; i++) {
|
for (i = 0; vs[i].str; i++) {
|
||||||
if (strncasecmp(vs[i].str, str, __maxlen(str, vs[i].str)) == 0)
|
if (strcasecmp(vs[i].str, str) == 0)
|
||||||
return vs[i].val;
|
return vs[i].val;
|
||||||
}
|
}
|
||||||
return vs[i].val;
|
return vs[i].val;
|
||||||
@ -1295,7 +1295,7 @@ ipmi_dcmi_prnt_setmngctrlids(struct ipmi_intf * intf, uint8_t * data)
|
|||||||
/* because after call "Set mc id string" RMCP+ will go down
|
/* because after call "Set mc id string" RMCP+ will go down
|
||||||
* we have no "rsp"
|
* we have no "rsp"
|
||||||
*/
|
*/
|
||||||
if (strncmp(intf->name, "lanplus", 7)) {
|
if (strcmp(intf->name, "lanplus")) {
|
||||||
if (chk_rsp(rsp)) {
|
if (chk_rsp(rsp)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3690,7 +3690,7 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
|
|
||||||
if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0)) {
|
if ((argc == 0) || (strcmp(argv[0], "help") == 0)) {
|
||||||
print_strs(dcmi_cmd_vals,
|
print_strs(dcmi_cmd_vals,
|
||||||
"Data Center Management Interface commands",
|
"Data Center Management Interface commands",
|
||||||
LOG_ERR, 0);
|
LOG_ERR, 0);
|
||||||
@ -3804,7 +3804,7 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
|
|||||||
{
|
{
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 2:
|
case 2:
|
||||||
if (strncmp(argv[1], "activate_dhcp", 13) != 0) {
|
if (strcmp(argv[1], "activate_dhcp") != 0) {
|
||||||
print_strs( dcmi_conf_param_vals,
|
print_strs( dcmi_conf_param_vals,
|
||||||
"DCMI Configuration Parameters",
|
"DCMI Configuration Parameters",
|
||||||
LOG_ERR, 0);
|
LOG_ERR, 0);
|
||||||
@ -3812,14 +3812,14 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (argc != 3 || strncmp(argv[1], "help", 4) == 0) {
|
if (argc != 3 || strcmp(argv[1], "help") == 0) {
|
||||||
print_strs(dcmi_conf_param_vals,
|
print_strs(dcmi_conf_param_vals,
|
||||||
"DCMI Configuration Parameters",
|
"DCMI Configuration Parameters",
|
||||||
LOG_ERR, 0);
|
LOG_ERR, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strncmp(argv[1], "activate_dhcp", 13) == 0) {
|
if (strcmp(argv[1], "activate_dhcp") == 0) {
|
||||||
rsp = ipmi_dcmi_setconfparam(intf, 1, 1);
|
rsp = ipmi_dcmi_setconfparam(intf, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
uint16_t tmp_val = 0;
|
uint16_t tmp_val = 0;
|
||||||
@ -3873,7 +3873,7 @@ ipmi_nm_main(struct ipmi_intf * intf, int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct nm_discover disc;
|
struct nm_discover disc;
|
||||||
|
|
||||||
if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0)) {
|
if ((argc == 0) || (strcmp(argv[0], "help") == 0)) {
|
||||||
print_strs(nm_cmd_vals,
|
print_strs(nm_cmd_vals,
|
||||||
"Node Manager Interface commands",
|
"Node Manager Interface commands",
|
||||||
LOG_ERR, 0);
|
LOG_ERR, 0);
|
||||||
|
@ -269,25 +269,25 @@ ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
current_arg = 0;
|
current_arg = 0;
|
||||||
if (argc == 0 || strncmp(argv[0], "help\0", 5) == 0) {
|
if (argc == 0 || strcmp(argv[0], "help") == 0) {
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (0 ==strncmp(argv[current_arg], "lcd\0", 4)) {
|
if (0 ==strcmp(argv[current_arg], "lcd")) {
|
||||||
rc = ipmi_delloem_lcd_main(intf,argc,argv);
|
rc = ipmi_delloem_lcd_main(intf,argc,argv);
|
||||||
} else if (strncmp(argv[current_arg], "mac\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "mac") == 0) {
|
||||||
/* mac address*/
|
/* mac address*/
|
||||||
rc = ipmi_delloem_mac_main(intf,argc,argv);
|
rc = ipmi_delloem_mac_main(intf,argc,argv);
|
||||||
} else if (strncmp(argv[current_arg], "lan\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "lan") == 0) {
|
||||||
/* lan address*/
|
/* lan address*/
|
||||||
rc = ipmi_delloem_lan_main(intf,argc,argv);
|
rc = ipmi_delloem_lan_main(intf,argc,argv);
|
||||||
} else if (strncmp(argv[current_arg], "setled\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "setled") == 0) {
|
||||||
/* SetLED support */
|
/* SetLED support */
|
||||||
rc = ipmi_delloem_setled_main(intf,argc,argv);
|
rc = ipmi_delloem_setled_main(intf,argc,argv);
|
||||||
} else if (strncmp(argv[current_arg], "powermonitor\0", 13) == 0) {
|
} else if (strcmp(argv[current_arg], "powermonitor") == 0) {
|
||||||
/*Powermanagement report processing*/
|
/*Powermanagement report processing*/
|
||||||
rc = ipmi_delloem_powermonitor_main(intf,argc,argv);
|
rc = ipmi_delloem_powermonitor_main(intf,argc,argv);
|
||||||
} else if (strncmp(argv[current_arg], "vFlash\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "vFlash") == 0) {
|
||||||
/* vFlash Support */
|
/* vFlash Support */
|
||||||
rc = ipmi_delloem_vFlash_main(intf,argc,argv);
|
rc = ipmi_delloem_vFlash_main(intf,argc,argv);
|
||||||
} else {
|
} else {
|
||||||
@ -368,15 +368,15 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (!IsLCDSupported()) {
|
if (!IsLCDSupported()) {
|
||||||
lprintf(LOG_ERR, "lcd is not supported on this system.");
|
lprintf(LOG_ERR, "lcd is not supported on this system.");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (strncmp(argv[current_arg], "info\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "info") == 0) {
|
||||||
if (iDRAC_FLAG_ALL) {
|
if (iDRAC_FLAG_ALL) {
|
||||||
rc = ipmi_lcd_get_info_wh(intf);
|
rc = ipmi_lcd_get_info_wh(intf);
|
||||||
} else {
|
} else {
|
||||||
rc = ipmi_lcd_get_info(intf);
|
rc = ipmi_lcd_get_info(intf);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "status\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "status") == 0) {
|
||||||
rc = ipmi_lcd_get_status(intf);
|
rc = ipmi_lcd_get_status(intf);
|
||||||
} else if (strncmp(argv[current_arg], "set\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "set") == 0) {
|
||||||
/* ipmitool delloem lcd set*/
|
/* ipmitool delloem lcd set*/
|
||||||
uint8_t line_number = 0;
|
uint8_t line_number = 0;
|
||||||
current_arg++;
|
current_arg++;
|
||||||
@ -384,7 +384,7 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "line\0", 5) == 0) {
|
if (strcmp(argv[current_arg], "line") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
usage();
|
usage();
|
||||||
@ -402,7 +402,7 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((strncmp(argv[current_arg], "mode\0", 5) == 0)
|
if ((strcmp(argv[current_arg], "mode") == 0)
|
||||||
&& (iDRAC_FLAG_ALL)) {
|
&& (iDRAC_FLAG_ALL)) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
@ -413,13 +413,13 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "none\0", 5) == 0) {
|
if (strcmp(argv[current_arg], "none") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_NONE, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_NONE, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "modelname\0", 10) == 0) {
|
} else if (strcmp(argv[current_arg], "modelname") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_DEFAULT, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_DEFAULT, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "userdefined\0", 12) == 0) {
|
} else if (strcmp(argv[current_arg], "userdefined") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
@ -427,38 +427,38 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_USER_DEFINED,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_CONFIG_USER_DEFINED,
|
||||||
0xFF, 0XFF, argv[current_arg]);
|
0xFF, 0XFF, argv[current_arg]);
|
||||||
} else if (strncmp(argv[current_arg], "ipv4address\0", 12) == 0) {
|
} else if (strcmp(argv[current_arg], "ipv4address") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_iDRAC_IPV4ADRESS,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_iDRAC_IPV4ADRESS,
|
||||||
0xFF, 0XFF, NULL);
|
0xFF, 0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "macaddress\0", 11) == 0) {
|
} else if (strcmp(argv[current_arg], "macaddress") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_IDRAC_MAC_ADDRESS,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_IDRAC_MAC_ADDRESS,
|
||||||
0xFF, 0XFF, NULL);
|
0xFF, 0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "systemname\0", 11) == 0) {
|
} else if (strcmp(argv[current_arg], "systemname") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_OS_SYSTEM_NAME, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_OS_SYSTEM_NAME, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "servicetag\0", 11) == 0) {
|
} else if (strcmp(argv[current_arg], "servicetag") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_SERVICE_TAG, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_SERVICE_TAG, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "ipv6address\0", 12) == 0) {
|
} else if (strcmp(argv[current_arg], "ipv6address") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_iDRAC_IPV6ADRESS,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_iDRAC_IPV6ADRESS,
|
||||||
0xFF, 0XFF, NULL);
|
0xFF, 0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "ambienttemp\0", 12) == 0) {
|
} else if (strcmp(argv[current_arg], "ambienttemp") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_AMBEINT_TEMP, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_AMBEINT_TEMP, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "systemwatt\0", 11) == 0) {
|
} else if (strcmp(argv[current_arg], "systemwatt") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_SYSTEM_WATTS, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_SYSTEM_WATTS, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "assettag\0", 9) == 0) {
|
} else if (strcmp(argv[current_arg], "assettag") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_ASSET_TAG, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, IPMI_DELL_LCD_ASSET_TAG, 0xFF,
|
||||||
0XFF, NULL);
|
0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "help\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "help") == 0) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
}
|
}
|
||||||
} else if ((strncmp(argv[current_arg], "lcdqualifier\0", 13) == 0)
|
} else if ((strcmp(argv[current_arg], "lcdqualifier") == 0)
|
||||||
&& (iDRAC_FLAG_ALL)) {
|
&& (iDRAC_FLAG_ALL)) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
@ -469,22 +469,22 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "watt\0", 5) == 0) {
|
if (strcmp(argv[current_arg], "watt") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x00, 0XFF, NULL);
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x00, 0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "btuphr\0",7) == 0) {
|
} else if (strcmp(argv[current_arg], "btuphr") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x01, 0XFF, NULL);
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x01, 0XFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "celsius\0", 8) == 0) {
|
} else if (strcmp(argv[current_arg], "celsius") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x02, 0xFF, NULL);
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x02, 0xFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "fahrenheit", 11) == 0) {
|
} else if (strcmp(argv[current_arg], "fahrenheit") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x03, 0xFF, NULL);
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0x03, 0xFF, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "help\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "help") == 0) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
}
|
}
|
||||||
} else if ((strncmp(argv[current_arg], "errordisplay\0", 13) == 0)
|
} else if ((strcmp(argv[current_arg], "errordisplay") == 0)
|
||||||
&& (iDRAC_FLAG_ALL)) {
|
&& (iDRAC_FLAG_ALL)) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
@ -495,26 +495,26 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "sel\0", 4) == 0) {
|
if (strcmp(argv[current_arg], "sel") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0xFF,
|
||||||
IPMI_DELL_LCD_ERROR_DISP_SEL, NULL);
|
IPMI_DELL_LCD_ERROR_DISP_SEL, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "simple\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "simple") == 0) {
|
||||||
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0xFF,
|
rc = ipmi_lcd_configure_wh(intf, 0xFF, 0xFF,
|
||||||
IPMI_DELL_LCD_ERROR_DISP_VERBOSE, NULL);
|
IPMI_DELL_LCD_ERROR_DISP_VERBOSE, NULL);
|
||||||
} else if (strncmp(argv[current_arg], "help\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "help") == 0) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
}
|
}
|
||||||
} else if ((strncmp(argv[current_arg], "none\0", 5) == 0)
|
} else if ((strcmp(argv[current_arg], "none") == 0)
|
||||||
&& (iDRAC_FLAG==0)) {
|
&& (iDRAC_FLAG==0)) {
|
||||||
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_NONE, NULL);
|
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_NONE, NULL);
|
||||||
} else if ((strncmp(argv[current_arg], "default\0", 8) == 0)
|
} else if ((strcmp(argv[current_arg], "default") == 0)
|
||||||
&& (iDRAC_FLAG==0)) {
|
&& (iDRAC_FLAG==0)) {
|
||||||
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_DEFAULT, NULL);
|
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_DEFAULT, NULL);
|
||||||
} else if ((strncmp(argv[current_arg], "custom\0", 7) == 0)
|
} else if ((strcmp(argv[current_arg], "custom") == 0)
|
||||||
&& (iDRAC_FLAG==0)) {
|
&& (iDRAC_FLAG==0)) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
@ -523,43 +523,43 @@ ipmi_delloem_lcd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_USER_DEFINED,
|
rc = ipmi_lcd_configure(intf, IPMI_DELL_LCD_CONFIG_USER_DEFINED,
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
} else if (strncmp(argv[current_arg], "vkvm\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "vkvm") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "active\0", 7) == 0) {
|
if (strcmp(argv[current_arg], "active") == 0) {
|
||||||
rc = ipmi_lcd_set_kvm(intf, 1);
|
rc = ipmi_lcd_set_kvm(intf, 1);
|
||||||
} else if (strncmp(argv[current_arg], "inactive\0", 9) == 0) {
|
} else if (strcmp(argv[current_arg], "inactive") == 0) {
|
||||||
rc = ipmi_lcd_set_kvm(intf, 0);
|
rc = ipmi_lcd_set_kvm(intf, 0);
|
||||||
} else if (strncmp(argv[current_arg], "help\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "help") == 0) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "frontpanelaccess\0", 17) == 0) {
|
} else if (strcmp(argv[current_arg], "frontpanelaccess") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argc <= current_arg) {
|
if (argc <= current_arg) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[current_arg], "viewandmodify\0", 14) == 0) {
|
if (strcmp(argv[current_arg], "viewandmodify") == 0) {
|
||||||
rc = ipmi_lcd_set_lock(intf, 0);
|
rc = ipmi_lcd_set_lock(intf, 0);
|
||||||
} else if (strncmp(argv[current_arg], "viewonly\0", 9)==0) {
|
} else if (strcmp(argv[current_arg], "viewonly")==0) {
|
||||||
rc = ipmi_lcd_set_lock(intf, 1);
|
rc = ipmi_lcd_set_lock(intf, 1);
|
||||||
} else if (strncmp(argv[current_arg], "disabled\0", 9)==0) {
|
} else if (strcmp(argv[current_arg], "disabled")==0) {
|
||||||
rc = ipmi_lcd_set_lock(intf, 2);
|
rc = ipmi_lcd_set_lock(intf, 2);
|
||||||
} else if (strncmp(argv[current_arg], "help\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "help") == 0) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
lprintf(LOG_ERR, "Invalid DellOEM command: %s",
|
||||||
argv[current_arg]);
|
argv[current_arg]);
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
}
|
}
|
||||||
} else if( (strncmp(argv[current_arg], "help\0", 5) == 0)
|
} else if( (strcmp(argv[current_arg], "help") == 0)
|
||||||
&& (iDRAC_FLAG==0)) {
|
&& (iDRAC_FLAG==0)) {
|
||||||
ipmi_lcd_usage();
|
ipmi_lcd_usage();
|
||||||
} else {
|
} else {
|
||||||
@ -1516,9 +1516,9 @@ ipmi_delloem_mac_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_idracvalidator_command(intf);
|
ipmi_idracvalidator_command(intf);
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
rc = ipmi_macinfo(intf, 0xff);
|
rc = ipmi_macinfo(intf, 0xff);
|
||||||
} else if (strncmp(argv[current_arg], "list\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "list") == 0) {
|
||||||
rc = ipmi_macinfo(intf, 0xff);
|
rc = ipmi_macinfo(intf, 0xff);
|
||||||
} else if (strncmp(argv[current_arg], "get\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "get") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
ipmi_mac_usage();
|
ipmi_mac_usage();
|
||||||
@ -1964,7 +1964,7 @@ ipmi_delloem_lan_main(struct ipmi_intf * intf, int __UNUSED__(argc), char ** arg
|
|||||||
if (!IsLANSupported()) {
|
if (!IsLANSupported()) {
|
||||||
lprintf(LOG_ERR, "lan is not supported on this system.");
|
lprintf(LOG_ERR, "lan is not supported on this system.");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (strncmp(argv[current_arg], "set\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "set") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
ipmi_lan_usage();
|
ipmi_lan_usage();
|
||||||
@ -2000,12 +2000,12 @@ ipmi_delloem_lan_main(struct ipmi_intf * intf, int __UNUSED__(argc), char ** arg
|
|||||||
rc = ipmi_lan_set_nic_selection(intf,nic_selection);
|
rc = ipmi_lan_set_nic_selection(intf,nic_selection);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(argv[current_arg], "get\0", 4) == 0) {
|
} else if (strcmp(argv[current_arg], "get") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
rc = ipmi_lan_get_nic_selection(intf);
|
rc = ipmi_lan_get_nic_selection(intf);
|
||||||
return rc;
|
return rc;
|
||||||
} else if (strncmp(argv[current_arg], "active\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "active") == 0) {
|
||||||
rc = ipmi_lan_get_active_nic(intf);
|
rc = ipmi_lan_get_active_nic(intf);
|
||||||
return rc;
|
return rc;
|
||||||
} else {
|
} else {
|
||||||
@ -2056,13 +2056,13 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
nic_set[0] = rsp->data[0];
|
nic_set[0] = rsp->data[0];
|
||||||
nic_set[1] = rsp->data[1];
|
nic_set[1] = rsp->data[1];
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "dedicated\0", 10) == 0) {
|
&& strcmp(argv[current_arg], "dedicated") == 0) {
|
||||||
nic_set[0] = 1;
|
nic_set[0] = 1;
|
||||||
nic_set[1] = 0;
|
nic_set[1] = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "shared\0", 7) == 0) {
|
&& strcmp(argv[current_arg], "shared") == 0) {
|
||||||
/* placeholder */
|
/* placeholder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2070,7 +2070,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "with\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "with") == 0) {
|
||||||
/* placeholder */
|
/* placeholder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2078,14 +2078,14 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "failover\0", 9) == 0) {
|
&& strcmp(argv[current_arg], "failover") == 0) {
|
||||||
failover = 1;
|
failover = 1;
|
||||||
}
|
}
|
||||||
if (failover) {
|
if (failover) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
}
|
}
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "lom1\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "lom1") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2104,7 +2104,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[current_arg]
|
} else if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "lom2\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "lom2") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2123,7 +2123,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[current_arg]
|
} else if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "lom3\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "lom3") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2142,7 +2142,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[current_arg]
|
} else if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "lom4\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "lom4") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2161,7 +2161,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (failover && argv[current_arg]
|
} else if (failover && argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "none\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "none") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type) ) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type) ) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2173,7 +2173,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (failover && argv[current_arg]
|
} else if (failover && argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "all\0", 4) == 0) {
|
&& strcmp(argv[current_arg], "all") == 0) {
|
||||||
/* placeholder */
|
/* placeholder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2181,7 +2181,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (failover && argv[current_arg]
|
if (failover && argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "loms\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "loms") == 0) {
|
||||||
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || (IMC_IDRAC_13G_MODULAR == IMC_Type)) {
|
||||||
return INVAILD_SHARED_MODE;
|
return INVAILD_SHARED_MODE;
|
||||||
}
|
}
|
||||||
@ -2198,11 +2198,11 @@ static int
|
|||||||
get_nic_selection_mode(int current_arg, char ** argv)
|
get_nic_selection_mode(int current_arg, char ** argv)
|
||||||
{
|
{
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "dedicated\0", 10) == 0) {
|
&& strcmp(argv[current_arg], "dedicated") == 0) {
|
||||||
return DEDICATED;
|
return DEDICATED;
|
||||||
}
|
}
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "shared\0", 7) == 0) {
|
&& strcmp(argv[current_arg], "shared") == 0) {
|
||||||
if (!argv[current_arg+1]) {
|
if (!argv[current_arg+1]) {
|
||||||
return SHARED;
|
return SHARED;
|
||||||
}
|
}
|
||||||
@ -2210,7 +2210,7 @@ get_nic_selection_mode(int current_arg, char ** argv)
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "with\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "with") == 0) {
|
||||||
/* place holder */
|
/* place holder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2218,7 +2218,7 @@ get_nic_selection_mode(int current_arg, char ** argv)
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "failover\0", 9) == 0) {
|
&& strcmp(argv[current_arg], "failover\0") == 0) {
|
||||||
/* place holder */
|
/* place holder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2226,10 +2226,10 @@ get_nic_selection_mode(int current_arg, char ** argv)
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "lom2\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "lom2") == 0) {
|
||||||
return SHARED_WITH_FAILOVER_LOM2;
|
return SHARED_WITH_FAILOVER_LOM2;
|
||||||
} else if (argv[current_arg]
|
} else if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "all\0", 4) == 0) {
|
&& strcmp(argv[current_arg], "all") == 0) {
|
||||||
/* place holder */
|
/* place holder */
|
||||||
} else {
|
} else {
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2237,7 +2237,7 @@ get_nic_selection_mode(int current_arg, char ** argv)
|
|||||||
|
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]
|
if (argv[current_arg]
|
||||||
&& strncmp(argv[current_arg], "loms\0", 5) == 0) {
|
&& strcmp(argv[current_arg], "loms") == 0) {
|
||||||
return SHARED_WITH_FAILOVER_ALL_LOMS;
|
return SHARED_WITH_FAILOVER_ALL_LOMS;
|
||||||
}
|
}
|
||||||
return INVALID;
|
return INVALID;
|
||||||
@ -2504,58 +2504,58 @@ ipmi_delloem_powermonitor_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
ipmi_idracvalidator_command(intf);
|
ipmi_idracvalidator_command(intf);
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
rc = ipmi_powermgmt(intf);
|
rc = ipmi_powermgmt(intf);
|
||||||
} else if (strncmp(argv[current_arg], "status\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "status") == 0) {
|
||||||
rc = ipmi_powermgmt(intf);
|
rc = ipmi_powermgmt(intf);
|
||||||
} else if (strncmp(argv[current_arg], "clear\0", 6) == 0) {
|
} else if (strcmp(argv[current_arg], "clear") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
} else if (strncmp(argv[current_arg], "peakpower\0", 10) == 0) {
|
} else if (strcmp(argv[current_arg], "peakpower") == 0) {
|
||||||
rc = ipmi_powermgmt_clear(intf, 1);
|
rc = ipmi_powermgmt_clear(intf, 1);
|
||||||
} else if (strncmp(argv[current_arg], "cumulativepower\0", 16) == 0) {
|
} else if (strcmp(argv[current_arg], "cumulativepower") == 0) {
|
||||||
rc = ipmi_powermgmt_clear(intf, 0);
|
rc = ipmi_powermgmt_clear(intf, 0);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "powerconsumption\0", 17) == 0) {
|
} else if (strcmp(argv[current_arg], "powerconsumption") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
rc = ipmi_print_get_power_consmpt_data(intf,watt);
|
rc = ipmi_print_get_power_consmpt_data(intf,watt);
|
||||||
} else if (strncmp(argv[current_arg], "watt\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "watt") == 0) {
|
||||||
rc = ipmi_print_get_power_consmpt_data(intf, watt);
|
rc = ipmi_print_get_power_consmpt_data(intf, watt);
|
||||||
} else if (strncmp(argv[current_arg], "btuphr\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "btuphr") == 0) {
|
||||||
rc = ipmi_print_get_power_consmpt_data(intf, btuphr);
|
rc = ipmi_print_get_power_consmpt_data(intf, btuphr);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "powerconsumptionhistory\0", 23) == 0) {
|
} else if (strcmp(argv[current_arg], "powerconsumptionhistory") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
rc = ipmi_print_power_consmpt_history(intf,watt);
|
rc = ipmi_print_power_consmpt_history(intf,watt);
|
||||||
} else if (strncmp(argv[current_arg], "watt\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "watt") == 0) {
|
||||||
rc = ipmi_print_power_consmpt_history(intf, watt);
|
rc = ipmi_print_power_consmpt_history(intf, watt);
|
||||||
} else if (strncmp(argv[current_arg], "btuphr\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "btuphr") == 0) {
|
||||||
rc = ipmi_print_power_consmpt_history(intf, btuphr);
|
rc = ipmi_print_power_consmpt_history(intf, btuphr);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "getpowerbudget\0", 15) == 0) {
|
} else if (strcmp(argv[current_arg], "getpowerbudget") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
rc=ipmi_print_power_cap(intf,watt);
|
rc=ipmi_print_power_cap(intf,watt);
|
||||||
} else if (strncmp(argv[current_arg], "watt\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "watt") == 0) {
|
||||||
rc = ipmi_print_power_cap(intf, watt);
|
rc = ipmi_print_power_cap(intf, watt);
|
||||||
} else if (strncmp(argv[current_arg], "btuphr\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "btuphr") == 0) {
|
||||||
rc = ipmi_print_power_cap(intf, btuphr);
|
rc = ipmi_print_power_cap(intf, btuphr);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "setpowerbudget\0", 15) == 0) {
|
} else if (strcmp(argv[current_arg], "setpowerbudget") == 0) {
|
||||||
int val;
|
int val;
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
@ -2575,19 +2575,19 @@ ipmi_delloem_powermonitor_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
} else if (strncmp(argv[current_arg], "watt\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "watt") == 0) {
|
||||||
rc = ipmi_set_power_cap(intf,watt,val);
|
rc = ipmi_set_power_cap(intf,watt,val);
|
||||||
} else if (strncmp(argv[current_arg], "btuphr\0", 7) == 0) {
|
} else if (strcmp(argv[current_arg], "btuphr") == 0) {
|
||||||
rc = ipmi_set_power_cap(intf, btuphr,val);
|
rc = ipmi_set_power_cap(intf, btuphr,val);
|
||||||
} else if (strncmp(argv[current_arg], "percent\0", 8) == 0) {
|
} else if (strcmp(argv[current_arg], "percent") == 0) {
|
||||||
rc = ipmi_set_power_cap(intf,percent,val);
|
rc = ipmi_set_power_cap(intf,percent,val);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[current_arg], "enablepowercap\0", 15) == 0) {
|
} else if (strcmp(argv[current_arg], "enablepowercap") == 0) {
|
||||||
ipmi_set_power_capstatus_command(intf,1);
|
ipmi_set_power_capstatus_command(intf,1);
|
||||||
} else if (strncmp(argv[current_arg], "disablepowercap\0", 16) == 0) {
|
} else if (strcmp(argv[current_arg], "disablepowercap") == 0) {
|
||||||
ipmi_set_power_capstatus_command(intf,0);
|
ipmi_set_power_capstatus_command(intf,0);
|
||||||
} else {
|
} else {
|
||||||
ipmi_powermonitor_usage();
|
ipmi_powermonitor_usage();
|
||||||
@ -3862,7 +3862,7 @@ static int
|
|||||||
ipmi_delloem_vFlash_process(struct ipmi_intf * intf, int current_arg, char ** argv)
|
ipmi_delloem_vFlash_process(struct ipmi_intf * intf, int current_arg, char ** argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
if (strncmp(intf->name,"wmi\0",4) && strncmp(intf->name, "open\0",5)) {
|
if (strcmp(intf->name,"wmi") && strcmp(intf->name, "open")) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"vFlash support is enabled only for wmi and open interface.");
|
"vFlash support is enabled only for wmi and open interface.");
|
||||||
lprintf(LOG_ERR, "Its not enabled for lan and lanplus interface.");
|
lprintf(LOG_ERR, "Its not enabled for lan and lanplus interface.");
|
||||||
@ -3874,12 +3874,12 @@ ipmi_delloem_vFlash_process(struct ipmi_intf * intf, int current_arg, char ** ar
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ipmi_idracvalidator_command(intf);
|
ipmi_idracvalidator_command(intf);
|
||||||
if (!strncmp(argv[current_arg], "info\0", 5)) {
|
if (!strcmp(argv[current_arg], "info")) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (!argv[current_arg]) {
|
if (!argv[current_arg]) {
|
||||||
ipmi_vFlash_usage();
|
ipmi_vFlash_usage();
|
||||||
return -1;
|
return -1;
|
||||||
} else if (strncmp(argv[current_arg], "Card\0", 5) == 0) {
|
} else if (strcmp(argv[current_arg], "Card") == 0) {
|
||||||
current_arg++;
|
current_arg++;
|
||||||
if (argv[current_arg]) {
|
if (argv[current_arg]) {
|
||||||
ipmi_vFlash_usage();
|
ipmi_vFlash_usage();
|
||||||
|
@ -561,7 +561,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *__UNUSED__(intf), int argc, char **argv)
|
|||||||
option = argv[argument_offset];
|
option = argv[argument_offset];
|
||||||
index ++;
|
index ++;
|
||||||
argc--;
|
argc--;
|
||||||
} else if ( strncmp(&argv[argument_offset][2], "=", 1) == 0) {
|
} else if ( strcmp(&argv[argument_offset][2], "=") == 0) {
|
||||||
/* since the command line must receive xx=filename,
|
/* since the command line must receive xx=filename,
|
||||||
* so the position of "=" sign is 2
|
* so the position of "=" sign is 2
|
||||||
*/
|
*/
|
||||||
@ -2729,7 +2729,7 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
printf("%s: None\n", board_type);
|
printf("%s: None\n", board_type);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (strncmp(board_type, "Custom", 6 ) != 0) {
|
if (strcmp(board_type, "Custom") != 0) {
|
||||||
unsigned char *data, *str;
|
unsigned char *data, *str;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
data = malloc(size_board + 1); /* Make room for type/length field */
|
data = malloc(size_board + 1); /* Make room for type/length field */
|
||||||
|
@ -232,7 +232,7 @@ ipmi_event_find_offset(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t even
|
|||||||
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
||||||
evt; evt = ipmi_get_next_event_sensor_type(evt)) {
|
evt; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
if (evt->desc &&
|
if (evt->desc &&
|
||||||
strncasecmp(desc, evt->desc, __maxlen(desc, evt->desc)) == 0) {
|
strcasecmp(desc, evt->desc) == 0) {
|
||||||
return evt->offset;
|
return evt->offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,9 +270,9 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
if (!evdir)
|
if (!evdir)
|
||||||
emsg.event_dir = EVENT_DIR_ASSERT;
|
emsg.event_dir = EVENT_DIR_ASSERT;
|
||||||
else if (strncasecmp(evdir, "assert", 6) == 0)
|
else if (strcmp(evdir, "assert") == 0)
|
||||||
emsg.event_dir = EVENT_DIR_ASSERT;
|
emsg.event_dir = EVENT_DIR_ASSERT;
|
||||||
else if (strncasecmp(evdir, "deassert", 8) == 0)
|
else if (strcmp(evdir, "deassert") == 0)
|
||||||
emsg.event_dir = EVENT_DIR_DEASSERT;
|
emsg.event_dir = EVENT_DIR_DEASSERT;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Invalid event direction %s. Must be 'assert' or 'deassert'", evdir);
|
lprintf(LOG_ERR, "Invalid event direction %s. Must be 'assert' or 'deassert'", evdir);
|
||||||
@ -318,7 +318,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
int hilo = 0;
|
int hilo = 0;
|
||||||
off = 1;
|
off = 1;
|
||||||
|
|
||||||
if (!state || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcmp(state, "list") == 0) {
|
||||||
printf("Sensor States:\n");
|
printf("Sensor States:\n");
|
||||||
printf(" lnr : Lower Non-Recoverable \n");
|
printf(" lnr : Lower Non-Recoverable \n");
|
||||||
printf(" lcr : Lower Critical\n");
|
printf(" lcr : Lower Critical\n");
|
||||||
@ -329,12 +329,12 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != strncasecmp(state, "lnr", 3) &&
|
if (0 != strcmp(state, "lnr") &&
|
||||||
0 != strncasecmp(state, "lcr", 3) &&
|
0 != strcmp(state, "lcr") &&
|
||||||
0 != strncasecmp(state, "lnc", 3) &&
|
0 != strcmp(state, "lnc") &&
|
||||||
0 != strncasecmp(state, "unc", 3) &&
|
0 != strcmp(state, "unc") &&
|
||||||
0 != strncasecmp(state, "ucr", 3) &&
|
0 != strcmp(state, "ucr") &&
|
||||||
0 != strncasecmp(state, "unr", 3))
|
0 != strcmp(state, "unr"))
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR, "Invalid threshold identifier %s", state);
|
lprintf(LOG_ERR, "Invalid threshold identifier %s", state);
|
||||||
return -1;
|
return -1;
|
||||||
@ -415,7 +415,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (!state || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
printf("Sensor State Shortcuts:\n");
|
printf("Sensor State Shortcuts:\n");
|
||||||
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
||||||
@ -426,12 +426,12 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
off = 0;
|
off = 0;
|
||||||
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
||||||
if (strncasecmp(state, digi_on[x], strlen(digi_on[x])) == 0) {
|
if (strcasecmp(state, digi_on[x]) == 0) {
|
||||||
emsg.event_data[0] = 1;
|
emsg.event_data[0] = 1;
|
||||||
off = 1;
|
off = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(state, digi_off[x], strlen(digi_off[x])) == 0) {
|
else if (strcasecmp(state, digi_off[x]) == 0) {
|
||||||
emsg.event_data[0] = 0;
|
emsg.event_data[0] = 0;
|
||||||
off = 1;
|
off = 1;
|
||||||
break;
|
break;
|
||||||
@ -455,7 +455,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (!state || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (!state || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -596,11 +596,11 @@ ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 0 || strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_event_usage();
|
ipmi_event_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "file", 4) == 0) {
|
if (strcmp(argv[0], "file") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
ipmi_event_usage();
|
ipmi_event_usage();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -128,7 +128,7 @@ ipmi_firewall_parse_args(int argc, char ** argv, struct ipmi_function_params * p
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
if (strncmp(argv[i], "channel", 7) == 0 && (++i < argc)) {
|
if (strcmp(argv[i], "channel") == 0 && (++i < argc)) {
|
||||||
uint8_t channel_tmp = 0;
|
uint8_t channel_tmp = 0;
|
||||||
if (is_ipmi_channel_num(argv[i], &channel_tmp) != 0) {
|
if (is_ipmi_channel_num(argv[i], &channel_tmp) != 0) {
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
@ -137,31 +137,31 @@ ipmi_firewall_parse_args(int argc, char ** argv, struct ipmi_function_params * p
|
|||||||
p->channel = channel_tmp;
|
p->channel = channel_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "lun", 3) == 0 && (++i < argc)) {
|
else if (strcmp(argv[i], "lun") == 0 && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->lun)) != 0) {
|
if (str2int(argv[i], &(p->lun)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given lun '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given lun '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "force", 5) == 0) {
|
else if (strcmp(argv[i], "force") == 0) {
|
||||||
p->force = 1;
|
p->force = 1;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "netfn", 5) == 0 && (++i < argc)) {
|
else if (strcmp(argv[i], "netfn") == 0 && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->netfn)) != 0) {
|
if (str2int(argv[i], &(p->netfn)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given netfn '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given netfn '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "command", 7) == 0 && (++i < argc)) {
|
else if (strcmp(argv[i], "command") == 0 && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->command)) != 0) {
|
if (str2int(argv[i], &(p->command)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given command '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given command '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "subfn", 5) == 0 && (++i < argc)) {
|
else if (strcmp(argv[i], "subfn") == 0 && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->subfn)) != 0) {
|
if (str2int(argv[i], &(p->subfn)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given subfn '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given subfn '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
@ -903,7 +903,7 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
struct bmc_fn_support * bmc_fn_support;
|
struct bmc_fn_support * bmc_fn_support;
|
||||||
unsigned int l, n, c;
|
unsigned int l, n, c;
|
||||||
|
|
||||||
if ((argc > 0 && strncmp(argv[0], "help", 4) == 0) || ipmi_firewall_parse_args(argc, argv, &p) < 0)
|
if ((argc > 0 && strcmp(argv[0], "help") == 0) || ipmi_firewall_parse_args(argc, argv, &p) < 0)
|
||||||
{
|
{
|
||||||
printf_firewall_info_usage();
|
printf_firewall_info_usage();
|
||||||
return 0;
|
return 0;
|
||||||
@ -1018,7 +1018,7 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
unsigned int l, n, c;
|
unsigned int l, n, c;
|
||||||
unsigned char enables[MAX_COMMAND_BYTES];
|
unsigned char enables[MAX_COMMAND_BYTES];
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || strcmp(argv[0], "help") == 0) {
|
||||||
char * s1 = enable?"en":"dis";
|
char * s1 = enable?"en":"dis";
|
||||||
char * s2 = enable?"":" [force]";
|
char * s2 = enable?"":" [force]";
|
||||||
printf("%sable [channel H] lun L netfn N%s\n", s1, s2);
|
printf("%sable [channel H] lun L netfn N%s\n", s1, s2);
|
||||||
@ -1113,7 +1113,7 @@ ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (argc > 0 && strncmp(argv[0], "help", 4) == 0) {
|
} else if (argc > 0 && strcmp(argv[0], "help") == 0) {
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1171,19 +1171,19 @@ ipmi_firewall_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || strcmp(argv[0], "help") == 0) {
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "info", 4) == 0) {
|
else if (strcmp(argv[0], "info") == 0) {
|
||||||
rc = ipmi_firewall_info(intf, argc-1, &(argv[1]));
|
rc = ipmi_firewall_info(intf, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "enable", 6) == 0) {
|
else if (strcmp(argv[0], "enable") == 0) {
|
||||||
rc = ipmi_firewall_enable_disable(intf, 1, argc-1, &(argv[1]));
|
rc = ipmi_firewall_enable_disable(intf, 1, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "disable", 7) == 0) {
|
else if (strcmp(argv[0], "disable") == 0) {
|
||||||
rc = ipmi_firewall_enable_disable(intf, 0, argc-1, &(argv[1]));
|
rc = ipmi_firewall_enable_disable(intf, 0, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "reset", 5) == 0) {
|
else if (strcmp(argv[0], "reset") == 0) {
|
||||||
rc = ipmi_firewall_reset(intf, argc-1, &(argv[1]));
|
rc = ipmi_firewall_reset(intf, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1631,7 +1631,7 @@ static void ipmi_fru_oemkontron_get(int argc,
|
|||||||
if(!badParams){
|
if(!badParams){
|
||||||
/* the 'OEM' field is already checked in caller */
|
/* the 'OEM' field is already checked in caller */
|
||||||
if( argc > OEM_KONTRON_SUBCOMMAND_ARG_POS ){
|
if( argc > OEM_KONTRON_SUBCOMMAND_ARG_POS ){
|
||||||
if(strncmp("oem", argv[OEM_KONTRON_SUBCOMMAND_ARG_POS],3)){
|
if(strcmp("oem", argv[OEM_KONTRON_SUBCOMMAND_ARG_POS])){
|
||||||
printf("usage: fru get <id> <oem>\n");
|
printf("usage: fru get <id> <oem>\n");
|
||||||
badParams = true;
|
badParams = true;
|
||||||
return;
|
return;
|
||||||
@ -1749,7 +1749,7 @@ ipmi_fru_oemkontron_edit( int argc, char ** argv,uint8_t * fru_data,
|
|||||||
if(!badParams){
|
if(!badParams){
|
||||||
/* the 'OEM' field is already checked in caller */
|
/* the 'OEM' field is already checked in caller */
|
||||||
if( argc > OEM_KONTRON_SUBCOMMAND_ARG_POS ){
|
if( argc > OEM_KONTRON_SUBCOMMAND_ARG_POS ){
|
||||||
if(strncmp("oem", argv[OEM_KONTRON_SUBCOMMAND_ARG_POS],3)){
|
if(strcmp("oem", argv[OEM_KONTRON_SUBCOMMAND_ARG_POS])){
|
||||||
printf("usage: fru edit <id> <oem> <args...>\n");
|
printf("usage: fru edit <id> <oem> <args...>\n");
|
||||||
badParams = true;
|
badParams = true;
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
@ -3515,7 +3515,7 @@ ipmi_fru_edit_multirec(struct ipmi_intf * intf, uint8_t id ,
|
|||||||
if( argc <=2 ) {
|
if( argc <=2 ) {
|
||||||
suppliedIana = IPMI_OEM_PICMG;
|
suppliedIana = IPMI_OEM_PICMG;
|
||||||
} else {
|
} else {
|
||||||
if( !strncmp( argv[2] , "oem" , 3 )) {
|
if( !strcmp( argv[2] , "oem")) {
|
||||||
/* Expect IANA number next */
|
/* Expect IANA number next */
|
||||||
if( argc <= 3 ) {
|
if( argc <= 3 ) {
|
||||||
lprintf(LOG_ERR, "oem iana <record> <format> [<args>]");
|
lprintf(LOG_ERR, "oem iana <record> <format> [<args>]");
|
||||||
@ -3713,7 +3713,7 @@ ipmi_fru_get_multirec(struct ipmi_intf * intf, uint8_t id ,
|
|||||||
|
|
||||||
uint32_t suppliedIana = 0 ;
|
uint32_t suppliedIana = 0 ;
|
||||||
/* Now makes sure this is really PICMG record */
|
/* Now makes sure this is really PICMG record */
|
||||||
if( !strncmp( argv[2] , "oem" , 3 )) {
|
if( !strcmp( argv[2] , "oem")) {
|
||||||
/* Expect IANA number next */
|
/* Expect IANA number next */
|
||||||
if( argc <= 3 ) {
|
if( argc <= 3 ) {
|
||||||
lprintf(LOG_ERR, "oem iana <record> <format>");
|
lprintf(LOG_ERR, "oem iana <record> <format>");
|
||||||
@ -4424,12 +4424,12 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
rc = ipmi_fru_print_all(intf);
|
rc = ipmi_fru_print_all(intf);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
else if (strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_fru_help();
|
ipmi_fru_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "print", 5) == 0 ||
|
else if (strcmp(argv[0], "print") == 0 ||
|
||||||
strncmp(argv[0], "list", 4) == 0) {
|
strcmp(argv[0], "list") == 0) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (strcmp(argv[1], "help") == 0) {
|
if (strcmp(argv[1], "help") == 0) {
|
||||||
lprintf(LOG_NOTICE, "fru print [fru id] - print information about FRU(s)");
|
lprintf(LOG_NOTICE, "fru print [fru id] - print information about FRU(s)");
|
||||||
@ -4444,7 +4444,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = ipmi_fru_print_all(intf);
|
rc = ipmi_fru_print_all(intf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "read", 5)) {
|
else if (!strcmp(argv[0], "read")) {
|
||||||
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
||||||
ipmi_fru_read_help();
|
ipmi_fru_read_help();
|
||||||
return 0;
|
return 0;
|
||||||
@ -4468,7 +4468,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/* TODO - rc is missing */
|
/* TODO - rc is missing */
|
||||||
ipmi_fru_read_to_bin(intf, argv[2], fru_id);
|
ipmi_fru_read_to_bin(intf, argv[2], fru_id);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "write", 5)) {
|
else if (!strcmp(argv[0], "write")) {
|
||||||
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
||||||
ipmi_fru_write_help();
|
ipmi_fru_write_help();
|
||||||
return 0;
|
return 0;
|
||||||
@ -4492,7 +4492,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/* TODO - rc is missing */
|
/* TODO - rc is missing */
|
||||||
ipmi_fru_write_from_bin(intf, argv[2], fru_id);
|
ipmi_fru_write_from_bin(intf, argv[2], fru_id);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "upgEkey", 7)) {
|
else if (!strcmp(argv[0], "upgEkey")) {
|
||||||
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
||||||
ipmi_fru_upgekey_help();
|
ipmi_fru_upgekey_help();
|
||||||
return 0;
|
return 0;
|
||||||
@ -4511,27 +4511,27 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
rc = ipmi_fru_upg_ekeying(intf, argv[2], fru_id);
|
rc = ipmi_fru_upg_ekeying(intf, argv[2], fru_id);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "internaluse", 11)) {
|
else if (!strcmp(argv[0], "internaluse")) {
|
||||||
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
||||||
ipmi_fru_internaluse_help();
|
ipmi_fru_internaluse_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (argc >= 3) && (!strncmp(argv[2], "info", 4)) ) {
|
if ( (argc >= 3) && (!strcmp(argv[2], "info")) ) {
|
||||||
|
|
||||||
if (is_fru_id(argv[1], &fru_id) != 0)
|
if (is_fru_id(argv[1], &fru_id) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rc = ipmi_fru_info_internal_use(intf, fru_id);
|
rc = ipmi_fru_info_internal_use(intf, fru_id);
|
||||||
}
|
}
|
||||||
else if ( (argc >= 3) && (!strncmp(argv[2], "print", 5)) ) {
|
else if ( (argc >= 3) && (!strcmp(argv[2], "print")) ) {
|
||||||
|
|
||||||
if (is_fru_id(argv[1], &fru_id) != 0)
|
if (is_fru_id(argv[1], &fru_id) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rc = ipmi_fru_read_internal_use(intf, fru_id, NULL);
|
rc = ipmi_fru_read_internal_use(intf, fru_id, NULL);
|
||||||
}
|
}
|
||||||
else if ( (argc >= 4) && (!strncmp(argv[2], "read", 4)) ) {
|
else if ( (argc >= 4) && (!strcmp(argv[2], "read")) ) {
|
||||||
|
|
||||||
if (is_fru_id(argv[1], &fru_id) != 0)
|
if (is_fru_id(argv[1], &fru_id) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -4545,7 +4545,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
rc = ipmi_fru_read_internal_use(intf, fru_id, argv[3]);
|
rc = ipmi_fru_read_internal_use(intf, fru_id, argv[3]);
|
||||||
}
|
}
|
||||||
else if ( (argc >= 4) && (!strncmp(argv[2], "write", 5)) ) {
|
else if ( (argc >= 4) && (!strcmp(argv[2], "write")) ) {
|
||||||
|
|
||||||
if (is_fru_id(argv[1], &fru_id) != 0)
|
if (is_fru_id(argv[1], &fru_id) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -4565,7 +4565,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "edit", 4)) {
|
else if (!strcmp(argv[0], "edit")) {
|
||||||
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
if (argc > 1 && strcmp(argv[1], "help") == 0) {
|
||||||
ipmi_fru_edit_help();
|
ipmi_fru_edit_help();
|
||||||
return 0;
|
return 0;
|
||||||
@ -4587,7 +4587,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
if (!strncmp(argv[2], "field", 5)) {
|
if (!strcmp(argv[2], "field")) {
|
||||||
if (argc != 6) {
|
if (argc != 6) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_fru_edit_help();
|
ipmi_fru_edit_help();
|
||||||
@ -4595,7 +4595,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = ipmi_fru_set_field_string(intf, fru_id, *argv[3], *argv[4],
|
rc = ipmi_fru_set_field_string(intf, fru_id, *argv[3], *argv[4],
|
||||||
(char *) argv[5]);
|
(char *) argv[5]);
|
||||||
} else if (!strncmp(argv[2], "oem", 3)) {
|
} else if (!strcmp(argv[2], "oem")) {
|
||||||
rc = ipmi_fru_edit_multirec(intf, fru_id, argc, argv);
|
rc = ipmi_fru_edit_multirec(intf, fru_id, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid command: %s", argv[2]);
|
lprintf(LOG_ERR, "Invalid command: %s", argv[2]);
|
||||||
@ -4606,8 +4606,8 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = ipmi_fru_edit_multirec(intf, fru_id, argc, argv);
|
rc = ipmi_fru_edit_multirec(intf, fru_id, argc, argv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "get", 4)) {
|
else if (!strcmp(argv[0], "get")) {
|
||||||
if (argc > 1 && (strncmp(argv[1], "help", 4) == 0)) {
|
if (argc > 1 && (strcmp(argv[1], "help") == 0)) {
|
||||||
ipmi_fru_get_help();
|
ipmi_fru_get_help();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argc < 2) {
|
} else if (argc < 2) {
|
||||||
@ -4628,7 +4628,7 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
if (!strncmp(argv[2], "oem", 3)) {
|
if (!strcmp(argv[2], "oem")) {
|
||||||
rc = ipmi_fru_get_multirec(intf, fru_id, argc, argv);
|
rc = ipmi_fru_get_multirec(intf, fru_id, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid command: %s", argv[2]);
|
lprintf(LOG_ERR, "Invalid command: %s", argv[2]);
|
||||||
|
@ -151,16 +151,16 @@ ipmi_fwum_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
printf_kfwum_help();
|
printf_kfwum_help();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "help", 4) == 0) {
|
if (strcmp(argv[0], "help") == 0) {
|
||||||
printf_kfwum_help();
|
printf_kfwum_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (strncmp(argv[0], "info", 4) == 0) {
|
} else if (strcmp(argv[0], "info") == 0) {
|
||||||
rc = ipmi_fwum_info(intf);
|
rc = ipmi_fwum_info(intf);
|
||||||
} else if (strncmp(argv[0], "status", 6) == 0) {
|
} else if (strcmp(argv[0], "status") == 0) {
|
||||||
rc = ipmi_fwum_status(intf);
|
rc = ipmi_fwum_status(intf);
|
||||||
} else if (strncmp(argv[0], "rollback", 8) == 0) {
|
} else if (strcmp(argv[0], "rollback") == 0) {
|
||||||
rc = KfwumManualRollback(intf);
|
rc = KfwumManualRollback(intf);
|
||||||
} else if (strncmp(argv[0], "download", 8) == 0) {
|
} else if (strcmp(argv[0], "download") == 0) {
|
||||||
if ((argc < 2) || (strlen(argv[1]) < 1)) {
|
if ((argc < 2) || (strlen(argv[1]) < 1)) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Path and file name must be specified.");
|
"Path and file name must be specified.");
|
||||||
@ -168,14 +168,14 @@ ipmi_fwum_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
printf("Firmware File Name : %s\n", argv[1]);
|
printf("Firmware File Name : %s\n", argv[1]);
|
||||||
rc = ipmi_fwum_fwupgrade(intf, argv[1], 0);
|
rc = ipmi_fwum_fwupgrade(intf, argv[1], 0);
|
||||||
} else if (strncmp(argv[0], "upgrade", 7) == 0) {
|
} else if (strcmp(argv[0], "upgrade") == 0) {
|
||||||
if ((argc >= 2) && (strlen(argv[1]) > 0)) {
|
if ((argc >= 2) && (strlen(argv[1]) > 0)) {
|
||||||
printf("Upgrading using file name %s\n", argv[1]);
|
printf("Upgrading using file name %s\n", argv[1]);
|
||||||
rc = ipmi_fwum_fwupgrade(intf, argv[1], 1);
|
rc = ipmi_fwum_fwupgrade(intf, argv[1], 1);
|
||||||
} else {
|
} else {
|
||||||
rc = KfwumStartFirmwareUpgrade(intf);
|
rc = KfwumStartFirmwareUpgrade(intf);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[0], "tracelog", 8) == 0) {
|
} else if (strcmp(argv[0], "tracelog") == 0) {
|
||||||
rc = KfwumGetTraceLog(intf);
|
rc = KfwumGetTraceLog(intf);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid KFWUM command: %s", argv[0]);
|
lprintf(LOG_ERR, "Invalid KFWUM command: %s", argv[0]);
|
||||||
|
@ -542,7 +542,7 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Rx gendev command: %s", argv[0]);
|
lprintf(LOG_ERR, "Rx gendev command: %s", argv[0]);
|
||||||
|
|
||||||
if (!argc
|
if (!argc
|
||||||
|| strncmp(argv[0], "help", 4) == 0)
|
|| strcmp(argv[0], "help") == 0)
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"SDR Commands: list read write");
|
"SDR Commands: list read write");
|
||||||
@ -552,9 +552,9 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
" read <sdr name> <file> Read to file eeprom specify by Generic Device Locators");
|
" read <sdr name> <file> Read to file eeprom specify by Generic Device Locators");
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
" write <sdr name> <file> Write from file eeprom specify by Generic Device Locators");
|
" write <sdr name> <file> Write from file eeprom specify by Generic Device Locators");
|
||||||
} else if (strncmp(argv[0], "list", 4) == 0) {
|
} else if (strcmp(argv[0], "list") == 0) {
|
||||||
rc = ipmi_sdr_print_sdr(intf, SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
rc = ipmi_sdr_print_sdr(intf, SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
||||||
} else if (strncmp(argv[0], "read", 4) == 0) {
|
} else if (strcmp(argv[0], "read") == 0) {
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
lprintf(LOG_ERR, "usage: gendev read <gendev> <filename>");
|
lprintf(LOG_ERR, "usage: gendev read <gendev> <filename>");
|
||||||
else {
|
else {
|
||||||
@ -580,7 +580,7 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
ipmi_gendev_read_file(intf, sdr->record.genloc, argv[2]);
|
ipmi_gendev_read_file(intf, sdr->record.genloc, argv[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[0], "write", 5) == 0) {
|
} else if (strcmp(argv[0], "write") == 0) {
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
lprintf(LOG_ERR, "usage: gendev write <gendev> <filename>");
|
lprintf(LOG_ERR, "usage: gendev write <gendev> <filename>");
|
||||||
else {
|
else {
|
||||||
|
@ -238,19 +238,19 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
|
|||||||
else if (strcmp(param, "bit-rate") == 0)
|
else if (strcmp(param, "bit-rate") == 0)
|
||||||
{
|
{
|
||||||
data[1] = ISOL_BAUD_RATE_PARAM;
|
data[1] = ISOL_BAUD_RATE_PARAM;
|
||||||
if (strncmp(value, "9.6", 3) == 0) {
|
if (strcmp(value, "9.6") == 0) {
|
||||||
data[2] = 0x06;
|
data[2] = 0x06;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "19.2", 4) == 0) {
|
else if (strcmp(value, "19.2") == 0) {
|
||||||
data[2] = 0x07;
|
data[2] = 0x07;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "38.4", 4) == 0) {
|
else if (strcmp(value, "38.4") == 0) {
|
||||||
data[2] = 0x08;
|
data[2] = 0x08;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "57.6", 4) == 0) {
|
else if (strcmp(value, "57.6") == 0) {
|
||||||
data[2] = 0x09;
|
data[2] = 0x09;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "115.2", 5) == 0) {
|
else if (strcmp(value, "115.2") == 0) {
|
||||||
data[2] = 0x0A;
|
data[2] = 0x0A;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -790,20 +790,20 @@ int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/*
|
/*
|
||||||
* Help
|
* Help
|
||||||
*/
|
*/
|
||||||
if (!argc || !strncmp(argv[0], "help", 4))
|
if (!argc || !strcmp(argv[0], "help"))
|
||||||
print_isol_usage();
|
print_isol_usage();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Info
|
* Info
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "info", 4)) {
|
else if (!strcmp(argv[0], "info")) {
|
||||||
ret = ipmi_print_isol_info(intf);
|
ret = ipmi_print_isol_info(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a parameter value
|
* Set a parameter value
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "set", 3)) {
|
else if (!strcmp(argv[0], "set")) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_isol_set_usage();
|
print_isol_set_usage();
|
||||||
return -1;
|
return -1;
|
||||||
@ -814,7 +814,7 @@ int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/*
|
/*
|
||||||
* Activate
|
* Activate
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "activate", 8)) {
|
else if (!strcmp(argv[0], "activate")) {
|
||||||
ret = ipmi_isol_activate(intf);
|
ret = ipmi_isol_activate(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ ipmi_kontronoem_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
ipmi_kontron_help();
|
ipmi_kontron_help();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "help", 4) == 0) {
|
if (strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_kontron_help();
|
ipmi_kontron_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "setsn", 5)) {
|
} else if (!strcmp(argv[0], "setsn")) {
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("fru setsn\n");
|
printf("fru setsn\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -89,7 +89,7 @@ ipmi_kontronoem_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
printf("FRU serial number set failed\n");
|
printf("FRU serial number set failed\n");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[0], "setmfgdate", 10)) {
|
} else if (!strcmp(argv[0], "setmfgdate")) {
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("fru setmfgdate\n");
|
printf("fru setmfgdate\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -100,7 +100,7 @@ ipmi_kontronoem_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
printf("FRU manufacturing date set failed\n");
|
printf("FRU manufacturing date set failed\n");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[0], "nextboot", 8)) {
|
} else if (!strcmp(argv[0], "nextboot")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_kontron_nextboot_help();
|
ipmi_kontron_nextboot_help();
|
||||||
|
190
lib/ipmi_lanp.c
190
lib/ipmi_lanp.c
@ -927,16 +927,16 @@ ipmi_lan_set_auth(struct ipmi_intf * intf, uint8_t chan, char * level, char * ty
|
|||||||
|
|
||||||
p = types;
|
p = types;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (strncasecmp(p, "none", 4) == 0)
|
if (strcasecmp(p, "none") == 0)
|
||||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_NONE;
|
authtype |= 1 << IPMI_SESSION_AUTHTYPE_NONE;
|
||||||
else if (strncasecmp(p, "md2", 3) == 0)
|
else if (strcasecmp(p, "md2") == 0)
|
||||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD2;
|
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD2;
|
||||||
else if (strncasecmp(p, "md5", 3) == 0)
|
else if (strcasecmp(p, "md5") == 0)
|
||||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD5;
|
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD5;
|
||||||
else if ((strncasecmp(p, "password", 8) == 0) ||
|
else if ((strcasecmp(p, "password") == 0) ||
|
||||||
(strncasecmp(p, "key", 3) == 0))
|
(strcasecmp(p, "key") == 0))
|
||||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_KEY;
|
authtype |= 1 << IPMI_SESSION_AUTHTYPE_KEY;
|
||||||
else if (strncasecmp(p, "oem", 3) == 0)
|
else if (strcasecmp(p, "oem") == 0)
|
||||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_OEM;
|
authtype |= 1 << IPMI_SESSION_AUTHTYPE_OEM;
|
||||||
else
|
else
|
||||||
lprintf(LOG_WARNING, "Invalid authentication type: %s", p);
|
lprintf(LOG_WARNING, "Invalid authentication type: %s", p);
|
||||||
@ -947,13 +947,13 @@ ipmi_lan_set_auth(struct ipmi_intf * intf, uint8_t chan, char * level, char * ty
|
|||||||
|
|
||||||
p = level;
|
p = level;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (strncasecmp(p, "callback", 8) == 0)
|
if (strcasecmp(p, "callback") == 0)
|
||||||
data[0] = authtype;
|
data[0] = authtype;
|
||||||
else if (strncasecmp(p, "user", 4) == 0)
|
else if (strcasecmp(p, "user") == 0)
|
||||||
data[1] = authtype;
|
data[1] = authtype;
|
||||||
else if (strncasecmp(p, "operator", 8) == 0)
|
else if (strcasecmp(p, "operator") == 0)
|
||||||
data[2] = authtype;
|
data[2] = authtype;
|
||||||
else if (strncasecmp(p, "admin", 5) == 0)
|
else if (strcasecmp(p, "admin") == 0)
|
||||||
data[3] = authtype;
|
data[3] = authtype;
|
||||||
else
|
else
|
||||||
lprintf(LOG_WARNING, "Invalid authentication level: %s", p);
|
lprintf(LOG_WARNING, "Invalid authentication level: %s", p);
|
||||||
@ -1384,8 +1384,8 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[0], "help", 4) == 0 ||
|
if (strcmp(argv[0], "help") == 0 ||
|
||||||
strncmp(argv[1], "help", 4) == 0) {
|
strcmp(argv[1], "help") == 0) {
|
||||||
print_lan_set_usage();
|
print_lan_set_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1405,23 +1405,23 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
|
|
||||||
/* set user access */
|
/* set user access */
|
||||||
if (strncmp(argv[1], "user", 4) == 0) {
|
if (strcmp(argv[1], "user") == 0) {
|
||||||
rc = ipmi_set_user_access(intf, chan, 1);
|
rc = ipmi_set_user_access(intf, chan, 1);
|
||||||
}
|
}
|
||||||
/* set channel access mode */
|
/* set channel access mode */
|
||||||
else if (strncmp(argv[1], "access", 6) == 0) {
|
else if (strcmp(argv[1], "access") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_lan_set_access_usage();
|
print_lan_set_access_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_access_usage();
|
print_lan_set_access_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "on", 2) == 0) {
|
else if (strcmp(argv[2], "on") == 0) {
|
||||||
rc = ipmi_set_channel_access(intf, chan, 1);
|
rc = ipmi_set_channel_access(intf, chan, 1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "off", 3) == 0) {
|
else if (strcmp(argv[2], "off") == 0) {
|
||||||
rc = ipmi_set_channel_access(intf, chan, 0);
|
rc = ipmi_set_channel_access(intf, chan, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1430,15 +1430,15 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* set ARP control */
|
/* set ARP control */
|
||||||
else if (strncmp(argv[1], "arp", 3) == 0) {
|
else if (strcmp(argv[1], "arp") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "interval", 8) == 0) {
|
else if (strcmp(argv[2], "interval") == 0) {
|
||||||
uint8_t interval = 0;
|
uint8_t interval = 0;
|
||||||
if (str2uchar(argv[3], &interval) != 0) {
|
if (str2uchar(argv[3], &interval) != 0) {
|
||||||
lprintf(LOG_ERR, "Given ARP interval '%s' is invalid.", argv[3]);
|
lprintf(LOG_ERR, "Given ARP interval '%s' is invalid.", argv[3]);
|
||||||
@ -1446,28 +1446,28 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = lan_set_arp_interval(intf, chan, interval);
|
rc = lan_set_arp_interval(intf, chan, interval);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "generate", 8) == 0) {
|
else if (strcmp(argv[2], "generate") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[3], "on", 2) == 0)
|
else if (strcmp(argv[3], "on") == 0)
|
||||||
rc = lan_set_arp_generate(intf, chan, 1);
|
rc = lan_set_arp_generate(intf, chan, 1);
|
||||||
else if (strncmp(argv[3], "off", 3) == 0)
|
else if (strcmp(argv[3], "off") == 0)
|
||||||
rc = lan_set_arp_generate(intf, chan, 0);
|
rc = lan_set_arp_generate(intf, chan, 0);
|
||||||
else {
|
else {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "respond", 7) == 0) {
|
else if (strcmp(argv[2], "respond") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[3], "on", 2) == 0)
|
else if (strcmp(argv[3], "on") == 0)
|
||||||
rc = lan_set_arp_respond(intf, chan, 1);
|
rc = lan_set_arp_respond(intf, chan, 1);
|
||||||
else if (strncmp(argv[3], "off", 3) == 0)
|
else if (strcmp(argv[3], "off") == 0)
|
||||||
rc = lan_set_arp_respond(intf, chan, 0);
|
rc = lan_set_arp_respond(intf, chan, 0);
|
||||||
else {
|
else {
|
||||||
print_lan_set_arp_usage();
|
print_lan_set_arp_usage();
|
||||||
@ -1479,12 +1479,12 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* set authentication types */
|
/* set authentication types */
|
||||||
else if (strncmp(argv[1], "auth", 4) == 0) {
|
else if (strcmp(argv[1], "auth") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_lan_set_auth_usage();
|
print_lan_set_auth_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_auth_usage();
|
print_lan_set_auth_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1492,22 +1492,22 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ip address source */
|
/* ip address source */
|
||||||
else if (strncmp(argv[1], "ipsrc", 5) == 0) {
|
else if (strcmp(argv[1], "ipsrc") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_lan_set_ipsrc_usage();
|
print_lan_set_ipsrc_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_ipsrc_usage();
|
print_lan_set_ipsrc_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "none", 4) == 0)
|
else if (strcmp(argv[2], "none") == 0)
|
||||||
data[0] = 0;
|
data[0] = 0;
|
||||||
else if (strncmp(argv[2], "static", 5) == 0)
|
else if (strcmp(argv[2], "static") == 0)
|
||||||
data[0] = 1;
|
data[0] = 1;
|
||||||
else if (strncmp(argv[2], "dhcp", 4) == 0)
|
else if (strcmp(argv[2], "dhcp") == 0)
|
||||||
data[0] = 2;
|
data[0] = 2;
|
||||||
else if (strncmp(argv[2], "bios", 4) == 0)
|
else if (strcmp(argv[2], "bios") == 0)
|
||||||
data[0] = 3;
|
data[0] = 3;
|
||||||
else {
|
else {
|
||||||
print_lan_set_ipsrc_usage();
|
print_lan_set_ipsrc_usage();
|
||||||
@ -1517,16 +1517,16 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
/* session password
|
/* session password
|
||||||
* not strictly a lan setting, but its used for lan connections */
|
* not strictly a lan setting, but its used for lan connections */
|
||||||
else if (strncmp(argv[1], "password", 8) == 0) {
|
else if (strcmp(argv[1], "password") == 0) {
|
||||||
rc = ipmi_lan_set_password(intf, 1, argv[2]);
|
rc = ipmi_lan_set_password(intf, 1, argv[2]);
|
||||||
}
|
}
|
||||||
/* snmp community string */
|
/* snmp community string */
|
||||||
else if (strncmp(argv[1], "snmp", 4) == 0) {
|
else if (strcmp(argv[1], "snmp") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_lan_set_snmp_usage();
|
print_lan_set_snmp_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_snmp_usage();
|
print_lan_set_snmp_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1537,7 +1537,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ip address */
|
/* ip address */
|
||||||
else if (strncmp(argv[1], "ipaddr", 6) == 0) {
|
else if (strcmp(argv[1], "ipaddr") == 0) {
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
{
|
{
|
||||||
print_lan_set_usage();
|
print_lan_set_usage();
|
||||||
@ -1552,7 +1552,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* network mask */
|
/* network mask */
|
||||||
else if (strncmp(argv[1], "netmask", 7) == 0) {
|
else if (strcmp(argv[1], "netmask") == 0) {
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
{
|
{
|
||||||
print_lan_set_usage();
|
print_lan_set_usage();
|
||||||
@ -1567,7 +1567,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* mac address */
|
/* mac address */
|
||||||
else if (strncmp(argv[1], "macaddr", 7) == 0) {
|
else if (strcmp(argv[1], "macaddr") == 0) {
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
{
|
{
|
||||||
print_lan_set_usage();
|
print_lan_set_usage();
|
||||||
@ -1582,23 +1582,23 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* default gateway settings */
|
/* default gateway settings */
|
||||||
else if (strncmp(argv[1], "defgw", 5) == 0) {
|
else if (strcmp(argv[1], "defgw") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
print_lan_set_defgw_usage();
|
print_lan_set_defgw_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_defgw_usage();
|
print_lan_set_defgw_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((strncmp(argv[2], "ipaddr", 5) == 0) &&
|
else if ((strcmp(argv[2], "ipaddr") == 0) &&
|
||||||
(get_cmdline_ipaddr(argv[3], data) == 0)) {
|
(get_cmdline_ipaddr(argv[3], data) == 0)) {
|
||||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||||
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_IP].desc,
|
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_IP].desc,
|
||||||
data[0], data[1], data[2], data[3]);
|
data[0], data[1], data[2], data[3]);
|
||||||
rc = set_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_IP, data, 4);
|
rc = set_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_IP, data, 4);
|
||||||
}
|
}
|
||||||
else if ((strncmp(argv[2], "macaddr", 7) == 0) &&
|
else if ((strcmp(argv[2], "macaddr") == 0) &&
|
||||||
(str2mac(argv[3], data) == 0)) {
|
(str2mac(argv[3], data) == 0)) {
|
||||||
printf("Setting LAN %s to %s\n",
|
printf("Setting LAN %s to %s\n",
|
||||||
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_MAC].desc,
|
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_MAC].desc,
|
||||||
@ -1611,23 +1611,23 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* backup gateway settings */
|
/* backup gateway settings */
|
||||||
else if (strncmp(argv[1], "bakgw", 5) == 0) {
|
else if (strcmp(argv[1], "bakgw") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
print_lan_set_bakgw_usage();
|
print_lan_set_bakgw_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_bakgw_usage();
|
print_lan_set_bakgw_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((strncmp(argv[2], "ipaddr", 5) == 0) &&
|
else if ((strcmp(argv[2], "ipaddr") == 0) &&
|
||||||
(get_cmdline_ipaddr(argv[3], data) == 0)) {
|
(get_cmdline_ipaddr(argv[3], data) == 0)) {
|
||||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||||
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_IP].desc,
|
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_IP].desc,
|
||||||
data[0], data[1], data[2], data[3]);
|
data[0], data[1], data[2], data[3]);
|
||||||
rc = set_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_IP, data, 4);
|
rc = set_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_IP, data, 4);
|
||||||
}
|
}
|
||||||
else if ((strncmp(argv[2], "macaddr", 7) == 0) &&
|
else if ((strcmp(argv[2], "macaddr") == 0) &&
|
||||||
(str2mac(argv[3], data) == 0)) {
|
(str2mac(argv[3], data) == 0)) {
|
||||||
printf("Setting LAN %s to %s\n",
|
printf("Setting LAN %s to %s\n",
|
||||||
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_MAC].desc,
|
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_MAC].desc,
|
||||||
@ -1639,24 +1639,24 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "vlan", 4) == 0) {
|
else if (strcmp(argv[1], "vlan") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
print_lan_set_vlan_usage();
|
print_lan_set_vlan_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[2], "help", 4) == 0) {
|
else if (strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_vlan_usage();
|
print_lan_set_vlan_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[2], "id", 2) == 0) {
|
else if (strcmp(argv[2], "id") == 0) {
|
||||||
if (strncasecmp(argv[3], "off", 3) == 0) {
|
if (strcmp(argv[3], "off") == 0) {
|
||||||
ipmi_lan_set_vlan_id(intf, chan, NULL);
|
ipmi_lan_set_vlan_id(intf, chan, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ipmi_lan_set_vlan_id(intf, chan, argv[3]);
|
ipmi_lan_set_vlan_id(intf, chan, argv[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[2], "priority", 8) == 0) {
|
else if (strcmp(argv[2], "priority") == 0) {
|
||||||
ipmi_lan_set_vlan_priority(intf, chan, argv[3]);
|
ipmi_lan_set_vlan_priority(intf, chan, argv[3]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1665,18 +1665,18 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* set PEF alerting on or off */
|
/* set PEF alerting on or off */
|
||||||
else if (strncasecmp(argv[1], "alert", 5) == 0) {
|
else if (strcmp(argv[1], "alert") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
lprintf(LOG_NOTICE, "LAN set alert must be 'on' or 'off'");
|
lprintf(LOG_NOTICE, "LAN set alert must be 'on' or 'off'");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[2], "on", 2) == 0 ||
|
else if (strcmp(argv[2], "on") == 0 ||
|
||||||
strncasecmp(argv[2], "enable", 6) == 0) {
|
strcmp(argv[2], "enable") == 0) {
|
||||||
printf("Enabling PEF alerts for LAN channel %d\n", chan);
|
printf("Enabling PEF alerts for LAN channel %d\n", chan);
|
||||||
rc = ipmi_set_alert_enable(intf, chan, 1);
|
rc = ipmi_set_alert_enable(intf, chan, 1);
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[2], "off", 3) == 0 ||
|
else if (strcmp(argv[2], "off") == 0 ||
|
||||||
strncasecmp(argv[2], "disable", 7) == 0) {
|
strcmp(argv[2], "disable") == 0) {
|
||||||
printf("Disabling PEF alerts for LAN channel %d\n", chan);
|
printf("Disabling PEF alerts for LAN channel %d\n", chan);
|
||||||
rc = ipmi_set_alert_enable(intf, chan, 0);
|
rc = ipmi_set_alert_enable(intf, chan, 0);
|
||||||
}
|
}
|
||||||
@ -1686,13 +1686,13 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* RMCP+ cipher suite privilege levels */
|
/* RMCP+ cipher suite privilege levels */
|
||||||
else if (strncmp(argv[1], "cipher_privs", 12) == 0)
|
else if (strcmp(argv[1], "cipher_privs") == 0)
|
||||||
{
|
{
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
print_lan_set_cipher_privs_usage();
|
print_lan_set_cipher_privs_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if ((strncmp(argv[2], "help", 4) == 0) ||
|
else if ((strcmp(argv[2], "help") == 0) ||
|
||||||
get_cmdline_cipher_suite_priv_data(argv[2], data))
|
get_cmdline_cipher_suite_priv_data(argv[2], data))
|
||||||
{
|
{
|
||||||
print_lan_set_cipher_privs_usage();
|
print_lan_set_cipher_privs_usage();
|
||||||
@ -1703,9 +1703,9 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = set_lan_param(intf, chan, IPMI_LANP_RMCP_PRIV_LEVELS, data, 9);
|
rc = set_lan_param(intf, chan, IPMI_LANP_RMCP_PRIV_LEVELS, data, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "bad_pass_thresh", 15) == 0)
|
else if (strcmp(argv[1], "bad_pass_thresh") == 0)
|
||||||
{
|
{
|
||||||
if (argc == 3 && strncmp(argv[2], "help", 4) == 0) {
|
if (argc == 3 && strcmp(argv[2], "help") == 0) {
|
||||||
print_lan_set_bad_pass_thresh_usage();
|
print_lan_set_bad_pass_thresh_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1848,8 +1848,8 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[0], "help", 4) == 0 ||
|
if (strcmp(argv[0], "help") == 0 ||
|
||||||
strncmp(argv[1], "help", 4) == 0) {
|
strcmp(argv[1], "help") == 0) {
|
||||||
print_lan_alert_set_usage();
|
print_lan_alert_set_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1858,7 +1858,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
memset(temp, 0, sizeof(temp));
|
memset(temp, 0, sizeof(temp));
|
||||||
|
|
||||||
/* alert destination ip address */
|
/* alert destination ip address */
|
||||||
if (strncasecmp(argv[0], "ipaddr", 6) == 0 &&
|
if (strcasecmp(argv[0], "ipaddr") == 0 &&
|
||||||
(get_cmdline_ipaddr(argv[1], temp) == 0)) {
|
(get_cmdline_ipaddr(argv[1], temp) == 0)) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
||||||
@ -1873,7 +1873,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* alert destination mac address */
|
/* alert destination mac address */
|
||||||
else if (strncasecmp(argv[0], "macaddr", 7) == 0 &&
|
else if (strcasecmp(argv[0], "macaddr") == 0 &&
|
||||||
(str2mac(argv[1], temp) == 0)) {
|
(str2mac(argv[1], temp) == 0)) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
||||||
@ -1888,7 +1888,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* alert destination gateway selector */
|
/* alert destination gateway selector */
|
||||||
else if (strncasecmp(argv[0], "gateway", 7) == 0) {
|
else if (strcasecmp(argv[0], "gateway") == 0) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_ADDR, alert);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -1896,13 +1896,13 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
}
|
}
|
||||||
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
||||||
|
|
||||||
if (strncasecmp(argv[1], "def", 3) == 0 ||
|
if (strcasecmp(argv[1], "def") == 0 ||
|
||||||
strncasecmp(argv[1], "default", 7) == 0) {
|
strcasecmp(argv[1], "default") == 0) {
|
||||||
printf("Setting LAN Alert %d to use Default Gateway\n", alert);
|
printf("Setting LAN Alert %d to use Default Gateway\n", alert);
|
||||||
data[2] = 0;
|
data[2] = 0;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "bak", 3) == 0 ||
|
else if (strcasecmp(argv[1], "bak") == 0 ||
|
||||||
strncasecmp(argv[1], "backup", 6) == 0) {
|
strcasecmp(argv[1], "backup") == 0) {
|
||||||
printf("Setting LAN Alert %d to use Backup Gateway\n", alert);
|
printf("Setting LAN Alert %d to use Backup Gateway\n", alert);
|
||||||
data[2] = 1;
|
data[2] = 1;
|
||||||
}
|
}
|
||||||
@ -1914,7 +1914,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_ADDR, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* alert acknowledgement */
|
/* alert acknowledgement */
|
||||||
else if (strncasecmp(argv[0], "ack", 3) == 0) {
|
else if (strcasecmp(argv[0], "ack") == 0) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -1922,13 +1922,13 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
}
|
}
|
||||||
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
||||||
|
|
||||||
if (strncasecmp(argv[1], "on", 2) == 0 ||
|
if (strcasecmp(argv[1], "on") == 0 ||
|
||||||
strncasecmp(argv[1], "yes", 3) == 0) {
|
strcasecmp(argv[1], "yes") == 0) {
|
||||||
printf("Setting LAN Alert %d to Acknowledged\n", alert);
|
printf("Setting LAN Alert %d to Acknowledged\n", alert);
|
||||||
data[1] |= 0x80;
|
data[1] |= 0x80;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "off", 3) == 0 ||
|
else if (strcasecmp(argv[1], "off") == 0 ||
|
||||||
strncasecmp(argv[1], "no", 2) == 0) {
|
strcasecmp(argv[1], "no") == 0) {
|
||||||
printf("Setting LAN Alert %d to Unacknowledged\n", alert);
|
printf("Setting LAN Alert %d to Unacknowledged\n", alert);
|
||||||
data[1] &= ~0x80;
|
data[1] &= ~0x80;
|
||||||
}
|
}
|
||||||
@ -1939,7 +1939,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* alert destination type */
|
/* alert destination type */
|
||||||
else if (strncasecmp(argv[0], "type", 4) == 0) {
|
else if (strcasecmp(argv[0], "type") == 0) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -1947,16 +1947,16 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
}
|
}
|
||||||
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
memcpy(data, p->data, __min(p->data_len, sizeof(data)));
|
||||||
|
|
||||||
if (strncasecmp(argv[1], "pet", 3) == 0) {
|
if (strcasecmp(argv[1], "pet") == 0) {
|
||||||
printf("Setting LAN Alert %d destination to PET Trap\n", alert);
|
printf("Setting LAN Alert %d destination to PET Trap\n", alert);
|
||||||
data[1] &= ~0x07;
|
data[1] &= ~0x07;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "oem1", 4) == 0) {
|
else if (strcasecmp(argv[1], "oem1") == 0) {
|
||||||
printf("Setting LAN Alert %d destination to OEM 1\n", alert);
|
printf("Setting LAN Alert %d destination to OEM 1\n", alert);
|
||||||
data[1] &= ~0x07;
|
data[1] &= ~0x07;
|
||||||
data[1] |= 0x06;
|
data[1] |= 0x06;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "oem2", 4) == 0) {
|
else if (strcasecmp(argv[1], "oem2") == 0) {
|
||||||
printf("Setting LAN Alert %d destination to OEM 2\n", alert);
|
printf("Setting LAN Alert %d destination to OEM 2\n", alert);
|
||||||
data[1] |= 0x07;
|
data[1] |= 0x07;
|
||||||
}
|
}
|
||||||
@ -1967,7 +1967,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* alert acknowledge timeout or retry interval */
|
/* alert acknowledge timeout or retry interval */
|
||||||
else if (strncasecmp(argv[0], "time", 4) == 0) {
|
else if (strcasecmp(argv[0], "time") == 0) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -1983,7 +1983,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert,
|
|||||||
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
rc = set_lan_param_nowait(intf, chan, IPMI_LANP_DEST_TYPE, data, p->data_len);
|
||||||
}
|
}
|
||||||
/* number of retries */
|
/* number of retries */
|
||||||
else if (strncasecmp(argv[0], "retry", 5) == 0) {
|
else if (strcasecmp(argv[0], "retry") == 0) {
|
||||||
/* get current parameter */
|
/* get current parameter */
|
||||||
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
p = get_lan_param_select(intf, chan, IPMI_LANP_DEST_TYPE, alert);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -2018,14 +2018,14 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
print_lan_alert_set_usage();
|
print_lan_alert_set_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[0], "help", 4) == 0) {
|
else if (strcasecmp(argv[0], "help") == 0) {
|
||||||
print_lan_alert_print_usage();
|
print_lan_alert_print_usage();
|
||||||
print_lan_alert_set_usage();
|
print_lan_alert_set_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alert print [channel] [alert] */
|
/* alert print [channel] [alert] */
|
||||||
if (strncasecmp(argv[0], "print", 5) == 0) {
|
if (strcasecmp(argv[0], "print") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
channel = find_lan_channel(intf, 1);
|
channel = find_lan_channel(intf, 1);
|
||||||
if (!is_lan_channel(intf, channel)) {
|
if (!is_lan_channel(intf, channel)) {
|
||||||
@ -2035,7 +2035,7 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return ipmi_lan_alert_print_all(intf, channel);
|
return ipmi_lan_alert_print_all(intf, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(argv[1], "help", 4) == 0) {
|
if (strcasecmp(argv[1], "help") == 0) {
|
||||||
print_lan_alert_print_usage();
|
print_lan_alert_print_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2064,12 +2064,12 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* alert set <channel> <alert> [option] */
|
/* alert set <channel> <alert> [option] */
|
||||||
if (strncasecmp(argv[0], "set", 3) == 0) {
|
if (strcasecmp(argv[0], "set") == 0) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
print_lan_alert_set_usage();
|
print_lan_alert_set_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[1], "help", 4) == 0) {
|
else if (strcasecmp(argv[1], "help") == 0) {
|
||||||
print_lan_alert_set_usage();
|
print_lan_alert_set_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2476,13 +2476,13 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
print_lan_usage();
|
print_lan_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strncmp(argv[0], "help", 4) == 0) {
|
} else if (strcmp(argv[0], "help") == 0) {
|
||||||
print_lan_usage();
|
print_lan_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[0], "printconf", 9) == 0 ||
|
if (strcmp(argv[0], "printconf") == 0 ||
|
||||||
strncmp(argv[0], "print", 5) == 0)
|
strcmp(argv[0], "print") == 0)
|
||||||
{
|
{
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
print_lan_usage();
|
print_lan_usage();
|
||||||
@ -2500,11 +2500,11 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
rc = ipmi_lan_print(intf, chan);
|
rc = ipmi_lan_print(intf, chan);
|
||||||
} else if (strncmp(argv[0], "set", 3) == 0) {
|
} else if (strcmp(argv[0], "set") == 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) {
|
} else if (strcmp(argv[0], "alert") == 0) {
|
||||||
rc = ipmi_lan_alert(intf, argc-1, &(argv[1]));
|
rc = ipmi_lan_alert(intf, argc-1, &(argv[1]));
|
||||||
} else if (strncmp(argv[0], "stats", 5) == 0) {
|
} else if (strcmp(argv[0], "stats") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
print_lan_usage();
|
print_lan_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -2520,9 +2520,9 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_ERR, "Invalid channel: %d", chan);
|
lprintf(LOG_ERR, "Invalid channel: %d", chan);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[1], "get", 3) == 0) {
|
if (strcmp(argv[1], "get") == 0) {
|
||||||
rc = ipmi_lan_stats_get(intf, chan);
|
rc = ipmi_lan_stats_get(intf, chan);
|
||||||
} else if (strncmp(argv[1], "clear", 5) == 0) {
|
} else if (strcmp(argv[1], "clear") == 0) {
|
||||||
rc = ipmi_lan_stats_clear(intf, chan);
|
rc = ipmi_lan_stats_clear(intf, chan);
|
||||||
} else {
|
} else {
|
||||||
print_lan_usage();
|
print_lan_usage();
|
||||||
|
@ -190,7 +190,7 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
if (!cmd->func || !cmd->name)
|
if (!cmd->func || !cmd->name)
|
||||||
return -1;
|
return -1;
|
||||||
else if (strncmp(cmd->name, "default", 7) == 0)
|
else if (strcmp(cmd->name, "default") == 0)
|
||||||
return cmd->func(intf, 0, NULL);
|
return cmd->func(intf, 0, NULL);
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "No command provided!");
|
lprintf(LOG_ERR, "No command provided!");
|
||||||
@ -200,12 +200,12 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (cmd=intf->cmdlist; cmd->func; cmd++) {
|
for (cmd=intf->cmdlist; cmd->func; cmd++) {
|
||||||
if (strncmp(name, cmd->name, __maxlen(cmd->name, name)) == 0)
|
if (strcmp(name, cmd->name) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!cmd->func) {
|
if (!cmd->func) {
|
||||||
cmd = intf->cmdlist;
|
cmd = intf->cmdlist;
|
||||||
if (strncmp(cmd->name, "default", 7) == 0)
|
if (strcmp(cmd->name, "default") == 0)
|
||||||
return cmd->func(intf, argc+1, argv-1);
|
return cmd->func(intf, argc+1, argv-1);
|
||||||
|
|
||||||
lprintf(LOG_ERR, "Invalid command: %s", name);
|
lprintf(LOG_ERR, "Invalid command: %s", name);
|
||||||
@ -380,8 +380,8 @@ ipmi_main(int argc, char ** argv,
|
|||||||
if (intflist) {
|
if (intflist) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (sup=intflist; sup->name; sup++) {
|
for (sup=intflist; sup->name; sup++) {
|
||||||
if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
|
if (strcmp(sup->name, intfname) == 0 &&
|
||||||
strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
|
strcmp(sup->name, intfname) == 0 &&
|
||||||
sup->supported == 1)
|
sup->supported == 1)
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
@ -609,8 +609,8 @@ ipmi_main(int argc, char ** argv,
|
|||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (strncmp(oemtype, "list", 4) == 0 ||
|
if (strcmp(oemtype, "list") == 0 ||
|
||||||
strncmp(oemtype, "help", 4) == 0) {
|
strcmp(oemtype, "help") == 0) {
|
||||||
ipmi_oem_print();
|
ipmi_oem_print();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@ -778,7 +778,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
|
|
||||||
/* check for command before doing anything */
|
/* check for command before doing anything */
|
||||||
if (argc-optind > 0 &&
|
if (argc-optind > 0 &&
|
||||||
strncmp(argv[optind], "help", 4) == 0) {
|
strcmp(argv[optind], "help") == 0) {
|
||||||
ipmi_cmd_print(cmdlist);
|
ipmi_cmd_print(cmdlist);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
@ -323,7 +323,7 @@ ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf_mc_usage();
|
printf_mc_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
else if (strcmp(argv[0], "help") == 0) {
|
||||||
printf_mc_usage();
|
printf_mc_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -348,13 +348,13 @@ ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
for (bf = mc_enables_bf; bf->name; bf++) {
|
for (bf = mc_enables_bf; bf->name; bf++) {
|
||||||
int nl = strlen(bf->name);
|
int nl = strlen(bf->name);
|
||||||
if (strncmp(argv[i], bf->name, nl) != 0)
|
if (strcmp(argv[i], bf->name) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (strncmp(argv[i]+nl+1, "off", 3) == 0) {
|
if (strcmp(argv[i]+nl+1, "off") == 0) {
|
||||||
printf("Disabling %s\n", bf->desc);
|
printf("Disabling %s\n", bf->desc);
|
||||||
en &= ~bf->mask;
|
en &= ~bf->mask;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i]+nl+1, "on", 2) == 0) {
|
else if (strcmp(argv[i]+nl+1, "on") == 0) {
|
||||||
printf("Enabling %s\n", bf->desc);
|
printf("Enabling %s\n", bf->desc);
|
||||||
en |= bf->mask;
|
en |= bf->mask;
|
||||||
}
|
}
|
||||||
@ -1284,24 +1284,24 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf_mc_usage();
|
printf_mc_usage();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
else if (strcmp(argv[0], "help") == 0) {
|
||||||
printf_mc_usage();
|
printf_mc_usage();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "reset", 5) == 0) {
|
else if (strcmp(argv[0], "reset") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
printf_mc_reset_usage();
|
printf_mc_reset_usage();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "help", 4) == 0) {
|
else if (strcmp(argv[1], "help") == 0) {
|
||||||
printf_mc_reset_usage();
|
printf_mc_reset_usage();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "cold", 4) == 0) {
|
else if (strcmp(argv[1], "cold") == 0) {
|
||||||
rc = ipmi_mc_reset(intf, BMC_COLD_RESET);
|
rc = ipmi_mc_reset(intf, BMC_COLD_RESET);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "warm", 4) == 0) {
|
else if (strcmp(argv[1], "warm") == 0) {
|
||||||
rc = ipmi_mc_reset(intf, BMC_WARM_RESET);
|
rc = ipmi_mc_reset(intf, BMC_WARM_RESET);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1310,15 +1310,15 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "info", 4) == 0) {
|
else if (strcmp(argv[0], "info") == 0) {
|
||||||
rc = ipmi_mc_get_deviceid(intf);
|
rc = ipmi_mc_get_deviceid(intf);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "guid", 4) == 0) {
|
else if (strcmp(argv[0], "guid") == 0) {
|
||||||
ipmi_guid_mode_t guid_mode = GUID_AUTO;
|
ipmi_guid_mode_t guid_mode = GUID_AUTO;
|
||||||
|
|
||||||
/* Allow for 'rfc' and 'rfc4122' */
|
/* Allow for 'rfc' and 'rfc4122' */
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "rfc", 3)) {
|
if (!strcmp(argv[1], "rfc")) {
|
||||||
guid_mode = GUID_RFC4122;
|
guid_mode = GUID_RFC4122;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "smbios")) {
|
else if (!strcmp(argv[1], "smbios")) {
|
||||||
@ -1336,26 +1336,26 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = ipmi_mc_print_guid(intf, guid_mode);
|
rc = ipmi_mc_print_guid(intf, guid_mode);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "getenables", 10) == 0) {
|
else if (strcmp(argv[0], "getenables") == 0) {
|
||||||
rc = ipmi_mc_get_enables(intf);
|
rc = ipmi_mc_get_enables(intf);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "setenables", 10) == 0) {
|
else if (strcmp(argv[0], "setenables") == 0) {
|
||||||
rc = ipmi_mc_set_enables(intf, argc-1, &(argv[1]));
|
rc = ipmi_mc_set_enables(intf, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "selftest", 8)) {
|
else if (!strcmp(argv[0], "selftest")) {
|
||||||
rc = ipmi_mc_get_selftest(intf);
|
rc = ipmi_mc_get_selftest(intf);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "watchdog", 8)) {
|
else if (!strcmp(argv[0], "watchdog")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
print_watchdog_usage();
|
print_watchdog_usage();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "help", 4) == 0) {
|
else if (strcmp(argv[1], "help") == 0) {
|
||||||
print_watchdog_usage();
|
print_watchdog_usage();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "set", 3) == 0) {
|
else if (strcmp(argv[1], "set") == 0) {
|
||||||
if (argc < 3) { /* Requires options */
|
if (argc < 3) { /* Requires options */
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
print_watchdog_usage();
|
print_watchdog_usage();
|
||||||
@ -1365,13 +1365,13 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = ipmi_mc_set_watchdog(intf, argc - 2, &(argv[2]));
|
rc = ipmi_mc_set_watchdog(intf, argc - 2, &(argv[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "get", 3) == 0) {
|
else if (strcmp(argv[1], "get") == 0) {
|
||||||
rc = ipmi_mc_get_watchdog(intf);
|
rc = ipmi_mc_get_watchdog(intf);
|
||||||
}
|
}
|
||||||
else if(strncmp(argv[1], "off", 3) == 0) {
|
else if(strcmp(argv[1], "off") == 0) {
|
||||||
rc = ipmi_mc_shutoff_watchdog(intf);
|
rc = ipmi_mc_shutoff_watchdog(intf);
|
||||||
}
|
}
|
||||||
else if(strncmp(argv[1], "reset", 5) == 0) {
|
else if(strcmp(argv[1], "reset") == 0) {
|
||||||
rc = ipmi_mc_rst_watchdog(intf);
|
rc = ipmi_mc_rst_watchdog(intf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1380,10 +1380,10 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "getsysinfo", 10) == 0) {
|
else if (strcmp(argv[0], "getsysinfo") == 0) {
|
||||||
rc = ipmi_sysinfo_main(intf, argc, argv, 0);
|
rc = ipmi_sysinfo_main(intf, argc, argv, 0);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "setsysinfo", 10) == 0) {
|
else if (strcmp(argv[0], "setsysinfo") == 0) {
|
||||||
rc = ipmi_sysinfo_main(intf, argc, argv, 1);
|
rc = ipmi_sysinfo_main(intf, argc, argv, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -135,15 +135,15 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (!oemtype
|
if (!oemtype
|
||||||
|| strncmp(oemtype, "help", 4) == 0
|
|| strcmp(oemtype, "help") == 0
|
||||||
|| strncmp(oemtype, "list", 4) == 0)
|
|| strcmp(oemtype, "list") == 0)
|
||||||
{
|
{
|
||||||
ipmi_oem_print();
|
ipmi_oem_print();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (oem=ipmi_oem_list; oem->name; oem++) {
|
for (oem=ipmi_oem_list; oem->name; oem++) {
|
||||||
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
|
if (strcmp(oemtype, oem->name) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
|
|||||||
if (!intf->oem)
|
if (!intf->oem)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strncmp(intf->oem->name, oemtype, strlen(oemtype)) == 0)
|
if (strcmp(intf->oem->name, oemtype) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1398,13 +1398,13 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_filter_help();
|
ipmi_pef2_filter_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_filter_help();
|
ipmi_pef2_filter_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "list\0", 5)) {
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
rc = ipmi_pef2_list_filters(intf);
|
rc = ipmi_pef2_list_filters(intf);
|
||||||
} else if (!strncmp(argv[0], "enable\0", 7)
|
} else if (!strcmp(argv[0], "enable")
|
||||||
||(!strncmp(argv[0], "disable\0", 8))) {
|
||(!strcmp(argv[0], "disable"))) {
|
||||||
uint8_t enable;
|
uint8_t enable;
|
||||||
uint8_t filter_id;
|
uint8_t filter_id;
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
@ -1420,16 +1420,16 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
"Valid range is <1..255>.");
|
"Valid range is <1..255>.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[0], "enable\0", 7)) {
|
if (!strcmp(argv[0], "enable")) {
|
||||||
enable = 1;
|
enable = 1;
|
||||||
} else {
|
} else {
|
||||||
enable = 0;
|
enable = 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_pef2_filter_enable(intf, enable, filter_id);
|
rc = ipmi_pef2_filter_enable(intf, enable, filter_id);
|
||||||
} else if (!strncmp(argv[0], "create\0", 7)) {
|
} else if (!strcmp(argv[0], "create")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "delete\0", 7)) {
|
} else if (!strcmp(argv[0], "delete")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1721,13 +1721,13 @@ ipmi_pef2_policy(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_policy_help();
|
ipmi_pef2_policy_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_policy_help();
|
ipmi_pef2_policy_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "list\0", 5)) {
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
rc = ipmi_pef2_list_policies(intf);
|
rc = ipmi_pef2_list_policies(intf);
|
||||||
} else if (!strncmp(argv[0], "enable\0", 7)
|
} else if (!strcmp(argv[0], "enable")
|
||||||
|| !strncmp(argv[0], "disable\0", 8)) {
|
|| !strcmp(argv[0], "disable")) {
|
||||||
uint8_t enable;
|
uint8_t enable;
|
||||||
uint8_t policy_id;
|
uint8_t policy_id;
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
@ -1742,16 +1742,16 @@ ipmi_pef2_policy(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "PEF Policy ID out of range. Valid range is <1..127>.");
|
lprintf(LOG_ERR, "PEF Policy ID out of range. Valid range is <1..127>.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[0], "enable\0", 7)) {
|
if (!strcmp(argv[0], "enable")) {
|
||||||
enable = 1;
|
enable = 1;
|
||||||
} else {
|
} else {
|
||||||
enable = 0;
|
enable = 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_pef2_policy_enable(intf, enable, policy_id);
|
rc = ipmi_pef2_policy_enable(intf, enable, policy_id);
|
||||||
} else if (!strncmp(argv[0], "create\0", 7)) {
|
} else if (!strcmp(argv[0], "create")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "delete\0", 7)) {
|
} else if (!strcmp(argv[0], "delete")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1812,30 +1812,30 @@ int ipmi_pef_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_help();
|
ipmi_pef2_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_help();
|
ipmi_pef2_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "capabilities\0", 13)) {
|
} else if (!strcmp(argv[0], "capabilities")) {
|
||||||
/* rc = ipmi_pef2_get_capabilities(intf); */
|
/* rc = ipmi_pef2_get_capabilities(intf); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "event\0", 6)) {
|
} else if (!strcmp(argv[0], "event")) {
|
||||||
/* rc = ipmi_pef2_event(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_event(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "filter\0", 7)) {
|
} else if (!strcmp(argv[0], "filter")) {
|
||||||
rc = ipmi_pef2_filter(intf, (argc - 1), ++argv);
|
rc = ipmi_pef2_filter(intf, (argc - 1), ++argv);
|
||||||
} else if (!strncmp(argv[0], "info\0", 5)) {
|
} else if (!strcmp(argv[0], "info")) {
|
||||||
rc = ipmi_pef2_get_info(intf);
|
rc = ipmi_pef2_get_info(intf);
|
||||||
} else if (!strncmp(argv[0], "pet\0", 4)) {
|
} else if (!strcmp(argv[0], "pet")) {
|
||||||
/* rc = ipmi_pef2_pet(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_pet(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "policy\0", 7)) {
|
} else if (!strcmp(argv[0], "policy")) {
|
||||||
rc = ipmi_pef2_policy(intf, (argc - 1), ++argv);
|
rc = ipmi_pef2_policy(intf, (argc - 1), ++argv);
|
||||||
} else if (!strncmp(argv[0], "status\0", 7)) {
|
} else if (!strcmp(argv[0], "status")) {
|
||||||
rc = ipmi_pef2_get_status(intf);
|
rc = ipmi_pef2_get_status(intf);
|
||||||
} else if (!strncmp(argv[0], "timer\0", 6)) {
|
} else if (!strcmp(argv[0], "timer")) {
|
||||||
/* rc = ipmi_pef2_timer(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_timer(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
|
@ -1883,24 +1883,24 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
int showProperties = 0;
|
int showProperties = 0;
|
||||||
|
|
||||||
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
if (argc == 0 || (!strcmp(argv[0], "help"))) {
|
||||||
ipmi_picmg_help();
|
ipmi_picmg_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get PICMG properties is called to obtain version information */
|
/* Get PICMG properties is called to obtain version information */
|
||||||
if (argc !=0 && !strncmp(argv[0], "properties", 10)) {
|
if (argc !=0 && !strcmp(argv[0], "properties")) {
|
||||||
showProperties =1;
|
showProperties =1;
|
||||||
}
|
}
|
||||||
rc = ipmi_picmg_properties(intf,showProperties);
|
rc = ipmi_picmg_properties(intf,showProperties);
|
||||||
|
|
||||||
/* address info command */
|
/* address info command */
|
||||||
if (!strncmp(argv[0], "addrinfo", 8)) {
|
if (!strcmp(argv[0], "addrinfo")) {
|
||||||
rc = ipmi_picmg_getaddr(intf, argc-1, &argv[1]);
|
rc = ipmi_picmg_getaddr(intf, argc-1, &argv[1]);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "busres", 6)) {
|
else if (!strcmp(argv[0], "busres")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "summary", 7)) {
|
if (!strcmp(argv[1], "summary")) {
|
||||||
ipmi_picmg_bused_resource(intf, PICMG_BUSED_RESOURCE_SUMMARY );
|
ipmi_picmg_bused_resource(intf, PICMG_BUSED_RESOURCE_SUMMARY );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1908,7 +1908,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* fru control command */
|
/* fru control command */
|
||||||
else if (!strncmp(argv[0], "frucontrol", 10)) {
|
else if (!strcmp(argv[0], "frucontrol")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_fru_control(intf, &(argv[1]));
|
rc = ipmi_picmg_fru_control(intf, &(argv[1]));
|
||||||
}
|
}
|
||||||
@ -1928,7 +1928,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fru activation command */
|
/* fru activation command */
|
||||||
else if (!strncmp(argv[0], "activate", 8)) {
|
else if (!strcmp(argv[0], "activate")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_ACTIVATE);
|
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_ACTIVATE);
|
||||||
}
|
}
|
||||||
@ -1939,7 +1939,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fru deactivation command */
|
/* fru deactivation command */
|
||||||
else if (!strncmp(argv[0], "deactivate", 10)) {
|
else if (!strcmp(argv[0], "deactivate")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_DEACTIVATE);
|
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_DEACTIVATE);
|
||||||
}else {
|
}else {
|
||||||
@ -1949,15 +1949,15 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* activation policy command */
|
/* activation policy command */
|
||||||
else if (!strncmp(argv[0], "policy", 6)) {
|
else if (!strcmp(argv[0], "policy")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_fru_activation_policy_get(intf, &(argv[2]));
|
rc = ipmi_picmg_fru_activation_policy_get(intf, &(argv[2]));
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_NOTICE, "usage: get <fruid>");
|
lprintf(LOG_NOTICE, "usage: get <fruid>");
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[1], "set", 3)) {
|
} else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
rc = ipmi_picmg_fru_activation_policy_set(intf, &(argv[2]));
|
rc = ipmi_picmg_fru_activation_policy_set(intf, &(argv[2]));
|
||||||
} else {
|
} else {
|
||||||
@ -1982,18 +1982,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* portstate command */
|
/* portstate command */
|
||||||
else if (!strncmp(argv[0], "portstate", 9)) {
|
else if (!strcmp(argv[0], "portstate")) {
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: portstate API");
|
lprintf(LOG_DEBUG,"PICMG: portstate API");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
int32_t iface;
|
int32_t iface;
|
||||||
uint8_t channel = 0;
|
uint8_t channel = 0;
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: get");
|
lprintf(LOG_DEBUG,"PICMG: get");
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)) {
|
if(!strcmp(argv[1], "getall")) {
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
|
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
|
||||||
@ -2005,7 +2005,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 10)) {
|
else if(!strcmp(argv[1], "getgranted")) {
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
||||||
@ -2013,7 +2013,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 9)){
|
else if(!strcmp(argv[1], "getdenied")){
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
||||||
@ -2036,7 +2036,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "<intf> <chn>|getall|getgranted|getdenied");
|
lprintf(LOG_NOTICE, "<intf> <chn>|getall|getgranted|getdenied");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc == 9) {
|
if (argc == 9) {
|
||||||
int32_t interface = 0;
|
int32_t interface = 0;
|
||||||
int32_t port = 0;
|
int32_t port = 0;
|
||||||
@ -2079,18 +2079,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* amc portstate command */
|
/* amc portstate command */
|
||||||
else if (!strncmp(argv[0], "amcportstate", 12)) {
|
else if (!strcmp(argv[0], "amcportstate")) {
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: amcportstate API");
|
lprintf(LOG_DEBUG,"PICMG: amcportstate API");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)){
|
if (!strcmp(argv[1], "get")){
|
||||||
int32_t device;
|
int32_t device;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: get");
|
lprintf(LOG_DEBUG,"PICMG: get");
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)){
|
if(!strcmp(argv[1], "getall")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2102,7 +2102,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 10)){
|
else if(!strcmp(argv[1], "getgranted")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2114,7 +2114,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 9)){
|
else if(!strcmp(argv[1], "getdenied")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2147,7 +2147,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "<chn> <device>|getall|getgranted|getdenied");
|
lprintf(LOG_NOTICE, "<chn> <device>|getall|getgranted|getdenied");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 7) {
|
if (argc > 7) {
|
||||||
int32_t device = -1;
|
int32_t device = -1;
|
||||||
int32_t port = 0;
|
int32_t port = 0;
|
||||||
@ -2194,9 +2194,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ATCA led commands */
|
/* ATCA led commands */
|
||||||
else if (!strncmp(argv[0], "led", 3)) {
|
else if (!strcmp(argv[0], "led")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "prop", 4)) {
|
if (!strcmp(argv[1], "prop")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_get_led_properties(intf, &(argv[2]));
|
rc = ipmi_picmg_get_led_properties(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2204,7 +2204,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "led prop <FRU-ID>");
|
lprintf(LOG_NOTICE, "led prop <FRU-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "cap", 3)) {
|
else if (!strcmp(argv[1], "cap")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_led_capabilities(intf, &(argv[2]));
|
rc = ipmi_picmg_get_led_capabilities(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2212,7 +2212,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "led cap <FRU-ID> <LED-ID>");
|
lprintf(LOG_NOTICE, "led cap <FRU-ID> <LED-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "get", 3)) {
|
else if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_led_state(intf, &(argv[2]));
|
rc = ipmi_picmg_get_led_state(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2220,7 +2220,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "led get <FRU-ID> <LED-ID>");
|
lprintf(LOG_NOTICE, "led get <FRU-ID> <LED-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 6) {
|
if (argc > 6) {
|
||||||
rc = ipmi_picmg_set_led_state(intf, &(argv[2]));
|
rc = ipmi_picmg_set_led_state(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2262,9 +2262,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* power commands */
|
/* power commands */
|
||||||
else if (!strncmp(argv[0], "power", 5)) {
|
else if (!strcmp(argv[0], "power")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_power_level(intf, &(argv[2]));
|
rc = ipmi_picmg_get_power_level(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2279,7 +2279,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
rc = ipmi_picmg_set_power_level(intf, &(argv[2]));
|
rc = ipmi_picmg_set_power_level(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2306,9 +2306,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}/* clk commands*/
|
}/* clk commands*/
|
||||||
else if (!strncmp(argv[0], "clk", 3)) {
|
else if (!strcmp(argv[0], "clk")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
int8_t clk_res = -1;
|
int8_t clk_res = -1;
|
||||||
uint8_t clk_id;
|
uint8_t clk_id;
|
||||||
uint8_t max_res = 15;
|
uint8_t max_res = 15;
|
||||||
@ -2317,7 +2317,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
max_res = 0;
|
max_res = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)) {
|
if(!strcmp(argv[1], "getall")) {
|
||||||
if( verbose ) { printf("Getting all clock state\n") ;}
|
if( verbose ) { printf("Getting all clock state\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2326,7 +2326,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 6)) {
|
else if(!strcmp(argv[1], "getdenied")) {
|
||||||
if( verbose ) { printf("Getting disabled clocks\n") ;}
|
if( verbose ) { printf("Getting disabled clocks\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2335,7 +2335,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 6)) {
|
else if(!strcmp(argv[1], "getgranted")) {
|
||||||
if( verbose ) { printf("Getting enabled clocks\n") ;}
|
if( verbose ) { printf("Getting enabled clocks\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2364,7 +2364,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 7) {
|
if (argc > 7) {
|
||||||
rc = ipmi_picmg_clk_set(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_clk_set(intf, argc-1, &(argv[2]));
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
memset(spd_data, 0, RAW_SPD_SIZE);
|
memset(spd_data, 0, RAW_SPD_SIZE);
|
||||||
|
|
||||||
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 2 || strcmp(argv[0], "help") == 0) {
|
||||||
lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
|
lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -203,9 +203,9 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/* handle bus= argument */
|
/* handle bus= argument */
|
||||||
if (argc > 2 && strncmp(argv[0], "bus=", 4) == 0) {
|
if (argc > 2 && strcmp(argv[0], "bus=") == 0) {
|
||||||
i = 1;
|
i = 1;
|
||||||
if (strncmp(argv[0], "bus=public", 10) == 0)
|
if (strcmp(argv[0], "bus=public") == 0)
|
||||||
bus = 0;
|
bus = 0;
|
||||||
else if (sscanf(argv[0], "bus=%u", &rbus) == 1)
|
else if (sscanf(argv[0], "bus=%u", &rbus) == 1)
|
||||||
bus = ((rbus & 7) << 1) | 1;
|
bus = ((rbus & 7) << 1) | 1;
|
||||||
@ -214,14 +214,14 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
/* handle channel= argument
|
/* handle channel= argument
|
||||||
* the bus= argument must be supplied first on command line */
|
* the bus= argument must be supplied first on command line */
|
||||||
if (argc > 3 && strncmp(argv[1], "chan=", 5) == 0) {
|
if (argc > 3 && strcmp(argv[1], "chan=") == 0) {
|
||||||
i = 2;
|
i = 2;
|
||||||
if (sscanf(argv[1], "chan=%u", &rbus) == 1)
|
if (sscanf(argv[1], "chan=%u", &rbus) == 1)
|
||||||
bus |= rbus << 4;
|
bus |= rbus << 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((argc-i) < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if ((argc-i) < 2 || strcmp(argv[0], "help") == 0) {
|
||||||
rawi2c_usage();
|
rawi2c_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int i;
|
int i;
|
||||||
uint8_t data[256];
|
uint8_t data[256];
|
||||||
|
|
||||||
if (argc == 1 && strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 1 && strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_raw_help();
|
ipmi_raw_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4570,8 +4570,8 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
|
|||||||
uint8_t sensor_type = 0;
|
uint8_t sensor_type = 0;
|
||||||
|
|
||||||
if (!type ||
|
if (!type ||
|
||||||
strncasecmp(type, "help", 4) == 0 ||
|
strcasecmp(type, "help") == 0 ||
|
||||||
strncasecmp(type, "list", 4) == 0) {
|
strcasecmp(type, "list") == 0) {
|
||||||
printf("Sensor Types:\n");
|
printf("Sensor Types:\n");
|
||||||
for (x = 1; x < SENSOR_TYPE_MAX; x += 2) {
|
for (x = 1; x < SENSOR_TYPE_MAX; x += 2) {
|
||||||
printf("\t%-25s (0x%02x) %-25s (0x%02x)\n",
|
printf("\t%-25s (0x%02x) %-25s (0x%02x)\n",
|
||||||
@ -4581,7 +4581,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(type, "0x", 2) == 0) {
|
if (strcmp(type, "0x") == 0) {
|
||||||
/* begins with 0x so let it be entered as raw hex value */
|
/* begins with 0x so let it be entered as raw hex value */
|
||||||
if (str2uchar(type, &sensor_type) != 0) {
|
if (str2uchar(type, &sensor_type) != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
@ -4591,9 +4591,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (x = 1; x < SENSOR_TYPE_MAX; x++) {
|
for (x = 1; x < SENSOR_TYPE_MAX; x++) {
|
||||||
if (strncasecmp(sensor_type_desc[x], type,
|
if (strcasecmp(sensor_type_desc[x], type) == 0) {
|
||||||
__maxlen(type,
|
|
||||||
sensor_type_desc[x])) == 0) {
|
|
||||||
sensor_type = x;
|
sensor_type = x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4640,8 +4638,8 @@ ipmi_sdr_print_entity(struct ipmi_intf *intf, char *entitystr)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (!entitystr ||
|
if (!entitystr ||
|
||||||
strncasecmp(entitystr, "help", 4) == 0 ||
|
strcasecmp(entitystr, "help") == 0 ||
|
||||||
strncasecmp(entitystr, "list", 4) == 0) {
|
strcasecmp(entitystr, "list") == 0) {
|
||||||
print_valstr_2col(entity_id_vals, "Entity IDs", -1);
|
print_valstr_2col(entity_id_vals, "Entity IDs", -1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4656,8 +4654,7 @@ ipmi_sdr_print_entity(struct ipmi_intf *intf, char *entitystr)
|
|||||||
|
|
||||||
/* now try string input */
|
/* now try string input */
|
||||||
for (i = 0; entity_id_vals[i].str; i++) {
|
for (i = 0; entity_id_vals[i].str; i++) {
|
||||||
if (strncasecmp(entitystr, entity_id_vals[i].str,
|
if (strcasecmp(entitystr, entity_id_vals[i].str) == 0) {
|
||||||
__maxlen(entitystr, entity_id_vals[i].str)) == 0) {
|
|
||||||
entity.id = entity_id_vals[i].val;
|
entity.id = entity_id_vals[i].val;
|
||||||
entity.instance = 0x7f;
|
entity.instance = 0x7f;
|
||||||
j=1;
|
j=1;
|
||||||
@ -4746,36 +4743,36 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return ipmi_sdr_print_sdr(intf, 0xfe);
|
return ipmi_sdr_print_sdr(intf, 0xfe);
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
else if (strcmp(argv[0], "help") == 0) {
|
||||||
printf_sdr_usage();
|
printf_sdr_usage();
|
||||||
} else if (strncmp(argv[0], "list", 4) == 0
|
} else if (strcmp(argv[0], "list") == 0
|
||||||
|| strncmp(argv[0], "elist", 5) == 0) {
|
|| strcmp(argv[0], "elist") == 0) {
|
||||||
|
|
||||||
if (strncmp(argv[0], "elist", 5) == 0)
|
if (strcmp(argv[0], "elist") == 0)
|
||||||
sdr_extended = 1;
|
sdr_extended = 1;
|
||||||
else
|
else
|
||||||
sdr_extended = 0;
|
sdr_extended = 0;
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
rc = ipmi_sdr_print_sdr(intf, 0xfe);
|
rc = ipmi_sdr_print_sdr(intf, 0xfe);
|
||||||
else if (strncmp(argv[1], "all", 3) == 0)
|
else if (strcmp(argv[1], "all") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf, 0xff);
|
rc = ipmi_sdr_print_sdr(intf, 0xff);
|
||||||
else if (strncmp(argv[1], "full", 4) == 0)
|
else if (strcmp(argv[1], "full") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_FULL_SENSOR);
|
SDR_RECORD_TYPE_FULL_SENSOR);
|
||||||
else if (strncmp(argv[1], "compact", 7) == 0)
|
else if (strcmp(argv[1], "compact") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_COMPACT_SENSOR);
|
SDR_RECORD_TYPE_COMPACT_SENSOR);
|
||||||
else if (strncmp(argv[1], "event", 5) == 0)
|
else if (strcmp(argv[1], "event") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_EVENTONLY_SENSOR);
|
SDR_RECORD_TYPE_EVENTONLY_SENSOR);
|
||||||
else if (strncmp(argv[1], "mcloc", 5) == 0)
|
else if (strcmp(argv[1], "mcloc") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_MC_DEVICE_LOCATOR);
|
SDR_RECORD_TYPE_MC_DEVICE_LOCATOR);
|
||||||
else if (strncmp(argv[1], "fru", 3) == 0)
|
else if (strcmp(argv[1], "fru") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR);
|
SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR);
|
||||||
else if (strncmp(argv[1], "generic", 7) == 0)
|
else if (strcmp(argv[1], "generic") == 0)
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
rc = ipmi_sdr_print_sdr(intf,
|
||||||
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
||||||
else if (strcmp(argv[1], "help") == 0) {
|
else if (strcmp(argv[1], "help") == 0) {
|
||||||
@ -4793,35 +4790,35 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
argv[0]);
|
argv[0]);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[0], "type", 4) == 0) {
|
} else if (strcmp(argv[0], "type") == 0) {
|
||||||
sdr_extended = 1;
|
sdr_extended = 1;
|
||||||
rc = ipmi_sdr_print_type(intf, argv[1]);
|
rc = ipmi_sdr_print_type(intf, argv[1]);
|
||||||
} else if (strncmp(argv[0], "entity", 6) == 0) {
|
} else if (strcmp(argv[0], "entity") == 0) {
|
||||||
sdr_extended = 1;
|
sdr_extended = 1;
|
||||||
rc = ipmi_sdr_print_entity(intf, argv[1]);
|
rc = ipmi_sdr_print_entity(intf, argv[1]);
|
||||||
} else if (strncmp(argv[0], "info", 4) == 0) {
|
} else if (strcmp(argv[0], "info") == 0) {
|
||||||
rc = ipmi_sdr_print_info(intf);
|
rc = ipmi_sdr_print_info(intf);
|
||||||
} else if (strncmp(argv[0], "get", 3) == 0) {
|
} else if (strcmp(argv[0], "get") == 0) {
|
||||||
rc = ipmi_sdr_print_entry_byid(intf, argc - 1, &argv[1]);
|
rc = ipmi_sdr_print_entry_byid(intf, argc - 1, &argv[1]);
|
||||||
} else if (strncmp(argv[0], "dump", 4) == 0) {
|
} else if (strcmp(argv[0], "dump") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
lprintf(LOG_NOTICE, "usage: sdr dump <file>");
|
lprintf(LOG_NOTICE, "usage: sdr dump <file>");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
rc = ipmi_sdr_dump_bin(intf, argv[1]);
|
rc = ipmi_sdr_dump_bin(intf, argv[1]);
|
||||||
} else if (strncmp(argv[0], "fill", 4) == 0) {
|
} else if (strcmp(argv[0], "fill") == 0) {
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
lprintf(LOG_NOTICE, "usage: sdr fill sensors");
|
lprintf(LOG_NOTICE, "usage: sdr fill sensors");
|
||||||
lprintf(LOG_NOTICE, "usage: sdr fill file <file>");
|
lprintf(LOG_NOTICE, "usage: sdr fill file <file>");
|
||||||
lprintf(LOG_NOTICE, "usage: sdr fill range <range>");
|
lprintf(LOG_NOTICE, "usage: sdr fill range <range>");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strncmp(argv[1], "sensors", 7) == 0) {
|
} else if (strcmp(argv[1], "sensors") == 0) {
|
||||||
rc = ipmi_sdr_add_from_sensors(intf, 21);
|
rc = ipmi_sdr_add_from_sensors(intf, 21);
|
||||||
} else if (strncmp(argv[1], "nosat", 5) == 0) {
|
} else if (strcmp(argv[1], "nosat") == 0) {
|
||||||
rc = ipmi_sdr_add_from_sensors(intf, 0);
|
rc = ipmi_sdr_add_from_sensors(intf, 0);
|
||||||
} else if (strncmp(argv[1], "file", 4) == 0) {
|
} else if (strcmp(argv[1], "file") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Not enough parameters given.");
|
"Not enough parameters given.");
|
||||||
@ -4830,7 +4827,7 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
rc = ipmi_sdr_add_from_file(intf, argv[2]);
|
rc = ipmi_sdr_add_from_file(intf, argv[2]);
|
||||||
} else if (strncmp(argv[1], "range", 4) == 0) {
|
} else if (strcmp(argv[1], "range") == 0) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Not enough parameters given.");
|
"Not enough parameters given.");
|
||||||
|
@ -2398,7 +2398,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
|
|||||||
* the command line
|
* the command line
|
||||||
*/
|
*/
|
||||||
sel_iana = iana;
|
sel_iana = iana;
|
||||||
if (strncmp("pps", format, 3) == 0) {
|
if (strcmp("pps", format) == 0) {
|
||||||
/* Parser for the following format */
|
/* Parser for the following format */
|
||||||
/* 0x001F: Event: at Mar 27 06:41:10 2007;from:(0x9a,0,7);
|
/* 0x001F: Event: at Mar 27 06:41:10 2007;from:(0x9a,0,7);
|
||||||
* sensor:(0xc3,119); event:0x6f(asserted): 0xA3 0x00 0x88
|
* sensor:(0xc3,119); event:0x6f(asserted): 0xA3 0x00 0x88
|
||||||
@ -2752,7 +2752,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
req.msg.cmd = IPMI_SET_SEL_TIME;
|
req.msg.cmd = IPMI_SET_SEL_TIME;
|
||||||
|
|
||||||
/* See if user requested set to current client system time */
|
/* See if user requested set to current client system time */
|
||||||
if (strncasecmp(time_string, "now", 3) == 0) {
|
if (strcasecmp(time_string, "now") == 0) {
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
/*
|
/*
|
||||||
* Now we have local time in t, but BMC requires UTC
|
* Now we have local time in t, but BMC requires UTC
|
||||||
@ -2857,7 +2857,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
uint8_t msg_data[4];
|
uint8_t msg_data[4];
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 0 || strcmp(argv[0], "help") == 0) {
|
||||||
lprintf(LOG_ERR, "usage: delete <id>...<id>\n");
|
lprintf(LOG_ERR, "usage: delete <id>...<id>\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2918,7 +2918,7 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
|
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 0 || strcmp(argv[0], "help") == 0) {
|
||||||
lprintf(LOG_ERR, "usage: sel get <id>...<id>");
|
lprintf(LOG_ERR, "usage: sel get <id>...<id>");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -3007,10 +3007,10 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
rc = ipmi_sel_get_info(intf);
|
rc = ipmi_sel_get_info(intf);
|
||||||
else if (strncmp(argv[0], "help", 4) == 0)
|
else if (strcmp(argv[0], "help") == 0)
|
||||||
lprintf(LOG_ERR, "SEL Commands: "
|
lprintf(LOG_ERR, "SEL Commands: "
|
||||||
"info clear delete list elist get add time save readraw writeraw interpret");
|
"info clear delete list elist get add time save readraw writeraw interpret");
|
||||||
else if (strncmp(argv[0], "interpret", 9) == 0) {
|
else if (strcmp(argv[0], "interpret") == 0) {
|
||||||
uint32_t iana = 0;
|
uint32_t iana = 0;
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel interpret iana filename format(pps)");
|
lprintf(LOG_NOTICE, "usage: sel interpret iana filename format(pps)");
|
||||||
@ -3023,37 +3023,37 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
rc = ipmi_sel_interpret(intf, iana, argv[2], argv[3]);
|
rc = ipmi_sel_interpret(intf, iana, argv[2], argv[3]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "info", 4) == 0)
|
else if (strcmp(argv[0], "info") == 0)
|
||||||
rc = ipmi_sel_get_info(intf);
|
rc = ipmi_sel_get_info(intf);
|
||||||
else if (strncmp(argv[0], "save", 4) == 0) {
|
else if (strcmp(argv[0], "save") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel save <filename>");
|
lprintf(LOG_NOTICE, "usage: sel save <filename>");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_sel_save_entries(intf, 0, argv[1]);
|
rc = ipmi_sel_save_entries(intf, 0, argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "add", 3) == 0) {
|
else if (strcmp(argv[0], "add") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel add <filename>");
|
lprintf(LOG_NOTICE, "usage: sel add <filename>");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_sel_add_entries_fromfile(intf, argv[1]);
|
rc = ipmi_sel_add_entries_fromfile(intf, argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "writeraw", 8) == 0) {
|
else if (strcmp(argv[0], "writeraw") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel writeraw <filename>");
|
lprintf(LOG_NOTICE, "usage: sel writeraw <filename>");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_sel_writeraw(intf, argv[1]);
|
rc = ipmi_sel_writeraw(intf, argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "readraw", 7) == 0) {
|
else if (strcmp(argv[0], "readraw") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel readraw <filename>");
|
lprintf(LOG_NOTICE, "usage: sel readraw <filename>");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_sel_readraw(intf, argv[1]);
|
rc = ipmi_sel_readraw(intf, argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "ereadraw", 8) == 0) {
|
else if (strcmp(argv[0], "ereadraw") == 0) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_NOTICE, "usage: sel ereadraw <filename>");
|
lprintf(LOG_NOTICE, "usage: sel ereadraw <filename>");
|
||||||
return 0;
|
return 0;
|
||||||
@ -3061,8 +3061,8 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
sel_extended = 1;
|
sel_extended = 1;
|
||||||
rc = ipmi_sel_readraw(intf, argv[1]);
|
rc = ipmi_sel_readraw(intf, argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "list", 4) == 0 ||
|
else if (strcmp(argv[0], "list") == 0 ||
|
||||||
strncmp(argv[0], "elist", 5) == 0) {
|
strcmp(argv[0], "elist") == 0) {
|
||||||
/*
|
/*
|
||||||
* Usage:
|
* Usage:
|
||||||
* list - show all SEL entries
|
* list - show all SEL entries
|
||||||
@ -3073,7 +3073,7 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int sign = 1;
|
int sign = 1;
|
||||||
char *countstr = NULL;
|
char *countstr = NULL;
|
||||||
|
|
||||||
if (strncmp(argv[0], "elist", 5) == 0)
|
if (strcmp(argv[0], "elist") == 0)
|
||||||
sel_extended = 1;
|
sel_extended = 1;
|
||||||
else
|
else
|
||||||
sel_extended = 0;
|
sel_extended = 0;
|
||||||
@ -3084,10 +3084,10 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else if (argc == 3) {
|
else if (argc == 3) {
|
||||||
countstr = argv[2];
|
countstr = argv[2];
|
||||||
|
|
||||||
if (strncmp(argv[1], "last", 4) == 0) {
|
if (strcmp(argv[1], "last") == 0) {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "first", 5) != 0) {
|
else if (strcmp(argv[1], "first") != 0) {
|
||||||
lprintf(LOG_ERR, "Unknown sel list option");
|
lprintf(LOG_ERR, "Unknown sel list option");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3104,26 +3104,26 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
rc = ipmi_sel_list_entries(intf,count);
|
rc = ipmi_sel_list_entries(intf,count);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "clear", 5) == 0)
|
else if (strcmp(argv[0], "clear") == 0)
|
||||||
rc = ipmi_sel_clear(intf);
|
rc = ipmi_sel_clear(intf);
|
||||||
else if (strncmp(argv[0], "delete", 6) == 0) {
|
else if (strcmp(argv[0], "delete") == 0) {
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
lprintf(LOG_ERR, "usage: sel delete <id>...<id>");
|
lprintf(LOG_ERR, "usage: sel delete <id>...<id>");
|
||||||
else
|
else
|
||||||
rc = ipmi_sel_delete(intf, argc-1, &argv[1]);
|
rc = ipmi_sel_delete(intf, argc-1, &argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "get", 3) == 0) {
|
else if (strcmp(argv[0], "get") == 0) {
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
lprintf(LOG_ERR, "usage: sel get <entry>");
|
lprintf(LOG_ERR, "usage: sel get <entry>");
|
||||||
else
|
else
|
||||||
rc = ipmi_sel_show_entry(intf, argc-1, &argv[1]);
|
rc = ipmi_sel_show_entry(intf, argc-1, &argv[1]);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "time", 4) == 0) {
|
else if (strcmp(argv[0], "time") == 0) {
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
lprintf(LOG_ERR, "sel time commands: get set");
|
lprintf(LOG_ERR, "sel time commands: get set");
|
||||||
else if (strncmp(argv[1], "get", 3) == 0)
|
else if (strcmp(argv[1], "get") == 0)
|
||||||
ipmi_sel_get_time(intf);
|
ipmi_sel_get_time(intf);
|
||||||
else if (strncmp(argv[1], "set", 3) == 0) {
|
else if (strcmp(argv[1], "set") == 0) {
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
lprintf(LOG_ERR, "usage: sel time set \"mm/dd/yyyy hh:mm:ss\"");
|
lprintf(LOG_ERR, "usage: sel time set \"mm/dd/yyyy hh:mm:ss\"");
|
||||||
else
|
else
|
||||||
|
@ -605,7 +605,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
if (argc < 3 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 3 || strcmp(argv[0], "help") == 0) {
|
||||||
print_sensor_thresh_usage();
|
print_sensor_thresh_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -613,7 +613,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
id = argv[0];
|
id = argv[0];
|
||||||
thresh = argv[1];
|
thresh = argv[1];
|
||||||
|
|
||||||
if (strncmp(thresh, "upper", 5) == 0) {
|
if (strcmp(thresh, "upper") == 0) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
@ -635,7 +635,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
argv[4]);
|
argv[4]);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else if (strncmp(thresh, "lower", 5) == 0) {
|
} else if (strcmp(thresh, "lower") == 0) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"usage: sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
"usage: sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
||||||
@ -658,17 +658,17 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strncmp(thresh, "unr", 3) == 0)
|
if (strcmp(thresh, "unr") == 0)
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
else if (strncmp(thresh, "ucr", 3) == 0)
|
else if (strcmp(thresh, "ucr") == 0)
|
||||||
settingMask = UPPER_CRIT_SPECIFIED;
|
settingMask = UPPER_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "unc", 3) == 0)
|
else if (strcmp(thresh, "unc") == 0)
|
||||||
settingMask = UPPER_NON_CRIT_SPECIFIED;
|
settingMask = UPPER_NON_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lnc", 3) == 0)
|
else if (strcmp(thresh, "lnc") == 0)
|
||||||
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lcr", 3) == 0)
|
else if (strcmp(thresh, "lcr") == 0)
|
||||||
settingMask = LOWER_CRIT_SPECIFIED;
|
settingMask = LOWER_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lnr", 3) == 0)
|
else if (strcmp(thresh, "lnr") == 0)
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
@ -886,7 +886,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
int i, rc=0;
|
int i, rc=0;
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || strcmp(argv[0], "help") == 0) {
|
||||||
lprintf(LOG_NOTICE, "sensor reading <id> ... [id]");
|
lprintf(LOG_NOTICE, "sensor reading <id> ... [id]");
|
||||||
lprintf(LOG_NOTICE, " id : name of desired sensor");
|
lprintf(LOG_NOTICE, " id : name of desired sensor");
|
||||||
return -1;
|
return -1;
|
||||||
@ -995,15 +995,15 @@ ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
} else if (strncmp(argv[0], "help", 4) == 0) {
|
} else if (strcmp(argv[0], "help") == 0) {
|
||||||
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get reading");
|
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get reading");
|
||||||
} else if (strncmp(argv[0], "list", 4) == 0) {
|
} else if (strcmp(argv[0], "list") == 0) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
} else if (strncmp(argv[0], "thresh", 5) == 0) {
|
} else if (strcmp(argv[0], "thresh") == 0) {
|
||||||
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
||||||
} else if (strncmp(argv[0], "get", 3) == 0) {
|
} else if (strcmp(argv[0], "get") == 0) {
|
||||||
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
||||||
} else if (strncmp(argv[0], "reading", 7) == 0) {
|
} else if (strcmp(argv[0], "reading") == 0) {
|
||||||
rc = ipmi_sensor_get_reading(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_get_reading(intf, argc - 1, &argv[1]);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
||||||
|
@ -303,7 +303,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
{
|
{
|
||||||
if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) &&
|
if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) &&
|
||||||
(strncmp(intf->name, "lan", 3) != 0))
|
(strcmp(intf->name, "lan") != 0))
|
||||||
lprintf(LOG_ERR, "It is likely that the channel in use "
|
lprintf(LOG_ERR, "It is likely that the channel in use "
|
||||||
"does not support sessions");
|
"does not support sessions");
|
||||||
}
|
}
|
||||||
@ -369,14 +369,14 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0)
|
if (argc == 0 || strcmp(argv[0], "help") == 0)
|
||||||
{
|
{
|
||||||
printf_session_usage();
|
printf_session_usage();
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "info", 4) == 0)
|
else if (strcmp(argv[0], "info") == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((argc < 2) || strncmp(argv[1], "help", 4) == 0)
|
if ((argc < 2) || strcmp(argv[1], "help") == 0)
|
||||||
{
|
{
|
||||||
printf_session_usage();
|
printf_session_usage();
|
||||||
}
|
}
|
||||||
@ -385,11 +385,11 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
Ipmi_Session_Request_Type session_request_type = 0;
|
Ipmi_Session_Request_Type session_request_type = 0;
|
||||||
uint32_t id_or_handle = 0;
|
uint32_t id_or_handle = 0;
|
||||||
|
|
||||||
if (strncmp(argv[1], "active", 6) == 0)
|
if (strcmp(argv[1], "active") == 0)
|
||||||
session_request_type = IPMI_SESSION_REQUEST_CURRENT;
|
session_request_type = IPMI_SESSION_REQUEST_CURRENT;
|
||||||
else if (strncmp(argv[1], "all", 3) == 0)
|
else if (strcmp(argv[1], "all") == 0)
|
||||||
session_request_type = IPMI_SESSION_REQUEST_ALL;
|
session_request_type = IPMI_SESSION_REQUEST_ALL;
|
||||||
else if (strncmp(argv[1], "id", 2) == 0)
|
else if (strcmp(argv[1], "id") == 0)
|
||||||
{
|
{
|
||||||
if (argc >= 3)
|
if (argc >= 3)
|
||||||
{
|
{
|
||||||
@ -408,7 +408,7 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
retval = -1;
|
retval = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[1], "handle", 6) == 0)
|
else if (strcmp(argv[1], "handle") == 0)
|
||||||
{
|
{
|
||||||
if (argc >= 3)
|
if (argc >= 3)
|
||||||
{
|
{
|
||||||
|
@ -1074,7 +1074,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(!strncmp(param, "set-in-progress", 15) && !strncmp(value, "commit-write", 12)) &&
|
if (!(!strcmp(param, "set-in-progress") && !strcmp(value, "commit-write")) &&
|
||||||
rsp->ccode) {
|
rsp->ccode) {
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x80:
|
case 0x80:
|
||||||
@ -1705,7 +1705,7 @@ ipmi_sol_activate(struct ipmi_intf * intf, int looptest, int interval,
|
|||||||
* This command is only available over RMCP+ (the lanplus
|
* This command is only available over RMCP+ (the lanplus
|
||||||
* interface).
|
* interface).
|
||||||
*/
|
*/
|
||||||
if (strncmp(intf->name, "lanplus", 7) != 0)
|
if (strcmp(intf->name, "lanplus") != 0)
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR, "Error: This command is only available over the "
|
lprintf(LOG_ERR, "Error: This command is only available over the "
|
||||||
"lanplus interface");
|
"lanplus interface");
|
||||||
@ -1908,10 +1908,10 @@ int
|
|||||||
ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
if (!argc || !strncmp(argv[0], "help", 4)) {
|
if (!argc || !strcmp(argv[0], "help")) {
|
||||||
/* Help */
|
/* Help */
|
||||||
print_sol_usage();
|
print_sol_usage();
|
||||||
} else if (!strncmp(argv[0], "info", 4)) {
|
} else if (!strcmp(argv[0], "info")) {
|
||||||
/* Info */
|
/* Info */
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
@ -1926,7 +1926,7 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
retval = ipmi_print_sol_info(intf, channel);
|
retval = ipmi_print_sol_info(intf, channel);
|
||||||
} else if (!strncmp(argv[0], "payload", 7)) {
|
} else if (!strcmp(argv[0], "payload")) {
|
||||||
/* Payload enable or disable */
|
/* Payload enable or disable */
|
||||||
uint8_t channel = 0xe;
|
uint8_t channel = 0xe;
|
||||||
uint8_t userid = 1;
|
uint8_t userid = 1;
|
||||||
@ -1945,25 +1945,25 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[1], "enable", 6)) {
|
if (!strcmp(argv[1], "enable")) {
|
||||||
enable = 1;
|
enable = 1;
|
||||||
} else if (!strncmp(argv[1], "disable", 7)) {
|
} else if (!strcmp(argv[1], "disable")) {
|
||||||
enable = 0;
|
enable = 0;
|
||||||
} else if (!strncmp(argv[1], "status", 6)) {
|
} else if (!strcmp(argv[1], "status")) {
|
||||||
return ipmi_sol_payload_access_status(intf, channel, userid);
|
return ipmi_sol_payload_access_status(intf, channel, userid);
|
||||||
} else {
|
} else {
|
||||||
print_sol_usage();
|
print_sol_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
retval = ipmi_sol_payload_access(intf, channel, userid, enable);
|
retval = ipmi_sol_payload_access(intf, channel, userid, enable);
|
||||||
} else if (!strncmp(argv[0], "set", 3)) {
|
} else if (!strcmp(argv[0], "set")) {
|
||||||
/* Set a parameter value */
|
/* Set a parameter value */
|
||||||
uint8_t channel = 0xe;
|
uint8_t channel = 0xe;
|
||||||
uint8_t guard = 1;
|
uint8_t guard = 1;
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
channel = 0xe;
|
channel = 0xe;
|
||||||
} else if (argc == 4) {
|
} else if (argc == 4) {
|
||||||
if (!strncmp(argv[3], "noguard", 7)) {
|
if (!strcmp(argv[3], "noguard")) {
|
||||||
guard = 0;
|
guard = 0;
|
||||||
} else {
|
} else {
|
||||||
if (is_ipmi_channel_num(argv[3], &channel) != 0) {
|
if (is_ipmi_channel_num(argv[3], &channel) != 0) {
|
||||||
@ -1974,7 +1974,7 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (is_ipmi_channel_num(argv[3], &channel) != 0) {
|
if (is_ipmi_channel_num(argv[3], &channel) != 0) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[4], "noguard", 7)) {
|
if (!strcmp(argv[4], "noguard")) {
|
||||||
guard = 0;
|
guard = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1982,16 +1982,16 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
retval = ipmi_sol_set_param(intf, channel, argv[1], argv[2], guard);
|
retval = ipmi_sol_set_param(intf, channel, argv[1], argv[2], guard);
|
||||||
} else if (!strncmp(argv[0], "activate", 8)) {
|
} else if (!strcmp(argv[0], "activate")) {
|
||||||
/* Activate */
|
/* Activate */
|
||||||
int i;
|
int i;
|
||||||
uint8_t instance = 1;
|
uint8_t instance = 1;
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strncmp(argv[i], "usesolkeepalive", 15)) {
|
if (!strcmp(argv[i], "usesolkeepalive")) {
|
||||||
_use_sol_for_keepalive = 1;
|
_use_sol_for_keepalive = 1;
|
||||||
} else if (!strncmp(argv[i], "nokeepalive", 11)) {
|
} else if (!strcmp(argv[i], "nokeepalive")) {
|
||||||
_disable_keepalive = 1;
|
_disable_keepalive = 1;
|
||||||
} else if (!strncmp(argv[i], "instance=", 9)) {
|
} else if (!strcmp(argv[i], "instance=")) {
|
||||||
if (str2uchar(argv[i] + 9, &instance) != 0) {
|
if (str2uchar(argv[i] + 9, &instance) != 0) {
|
||||||
lprintf(LOG_ERR, "Given instance '%s' is invalid.", argv[i] + 9);
|
lprintf(LOG_ERR, "Given instance '%s' is invalid.", argv[i] + 9);
|
||||||
print_sol_usage();
|
print_sol_usage();
|
||||||
@ -2003,12 +2003,12 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_sol_activate(intf, 0, 0, instance);
|
retval = ipmi_sol_activate(intf, 0, 0, instance);
|
||||||
} else if (!strncmp(argv[0], "deactivate", 10)) {
|
} else if (!strcmp(argv[0], "deactivate")) {
|
||||||
/* Deactivate */
|
/* Deactivate */
|
||||||
int i;
|
int i;
|
||||||
uint8_t instance = 1;
|
uint8_t instance = 1;
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strncmp(argv[i], "instance=", 9)) {
|
if (!strcmp(argv[i], "instance=")) {
|
||||||
if (str2uchar(argv[i] + 9, &instance) != 0) {
|
if (str2uchar(argv[i] + 9, &instance) != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Given instance '%s' is invalid.",
|
"Given instance '%s' is invalid.",
|
||||||
@ -2022,7 +2022,7 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_sol_deactivate(intf, instance);
|
retval = ipmi_sol_deactivate(intf, instance);
|
||||||
} else if (!strncmp(argv[0], "looptest", 8)) {
|
} else if (!strcmp(argv[0], "looptest")) {
|
||||||
/* SOL loop test: Activate and then Deactivate */
|
/* SOL loop test: Activate and then Deactivate */
|
||||||
int cnt = 200;
|
int cnt = 200;
|
||||||
int interval = 100; /* Unit is: ms */
|
int interval = 100; /* Unit is: ms */
|
||||||
|
@ -459,7 +459,7 @@ ipmi_sunoem_led_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
* sunoem led/sbled get <id> [type]
|
* sunoem led/sbled get <id> [type]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_sunoem_usage();
|
ipmi_sunoem_usage();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ ipmi_sunoem_led_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
"Unknown ledtype, will use data from the SDR oem field");
|
"Unknown ledtype, will use data from the SDR oem field");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(argv[0], "all", 3) == 0) {
|
if (strcasecmp(argv[0], "all") == 0) {
|
||||||
/* do all generic sensors */
|
/* do all generic sensors */
|
||||||
alist = ipmi_sdr_find_sdr_bytype(intf,
|
alist = ipmi_sdr_find_sdr_bytype(intf,
|
||||||
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
||||||
@ -657,7 +657,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
* sunoem led/sbled set <id> <mode> [type]
|
* sunoem led/sbled set <id> <mode> [type]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 2 || strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_sunoem_usage();
|
ipmi_sunoem_usage();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -678,7 +678,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
"Unknown ledtype, will use data from the SDR oem field");
|
"Unknown ledtype, will use data from the SDR oem field");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(argv[0], "all", 3) == 0) {
|
if (strcasecmp(argv[0], "all") == 0) {
|
||||||
/* do all generic sensors */
|
/* do all generic sensors */
|
||||||
alist = ipmi_sdr_find_sdr_bytype(intf,
|
alist = ipmi_sdr_find_sdr_bytype(intf,
|
||||||
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
||||||
@ -1096,10 +1096,8 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
cli_rsp = (sunoem_cli_msg_t *) rsp->data;
|
cli_rsp = (sunoem_cli_msg_t *) rsp->data;
|
||||||
if (cli_rsp->command_response || rsp->ccode) {
|
if (cli_rsp->command_response || rsp->ccode) {
|
||||||
if (strncmp(cli_rsp->buf, SUNOEM_CLI_INVALID_VER_ERR,
|
if (strcmp(cli_rsp->buf, SUNOEM_CLI_INVALID_VER_ERR) == 0
|
||||||
sizeof(SUNOEM_CLI_INVALID_VER_ERR) - 1) == 0
|
|| strcmp(&(cli_rsp->buf[1]), SUNOEM_CLI_INVALID_VER_ERR) == 0) {
|
||||||
|| strncmp(&(cli_rsp->buf[1]), SUNOEM_CLI_INVALID_VER_ERR,
|
|
||||||
sizeof(SUNOEM_CLI_INVALID_VER_ERR) - 1) == 0) {
|
|
||||||
if (SunOemCliActingVersion == SUNOEM_CLI_VERSION) {
|
if (SunOemCliActingVersion == SUNOEM_CLI_VERSION) {
|
||||||
/* Server doesn't support version SUNOEM_CLI_VERSION
|
/* Server doesn't support version SUNOEM_CLI_VERSION
|
||||||
Fall back to legacy version, and try again*/
|
Fall back to legacy version, and try again*/
|
||||||
@ -1109,8 +1107,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
|
|||||||
/* Server doesn't support legacy version either */
|
/* Server doesn't support legacy version either */
|
||||||
lprintf(LOG_ERR, "Failed to connect: %s", cli_rsp->buf);
|
lprintf(LOG_ERR, "Failed to connect: %s", cli_rsp->buf);
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strncmp(cli_rsp->buf, SUNOEM_CLI_BUSY_ERR,
|
} else if (strcmp(cli_rsp->buf, SUNOEM_CLI_BUSY_ERR) == 0) {
|
||||||
sizeof(SUNOEM_CLI_BUSY_ERR) - 1) == 0) {
|
|
||||||
if (retries++ < SUNOEM_CLI_MAX_RETRY) {
|
if (retries++ < SUNOEM_CLI_MAX_RETRY) {
|
||||||
lprintf(LOG_INFO, "Failed to connect: %s, retrying",
|
lprintf(LOG_INFO, "Failed to connect: %s, retrying",
|
||||||
cli_rsp->buf);
|
cli_rsp->buf);
|
||||||
@ -1196,7 +1193,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
|
|||||||
} else if (arg_num >= argc) {
|
} else if (arg_num >= argc) {
|
||||||
/* Last arg was sent. Set EOF */
|
/* Last arg was sent. Set EOF */
|
||||||
cli_req.command_response = SUNOEM_CLI_CMD_EOF;
|
cli_req.command_response = SUNOEM_CLI_CMD_EOF;
|
||||||
} else if (strncmp(argv[arg_num], "@wait=", 6) == 0) {
|
} else if (strcmp(argv[arg_num], "@wait=") == 0) {
|
||||||
/* This is a wait command */
|
/* This is a wait command */
|
||||||
char *s = &argv[arg_num][6];
|
char *s = &argv[arg_num][6];
|
||||||
delay = 0;
|
delay = 0;
|
||||||
@ -1799,7 +1796,7 @@ ipmi_sunoem_getval(struct ipmi_intf * intf, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((ipmi_sunoem_checkversion(intf, &supp_ver) < 0)
|
if ((ipmi_sunoem_checkversion(intf, &supp_ver) < 0)
|
||||||
&& (!strncmp(argv[0], sp_path, strlen(sp_path)))) {
|
&& (!strcmp(argv[0], sp_path))) {
|
||||||
argv[0][1] = 'X'; /*replace SP by X to gain access to hidden properties*/
|
argv[0][1] = 'X'; /*replace SP by X to gain access to hidden properties*/
|
||||||
memmove(&argv[0][2], &argv[0][3], strlen(argv[0]) - 2);
|
memmove(&argv[0][2], &argv[0][3], strlen(argv[0]) - 2);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ ipmi_tsol_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
int read_only = 0, rows = 0, cols = 0;
|
int read_only = 0, rows = 0, cols = 0;
|
||||||
int port = IPMI_TSOL_DEF_PORT;
|
int port = IPMI_TSOL_DEF_PORT;
|
||||||
|
|
||||||
if (strlen(intf->name) < 3 || strncmp(intf->name, "lan", 3) != 0) {
|
if (strlen(intf->name) < 3 || strcmp(intf->name, "lan") != 0) {
|
||||||
lprintf(LOG_ERR, "Error: Tyan SOL is only available over lan interface");
|
lprintf(LOG_ERR, "Error: Tyan SOL is only available over lan interface");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -398,16 +398,16 @@ ipmi_tsol_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
} else if (sscanf(argv[i], "cols=%d", &ip1) == 1) {
|
} else if (sscanf(argv[i], "cols=%d", &ip1) == 1) {
|
||||||
cols = ip1;
|
cols = ip1;
|
||||||
} else if (strlen(argv[i]) == 2
|
} else if (strlen(argv[i]) == 2
|
||||||
&& strncmp(argv[i], "ro", 2) == 0) {
|
&& strcmp(argv[i], "ro") == 0) {
|
||||||
read_only = 1;
|
read_only = 1;
|
||||||
} else if (strlen(argv[i]) == 2
|
} else if (strlen(argv[i]) == 2
|
||||||
&& strncmp(argv[i], "rw", 2) == 0) {
|
&& strcmp(argv[i], "rw") == 0) {
|
||||||
read_only = 0;
|
read_only = 0;
|
||||||
} else if (strlen(argv[i]) == 7
|
} else if (strlen(argv[i]) == 7
|
||||||
&& strncmp(argv[i], "altterm", 7) == 0) {
|
&& strcmp(argv[i], "altterm") == 0) {
|
||||||
_altterm = 1;
|
_altterm = 1;
|
||||||
} else if (strlen(argv[i]) == 4
|
} else if (strlen(argv[i]) == 4
|
||||||
&& strncmp(argv[i], "help", 4) == 0) {
|
&& strcmp(argv[i], "help") == 0) {
|
||||||
print_tsol_usage();
|
print_tsol_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -613,7 +613,7 @@ ipmi_user_mod(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
if (is_ipmi_user_id(argv[1], &user_id)) {
|
if (is_ipmi_user_id(argv[1], &user_id)) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
operation = (strncmp(argv[0], "disable", 7) == 0) ?
|
operation = (strcmp(argv[0], "disable") == 0) ?
|
||||||
IPMI_PASSWORD_DISABLE_USER : IPMI_PASSWORD_ENABLE_USER;
|
IPMI_PASSWORD_DISABLE_USER : IPMI_PASSWORD_ENABLE_USER;
|
||||||
|
|
||||||
ccode = _ipmi_set_user_password(intf, user_id, operation,
|
ccode = _ipmi_set_user_password(intf, user_id, operation,
|
||||||
@ -740,32 +740,32 @@ ipmi_user_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
print_user_usage();
|
print_user_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "help", 4) == 0) {
|
if (strcmp(argv[0], "help") == 0) {
|
||||||
/* Help */
|
/* Help */
|
||||||
print_user_usage();
|
print_user_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(argv[0], "summary", 7) == 0) {
|
} else if (strcmp(argv[0], "summary") == 0) {
|
||||||
return ipmi_user_summary(intf, argc, argv);
|
return ipmi_user_summary(intf, argc, argv);
|
||||||
} else if (strncmp(argv[0], "list", 4) == 0) {
|
} else if (strcmp(argv[0], "list") == 0) {
|
||||||
return ipmi_user_list(intf, argc, argv);
|
return ipmi_user_list(intf, argc, argv);
|
||||||
} else if (strncmp(argv[0], "test", 4) == 0) {
|
} else if (strcmp(argv[0], "test") == 0) {
|
||||||
return ipmi_user_test(intf, argc, argv);
|
return ipmi_user_test(intf, argc, argv);
|
||||||
} else if (strncmp(argv[0], "set", 3) == 0) {
|
} else if (strcmp(argv[0], "set") == 0) {
|
||||||
/* Set */
|
/* Set */
|
||||||
if ((argc >= 3)
|
if ((argc >= 3)
|
||||||
&& (strncmp("password", argv[1], 8) == 0)) {
|
&& (strcmp("password", argv[1]) == 0)) {
|
||||||
return ipmi_user_password(intf, argc, argv);
|
return ipmi_user_password(intf, argc, argv);
|
||||||
} else if ((argc >= 2)
|
} else if ((argc >= 2)
|
||||||
&& (strncmp("name", argv[1], 4) == 0)) {
|
&& (strcmp("name", argv[1]) == 0)) {
|
||||||
return ipmi_user_name(intf, argc, argv);
|
return ipmi_user_name(intf, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
print_user_usage();
|
print_user_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[0], "priv", 4) == 0) {
|
} else if (strcmp(argv[0], "priv") == 0) {
|
||||||
return ipmi_user_priv(intf, argc, argv);
|
return ipmi_user_priv(intf, argc, argv);
|
||||||
} else if ((strncmp(argv[0], "disable", 7) == 0)
|
} else if ((strcmp(argv[0], "disable") == 0)
|
||||||
|| (strncmp(argv[0], "enable", 6) == 0)) {
|
|| (strcmp(argv[0], "enable") == 0)) {
|
||||||
return ipmi_user_mod(intf, argc, argv);
|
return ipmi_user_mod(intf, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid user command: '%s'\n", argv[0]);
|
lprintf(LOG_ERR, "Invalid user command: '%s'\n", argv[0]);
|
||||||
|
@ -819,48 +819,48 @@ ipmi_vita_fru_control(struct ipmi_intf *intf, char **argv)
|
|||||||
static int
|
static int
|
||||||
ipmi_vita_get_cmd(int argc, char **argv)
|
ipmi_vita_get_cmd(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 1 || !strncmp(argv[0], "help", 4)) {
|
if (argc < 1 || !strcmp(argv[0], "help")) {
|
||||||
return VITA_CMD_HELP;
|
return VITA_CMD_HELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get VSO Properties */
|
/* Get VSO Properties */
|
||||||
if (!strncmp(argv[0], "properties", 10)) {
|
if (!strcmp(argv[0], "properties")) {
|
||||||
return VITA_CMD_PROPERTIES;
|
return VITA_CMD_PROPERTIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU Control command */
|
/* FRU Control command */
|
||||||
if (!strncmp(argv[0], "frucontrol", 10)) {
|
if (!strcmp(argv[0], "frucontrol")) {
|
||||||
return VITA_CMD_FRUCONTROL;
|
return VITA_CMD_FRUCONTROL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get FRU Address Info command */
|
/* Get FRU Address Info command */
|
||||||
if (!strncmp(argv[0], "addrinfo", 8)) {
|
if (!strcmp(argv[0], "addrinfo")) {
|
||||||
return VITA_CMD_ADDRINFO;
|
return VITA_CMD_ADDRINFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set FRU Activation (activate) command */
|
/* Set FRU Activation (activate) command */
|
||||||
if (!strncmp(argv[0], "activate", 8)) {
|
if (!strcmp(argv[0], "activate")) {
|
||||||
return VITA_CMD_ACTIVATE;
|
return VITA_CMD_ACTIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set FRU Activation (deactivate) command */
|
/* Set FRU Activation (deactivate) command */
|
||||||
if (!strncmp(argv[0], "deactivate", 10)) {
|
if (!strcmp(argv[0], "deactivate")) {
|
||||||
return VITA_CMD_DEACTIVATE;
|
return VITA_CMD_DEACTIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU State Policy Bits commands */
|
/* FRU State Policy Bits commands */
|
||||||
if (!strncmp(argv[0], "policy", 6)) {
|
if (!strcmp(argv[0], "policy")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
return VITA_CMD_UNKNOWN;
|
return VITA_CMD_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get FRU State Policy Bits command */
|
/* Get FRU State Policy Bits command */
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
return VITA_CMD_POLICY_GET;
|
return VITA_CMD_POLICY_GET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set FRU State Policy Bits command */
|
/* Set FRU State Policy Bits command */
|
||||||
if (!strncmp(argv[1], "set", 3)) {
|
if (!strcmp(argv[1], "set")) {
|
||||||
return VITA_CMD_POLICY_SET;
|
return VITA_CMD_POLICY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,28 +869,28 @@ ipmi_vita_get_cmd(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FRU LED commands */
|
/* FRU LED commands */
|
||||||
if (!strncmp(argv[0], "led", 3)) {
|
if (!strcmp(argv[0], "led")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
return VITA_CMD_UNKNOWN;
|
return VITA_CMD_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU LED Get Properties */
|
/* FRU LED Get Properties */
|
||||||
if (!strncmp(argv[1], "prop", 4)) {
|
if (!strcmp(argv[1], "prop")) {
|
||||||
return VITA_CMD_LED_PROP;
|
return VITA_CMD_LED_PROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU LED Get Capabilities */
|
/* FRU LED Get Capabilities */
|
||||||
if (!strncmp(argv[1], "cap", 3)) {
|
if (!strcmp(argv[1], "cap")) {
|
||||||
return VITA_CMD_LED_CAP;
|
return VITA_CMD_LED_CAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU LED Get State */
|
/* FRU LED Get State */
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
return VITA_CMD_LED_GET;
|
return VITA_CMD_LED_GET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FRU LED Set State */
|
/* FRU LED Set State */
|
||||||
if (!strncmp(argv[1], "set", 3)) {
|
if (!strcmp(argv[1], "set")) {
|
||||||
return VITA_CMD_LED_SET;
|
return VITA_CMD_LED_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ ipmi_event_intf_load(char * name)
|
|||||||
intf++)
|
intf++)
|
||||||
{
|
{
|
||||||
i = *intf;
|
i = *intf;
|
||||||
if (strncmp(name, i->name, strlen(name)) == 0) {
|
if (strcmp(name, i->name) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,32 +705,32 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
|
|||||||
sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
|
sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (strncasecmp(argv[i], "help", 4) == 0) {
|
if (strcasecmp(argv[i], "help") == 0) {
|
||||||
ipmievd_usage();
|
ipmievd_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncasecmp(argv[i], "daemon", 6) == 0) {
|
if (strcasecmp(argv[i], "daemon") == 0) {
|
||||||
daemon = 1;
|
daemon = 1;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[i], "nodaemon", 8) == 0) {
|
else if (strcasecmp(argv[i], "nodaemon") == 0) {
|
||||||
daemon = 0;
|
daemon = 0;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[i], "daemon=", 7) == 0) {
|
else if (strcasecmp(argv[i], "daemon=") == 0) {
|
||||||
if (strncasecmp(argv[i]+7, "on", 2) == 0 ||
|
if (strcasecmp(argv[i]+7, "on") == 0 ||
|
||||||
strncasecmp(argv[i]+7, "yes", 3) == 0)
|
strcasecmp(argv[i]+7, "yes") == 0)
|
||||||
daemon = 1;
|
daemon = 1;
|
||||||
else if (strncasecmp(argv[i]+7, "off", 3) == 0 ||
|
else if (strcasecmp(argv[i]+7, "off") == 0 ||
|
||||||
strncasecmp(argv[i]+7, "no", 2) == 0)
|
strcasecmp(argv[i]+7, "no") == 0)
|
||||||
daemon = 0;
|
daemon = 0;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[i], "timeout=", 8) == 0) {
|
else if (strcasecmp(argv[i], "timeout=") == 0) {
|
||||||
if ( (str2int(argv[i]+8, &selwatch_timeout) != 0) ||
|
if ( (str2int(argv[i]+8, &selwatch_timeout) != 0) ||
|
||||||
selwatch_timeout < 0) {
|
selwatch_timeout < 0) {
|
||||||
lprintf(LOG_ERR, "Invalid input given or out of range for time-out.");
|
lprintf(LOG_ERR, "Invalid input given or out of range for time-out.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncasecmp(argv[i], "pidfile=", 8) == 0) {
|
else if (strcasecmp(argv[i], "pidfile=") == 0) {
|
||||||
memset(pidfile, 0, 64);
|
memset(pidfile, 0, 64);
|
||||||
strncpy(pidfile, argv[i]+8,
|
strncpy(pidfile, argv[i]+8,
|
||||||
__min(strlen((const char *)(argv[i]+8)), 63));
|
__min(strlen((const char *)(argv[i]+8)), 63));
|
||||||
@ -845,7 +845,7 @@ ipmievd_open_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
struct ipmi_event_intf * eintf;
|
struct ipmi_event_intf * eintf;
|
||||||
|
|
||||||
/* only one interface works for this */
|
/* only one interface works for this */
|
||||||
if (strncmp(intf->name, "open", 4) != 0) {
|
if (strcmp(intf->name, "open") != 0) {
|
||||||
lprintf(LOG_ERR, "Invalid Interface for OpenIPMI Event Handler: %s", intf->name);
|
lprintf(LOG_ERR, "Invalid Interface for OpenIPMI Event Handler: %s", intf->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -125,14 +125,14 @@ int ipmi_shell_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
pbuf = NULL;
|
pbuf = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strncmp(pbuf, "quit", 4) == 0 ||
|
if (strcmp(pbuf, "quit") == 0 ||
|
||||||
strncmp(pbuf, "exit", 4) == 0) {
|
strcmp(pbuf, "exit") == 0) {
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
pbuf = NULL;
|
pbuf = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(pbuf, "help", 4) == 0 ||
|
if (strcmp(pbuf, "help") == 0 ||
|
||||||
strncmp(pbuf, "?", 1) == 0) {
|
strcmp(pbuf, "?") == 0) {
|
||||||
ipmi_cmd_print(intf->cmdlist);
|
ipmi_cmd_print(intf->cmdlist);
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
pbuf = NULL;
|
pbuf = NULL;
|
||||||
@ -258,13 +258,13 @@ ipmi_set_usage(void)
|
|||||||
|
|
||||||
int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 0 || strcmp(argv[0], "help") == 0) {
|
||||||
ipmi_set_usage();
|
ipmi_set_usage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* these options can have no arguments */
|
/* these options can have no arguments */
|
||||||
if (strncmp(argv[0], "verbose", 7) == 0) {
|
if (strcmp(argv[0], "verbose") == 0) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (str2int(argv[1], &verbose) != 0) {
|
if (str2int(argv[1], &verbose) != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
@ -277,7 +277,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "csv", 3) == 0) {
|
if (strcmp(argv[0], "csv") == 0) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (str2int(argv[1], &csv_output) != 0) {
|
if (str2int(argv[1], &csv_output) != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
@ -297,8 +297,8 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[0], "host", 4) == 0 ||
|
if (strcmp(argv[0], "host") == 0 ||
|
||||||
strncmp(argv[0], "hostname", 8) == 0) {
|
strcmp(argv[0], "hostname") == 0) {
|
||||||
ipmi_intf_session_set_hostname(intf, argv[1]);
|
ipmi_intf_session_set_hostname(intf, argv[1]);
|
||||||
if (!intf->session) {
|
if (!intf->session) {
|
||||||
lprintf(LOG_ERR, "Failed to set session hostname.");
|
lprintf(LOG_ERR, "Failed to set session hostname.");
|
||||||
@ -307,8 +307,8 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("Set session hostname to %s\n",
|
printf("Set session hostname to %s\n",
|
||||||
intf->ssn_params.hostname);
|
intf->ssn_params.hostname);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "user", 4) == 0 ||
|
else if (strcmp(argv[0], "user") == 0 ||
|
||||||
strncmp(argv[0], "username", 8) == 0) {
|
strcmp(argv[0], "username") == 0) {
|
||||||
ipmi_intf_session_set_username(intf, argv[1]);
|
ipmi_intf_session_set_username(intf, argv[1]);
|
||||||
if (!intf->session) {
|
if (!intf->session) {
|
||||||
lprintf(LOG_ERR, "Failed to set session username.");
|
lprintf(LOG_ERR, "Failed to set session username.");
|
||||||
@ -317,8 +317,8 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("Set session username to %s\n",
|
printf("Set session username to %s\n",
|
||||||
intf->ssn_params.username);
|
intf->ssn_params.username);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "pass", 4) == 0 ||
|
else if (strcmp(argv[0], "pass") == 0 ||
|
||||||
strncmp(argv[0], "password", 8) == 0) {
|
strcmp(argv[0], "password") == 0) {
|
||||||
ipmi_intf_session_set_password(intf, argv[1]);
|
ipmi_intf_session_set_password(intf, argv[1]);
|
||||||
if (!intf->session) {
|
if (!intf->session) {
|
||||||
lprintf(LOG_ERR, "Failed to set session password.");
|
lprintf(LOG_ERR, "Failed to set session password.");
|
||||||
@ -326,7 +326,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
printf("Set session password\n");
|
printf("Set session password\n");
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "authtype", 8) == 0) {
|
else if (strcmp(argv[0], "authtype") == 0) {
|
||||||
int authtype;
|
int authtype;
|
||||||
authtype = str2val(argv[1], ipmi_authtype_session_vals);
|
authtype = str2val(argv[1], ipmi_authtype_session_vals);
|
||||||
if (authtype == 0xFF) {
|
if (authtype == 0xFF) {
|
||||||
@ -343,7 +343,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
val2str(intf->ssn_params.authtype_set,
|
val2str(intf->ssn_params.authtype_set,
|
||||||
ipmi_authtype_session_vals));
|
ipmi_authtype_session_vals));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "privlvl", 7) == 0) {
|
else if (strcmp(argv[0], "privlvl") == 0) {
|
||||||
int privlvl;
|
int privlvl;
|
||||||
privlvl = str2val(argv[1], ipmi_privlvl_vals);
|
privlvl = str2val(argv[1], ipmi_privlvl_vals);
|
||||||
if (privlvl == 0xFF) {
|
if (privlvl == 0xFF) {
|
||||||
@ -361,7 +361,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
val2str(intf->ssn_params.privlvl,
|
val2str(intf->ssn_params.privlvl,
|
||||||
ipmi_privlvl_vals));
|
ipmi_privlvl_vals));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "port", 4) == 0) {
|
else if (strcmp(argv[0], "port") == 0) {
|
||||||
int port = 0;
|
int port = 0;
|
||||||
if (str2int(argv[1], &port) != 0 || port > MAX_PORT) {
|
if (str2int(argv[1], &port) != 0 || port > MAX_PORT) {
|
||||||
lprintf(LOG_ERR, "Given port '%s' is invalid.",
|
lprintf(LOG_ERR, "Given port '%s' is invalid.",
|
||||||
@ -375,7 +375,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
printf("Set session port to %d\n", intf->ssn_params.port);
|
printf("Set session port to %d\n", intf->ssn_params.port);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "localaddr", 9) == 0) {
|
else if (strcmp(argv[0], "localaddr") == 0) {
|
||||||
uint8_t my_addr = 0;
|
uint8_t my_addr = 0;
|
||||||
if (str2uchar(argv[1], &my_addr) != 0) {
|
if (str2uchar(argv[1], &my_addr) != 0) {
|
||||||
lprintf(LOG_ERR, "Given localaddr '%s' is invalid.",
|
lprintf(LOG_ERR, "Given localaddr '%s' is invalid.",
|
||||||
@ -385,7 +385,7 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
intf->my_addr = my_addr;
|
intf->my_addr = my_addr;
|
||||||
printf("Set local IPMB address to 0x%02x\n", intf->my_addr);
|
printf("Set local IPMB address to 0x%02x\n", intf->my_addr);
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "targetaddr", 10) == 0) {
|
else if (strcmp(argv[0], "targetaddr") == 0) {
|
||||||
uint8_t target_addr = 0;
|
uint8_t target_addr = 0;
|
||||||
if (str2uchar(argv[1], &target_addr) != 0) {
|
if (str2uchar(argv[1], &target_addr) != 0) {
|
||||||
lprintf(LOG_ERR, "Given targetaddr '%s' is invalid.",
|
lprintf(LOG_ERR, "Given targetaddr '%s' is invalid.",
|
||||||
|
@ -167,8 +167,8 @@ void ipmi_intf_print(struct ipmi_intf_support * intflist)
|
|||||||
if (intflist) {
|
if (intflist) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (sup=intflist; sup->name; sup++) {
|
for (sup=intflist; sup->name; sup++) {
|
||||||
if (strncmp(sup->name, (*intf)->name, strlen(sup->name)) == 0 &&
|
if (strcmp(sup->name, (*intf)->name) == 0 &&
|
||||||
strncmp(sup->name, (*intf)->name, strlen((*intf)->name)) == 0 &&
|
strcmp(sup->name, (*intf)->name) == 0 &&
|
||||||
sup->supported == 1)
|
sup->supported == 1)
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ struct ipmi_intf * ipmi_intf_load(char * name)
|
|||||||
intf++)
|
intf++)
|
||||||
{
|
{
|
||||||
i = *intf;
|
i = *intf;
|
||||||
if (strncmp(name, i->name, strlen(name)) == 0) {
|
if (strcmp(name, i->name) == 0) {
|
||||||
if (i->setup && (i->setup(i) < 0)) {
|
if (i->setup && (i->setup(i) < 0)) {
|
||||||
lprintf(LOG_ERR, "Unable to setup "
|
lprintf(LOG_ERR, "Unable to setup "
|
||||||
"interface %s", name);
|
"interface %s", name);
|
||||||
|
@ -394,7 +394,7 @@ recv_response(struct ipmi_intf * intf, unsigned char *data, int len)
|
|||||||
*pp = 0;
|
*pp = 0;
|
||||||
|
|
||||||
/* was it an error? */
|
/* was it an error? */
|
||||||
if (strncmp(p, "ERR ", 4) == 0) {
|
if (strcmp(p, "ERR ") == 0) {
|
||||||
serial_write_line(intf, "\r\r\r\r");
|
serial_write_line(intf, "\r\r\r\r");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
serial_flush(intf);
|
serial_flush(intf);
|
||||||
|
@ -133,7 +133,7 @@ scsiProbeNew(int *num_ami_devices, int *sg_nos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(linebuf, "%s", vendor) == 1) {
|
if (sscanf(linebuf, "%s", vendor) == 1) {
|
||||||
if (strncmp(vendor, "AMI", strlen("AMI")) == 0) {
|
if (strcmp(vendor, "AMI") == 0) {
|
||||||
numdevfound++;
|
numdevfound++;
|
||||||
sg_nos[numdevfound - 1] = lineno;
|
sg_nos[numdevfound - 1] = lineno;
|
||||||
if (numdevfound == inplen) {
|
if (numdevfound == inplen) {
|
||||||
@ -249,7 +249,7 @@ IsG2Drive(int cd_desc)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(szSignature, "$$$AMI$$$", strlen("$$$AMI$$$")) != 0) {
|
if (strcmp(szSignature, "$$$AMI$$$") != 0) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"IsG2Drive:Signature mismatch when ID command sent");
|
"IsG2Drive:Signature mismatch when ID command sent");
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user