Skip to content

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

@AlexanderAmelkin

Description

@AlexanderAmelkin

Reported by: Elaine Li
Original Ticket: ipmitool/bugs/509

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;
 	}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions