Skip to content

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

Open
AlexanderAmelkin opened this issue Mar 1, 2018 · 6 comments
Open

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

AlexanderAmelkin opened this issue Mar 1, 2018 · 6 comments

Comments

@AlexanderAmelkin
Copy link

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;
 	}
@AlexanderAmelkin
Copy link
Author

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

Original comment by: Alexander Amelkin

@AlexanderAmelkin
Copy link
Author

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

Original comment by: Alexander Amelkin

@AlexanderAmelkin
Copy link
Author

  • 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;
  	}
+~~~

Original comment by: Alexander Amelkin

@AlexanderAmelkin
Copy link
Author

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

Original comment by: Alexander Amelkin

@AlexanderAmelkin
Copy link
Author

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

Original comment by: Alexander Amelkin

@AlexanderAmelkin
Copy link
Author

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

Original comment by: Elaine Li

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant