Dell specific mac sub command is updated to support
the latest 12G Dell servers. 
Support for virtual mac is also implemented.


Signed-off-by: Srinivas Gowda G <srinivas_g_go...@dell.com>
---
 include/ipmitool/ipmi_delloem.h |    1 +
 lib/ipmi_delloem.c              |   55 +++++++++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/include/ipmitool/ipmi_delloem.h b/include/ipmitool/ipmi_delloem.h
index a82587c..0ef81b3 100644
--- a/include/ipmitool/ipmi_delloem.h
+++ b/include/ipmitool/ipmi_delloem.h
@@ -182,6 +182,7 @@ typedef struct _lcd_mode
 #define IMC_IDRAC_11G_MODULAR       (uint8_t) (0x0B)
 #define IMC_UNUSED                  (uint8_t) (0x0C)
 #define IMC_MASER_LITE_BMC          (uint8_t) (0x0D)
+#define IMC_MASER_LITE_NU                      (uint8_t) (0x0E)
 #define IMC_IDRAC_12G_MONOLITHIC       (uint8_t) (0x10)
 #define IMC_IDRAC_12G_MODULAR          (uint8_t) (0x11)
 
diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
index 963a321..4c01f73 100644
--- a/lib/ipmi_delloem.c
+++ b/lib/ipmi_delloem.c
@@ -751,8 +751,10 @@ ipmi_idracvalidator_command (struct ipmi_intf * intf)
         /*lprintf(LOG_ERR, " Error getting IMC type: %s",
         val2str(rsp->ccode, completion_code_vals));  */
         return -1;
-       }
-       if( (IMC_IDRAC_11G_MONOLITHIC == rsp->data[10]) || 
(IMC_IDRAC_11G_MODULAR ==rsp->data[10]) )
+       } 
+       /* Support the 11G Monolithic, modular, Maisy and Coaster */
+       if( (IMC_IDRAC_11G_MONOLITHIC == rsp->data[10]) || 
(IMC_IDRAC_11G_MODULAR ==rsp->data[10])  ||
+               (IMC_MASER_LITE_BMC == rsp->data[10]) || (IMC_MASER_LITE_NU 
==rsp->data[10])    )
     {
                iDRAC_FLAG=IDRAC_11G;
     }
@@ -1890,6 +1892,7 @@ 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 && strcmp(argv[current_arg], "help") == 0)
@@ -1914,12 +1917,14 @@ static int ipmi_delloem_mac_main (struct ipmi_intf * 
intf, int argc, char ** arg
             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);
@@ -2016,6 +2021,30 @@ static int ipmi_macinfo_drac_idrac_virtual_mac(struct 
ipmi_intf* intf,uint8_t Ni
         {
             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++)
@@ -2025,10 +2054,17 @@ static int ipmi_macinfo_drac_idrac_virtual_mac(struct 
ipmi_intf* intf,uint8_t Ni
                 UseVirtualMacAddress = 1;
             }       
         }
+               }
         if (0 == UseVirtualMacAddress)
             return -1;              
         if (IMC_IDRAC_10G == IMC_Type)
-            printf ("\nDRAC MAC Address ");
+                       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 if ( (IMC_MASER_LITE_BMC== IMC_Type) || 
(IMC_MASER_LITE_NU== IMC_Type) )
+                       printf ("\nBMC MAC Address ");          
         else
             printf ("\niDRAC6 MAC Address ");
 
@@ -2103,6 +2139,8 @@ static int ipmi_macinfo_drac_idrac_mac(struct ipmi_intf* 
intf,uint8_t NicNum)
                        printf ("\niDRAC6 MAC Address ");
                else if ((IMC_IDRAC_12G_MODULAR == IMC_Type) || 
(IMC_IDRAC_12G_MONOLITHIC== IMC_Type))          
                        printf ("\niDRAC7 MAC Address ");
+               else if ( (IMC_MASER_LITE_BMC== IMC_Type) || 
(IMC_MASER_LITE_NU== IMC_Type) )
+                       printf ("\n\rBMC MAC Address ");                        
        
         else
             printf ("\niDRAC6 MAC Address ");
 
@@ -2365,7 +2403,8 @@ static int ipmi_macinfo (struct ipmi_intf* intf, uint8_t 
NicNum)
         return ipmi_macinfo_10g (intf,NicNum);
     }
        else if ((IMC_IDRAC_11G_MODULAR == IMC_Type || 
IMC_IDRAC_11G_MONOLITHIC== IMC_Type )  ||
-                       (IMC_IDRAC_12G_MODULAR == IMC_Type || 
IMC_IDRAC_12G_MONOLITHIC== IMC_Type ) )
+                       (IMC_IDRAC_12G_MODULAR == IMC_Type || 
IMC_IDRAC_12G_MONOLITHIC== IMC_Type ) || 
+                       (IMC_MASER_LITE_NU== IMC_Type || IMC_MASER_LITE_BMC== 
IMC_Type ))
     {
         return ipmi_macinfo_11g (intf,NicNum);
     }
-- 
1.7.7.6


Thanks,
G
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to