All,

We recently found that the ipmitool was not setting the clear cmos bit when 
doing
the following ipmitool command:

    ipmitool chassis bootdev bios clear-cmost=yes

I tracked this down to ipmi_chassis_set_bootdev ignoring all bits set in the 
input iflags
argument.

I've attached a patch which fixes this.   I took a very simplistic approach for 
a
fix and simply or'ed in the flags bits instead of setting them.

Feel free to review and send comments.

Thanks in advance,
Jim

--
-- Jim Mankovich | jm...@hp.com --

>From 23f48ead1af204445d86c36b691e7e8fc07e2dbc Mon Sep 17 00:00:00 2001
From: Jim Mankovich <jm...@hp.com>
Date: Fri, 18 May 2012 09:29:23 -0600
Subject: [PATCH] don't overwrite input iflags bits

---
 lib/ipmi_chassis.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/ipmi_chassis.c b/lib/ipmi_chassis.c
index 2c1a72a..b1c9d60 100644
--- a/lib/ipmi_chassis.c
+++ b/lib/ipmi_chassis.c
@@ -799,30 +799,30 @@ ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, uint8_t *iflags)
          memcpy(flags, iflags, sizeof (flags));
 
    if (arg == NULL)
-      flags[1] = 0x00;
+      flags[1] |= 0x00;
    else if (strncmp(arg, "none", 4) == 0)
-      flags[1] = 0x00;
+      flags[1] |= 0x00;
    else if (strncmp(arg, "pxe", 3) == 0 ||
        strncmp(arg, "force_pxe", 9) == 0)
-      flags[1] = 0x04;
+      flags[1] |= 0x04;
    else if (strncmp(arg, "disk", 4) == 0 ||
        strncmp(arg, "force_disk", 10) == 0)
-      flags[1] = 0x08;
+      flags[1] |= 0x08;
    else if (strncmp(arg, "safe", 4) == 0 ||
        strncmp(arg, "force_safe", 10) == 0)
-      flags[1] = 0x0c;
+      flags[1] |= 0x0c;
    else if (strncmp(arg, "diag", 4) == 0 ||
        strncmp(arg, "force_diag", 10) == 0)
-      flags[1] = 0x10;
+      flags[1] |= 0x10;
    else if (strncmp(arg, "cdrom", 5) == 0 ||
        strncmp(arg, "force_cdrom", 11) == 0)
-      flags[1] = 0x14;
+      flags[1] |= 0x14;
    else if (strncmp(arg, "floppy", 6) == 0 ||
        strncmp(arg, "force_floppy", 12) == 0)
-      flags[1] = 0x3c;
+      flags[1] |= 0x3c;
    else if (strncmp(arg, "bios", 4) == 0 ||
        strncmp(arg, "force_bios", 10) == 0)
-      flags[1] = 0x18;
+      flags[1] |= 0x18;
    else {
       lprintf(LOG_ERR, "Invalid argument: %s", arg);
       if (use_progress) {
-- 
1.7.9.5

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to