Menu

#509 Can't get data of Node Manager Policy ID 255

version-1.8.19
closed-fixed
5
2018-05-30
2018-03-01
Elaine Li
No

Ipmitool Node Manage Policy ID 255 is a invalid parameter and always return help info.
From spec 4.0, policy ID is one Byte data and the range is 0-255.

diff -ruN ipmitool-1.8.18.orig/lib/ipmi_dcmi.c ipmitool-1.8.18.new/lib/ipmi_dcmi.c
--- ipmitool-1.8.18.orig/lib/ipmi_dcmi.c    2018-02-27 19:01:37.949879900 +0800
+++ ipmitool-1.8.18.new/lib/ipmi_dcmi.c 2018-03-01 11:17:22.642570311 +0800
@@ -2504,6 +2516,7 @@
    uint8_t option;
    uint8_t domain = 0; /* default domain of platform */
    uint8_t policy_id = -1;
+   uint8_t get_policy_id = FALSE;
    struct nm_get_policy policy;

    memset(&policy, 0, sizeof(policy));
@@ -2528,6 +2541,7 @@
                lprintf(LOG_ERR,"    Policy ID must be a positive integer 0-7.\n");
                return -1;
            }
+           get_policy_id = TRUE;
            break;
        default:
            printf("    Unknown command 0x%x, skipping.\n", option);
@@ -2536,7 +2550,7 @@
        argc--;
        argv++;
    }
-        if (policy_id == 0xFF) {
+   if (get_policy_id == FALSE) {
        print_strs(nm_stats_opts, "Missing policy_id parameter:", LOG_ERR, 0);
                 return -1;
         }
@@ -2594,6 +2608,7 @@
    uint8_t correction;
    uint8_t domain = 0; /* default domain of platform */
    uint8_t policy_id = -1;
+   uint8_t get_policy_id = FALSE;
    uint16_t power, period, inlet;
    uint16_t cores;
    uint32_t limit;
@@ -2680,6 +2695,7 @@
                return -1;
            }
            policy.policy_id = policy_id;
+           get_policy_id = TRUE;
            break;
        case 0x0C:   /* volatile */
            policy.policy_type |= 0x80;
@@ -2709,7 +2725,7 @@
        printf("limit %x\n", limit);
        return 0;
    }
-   if (policy_id == 0xFF) {
+   if (get_policy_id == FALSE) {
        print_strs(nm_stats_opts, "Missing policy_id parameter:", LOG_ERR, 0);
        return -1;
    }
@@ -2728,6 +2744,7 @@
    uint8_t scope = 0;   /* default control scope of global */
    uint8_t domain = 0;  /* default domain of platform */
    uint8_t policy_id = -1;
+   uint8_t get_policy_id = FALSE;

    argv++;
    argc--;
@@ -2759,12 +2776,13 @@
                lprintf(LOG_ERR,"Policy ID must be a positive integer.\n");
                return -1;
            }
+           get_policy_id = TRUE;
            break;
        }
        argc--;
        argv++;
    }
-        if ((scope == 0x04) && (policy_id == 0xFF)) {
+   if ((scope == 0x04) && (get_policy_id == FALSE)) {
        print_strs(nm_stats_opts, "Missing policy_id parameter:", LOG_ERR, 0);
        return -1;
    }

Discussion

  • Alexander Amelkin

    Please next time do not copy-paste patches. Besides, your patch is incomplete. However, I got the idea and will fix that.

     
  • Alexander Amelkin

    • labels: --> dcmi, nm, range error
    • status: open --> open-accepted
    • assigned_to: Alexander Amelkin
    • Group: version-1.8.18 --> version-1.8.19
     
  • Alexander Amelkin

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     Ipmitool Node Manage Policy ID 255 is a  invalid parameter and always return help info.
     From spec 4.0, policy ID is one Byte data and the range is 0-255.  
    
    -
    +~~~
     diff -ruN ipmitool-1.8.18.orig/lib/ipmi_dcmi.c ipmitool-1.8.18.new/lib/ipmi_dcmi.c
     --- ipmitool-1.8.18.orig/lib/ipmi_dcmi.c   2018-02-27 19:01:37.949879900 +0800
     +++ ipmitool-1.8.18.new/lib/ipmi_dcmi.c    2018-03-01 11:17:22.642570311 +0800
    @@ -78,3 +78,4 @@
            print_strs(nm_stats_opts, "Missing policy_id parameter:", LOG_ERR, 0);
            return -1;
        }
    +~~~
    
     
  • Alexander Amelkin

    Elaine Li, please take a look at the attached patch (also available in bugfix/509 branch that sourceforge refuses to display in web interface).

     
  • Alexander Amelkin

    If it works for you, then I'll merge it into master.

     
  • Elaine Li

    Elaine Li - 2018-04-09

    The patch resolve all related problems. Thanks for your fix.
    About your remind, next time I will attach patch file if new issue occur.

     
  • Alexander Amelkin

    The patch has been just merged into master on github.
    Next time please use the issue system there.
    Do you have an account?

     
  • Alexander Amelkin

    • status: open-accepted --> closed-fixed
     

Log in to post a comment.