summaryrefslogtreecommitdiff
path: root/lib/ipmi_oem.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-30 18:12:02 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-30 18:12:02 +0100
commit1f3c9b4ae26ce1d46d954d509b83b8684ada5625 (patch)
tree260b922ec4d5d153cc6db745e27931cfd464472f /lib/ipmi_oem.c
parent8fcf0ba6f182918bd584bb80bf0b8998acad26a8 (diff)
parent8b758ee941f4c1ffea0532caa74b1fcd8101d1d8 (diff)
Merge branch 'release/debian/1.8.19-1'debian/1.8.19-1
Diffstat (limited to 'lib/ipmi_oem.c')
-rw-r--r--lib/ipmi_oem.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/lib/ipmi_oem.c b/lib/ipmi_oem.c
index 96db2ea..d7cf9aa 100644
--- a/lib/ipmi_oem.c
+++ b/lib/ipmi_oem.c
@@ -37,8 +37,9 @@
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_sel.h>
-static int ipmi_oem_supermicro(struct ipmi_intf * intf);
-static int ipmi_oem_ibm(struct ipmi_intf * intf);
+static int ipmi_oem_supermicro(struct ipmi_intf *intf);
+static int ipmi_oem_ibm(struct ipmi_intf *intf);
+static int ipmi_oem_quanta(struct ipmi_intf *intf);
static struct ipmi_oem_handle ipmi_oem_list[] = {
{
@@ -71,36 +72,49 @@ static struct ipmi_oem_handle ipmi_oem_list[] = {
.name = "kontron",
.desc = "Kontron OEM big buffer support"
},
+ {
+ .name = "quanta",
+ .desc = "Quanta IPMIv1.5 BMC with OEM LAN authentication support",
+ .setup = ipmi_oem_quanta,
+ },
{ 0 }
};
/* Supermicro IPMIv2 BMCs use OEM authtype */
static int
-ipmi_oem_supermicro(struct ipmi_intf * intf)
+ipmi_oem_supermicro(struct ipmi_intf *intf)
{
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
return 0;
}
static int
-ipmi_oem_ibm(struct ipmi_intf * intf)
+ipmi_oem_ibm(struct ipmi_intf *__UNUSED__(intf))
{
- char * filename;
- if ((filename = getenv("IPMI_OEM_IBM_DATAFILE")) == NULL) {
+ char *filename = getenv("IPMI_OEM_IBM_DATAFILE");
+ if (!filename) {
lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
return -1;
}
return ipmi_sel_oem_init((const char *)filename);
}
+/* Quanta IPMIv2 BMCs use OEM authtype */
+static int
+ipmi_oem_quanta(struct ipmi_intf *intf)
+{
+ ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
+ return 0;
+}
+
/* ipmi_oem_print - print list of OEM handles
*/
void
ipmi_oem_print(void)
{
- struct ipmi_oem_handle * oem;
+ struct ipmi_oem_handle *oem;
lprintf(LOG_NOTICE, "\nOEM Support:");
- for (oem=ipmi_oem_list; oem->name != NULL && oem->desc != NULL; oem++) {
+ for (oem=ipmi_oem_list; oem->name && oem->desc; oem++) {
lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
}
lprintf(LOG_NOTICE, "");
@@ -120,26 +134,27 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
struct ipmi_oem_handle * oem;
int rc = 0;
- if (oemtype == NULL ||
- strncmp(oemtype, "help", 4) == 0 ||
- strncmp(oemtype, "list", 4) == 0) {
+ if (!oemtype
+ || !strcmp(oemtype, "help")
+ || !strcmp(oemtype, "list"))
+ {
ipmi_oem_print();
return -1;
}
- for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
- if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
+ for (oem=ipmi_oem_list; oem->name; oem++) {
+ if (!strcmp(oemtype, oem->name))
break;
}
- if (oem->name == NULL)
+ if (!oem->name)
return -1;
/* save pointer for later use */
intf->oem = oem;
/* run optional setup function if it is defined */
- if (oem->setup != NULL) {
+ if (oem->setup) {
lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
rc = oem->setup(intf);
}
@@ -158,10 +173,10 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
int
ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
{
- if (intf->oem == NULL)
+ if (!intf->oem)
return 0;
- if (strncmp(intf->oem->name, oemtype, strlen(oemtype)) == 0)
+ if (!strcmp(intf->oem->name, oemtype))
return 1;
return 0;