On 03/26/2012 10:06 PM, Gowda, Srinivas G wrote:
> 
> Thanks,
> G
> srinivas_g_go...@dell.com
> DELL


Rewritten patch using macros.

Thanks,
G
srinivas_g_go...@dell.com
DELL
diff -Naurp 01-ipmitool_opensrc_update/lib/ipmi_delloem.c 
02-ipmitool_delloem_mac_update/lib/ipmi_delloem.c
--- 01-ipmitool_opensrc_update/lib/ipmi_delloem.c       2012-04-03 
17:51:37.000000000 +0530
+++ 02-ipmitool_delloem_mac_update/lib/ipmi_delloem.c   2012-04-03 
17:51:36.000000000 +0530
@@ -64,6 +64,8 @@ POSSIBILITY OF SUCH DAMAGE. 
 #include <ipmitool/ipmi_fru.h>
 #include <ipmitool/ipmi_sensor.h>
 /*------------ipmi headers------------------*/
+#include <ipmitool/ipmi_chassis.h>
+#include <ipmitool/ipmi_sol.h>
 
 
 
@@ -78,8 +80,14 @@ POSSIBILITY OF SUCH DAMAGE. 
 #define SHARED_WITH_FAILOVER_LOM2 1
 #define DEDICATED 2
 #define SHARED_WITH_FAILOVER_ALL_LOMS 3
-char AciveLOM_String [5] [10] =        
{"dedicated","LOM1","LOM2","LOM3","LOM4" };
-#define        INVALID -1
+char AciveLOM_String [6] [10] =        
{"dedicated","LOM1","LOM2","LOM3","LOM4","None" };
+#define        INVAILD_FAILOVER_MODE   -2
+#define        INVAILD_FAILOVER_MODE_SETTINGS  -3
+#define        INVAILD_SHARED_MODE             -4
+
+#define        INVAILD_FAILOVER_MODE_STRING    "ERROR: Cannot set shared with 
failover lom same as current shared lom.\n"
+#define        INVAILD_FAILOVER_MODE_SET               "ERROR: Cannot set 
shared with failover loms when NIC is set to dedicated Mode.\n"
+#define        INVAILD_SHARED_MODE_SET_STRING  "ERROR: Cannot set shared Mode 
for Blades.\n"
 
 // 11g Support Strings for nic selection
 char NIC_Selection_Mode_String [4] [50] =      {       "shared",  
@@ -1893,11 +1901,12 @@ ipmi_lcd_usage(void)
 static int ipmi_delloem_mac_main (struct ipmi_intf * intf, int argc, char ** 
argv)
 {
     int rc = 0;
+       int currIdInt = -1;
 
     current_arg++;
     if (argc == 1)
     {
-        rc = ipmi_macinfo(intf, 0xff);
+               ipmi_mac_usage();
     }
     else if (strncmp(argv[current_arg], "list\0", 5) == 0)
     {
@@ -1911,12 +1920,14 @@ static int ipmi_delloem_mac_main (struct
             ipmi_mac_usage();
             return -1;
         }
-        int currIdInt;
-        make_int(argv[current_arg],&currIdInt);
-        if(currIdInt>8)
+
+               if(make_int(argv[current_arg],&currIdInt) < 0) {
+                       lprintf(LOG_ERR, "Invalid NIC number. The NIC number 
should be between 0-8\n");                 
+                       return -1;
+               }
+               if( (currIdInt > 8) || (currIdInt < 0) )
         {
             lprintf(LOG_ERR, "Invalid NIC number. The NIC number should be 
between 0-8\n");
-            ipmi_mac_usage();
             return -1;
         }
         rc = ipmi_macinfo(intf, currIdInt);
@@ -2015,6 +2026,30 @@ static int ipmi_macinfo_drac_idrac_virtu
         {
             return -1;
         }
+               if( (IMC_IDRAC_12G_MODULAR == IMC_Type) || 
(IMC_IDRAC_12G_MONOLITHIC== IMC_Type) ) {
+                       // Get the Chasiss Assigned MAC Addresss        for 12g 
Only            
+                       
memcpy(VirtualMacAddress,((rsp->data)+1),MACADDRESSLENGH);
+                       
+                       for (i=0;i<MACADDRESSLENGH;i++)
+                       {
+                               if (0 != VirtualMacAddress [i])
+                               {
+                                       UseVirtualMacAddress = 1;
+                               }       
+                       }
+                       // Get the Server Assigned MAC Addresss for 12g Only    
+                       if(!UseVirtualMacAddress) {
+                               
memcpy(VirtualMacAddress,((rsp->data)+1+MACADDRESSLENGH),MACADDRESSLENGH);
+                       
+                               for (i=0;i<MACADDRESSLENGH;i++)
+                               {
+                                       if (0 != VirtualMacAddress [i])
+                                       {
+                                               UseVirtualMacAddress = 1;
+                                       }       
+                               }
+                       }
+               } else {
         
memcpy(VirtualMacAddress,((rsp->data)+VIRTUAL_MAC_OFFSET),MACADDRESSLENGH);
 
         for (i=0;i<MACADDRESSLENGH;i++)
@@ -2024,10 +2059,15 @@ static int ipmi_macinfo_drac_idrac_virtu
                 UseVirtualMacAddress = 1;
             }       
         }
+               }
         if (0 == UseVirtualMacAddress)
             return -1;              
         if (IMC_IDRAC_10G == IMC_Type)
             printf ("\nDRAC MAC Address ");
+               else if ( (IMC_IDRAC_11G_MODULAR == IMC_Type) || 
(IMC_IDRAC_11G_MONOLITHIC== IMC_Type) )
+                       printf ("\niDRAC6 MAC Address ");
+               else if ( (IMC_IDRAC_12G_MODULAR == IMC_Type) || 
(IMC_IDRAC_12G_MONOLITHIC== IMC_Type) )
+                       printf ("\niDRAC7 MAC Address ");
         else
             printf ("\niDRAC6 MAC Address ");
 
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to