Get Node Manager Policy Command spec description :
Response
Byte 1 – Completion Code
=00h – Success (Remaining standard Completion Codes are shown in Section 2.15).
=80h – Policy ID Invalid. In addition to bytes 2 to 4 extended error information is returned for this error code.
=81h – Domain ID Invalid. In addition to bytes 2 to 4 extended error information is returned for this error code.
For Completion Code 80h (Policy ID Invalid) response bytes 2 to 6 are defined as follows:
Byte 2:4 - Intel Manufacturer ID – 000157h, LS byte first.
Byte 5 – Next valid Policy ID.
The field contains lowest valid Policy ID that is higher than Policy ID specified in the request for the Domain ID specified in the request. If no such Policy ID exists, zero value is returned.
Byte 6 – Number of defined policies for the specified in request Domain ID.
Note – This information can be used to query all existing policies within specified domain. Start with Domain ID and Policy ID set to 0. Increment Policy ID treated as an unsigned integer value by one on success and set Policy ID to Byte 5 on reception of Completion Code 80h.
For Completion Code 81h (Domain ID Invalid ) response bytes 2 to 6 are defined as follows:
Byte 2:4 – Intel Manufacturer ID – 000157h, LS byte first.
Byte 5 – Next valid Domain ID. [3:0] – Next valid Domain ID. The field contains lowest valid Domain ID that is higher than Domain ID specified in the request. If no such Domain ID exists, zero value is returned. [7:4] – Reserved. Write as 0000b.
Byte 6 – Number of available domains.
Note – This information can be used to query all available domains. Start with Domain ID and Policy ID both set to 0. Increment Domain ID treated as an unsigned numerical value by one on success and set Domain ID to Byte 5 bits [3:0] on reception of Completion Code 81h.
Current Output
ipmitool nm policy get policy_id 0
NM request failed because: Policy ID Invalid (80)
Expect Output:
ipmittol nm policy get policy_id 0(patched)
NM request failed because: Policy ID Invalid (80)
Next valid Policy ID: 1
Number of Policies: 2
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
@@ -2067,6 +2072,13 @@
req.msg.data_len = 5;
rsp = intf->sendrecv(intf, &req);
if (chk_nm_rsp(rsp)) {
+ if ((rsp != NULL) && (rsp->ccode == 0x80)) {
+ / Print response when the error code is 0x80. /
+ if (rsp->data_len >= 4)
+ printf(" Next valid Policy ID: %u\n", rsp->data[3]);
+ if (rsp->data_len >= 5)
+ printf(" Number of Policies: %u\n", rsp->data[4]);
+ }
return -1;
}
memcpy(policy, rsp->data, sizeof (struct nm_get_policy));