Hello, Jim,

I would like to revive our conversation from the last year and submit a couple of patches into the mainline.

Below is the description for the attached patches:

1. pps-bugfixes.diff:
   o lib/ipmi_sel.c
     - zero data before making request to avoid reading of uninitialized
       data
   o lib/ipmi_mc.c
     - do not print AUX info, if IPMC return 12-byte Get Device ID
       response
   o lib/ipmi_picmg.c
     - add support for hexadecimal and octal formats for the command-line
       parameters
   o configure.in
      - fixed build for the newer autotool releases
2. pps-oem.diff
    o Add support for Intel 82571 MAC which has some deviations from
      the IPMIv2 specification in its RMCP+ implementation when working
      in super pass-through mode (handles all RMCP without BMC
      participation).

Could you, please, describe the routine of submitting patches. Who makes review of patches and when they are submitted?

Regards,
Dmitry
diff -Nurp ipmitool.sav/configure.in ipmitool.cvs/configure.in
--- ipmitool.sav/configure.in	2013-04-15 15:12:09 +0600
+++ ipmitool.cvs/configure.in	2013-04-17 22:41:55 +0600
@@ -209,11 +209,18 @@ AC_ARG_WITH([kerneldir],
 
 AH_TEMPLATE([HAVE_LINUX_COMPILER_H], [])
 AC_MSG_CHECKING([for linux/compiler.h])
-AC_PREPROC_IFELSE([#include <linux/compiler.h>],
-	[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
+
+m4_version_prereq([2.68],
+	[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <linux/compiler.h>]])],
+		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
+			[Define to 1 if you have the <linux/compiler.h> header file.])
+		AC_MSG_RESULT([yes])],
+		[AC_MSG_RESULT([no])])],
+	[AC_PREPROC_IFELSE([#include <linux/compiler.h>],
+		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
 		[Define to 1 if you have the <linux/compiler.h> header file.])
-	AC_MSG_RESULT([yes])],
-	[AC_MSG_RESULT([no])])
+		AC_MSG_RESULT([yes])],
+		[AC_MSG_RESULT([no])])])
 
 CPPFLAGS=$ORIG_CPPFLAGS
 AC_SUBST(CPPFLAGS)
diff -Nurp ipmitool.sav/lib/ipmi_mc.c ipmitool.cvs/lib/ipmi_mc.c
--- ipmitool.sav/lib/ipmi_mc.c	2013-01-15 18:32:54 +0600
+++ ipmitool.cvs/lib/ipmi_mc.c	2013-04-17 22:38:16 +0600
@@ -448,13 +448,15 @@ ipmi_mc_get_deviceid(struct ipmi_intf * 
 			printf("    %s\n", ipm_dev_adtl_dev_support[i]);
 		}
 	}
-	printf("Aux Firmware Rev Info     : \n");
-	/* These values could be looked-up by vendor if documented,
-	 * so we put them on individual lines for better treatment later
-	 */
-	printf("    0x%02x\n    0x%02x\n    0x%02x\n    0x%02x\n",
-		devid->aux_fw_rev[0], devid->aux_fw_rev[1],
-		devid->aux_fw_rev[2], devid->aux_fw_rev[3]);
+	if (rsp->data_len == sizeof(*devid)) {
+		printf("Aux Firmware Rev Info     : \n");
+		/* These values could be looked-up by vendor if documented,
+		 * so we put them on individual lines for better treatment later
+		 */
+		printf("    0x%02x\n    0x%02x\n    0x%02x\n    0x%02x\n",
+			devid->aux_fw_rev[0], devid->aux_fw_rev[1],
+			devid->aux_fw_rev[2], devid->aux_fw_rev[3]);
+	}
 	return 0;
 }
 
diff -Nurp ipmitool.sav/lib/ipmi_picmg.c ipmitool.cvs/lib/ipmi_picmg.c
--- ipmitool.sav/lib/ipmi_picmg.c	2013-04-15 15:12:11 +0600
+++ ipmitool.cvs/lib/ipmi_picmg.c	2013-04-17 22:38:16 +0600
@@ -1095,8 +1095,8 @@ ipmi_picmg_fru_control(struct ipmi_intf 
 	req.msg.data_len = 3;
 
 	msg_data[0] = 0x00;					/* PICMG identifier */
-	msg_data[1] = atoi(argv[0]);				/* FRU-ID	  */
-	msg_data[2] = atoi(argv[1]);				/* control option  */
+	msg_data[1] = strtol(argv[0], NULL, 0);			/* FRU-ID	  */
+	msg_data[2] = strtol(argv[1], NULL, 0);			/* control option  */
 
 	printf("FRU Device Id: %d FRU Control Option: %s\n", msg_data[1],  \
 				val2str( msg_data[2], picmg_frucontrol_vals));
diff -Nurp ipmitool.sav/lib/ipmi_sel.c ipmitool.cvs/lib/ipmi_sel.c
--- ipmitool.sav/lib/ipmi_sel.c	2013-04-15 15:12:11 +0600
+++ ipmitool.cvs/lib/ipmi_sel.c	2013-04-17 22:38:16 +0600
@@ -329,6 +329,7 @@ ipmi_sel_add_entry(struct ipmi_intf * in
 	struct ipmi_rs * rsp;
 	struct ipmi_rq req;
 
+	memset(&req, 0, sizeof(req));
 	req.msg.netfn = IPMI_NETFN_STORAGE;
 	req.msg.cmd = IPMI_CMD_ADD_SEL_ENTRY;
 	req.msg.data = (unsigned char *)rec;
diff -Nurp ipmitool.sav/lib/ipmi_oem.c ipmitool.cvs/lib/ipmi_oem.c
--- ipmitool.sav/lib/ipmi_oem.c	2013-04-15 15:12:11 +0600
+++ ipmitool.cvs/lib/ipmi_oem.c	2013-04-17 22:47:19 +0600
@@ -63,6 +63,10 @@ static struct ipmi_oem_handle ipmi_oem_l
 		desc:   "IBM OEM support",
 		setup:	ipmi_oem_ibm,
 	},
+	{
+		name:   "i82571spt",
+		desc:   "Intel 82571 MAC with integrated RMCP+ support in super pass-through mode",
+	},
 	{ 0 }
 };
 
diff -Nurp ipmitool.sav/lib/ipmi_sol.c ipmitool.cvs/lib/ipmi_sol.c
--- ipmitool.sav/lib/ipmi_sol.c	2013-04-15 15:12:11 +0600
+++ ipmitool.cvs/lib/ipmi_sol.c	2013-04-17 22:45:59 +0600
@@ -1568,6 +1568,8 @@ ipmi_sol_red_pill(struct ipmi_intf * int
 		FD_SET(0, &read_fds);
 		FD_SET(intf->fd, &read_fds);
 
+		if (!ipmi_oem_active(intf,"i82571spt"))
+		{
 		/* Send periodic keepalive packet */
 		if(_use_sol_for_keepalive == 0)
 		{
@@ -1604,7 +1606,7 @@ ipmi_sol_red_pill(struct ipmi_intf * int
 			/* if the keep Alive is successful reset retries to zero */
 			retrySol = 0;
 		}
-
+		} /* !oem="i82571spt" */
 		/* Wait up to half a second */
 		tv.tv_sec =  0;
 		tv.tv_usec = 500000;
@@ -1757,6 +1759,20 @@ ipmi_sol_activate(struct ipmi_intf * int
 
 	if (ipmi_oem_active(intf, "intelplus")) {
 		data[2] |= IPMI_SOL_BMC_ASSERTS_CTS_MASK_TRUE;
+	} else if (ipmi_oem_active(intf, "i82571spt")) {
+		/*
+		 * A quote from Intel: "Engineering believes the problem
+		 * lies within the Auxiliary data being sent with the
+		 * 'Activate Payload' command from IPMITool.  IPMITool
+		 * sends a C6h which sets some bits having to do with
+		 * encryption and some behavior dealing with CTS DCD/DSR.
+		 * I recommend that the customer modify this request
+		 * to send 08h instead. This is what our internal utility
+		 * sends and it works without issue. I will work with
+		 * engineering to ensure the settings that IPMITool uses
+		 * (C6h) are supported in the future.
+		 */
+		data[2] = 0x08;
 	} else {
 		data[2] |= IPMI_SOL_BMC_ASSERTS_CTS_MASK_FALSE;
 	}
diff -Nurp ipmitool.sav/src/plugins/lanplus/lanplus.c ipmitool.cvs/src/plugins/lanplus/lanplus.c
--- ipmitool.sav/src/plugins/lanplus/lanplus.c	2013-04-15 15:12:11 +0600
+++ ipmitool.cvs/src/plugins/lanplus/lanplus.c	2013-04-17 22:45:59 +0600
@@ -3157,7 +3157,7 @@ ipmi_lanplus_rakp3(struct ipmi_intf * in
 		}
 
 		/* Generate our Session Integrity Key, K1, and K2 */
-		if (lanplus_generate_sik(session))
+		if (lanplus_generate_sik(session, intf))
 		{
 			/* Error */
 			lprintf(LOG_INFO, "> Error generating session integrity key");
@@ -3408,7 +3408,8 @@ ipmi_lanplus_open(struct ipmi_intf * int
 	 *
 	 * I'm not sure why we accept a failure for the first call
 	 */
-	if (ipmi_get_auth_capabilities_cmd(intf, &auth_cap)) {
+	if (!ipmi_oem_active(intf, "i82571spt") &&
+			ipmi_get_auth_capabilities_cmd(intf, &auth_cap)) {
 		sleep(1);
 		if (ipmi_get_auth_capabilities_cmd(intf, &auth_cap));
 		{
@@ -3418,7 +3419,7 @@ ipmi_lanplus_open(struct ipmi_intf * int
 		}
 	}
 
-	if (! auth_cap.v20_data_available)
+	if (!ipmi_oem_active(intf, "i82571spt") && ! auth_cap.v20_data_available)
 	{
 		lprintf(LOG_INFO, "This BMC does not support IPMI v2 / RMCP+");
 		goto fail;
@@ -3455,9 +3456,11 @@ ipmi_lanplus_open(struct ipmi_intf * int
 
 	bridgePossible = 1;
 
-	rc = ipmi_set_session_privlvl_cmd(intf);
-	if (rc < 0)
-		goto fail;
+	if (!ipmi_oem_active(intf, "i82571spt")) {
+		rc = ipmi_set_session_privlvl_cmd(intf);
+		if (rc < 0)
+			goto fail;
+	}
 
 	intf->manufacturer_id = ipmi_get_oem(intf);
 	return intf->fd;
diff -Nurp ipmitool.sav/src/plugins/lanplus/lanplus_crypt.c ipmitool.cvs/src/plugins/lanplus/lanplus_crypt.c
--- ipmitool.sav/src/plugins/lanplus/lanplus_crypt.c	2013-04-15 15:12:12 +0600
+++ ipmitool.cvs/src/plugins/lanplus/lanplus_crypt.c	2013-04-17 22:45:59 +0600
@@ -153,6 +153,15 @@ int lanplus_rakp2_hmac_matches(const str
 	/* ROLEm */
 	buffer[56] = session->v2_data.requested_role;
 
+	if (ipmi_oem_active(intf, "i82571spt")) {
+		/*
+		 * The HMAC calculation code in the Intel 82571 GbE	
+		 * skips this bit!  Looks like a GbE bug, but we need
+		 * to work around it here anyway...
+		 */
+		buffer[56] &= ~0x10;
+	}
+
 	/* ULENGTHm */
 	buffer[57] = strlen((const char *)session->username);
 
@@ -396,7 +405,7 @@ int lanplus_generate_rakp3_authcode(uint
 	memcpy(input_buffer + 16, &SIDm_lsbf, 4);
 	
 	/* ROLEm */
-	if (ipmi_oem_active(intf, "intelplus")) 
+	if (ipmi_oem_active(intf, "intelplus") || ipmi_oem_active(intf, "i82571spt")) 
 		input_buffer[20] = session->privlvl;
 	else 
 		input_buffer[20] = session->v2_data.requested_role;
@@ -460,7 +469,7 @@ int lanplus_generate_rakp3_authcode(uint
  * returns 0 on success
  *         1 on failure
  */
-int lanplus_generate_sik(struct ipmi_session * session)
+int lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf)
 {
 	uint8_t * input_buffer;
 	int input_buffer_length, i;
@@ -516,6 +525,15 @@ int lanplus_generate_sik(struct ipmi_ses
 	/* ROLEm */
 	input_buffer[32] = session->v2_data.requested_role;
 
+	if (ipmi_oem_active(intf, "i82571spt")) {
+		/*
+		 * The HMAC calculation code in the Intel 82571 GbE	
+		 * skips this bit!  Looks like a GbE bug, but we need
+		 * to work around it here anyway...
+		 */
+		input_buffer[32] &= ~0x10;
+	}
+
 	/* ULENGTHm */
 	input_buffer[33] = strlen((const char *)session->username);
 
@@ -897,7 +915,7 @@ int lanplus_decrypt_payload(uint8_t     
 		 */
 		for (i = 0; i < conf_pad_length; ++i)
 		{
-			if (decrypted_payload[*payload_size + i] == i)
+			if (decrypted_payload[*payload_size + i] != (i + 1))
 			{
 				lprintf(LOG_ERR, "Malformed payload padding");
 				assert(0);
diff -Nurp ipmitool.sav/src/plugins/lanplus/lanplus_crypt.h ipmitool.cvs/src/plugins/lanplus/lanplus_crypt.h
--- ipmitool.sav/src/plugins/lanplus/lanplus_crypt.h	2006-03-20 02:54:44 +0600
+++ ipmitool.cvs/src/plugins/lanplus/lanplus_crypt.h	2013-04-17 22:45:59 +0600
@@ -51,7 +51,7 @@ int lanplus_generate_rakp3_authcode(uint
 									const struct ipmi_session * session,
 									uint32_t                  * auth_length,
 									struct ipmi_intf          * intf);
-int lanplus_generate_sik(struct ipmi_session * session);
+int lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf);
 int lanplus_generate_k1(struct ipmi_session * session);
 int lanplus_generate_k2(struct ipmi_session * session);
 int lanplus_encrypt_payload(uint8_t         crypt_alg,
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to