diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
commit | a9ee361f27e0439530387765924574e5358c8a5c (patch) | |
tree | 3104aecc4d574f7d7bbb269223814586277b1797 /lib/ipmi_pef.c | |
parent | 82ac6c87ce0b0af2fb8de25d70442fec406bb742 (diff) |
New upstream version 1.8.19upstream/1.8.19upstream
Diffstat (limited to 'lib/ipmi_pef.c')
-rw-r--r-- | lib/ipmi_pef.c | 429 |
1 files changed, 363 insertions, 66 deletions
diff --git a/lib/ipmi_pef.c b/lib/ipmi_pef.c index bbf25f2..ef8c5d4 100644 --- a/lib/ipmi_pef.c +++ b/lib/ipmi_pef.c @@ -42,6 +42,7 @@ #include <ipmitool/ipmi_mc.h> #include <ipmitool/ipmi_pef.h> #include <ipmitool/ipmi_sel.h> +#include <ipmitool/ipmi_time.h> #include <ipmitool/log.h> extern int verbose; @@ -78,6 +79,307 @@ static const char * pef_flag_fmts[][3] = { }; static const char * listitem[] = {" | %s", ",%s", "%s"}; +static struct bit_desc_map +pef_b2s_actions = { +BIT_DESC_MAP_ALL, +{ {"Alert", PEF_ACTION_ALERT}, + {"Power-off", PEF_ACTION_POWER_DOWN}, + {"Reset", PEF_ACTION_RESET}, + {"Power-cycle", PEF_ACTION_POWER_CYCLE}, + {"OEM-defined", PEF_ACTION_OEM}, + {"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_severities = { +BIT_DESC_MAP_ANY, +{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE}, + {"Critical", PEF_SEVERITY_CRITICAL}, + {"Warning", PEF_SEVERITY_WARNING}, + {"OK", PEF_SEVERITY_OK}, + {"Information", PEF_SEVERITY_INFORMATION}, + {"Monitor", PEF_SEVERITY_MONITOR}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_sensortypes = { +BIT_DESC_MAP_LIST, +{ {"Any", 255}, + {"Temperature", 1}, + {"Voltage", 2}, + {"Current", 3}, + {"Fan", 4}, + {"Chassis Intrusion", 5}, + {"Platform security breach", 6}, + {"Processor", 7}, + {"Power supply", 8}, + {"Power Unit", 9}, + {"Cooling device", 10}, + {"Other (units-based)", 11}, + {"Memory", 12}, + {"Drive Slot", 13}, + {"POST memory resize", 14}, + {"POST error", 15}, + {"Logging disabled", 16}, + {"Watchdog 1", 17}, + {"System event", 18}, + {"Critical Interrupt", 19}, + {"Button", 20}, + {"Module/board", 21}, + {"uController/coprocessor", 22}, + {"Add-in card", 23}, + {"Chassis", 24}, + {"Chipset", 25}, + {"Other (FRU)", 26}, + {"Cable/interconnect", 27}, + {"Terminator", 28}, + {"System boot", 29}, + {"Boot error", 30}, + {"OS boot", 31}, + {"OS critical stop", 32}, + {"Slot/connector", 33}, + {"ACPI power state", 34}, + {"Watchdog 2", 35}, + {"Platform alert", 36}, + {"Entity presence", 37}, + {"Monitor ASIC/IC", 38}, + {"LAN", 39}, + {"Management subsystem health", 40}, + {"Battery", 41}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_1 = { +BIT_DESC_MAP_LIST, +{ {"<LNC", 0}, /* '<' : getting worse */ + {">LNC", 1}, /* '>' : getting better */ + {"<LC", 2}, + {">LC", 3}, + {"<LNR", 4}, + {">LNR", 5}, + {">UNC", 6}, + {"<UNC", 7}, + {">UC", 8}, + {"<UC", 9}, + {">UNR", 10}, + {"<UNR", 11}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_2 = { +BIT_DESC_MAP_LIST, +{ {"transition to idle", 0}, + {"transition to active", 1}, + {"transition to busy", 2}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_3 = { +BIT_DESC_MAP_LIST, +{ {"state deasserted", 0}, + {"state asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_4 = { +BIT_DESC_MAP_LIST, +{ {"predictive failure deasserted", 0}, + {"predictive failure asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_5 = { +BIT_DESC_MAP_LIST, +{ {"limit not exceeded", 0}, + {"limit exceeded", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_6 = { +BIT_DESC_MAP_LIST, +{ {"performance met", 0}, + {"performance lags", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_7 = { +BIT_DESC_MAP_LIST, +{ {"ok", 0}, + {"<warn", 1}, /* '<' : getting worse */ + {"<fail", 2}, + {"<dead", 3}, + {">warn", 4}, /* '>' : getting better */ + {">fail", 5}, + {"dead", 6}, + {"monitor", 7}, + {"informational", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_8 = { +BIT_DESC_MAP_LIST, +{ {"device removed/absent", 0}, + {"device inserted/present", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_9 = { +BIT_DESC_MAP_LIST, +{ {"device disabled", 0}, + {"device enabled", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_10 = { +BIT_DESC_MAP_LIST, +{ {"transition to running", 0}, + {"transition to in test", 1}, + {"transition to power off", 2}, + {"transition to online", 3}, + {"transition to offline", 4}, + {"transition to off duty", 5}, + {"transition to degraded", 6}, + {"transition to power save", 7}, + {"install error", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_11 = { +BIT_DESC_MAP_LIST, +{ {"fully redundant", 0}, + {"redundancy lost", 1}, + {"redundancy degraded", 2}, + {"<non-redundant/sufficient", 3}, /* '<' : getting worse */ + {">non-redundant/sufficient", 4}, /* '>' : getting better */ + {"non-redundant/insufficient", 5}, + {"<redundancy degraded", 6}, + {">redundancy degraded", 7}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_12 = { +BIT_DESC_MAP_LIST, +{ {"D0 power state", 0}, + {"D1 power state", 1}, + {"D2 power state", 2}, + {"D3 power state", 3}, + {NULL} +} }; + +static struct bit_desc_map * +pef_b2s_generic_ER[] = { + &pef_b2s_gentype_1, + &pef_b2s_gentype_2, + &pef_b2s_gentype_3, + &pef_b2s_gentype_4, + &pef_b2s_gentype_5, + &pef_b2s_gentype_6, + &pef_b2s_gentype_7, + &pef_b2s_gentype_8, + &pef_b2s_gentype_9, + &pef_b2s_gentype_10, + &pef_b2s_gentype_11, + &pef_b2s_gentype_12, +}; +#define PEF_B2S_GENERIC_ER_ENTRIES ARRAY_SIZE(pef_b2s_generic_ER) + +static struct bit_desc_map +pef_b2s_policies = { +BIT_DESC_MAP_LIST, +{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS}, + {"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP}, + {"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET}, + {"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET}, + {"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_ch_medium = { +#define PEF_CH_MEDIUM_TYPE_IPMB 1 +#define PEF_CH_MEDIUM_TYPE_ICMB_10 2 +#define PEF_CH_MEDIUM_TYPE_ICMB_09 3 +#define PEF_CH_MEDIUM_TYPE_LAN 4 +#define PEF_CH_MEDIUM_TYPE_SERIAL 5 +#define PEF_CH_MEDIUM_TYPE_XLAN 6 +#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9 +#define PEF_CH_MEDIUM_TYPE_USB_V1X 10 +#define PEF_CH_MEDIUM_TYPE_USB_V2X 11 +#define PEF_CH_MEDIUM_TYPE_SYSTEM 12 +BIT_DESC_MAP_LIST, +{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB}, + {"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10}, + {"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09}, + {"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN}, + {"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL}, + {"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN}, + {"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS}, + {"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X}, + {"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X}, + {"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X}, + {"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X}, + {"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_control = { +BIT_DESC_MAP_ALL, +{ {"PEF", PEF_CONTROL_ENABLE}, + {"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES}, + {"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY}, + {"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_lan_desttype = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK}, + {"PET", PEF_LAN_DEST_TYPE_PET}, + {"OEM 1", PEF_LAN_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_LAN_DEST_TYPE_OEM_2}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_serial_desttype = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK}, + {"TAP page", PEF_SERIAL_DEST_TYPE_TAP}, + {"PPP PET", PEF_SERIAL_DEST_TYPE_PPP}, + {"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK}, + {"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK}, + {"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_tap_svc_confirm = { +BIT_DESC_MAP_LIST, +{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX}, + {"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX}, + {"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX}, + {NULL} +} }; + static int ipmi_pef2_list_filters(struct ipmi_intf *); const char * @@ -193,7 +495,7 @@ ipmi_pef_print_1xd(const char * text, uint32_t val) static int ipmi_pef_print_guid(uint8_t *guid) { - if (guid == NULL) { + if (!guid) { return (-1); } @@ -247,7 +549,7 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf, { struct ipmi_rs *rsp; struct ipmi_rq req; - if (pcap == NULL) { + if (!pcap) { return (-3); } @@ -257,9 +559,9 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf, req.msg.cmd = IPMI_CMD_GET_PEF_CAPABILITIES; rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 3) { return (-2); @@ -287,7 +589,7 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id, uint8_t data[3]; uint8_t data_len = 3 * sizeof(uint8_t); int dest_size; - if (filter_entry == NULL) { + if (!filter_entry) { return (-3); } @@ -303,9 +605,9 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id, req.msg.data = (uint8_t *)&data; req.msg.data_len = data_len; rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) { return (-2); @@ -331,7 +633,7 @@ _ipmi_get_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id, uint8_t data[3]; uint8_t data_len = 3 * sizeof(uint8_t); int dest_size; - if (filter_cfg == NULL) { + if (!filter_cfg) { return (-3); } @@ -347,9 +649,9 @@ _ipmi_get_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id, req.msg.data = (uint8_t *)&data; req.msg.data_len = data_len; rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) { return (-2); @@ -375,7 +677,7 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id, uint8_t data[3]; uint8_t data_len = 3 * sizeof(uint8_t); int dest_size; - if (policy_entry == NULL) { + if (!policy_entry) { return (-3); } @@ -391,9 +693,9 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id, req.msg.data = (uint8_t *)&data; req.msg.data_len = data_len; rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) { return (-2); @@ -416,7 +718,7 @@ _ipmi_get_pef_filter_table_size(struct ipmi_intf *intf, uint8_t *table_size) struct ipmi_rq req; struct pef_cfgparm_selector psel; - if (table_size == NULL) { + if (!table_size) { return (-3); } @@ -430,9 +732,9 @@ _ipmi_get_pef_filter_table_size(struct ipmi_intf *intf, uint8_t *table_size) req.msg.data = (uint8_t *)&psel; req.msg.data_len = sizeof(psel); rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 2) { return (-2); @@ -455,7 +757,7 @@ _ipmi_get_pef_policy_table_size(struct ipmi_intf *intf, uint8_t *table_size) struct ipmi_rq req; struct pef_cfgparm_selector psel; - if (table_size == NULL) { + if (!table_size) { return (-3); } @@ -469,9 +771,9 @@ _ipmi_get_pef_policy_table_size(struct ipmi_intf *intf, uint8_t *table_size) req.msg.data = (uint8_t *)&psel; req.msg.data_len = sizeof(psel); rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 2) { return (-2); @@ -494,7 +796,7 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf, struct ipmi_rs *rsp; struct ipmi_rq req; struct pef_cfgparm_selector psel; - if (system_guid == NULL) { + if (!system_guid) { return (-3); } @@ -508,9 +810,9 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf, req.msg.data_len = sizeof(psel); rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } else if (rsp->data_len != 18 || (rsp->data_len - 2) != sizeof(system_guid->guid)) { @@ -537,7 +839,7 @@ _ipmi_set_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id, struct ipmi_rq req; uint8_t data[3]; uint8_t data_len = 3 * sizeof(uint8_t); - if (filter_cfg == NULL) { + if (!filter_cfg) { return (-3); } @@ -553,9 +855,9 @@ _ipmi_set_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id, data[2] = filter_cfg->cfg; rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } return 0; @@ -576,7 +878,7 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id, struct ipmi_rs *rsp; struct ipmi_rq req; struct pef_cfgparm_set_policy_table_entry payload; - if (policy_entry == NULL) { + if (!policy_entry) { return (-3); } @@ -593,16 +895,17 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id, sizeof(policy_entry->entry)); rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { return (-1); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { return rsp->ccode; } return 0; } static void -ipmi_pef_print_oem_lan_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest) +ipmi_pef_print_oem_lan_dest(struct ipmi_intf *intf, + uint8_t dest) { char address[128]; int len; @@ -865,7 +1168,7 @@ ipmi_pef_print_serial_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest) if (!dest || tbl_size == 0) /* Page alerting not supported */ return; if (dest > tbl_size) { - ipmi_pef_print_oem_lan_dest(intf, ch, dest - tbl_size); + ipmi_pef_print_oem_lan_dest(intf, dest - tbl_size); return; } @@ -903,7 +1206,7 @@ ipmi_pef_print_serial_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest) } static void -ipmi_pef_print_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest) +ipmi_pef_print_dest(uint8_t dest) { /* // print generic alert destination info */ @@ -1095,13 +1398,13 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv) lprintf(LOG_ERR, "Not enough parameters given."); ipmi_pef2_filter_help(); rc = (-1); - } else if (!strncmp(argv[0], "help\0", 5)) { + } else if (!strcmp(argv[0], "help")) { ipmi_pef2_filter_help(); rc = 0; - } else if (!strncmp(argv[0], "list\0", 5)) { + } else if (!strcmp(argv[0], "list")) { rc = ipmi_pef2_list_filters(intf); - } else if (!strncmp(argv[0], "enable\0", 7) - ||(!strncmp(argv[0], "disable\0", 8))) { + } else if (!strcmp(argv[0], "enable") + ||(!strcmp(argv[0], "disable"))) { uint8_t enable; uint8_t filter_id; if (argc != 2) { @@ -1117,16 +1420,16 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv) "Valid range is <1..255>."); return (-1); } - if (!strncmp(argv[0], "enable\0", 7)) { + if (!strcmp(argv[0], "enable")) { enable = 1; } else { enable = 0; } 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."); rc = 1; - } else if (!strncmp(argv[0], "delete\0", 7)) { + } else if (!strcmp(argv[0], "delete")) { lprintf(LOG_ERR, "Not implemented."); rc = 1; } else { @@ -1143,7 +1446,7 @@ ipmi_pef2_get_info(struct ipmi_intf *intf) { struct pef_capabilities pcap; struct pef_cfgparm_system_guid psys_guid; - struct ipmi_guid_t guid; + ipmi_guid_t guid; int rc; uint8_t *guid_ptr = NULL; uint8_t policy_table_size; @@ -1183,6 +1486,7 @@ ipmi_pef2_get_info(struct ipmi_intf *intf) ipmi_pef_print_guid(guid_ptr); } ipmi_pef_print_flags(&pef_b2s_actions, P_SUPP, pcap.actions); + putchar('\n'); return 0; } @@ -1193,8 +1497,6 @@ ipmi_pef2_get_status(struct ipmi_intf *intf) struct ipmi_rs *rsp; struct ipmi_rq req; struct pef_cfgparm_selector psel; - char tbuf[40]; - uint32_t timei; time_t ts; memset(&req, 0, sizeof(req)); @@ -1206,15 +1508,9 @@ ipmi_pef2_get_status(struct ipmi_intf *intf) "Last S/W processed ID"); return (-1); } - memcpy(&timei, rsp->data, sizeof(timei)); -#if WORDS_BIGENDIAN - timei = BSWAP_32(timei); -#endif - ts = (time_t)timei; - - strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", gmtime(&ts)); - ipmi_pef_print_str("Last SEL addition", tbuf); + ts = ipmi32toh(rsp->data); + ipmi_pef_print_str("Last SEL addition", ipmi_timestamp_numeric(ts)); ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]); ipmi_pef_print_2xd("Last S/W processed ID", rsp->data[7], rsp->data[6]); ipmi_pef_print_2xd("Last BMC processed ID", rsp->data[9], rsp->data[8]); @@ -1242,6 +1538,7 @@ ipmi_pef2_get_status(struct ipmi_intf *intf) return (-1); } ipmi_pef_print_flags(&pef_b2s_actions, P_ACTV, rsp->data[1]); + putchar('\n'); return 0; } @@ -1337,7 +1634,7 @@ ipmi_pef2_list_policies(struct ipmi_intf *intf) dest); break; default: - ipmi_pef_print_dest(intf, channel_info.channel, dest); + ipmi_pef_print_dest(dest); break; } printf("\n"); @@ -1424,13 +1721,13 @@ ipmi_pef2_policy(struct ipmi_intf *intf, int argc, char **argv) lprintf(LOG_ERR, "Not enough parameters given."); ipmi_pef2_policy_help(); rc = (-1); - } else if (!strncmp(argv[0], "help\0", 5)) { + } else if (!strcmp(argv[0], "help")) { ipmi_pef2_policy_help(); rc = 0; - } else if (!strncmp(argv[0], "list\0", 5)) { + } else if (!strcmp(argv[0], "list")) { rc = ipmi_pef2_list_policies(intf); - } else if (!strncmp(argv[0], "enable\0", 7) - || !strncmp(argv[0], "disable\0", 8)) { + } else if (!strcmp(argv[0], "enable") + || !strcmp(argv[0], "disable")) { uint8_t enable; uint8_t policy_id; if (argc != 2) { @@ -1445,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>."); return (-1); } - if (!strncmp(argv[0], "enable\0", 7)) { + if (!strcmp(argv[0], "enable")) { enable = 1; } else { enable = 0; } 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."); rc = 1; - } else if (!strncmp(argv[0], "delete\0", 7)) { + } else if (!strcmp(argv[0], "delete")) { lprintf(LOG_ERR, "Not implemented."); rc = 1; } else { @@ -1515,30 +1812,30 @@ int ipmi_pef_main(struct ipmi_intf *intf, int argc, char **argv) lprintf(LOG_ERR, "Not enough parameters given."); ipmi_pef2_help(); rc = (-1); - } else if (!strncmp(argv[0], "help\0", 5)) { + } else if (!strcmp(argv[0], "help")) { ipmi_pef2_help(); rc = 0; - } else if (!strncmp(argv[0], "capabilities\0", 13)) { + } else if (!strcmp(argv[0], "capabilities")) { /* rc = ipmi_pef2_get_capabilities(intf); */ lprintf(LOG_ERR, "Not implemented."); rc = 1; - } else if (!strncmp(argv[0], "event\0", 6)) { + } else if (!strcmp(argv[0], "event")) { /* rc = ipmi_pef2_event(intf, (argc - 1), ++argv); */ lprintf(LOG_ERR, "Not implemented."); rc = 1; - } else if (!strncmp(argv[0], "filter\0", 7)) { + } else if (!strcmp(argv[0], "filter")) { 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); - } else if (!strncmp(argv[0], "pet\0", 4)) { + } else if (!strcmp(argv[0], "pet")) { /* rc = ipmi_pef2_pet(intf, (argc - 1), ++argv); */ lprintf(LOG_ERR, "Not implemented."); rc = 1; - } else if (!strncmp(argv[0], "policy\0", 7)) { + } else if (!strcmp(argv[0], "policy")) { 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); - } else if (!strncmp(argv[0], "timer\0", 6)) { + } else if (!strcmp(argv[0], "timer")) { /* rc = ipmi_pef2_timer(intf, (argc - 1), ++argv); */ lprintf(LOG_ERR, "Not implemented."); rc = 1; |