zhangbo 3 лет назад
Родитель
Сommit
b9d4229f30

+ 3 - 3
app/bmc/Api.c

@@ -50,9 +50,9 @@ int PlatformInit(void)
 	
 	
 	//LAN地址
-	LanInfo_T *pSetLanInfo = &g_BMCInfo.LanInfo[0];
-	strcpy(pSetLanInfo->EthName, "eth0");
-	pSetLanInfo->IPAddrSrc 	= 	0x01;	//static
+	LanInfo_T *pSetLanInfo = &g_BMCInfo.IpmiConfig.LanInfo[0];
+	// strcpy(pSetLanInfo->EthName, "eth0");
+	// pSetLanInfo->IPAddrSrc 	= 	0x01;	//static
 	pSetLanInfo->IPAddr[0] = 192;
 	pSetLanInfo->IPAddr[1] = 168;
 	pSetLanInfo->IPAddr[2] = 1;		//网段

+ 4 - 2
app/bmc/BmcType.h

@@ -74,6 +74,9 @@ typedef struct
 	SDR_T				SDRConfig;
 	SEL_T				SELConfig;
 
+	//lan configuration
+	LanInfo_T 	LanInfo[1];	//方便扩展多个网卡。
+
 	
 } IPMIConfig_T;
 
@@ -97,8 +100,7 @@ typedef struct
 	uint8_t				ChassisID;
 	uint8_t             PrimaryIPMBAddr;	//8bit
 	uint8_t				SecondaryIPMBAddr;	//8bit
-	//lan configuration
-	LanInfo_T 	LanInfo[1];	//方便扩展多个网卡。
+	
 
 	uint8_t				PowerGoodFlag;
 	uint8_t				FirstPowerOn;

+ 14 - 7
app/bmc/PendActionTask/PendActionTask.c

@@ -108,7 +108,9 @@ void *PendActionTask(void *Param)
 			}
 			else if(MsgPkt.Param == PARAM_LAN)
 			{
-				pSetLanCfg = (SetLanConfigReq_T*)MsgPkt.Data;
+				int index = MsgPkt.Data[0];
+				int isSave = MsgPkt.Data[1];
+				pSetLanCfg = (SetLanConfigReq_T*)&MsgPkt.Data[2];
 				printf("---> PARAM_LAN, NetFnLUN: %#x, cmd: %#x\n", MsgPkt.NetFnLUN, MsgPkt.Cmd);
 				printf("---> Data: %#x %#x %#x %#x %#x\n", MsgPkt.Data[0], MsgPkt.Data[1], MsgPkt.Data[2], MsgPkt.Data[3], MsgPkt.Data[4]);
 				if(((MsgPkt.NetFnLUN>>2) == NETFN_TRANSPORT) 
@@ -161,22 +163,22 @@ void *PendActionTask(void *Param)
 				else if(((MsgPkt.NetFnLUN>>2) == NETFN_STORLEAD) 
 					&& (MsgPkt.Cmd == CMD_SET_LAN_INFO))
 				{
-					LanInfo_T *pSetLanInfo = (LanInfo_T*)MsgPkt.Data;
+					LanInfo_T *pSetLanInfo = (LanInfo_T*)&MsgPkt.Data[2];
 					sleep(1);
 					//down
-					sprintf(cmdStr, "ifconfig %s down", pSetLanInfo->EthName);
+					sprintf(cmdStr, "ifconfig eth%d down", index);
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 					//set mac
-					sprintf(cmdStr, "ifconfig %s hw ether %02x:%02x:%02x:%02x:%02x:%02x", 
-						pSetLanInfo->EthName, pSetLanInfo->MACAddr[0], pSetLanInfo->MACAddr[1],
+					sprintf(cmdStr, "ifconfig eth%d hw ether %02x:%02x:%02x:%02x:%02x:%02x", 
+						index, pSetLanInfo->MACAddr[0], pSetLanInfo->MACAddr[1],
 						pSetLanInfo->MACAddr[2], pSetLanInfo->MACAddr[3], 
 						pSetLanInfo->MACAddr[4], pSetLanInfo->MACAddr[5]);
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 					//ip, broadcast, netmask
-					sprintf(cmdStr, "ifconfig %s %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
-						pSetLanInfo->EthName, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
+					sprintf(cmdStr, "ifconfig eth%d %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
+						index, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
 						pSetLanInfo->IPAddr[2], pSetLanInfo->IPAddr[3], pSetLanInfo->BroadCast[0],
 						pSetLanInfo->BroadCast[1], pSetLanInfo->BroadCast[2], pSetLanInfo->BroadCast[3],
 						pSetLanInfo->NetMask[0], pSetLanInfo->NetMask[1], pSetLanInfo->NetMask[2],
@@ -189,6 +191,11 @@ void *PendActionTask(void *Param)
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 				} 
+
+				if(isSave)
+				{
+					FlushIPMIToFlash();
+				}
 			}
 		}
 	}

+ 0 - 5
app/bmc/Util.h

@@ -67,11 +67,6 @@ uint8_t mac2hex(const char *strMac, uint8_t index);
 */
 uint8_t ip2dec(const char *strIp, uint8_t index);
 
-int FlushUserInfo(void);
-int FlushFRU(void);
-int FlushSDR(void);
-int FlushIpmiConfig(void);
-int FlushSEL(void);
 
 
 

+ 3 - 3
app/bmc/main.c

@@ -124,7 +124,7 @@ void main(void)
 
 	//Initialize IP
 	char cmdStr[100];
-	LanInfo_T *pSetLanInfo = &g_BMCInfo.LanInfo[0];
+	LanInfo_T *pSetLanInfo = &g_BMCInfo.IpmiConfig.LanInfo[0];
 	// //down
 	// sprintf(cmdStr, "ifconfig %s down", pSetLanInfo->EthName);
 	// printf("%s\n", cmdStr);
@@ -137,8 +137,8 @@ void main(void)
 	// printf("%s\n", cmdStr);
 	// system(cmdStr);
 	//ip, broadcast, netmask
-	sprintf(cmdStr, "ifconfig %s %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
-		pSetLanInfo->EthName, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
+	sprintf(cmdStr, "ifconfig eth0 %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
+		pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
 		pSetLanInfo->IPAddr[2], pSetLanInfo->IPAddr[3], pSetLanInfo->BroadCast[0],
 		pSetLanInfo->BroadCast[1], pSetLanInfo->BroadCast[2], pSetLanInfo->BroadCast[3],
 		pSetLanInfo->NetMask[0], pSetLanInfo->NetMask[1], pSetLanInfo->NetMask[2],

+ 32 - 23
app/bmc/msghndlr/Storlead/Storlead.c

@@ -571,46 +571,53 @@ int Storlead_GetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
     //Update LanInfo
     char ip_buf[16];
     getip(ip_buf);
-    g_BMCInfo.LanInfo[index].IPAddr[0] = ip2dec(ip_buf, 0);
-    g_BMCInfo.LanInfo[index].IPAddr[1] = ip2dec(ip_buf, 1);
-    g_BMCInfo.LanInfo[index].IPAddr[2] = ip2dec(ip_buf, 2);
-    g_BMCInfo.LanInfo[index].IPAddr[3] = ip2dec(ip_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[0] = ip2dec(ip_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[1] = ip2dec(ip_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[2] = ip2dec(ip_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[3] = ip2dec(ip_buf, 3);
 
     char mask_buf[16];
     getnetmask(mask_buf);
-    g_BMCInfo.LanInfo[index].NetMask[0] = ip2dec(mask_buf, 0);
-    g_BMCInfo.LanInfo[index].NetMask[1] = ip2dec(mask_buf, 1);
-    g_BMCInfo.LanInfo[index].NetMask[2] = ip2dec(mask_buf, 2);
-    g_BMCInfo.LanInfo[index].NetMask[3] = ip2dec(mask_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[0] = ip2dec(mask_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[1] = ip2dec(mask_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[2] = ip2dec(mask_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[3] = ip2dec(mask_buf, 3);
 
     char broadcast_buf[16];
     getbroadcast(broadcast_buf);
-    g_BMCInfo.LanInfo[index].BroadCast[0] = ip2dec(broadcast_buf, 0);
-    g_BMCInfo.LanInfo[index].BroadCast[1] = ip2dec(broadcast_buf, 1);
-    g_BMCInfo.LanInfo[index].BroadCast[2] = ip2dec(broadcast_buf, 2);
-    g_BMCInfo.LanInfo[index].BroadCast[3] = ip2dec(broadcast_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[0] = ip2dec(broadcast_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[1] = ip2dec(broadcast_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[2] = ip2dec(broadcast_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[3] = ip2dec(broadcast_buf, 3);
 
     char mac_buf[18];
     getmac(mac_buf);
-    g_BMCInfo.LanInfo[index].MACAddr[0] = mac2hex(mac_buf, 0);
-    g_BMCInfo.LanInfo[index].MACAddr[1] = mac2hex(mac_buf, 1);
-    g_BMCInfo.LanInfo[index].MACAddr[2] = mac2hex(mac_buf, 2);
-    g_BMCInfo.LanInfo[index].MACAddr[3] = mac2hex(mac_buf, 3);
-    g_BMCInfo.LanInfo[index].MACAddr[4] = mac2hex(mac_buf, 4);
-    g_BMCInfo.LanInfo[index].MACAddr[5] = mac2hex(mac_buf, 5);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[0] = mac2hex(mac_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[1] = mac2hex(mac_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[2] = mac2hex(mac_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[3] = mac2hex(mac_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[4] = mac2hex(mac_buf, 4);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[5] = mac2hex(mac_buf, 5);
 
     //TODO: get default GetWay
 
-    memcpy(pRes+1, &g_BMCInfo.LanInfo[index], sizeof(LanInfo_T));
+    memcpy(pRes+1, &g_BMCInfo.IpmiConfig.LanInfo[index], sizeof(LanInfo_T));
 
     return 1+sizeof(LanInfo_T);
 }
 
+/*
+    Req[0]:     index
+    Req[1]:     isSave      0:掉电不保存,1:掉电保存
+    Req[2~n]:   LanInfo_T
+*/
 int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     MsgPkt_T m_MsgPkt;
     uint8_t index = pReq[0];
-    LanInfo_T *pLanInfo = (LanInfo_T*)&pReq[1];
+    uint8_t isSave = pReq[1];
+    LanInfo_T *pLanInfo = (LanInfo_T*)&pReq[2];
+    
 
     if(index > 0)   //只有一张网卡,index只能是0
     {
@@ -618,13 +625,15 @@ int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
         return 1;
     }
 
-    memcpy(&g_BMCInfo.LanInfo[index], pLanInfo, sizeof(LanInfo_T));
+    memcpy(&g_BMCInfo.IpmiConfig.LanInfo[index], pLanInfo, sizeof(LanInfo_T));
 
     m_MsgPkt.Param      = PARAM_LAN;
     m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_STORLEAD;
     m_MsgPkt.Cmd        = CMD_SET_LAN_INFO;
-    m_MsgPkt.Size       = sizeof(LanInfo_T);
-    memcpy(m_MsgPkt.Data, pLanInfo, sizeof(LanInfo_T));
+    m_MsgPkt.Size       = sizeof(LanInfo_T)+2;
+    m_MsgPkt.Data[0]    = index;
+    m_MsgPkt.Data[1]    = isSave;
+    memcpy(&m_MsgPkt.Data[2], pLanInfo, sizeof(LanInfo_T));
     PostMsg(gPendActionIfc, &m_MsgPkt);
     
     pRes[0] = CC_NORMAL;

+ 20 - 492
app/bmc/msghndlr/Transport/LANConfig.c

@@ -359,12 +359,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
 
             //Update
-            memcpy(g_BMCInfo.LanInfo[index].IPAddr, pSetLanReq->ConfigData.IPAddr, 4); 
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr, pSetLanReq->ConfigData.IPAddr, 4); 
             FlushIpmiConfig();
             printf("---> old_ip: %s, new_ip: %s\n", old_ip, ipStr);
             printf("---> send data: %#x %#x %#x %#x %#x\n", m_MsgPkt.Data[0], m_MsgPkt.Data[1]
@@ -373,79 +375,6 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_IP_ADDRESS_SOURCE:
             printf("---> Not implement!\n");
-            //Update
-            g_BMCInfo.LanInfo[index].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-            FlushIpmiConfig();
-      //       if ((pSetLanReq->ConfigData.IPAddrSrc > BMC_OTHER_SOURCE)
-      //           ||(pSetLanReq->ConfigData.IPAddrSrc == UNSPECIFIED_IP_SOURCE))
-      //       {
-      //           *pRes = CC_INV_DATA_FIELD;
-      //           return sizeof (uint8_t);
-      //       }
-      //       if ( g_BMCInfo.IpmiConfig.IPAddrSrc == pSetLanReq->ConfigData.IPAddrSrc )
-      //       {
-      //           printf("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
-      //           break;
-      //       }
-		    // if(!((pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE )))
-			   //   g_BMCInfo.IpmiConfig.IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-
-      //       if ( (pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE ) )
-      //       {
-      //           pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-      //           if(pendStatus == PEND_STATUS_PENDING)
-      //           {
-      //               *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-      //               return sizeof (uint8_t);
-      //           }
-		    //     pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-      //           NWConfig.CfgMethod = pSetLanReq->ConfigData.IPAddrSrc;
-      //           SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-      //           PostPendTask(PEND_OP_SET_SOURCE,(uint8_t*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-      //       }
-      //       else if(pSetLanReq->ConfigData.IPAddrSrc == BIOS_IP_SOURCE)
-      //       {
-      //           /*Perform OEM action*/
-      //           if(g_PDKHandle[PDK_BIOSIPSOURCE] != NULL)
-      //           {
-      //           	 retValue = ((int(*)(uint8_t))g_PDKHandle[PDK_BIOSIPSOURCE]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
-	     //             if(retValue == 1)
-	     //             {
-		    //              *pRes = CC_INV_DATA_FIELD;
-		    //              return sizeof (*pRes);
-	     //             }
-      //           }
-      //           else
-      //           {
-      //               pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-      //               if(pendStatus == PEND_STATUS_PENDING)
-      //               {
-      //                   *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-      //                   return sizeof (uint8_t);
-      //               }
-      //               NWConfig.CfgMethod = STATIC_IP_SOURCE;
-      //               SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-      //               PostPendTask(PEND_OP_SET_SOURCE, (uint8_t*) &NWConfig,sizeof(NWConfig), (pSetLanReq->ChannelNum & CHANNEL_ID_MASK), BMCInst );
-      //           }
-      //       }
-      //       else if(pSetLanReq->ConfigData.IPAddrSrc == BMC_OTHER_SOURCE)
-      //       {
-      //           /*Perform OEM action*/
-      //           if(g_PDKHandle[PDK_BMCOTHERSOURCEIP] != NULL)
-      //           {
-      //           	retValue = ((int(*)(uint8_t))g_PDKHandle[PDK_BMCOTHERSOURCEIP]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
-      //                if(retValue == 1)
-      //                {
-		    //              *pRes = CC_INV_DATA_FIELD;
-		    //              return sizeof (*pRes);
-	     //             }
-      //           }
-      //           else
-      //           {	
-      //                *pRes = CC_INV_DATA_FIELD;
-	     //             return sizeof (*pRes);
-      //           }
-      //       }  
             break;
 
         case LAN_PARAM_MAC_ADDRESS:
@@ -479,25 +408,19 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 				m_MsgPkt.Param      = PARAM_LAN;
                 m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
                 m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-                m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-                memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+                m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+                m_MsgPkt.Data[0]    = 0;//eth0
+                m_MsgPkt.Data[1]    = 0;//掉电不保存
+                memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
                 PostMsg(gPendActionIfc, &m_MsgPkt);
                 //Update
-                memcpy(g_BMCInfo.LanInfo[index].MACAddr, pSetLanReq->ConfigData.MACAddr, 6); 
-                FlushIpmiConfig();
+                memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr, pSetLanReq->ConfigData.MACAddr, 6); 
 				printf("---> old_mac: %s, new_mac: %s\n", old_mac, macStr);
 				pSetLanRes->CompletionCode = CC_NORMAL;
 			}
 			
 			break;
         case LAN_PARAM_SUBNET_MASK:
-            /*Returning valid completion code in case of attempt to set netmask in DHCP mode */
-            if(g_BMCInfo.LanInfo[index].IPAddrSrc == DHCP_IP_SOURCE)
-            {
-                *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-                return sizeof (uint8_t);
-            }
-
             getnetmask(old_netmask);
             sprintf(netmaskStr, "%d.%d.%d.%d", pSetLanReq->ConfigData.SubNetMask[0],
                 pSetLanReq->ConfigData.SubNetMask[1], pSetLanReq->ConfigData.SubNetMask[2],
@@ -518,58 +441,22 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
              //Update
-            memcpy(g_BMCInfo.LanInfo[index].NetMask, pSetLanReq->ConfigData.SubNetMask, 4); 
-            FlushIpmiConfig();
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].NetMask, pSetLanReq->ConfigData.SubNetMask, 4); 
             pSetLanRes->CompletionCode = CC_NORMAL;  
             break;
 
         case LAN_PARAM_IPv4_HEADER:
             printf("Not implement\n");
-            // pendStatus = GetPendStatus(PEND_OP_SET_IPV4_HEADERS);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // if(!pSetLanReq->ConfigData.Ipv4HdrParam.TimeToLive > 0)
-            // {
-            //     IPMI_DBG_PRINT("The requested IPv4 header(TTL) to set is invalid.\n");
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof(*pRes);
-            // }
-            // if(pSetLanReq->ConfigData.Ipv4HdrParam.IpHeaderFlags == 0x60) // Flags can be either of the values: DF(0x40) or MF(0x20)
-            // {
-            //     IPMI_DBG_PRINT("The requested IPv4 header(Flags) to set is invalid.\n");
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof(*pRes);
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam,
-            // &pSetLanReq->ConfigData.Ipv4HdrParam, sizeof(IPv4HdrParams_T));
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // SetPendStatus(PEND_OP_SET_IPV4_HEADERS,PEND_STATUS_PENDING);
-            // PostPendTask(PEND_OP_SET_IPV4_HEADERS, (uint8_t*)&(pSetLanReq->ConfigData.Ipv4HdrParam),
-            // sizeof(pSetLanReq->ConfigData.Ipv4HdrParam),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
             break;
 
         case LAN_PARAM_PRI_RMCP_PORT:
             printf("Not implement\n");  //需要重启网络线程
-            // pendStatus = GetPendStatus(PEND_RMCP_PORT_CHANGE);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort = ipmitoh_u16 (pSetLanReq->ConfigData.PrimaryRMCPPort);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // SetPendStatus(PEND_RMCP_PORT_CHANGE,PEND_STATUS_PENDING);
-            // PostPendTask(PEND_RMCP_PORT_CHANGE,(uint8_t*)&(pSetLanReq->ConfigData.PrimaryRMCPPort),
-            //                         sizeof(pSetLanReq->ConfigData.PrimaryRMCPPort),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
             break;
 
         case LAN_PARAM_SEC_RMCP_PORT:
@@ -581,46 +468,13 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
             printf("Not implement\n");  
-   //      	currBmcGenArpCtrl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
-        	
-			// if(currBmcGenArpCtrl != pSetLanReq->ConfigData.BMCGeneratedARPControl)
-			// 	pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl = pSetLanReq->ConfigData.BMCGeneratedARPControl;
-
-			// if((ENABLE_ARP_RESPONSES & currBmcGenArpCtrl) !=
-			//    (ENABLE_ARP_RESPONSES & pSetLanReq->ConfigData.BMCGeneratedARPControl))
-			// {
-			// 	UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
-			// }
-
-			// if(!(GRATIUTOUS_ENABLE_MASK & currBmcGenArpCtrl) &&
-			//    (GRATIUTOUS_ENABLE_MASK & pSetLanReq->ConfigData.BMCGeneratedARPControl))
-			// {
-   //              /* Create a thread to Send Gratuitous ARP Packet */
-   //              pLANArg = malloc(sizeof(BMCArg));
-   //              pLANArg->BMCInst = BMCInst; 
-   //              pLANArg->Len = strlen((char *)&EthIndex);
-   //              pLANArg->Argument = malloc(pLANArg->Len);
-   //              memcpy(pLANArg->Argument,(char *)&EthIndex,pLANArg->Len);
-               
-   //              OS_CREATE_THREAD ((void *)GratuitousARPTask,(void *)pLANArg, NULL);
-   //          }
-
             break;
 
         case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
             printf("Not implement\n");  
-            // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval =
-            //                         pSetLanReq->ConfigData.GratitousARPInterval;
             break;
 
         case LAN_PARAM_DEFAULT_GATEWAY_IP:
-            /*Returning valid completion code in case of attempt to set default gateway ip in DHCP mode */
-            if(g_BMCInfo.LanInfo[index].IPAddrSrc == DHCP_IP_SOURCE)
-            {
-                *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-                return sizeof (uint8_t);
-            }
-            
             if(IPAddrCheck(pSetLanReq->ConfigData.DefaultGatewayIPAddr,LAN_PARAM_DEFAULT_GATEWAY_IP))
             {
                 *pRes = CC_INV_DATA_FIELD;
@@ -630,12 +484,13 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
             //Update
-            memcpy(g_BMCInfo.LanInfo[index].DefaultGW, pSetLanReq->ConfigData.DefaultGatewayIPAddr, 4); 
-            FlushIpmiConfig();
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].DefaultGW, pSetLanReq->ConfigData.DefaultGatewayIPAddr, 4); 
             pSetLanRes->CompletionCode = CC_NORMAL;  
            
             break;
@@ -647,45 +502,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_BACKUP_GATEWAY_IP:
             printf("Not implement\n");
-            // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
-            // _fmemcpy ((uint8_t*)&GWIp,pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
-            // _fmemcpy ((uint8_t*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
-            // _fmemcpy ((uint8_t*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
-            // if(GWIp != 0)
-            // {
-            //     if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
-            //     {
-            //          IPMI_DBG_PRINT("\n Backup GatewayIP to set is not valid \n");
-            //         *pRes = CC_INV_DATA_FIELD;
-            //         return sizeof (uint8_t);
-            //     }
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,
-            // pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
-            // nwSetBkupGWyAddr(pSetLanReq->ConfigData.BackupGatewayIPAddr,netindex);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_BACKUP_GATEWAY_MAC:
             printf("Not implement\n");
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr,
-            //           pSetLanReq->ConfigData.BackupGatewayMACAddr, MAC_ADDR_LEN);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_COMMUNITY_STRING:
             printf("Not implement\n");
-            // if (g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME] != NULL )
-            // {
-            //         if(((int(*)(uint8_t *, uint8_t,int))(g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME]))(pSetLanReq->ConfigData.CommunityStr,MAX_COMM_STRING_SIZE, BMCInst)==0)
-            //             break;
-            // }
-            // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->PefConfig.PEFSharedMemMutex, WAIT_INFINITE);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CommunityStr,
-            //          pSetLanReq->ConfigData.CommunityStr, MAX_COMM_STRING_SIZE);
-            // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->PefConfig.PEFSharedMemMutex);
             break;
 
         case LAN_PARAM_DEST_NUM:
@@ -695,285 +519,17 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_SELECT_DEST_TYPE:
             printf("Not implement\n");
-            // // if (pSetLanReq->ConfigData.DestType.SetSelect > NUM_LAN_DESTINATION)
-            // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
-            // {
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof (*pRes);
-            // }
-
-            // if (0 == pSetLanReq->ConfigData.DestType.SetSelect)
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pSharedMem->VolLANDestType[EthIndex],
-            //               &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // else
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestType.SetSelect - 1],
-            //               &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
             break;
 
         case LAN_PARAM_SELECT_DEST_ADDR:
             printf("Not implement\n");
-            // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // // if (pSetLanReq->ConfigData.DestAddr.SetSelect > NUM_LAN_DESTINATION)
-            // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
-            // {
-            //     *pRes = CC_PARAM_OUT_OF_RANGE ;
-            //     return sizeof (*pRes);
-            // }
-
-            // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pSharedMem->VolLANDest[EthIndex],
-            //               &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
-            //    memset(pSharedMem->VolLANv6Dest,0,sizeof(LANDestv6Addr_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // else
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestAddr [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
-            //               &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
-            //     memset( &pBMCInfo->LANCfs[EthIndex].Destv6Addr [pSetLanReq->ConfigData.Destv6Addr.SetSelect -1], 0 ,
-            //         sizeof(LANDestv6Addr_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // /* Setting BackupGw to DefaultGw as per request to send trap */
-            // if(pSetLanReq->ConfigData.DestAddr.GateWayUse == 1)
-            // {
-            //     IPMI_DBG_PRINT("Setting Backupgw to Defaultgwip as per Request \n");
-            //     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy(NWConfig.Gateway,pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,IP_ADDR_LEN);
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            //     SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
-            //     PostPendTask(PEND_OP_SET_GATEWAY,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
-
-            //  }
             break;
 
         case LAN_PARAM_VLAN_ID:
             printf("Not implement\n");
-            // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
-            // {
-            //     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-
-            //     if((pSetLanReq->ConfigData.VLANID & VLAN_MASK_BIT) == VLAN_MASK_BIT)    /* checks for VLAN enable bit*/
-            //     {
-            //         pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //         if(pendStatus == PEND_STATUS_PENDING)
-            //         {
-            //             *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //             return sizeof (uint8_t);
-            //         }
-            //         vlanID = (pSetLanReq->ConfigData.VLANID & 0xfff);    /* get the vlan d from the data */
-
-            //         for(i=0;i<sizeof(InvalidVlanID)/sizeof(uint16_t);i++)
-            //         {
-            //             if(InvalidVlanID[i] != vlanID)
-            //             {
-            //                 continue;
-            //             }
-            //             else        /*invalid vlan id */
-            //             {
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //         }
-
-            //         if ( NWConfig.VLANID != 0)     /* checks if vlan id already present */
-            //         {
-            //             if(NWConfig.VLANID == vlanID)
-            //             {
-            //                 TCRIT("Currently configured vlan id and incoming set vlan id are same thus, do nothing\n");
-            //                 break;
-            //             }
-            //             memset(IfcName,0,sizeof(IfcName));
-            //             if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //             {
-            //                 TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
-            //             if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
-            //             {
-            //                 pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //                 if(pendStatus == PEND_STATUS_PENDING)
-            //                 {
-            //                     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                     return sizeof (uint8_t);
-            //                 }
-            //                 SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
-            //                 PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //                 pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
-            //             }
-            //         }
-
-            //         NWConfig.VLANID=vlanID;
-            //         SetPendStatus(PEND_OP_SET_VLAN_ID,PEND_STATUS_PENDING);
-            //         PostPendTask(PEND_OP_SET_VLAN_ID,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //         pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //     }
-            //     else        /* Vlan Bit is Disabled */
-            //     {
-            //         if(NWConfig.VLANID==0)        /* Vlan id is disabled */
-            //         {
-            //             if((pSetLanReq->ConfigData.VLANID & 0xfff)!=0)
-            //             {
-            //                 pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //             }
-
-            //             if((pSetLanReq->ConfigData.VLANID & 0xfff)==0)
-            //             {
-            //                 if((pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff)!=0)
-            //                 {
-            //                     pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //                 }
-            //             }
-            //         }
-
-            //         else                /* Vlan ID is enable. so deconfigure it */
-            //         {
-            //             memset(IfcName,0,sizeof(IfcName));
-            //             if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //             {
-            //                 TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
-            //             if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
-            //             {
-            //                 pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //                 if(pendStatus == PEND_STATUS_PENDING)
-            //                 {
-            //                     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                     return sizeof (uint8_t);
-            //                 }
-            //                 SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
-            //                 PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //                 pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
-            //             }
-            //             pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-            //             if(pendStatus == PEND_STATUS_PENDING)
-            //             {
-            //                 *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                 return sizeof (uint8_t);
-            //             }
-            //             //NWConfig.VLANID=0;
-            //             NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
-            //             SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-            //             PostPendTask(PEND_OP_SET_SOURCE,(uint8_t*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //             pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //         }
-
-            //     }
-            // }
-            // else
-            // {
-            //     pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof(uint8_t);
-            // }
             break;
         case LAN_PARAM_VLAN_PRIORITY:
             printf("Not implement\n");
-            // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
-            // {
-            //     if((pBMCInfo->LANCfs[EthIndex].VLANID & VLAN_MASK_BIT) != VLAN_MASK_BIT)    /* checks for VLAN enable bit*/
-            //     {
-            //         if(g_corefeatures.vlan_priorityset == ENABLED)
-            //         {
-            //             if(pSetLanReq->ConfigData.VLANPriority > 7 )
-            //             {
-            //                 TCRIT(" VLAN Priority value should be 0-7 \n");
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
-            //             {
-            //                 return -1;
-            //             }
-            //             if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
-            //             {
-            //                 return -1;
-            //             }
-            //             pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
-            //         }
-            //         else
-            //         {
-            //             TCRIT(" VLAN is not Configured \n");
-            //             *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //             return sizeof (*pRes);
-            //         }
-            //     }
-            //     else
-            //     {
-            //         if(pSetLanReq->ConfigData.VLANPriority > 7 )
-            //         {
-            //             TCRIT(" VLAN Priority value should be 0-7 \n");
-            //             *pRes = CC_INV_DATA_FIELD ;
-            //             return sizeof (*pRes);
-            //         }
-
-            //         if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
-            //         {
-            //             return -1;
-            //         }
-
-            //         if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
-            //         {
-            //             return -1;
-            //         }
-
-            //         pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
-            //         vlanID = (pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff);
-            //         memset(IfcName,0,sizeof(IfcName));
-            //         if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //         {
-            //              TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //              *pRes = CC_INV_DATA_FIELD;
-            //              return sizeof(*pRes);
-            //         }
-            //         /*vconfig set_egress_map <valninterface> <skb_buffer> <vlan-priority>*/
-            //         sprintf(cmdSetPriority,"vconfig set_egress_map  %s.%d  0  %d",IfcName,vlanID,pSetLanReq->ConfigData.VLANPriority);
-            //         if(((retValue = safe_system(cmdSetPriority)) < 0))
-            //         {
-            //             TCRIT("ERROR %d: Set VLAN Priority failed\n",retValue);
-            //         }
-                
-            //     /* 
-            //      * Set priority of IPMI commands. 
-            //      * The skb->priority value of IPMI command will be modified by TOS option.
-            //      * So, use the mapping table to get the current value.
-            //      */
-            //         memset(&cmdSetPriority,0,sizeof(cmdSetPriority));
-            //         TOS = pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam.TypeOfService;
-            //         SkbPriority = IP_TOS2PRIO[IPTOS_TOS(TOS)>>1];
-            //         sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d %d %d",IfcName,vlanID,SkbPriority,pSetLanReq->ConfigData.VLANPriority);
-            //         if(((retValue = safe_system(cmdSetPriority)) < 0))
-            //         {
-            //             TCRIT("ERROR %d: Set VLAN IPMI Priority failed\n",retValue);
-            //         } 
-            //     }
-            // }
-            // else
-            // {
-            //      pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //      return sizeof(uint8_t);
-            // }
             break;
         case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
             pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
@@ -986,42 +542,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
             printf("Not implement\n");
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
-            //           pSetLanReq->ConfigData.CipherSuitePrivLevels, MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_VLAN_TAGS:
             printf("Not implement\n");
-          //   if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
-          // {
-          //       LOCK_BMC_SHARED_MEM(BMCInst);
-          //       _fmemcpy(&pSharedMem->VLANDestTag,
-          //                ((  uint8_t*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
-          //       UNLOCK_BMC_SHARED_MEM(BMCInst);
-          // }
-          // else
-          // {
-          //       if (pSetLanReq->ConfigData.DestAddr.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
-          //       {
-          //           pSetLanRes->CompletionCode = CC_PARAM_OUT_OF_RANGE;
-          //           return sizeof (uint8_t);
-          //       }
-          //       LOCK_BMC_SHARED_MEM(BMCInst);
-          //       _fmemcpy(&pBMCInfo->LANCfs[EthIndex].VLANDestTags [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
-          //                ((  uint8_t*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
-          //       UNLOCK_BMC_SHARED_MEM(BMCInst);
-          // }
             break;
 
         case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
             printf("Not implement\n");
-            // ClearUserLockAttempts(LAN_CHANNEL_BADP,BMCInst);
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].BadPasswd,
-            //                 &pSetLanReq->ConfigData.BadPasswd,sizeof(BadPassword_T));
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
         default:
             pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;

+ 2 - 2
app/common_include/com_BmcType.h

@@ -322,8 +322,8 @@ typedef struct{
 
 
 typedef struct{
-    uint8_t EthName[20];
-    uint8_t IPAddrSrc;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other
+//    uint8_t EthName[20];
+//    uint8_t IPAddrSrc;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other
     uint8_t IPAddr[4];
     uint8_t BroadCast[4];
     uint8_t NetMask[4];

+ 1 - 1
app/goahead-3.6.5/src/libipmi/inc/libipmi_storlead_OEM.h

@@ -108,7 +108,7 @@ uint16_t Storlead_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ip
 	SELEventRecordWithSensorName_T *pSELEntriesBuffer,uint32_t *nNumSelEntries,int timeout);
 uint16_t IPMICMD_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, int timeout);
 uint16_t IPMC_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout);
-uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout);
+uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, uint8_t isSave, LanInfo_T *pLanInfo, int timeout);
 uint16_t IPMICMD_GetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout);
 uint16_t IPMICMD_restoreFactorySettings(IPMI20_UDS_SESSION_T *pUDSSession, int timeout);
 uint16_t IPMC_restoreFactorySettings(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout);

+ 4 - 3
app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c

@@ -547,7 +547,7 @@ uint16_t IPMC_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int
 	return (wRet);
 }
 
-uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout)
+uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, uint8_t isSave, LanInfo_T *pLanInfo, int timeout)
 {
 	uint16_t wRet;
 	uint32_t dwResLen;
@@ -555,10 +555,11 @@ uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, La
 	uint8_t req[100];
 	
 	req[0] = index; 
-	memcpy(&req[1], pLanInfo, sizeof(LanInfo_T));
+	req[1] = isSave;
+	memcpy(&req[2], pLanInfo, sizeof(LanInfo_T));
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
 						NETFNLUN_IPMI_STORLEAD, CMD_SET_LAN_INFO,
-						req, sizeof(LanInfo_T)+1,
+						req, sizeof(LanInfo_T)+2,
 						(uint8_t*)res, &dwResLen,
 						timeout);
 	if(res[0] != 0)

+ 12 - 33
app/goahead-3.6.5/src/web_interface/src/config.c

@@ -160,7 +160,6 @@ void web_GetLanInfo(Webs *wp){
     else
     {
         memset(&LanInfo, 0, sizeof(LanInfo_T));
-        strcpy(LanInfo.EthName, "--");
     }
 
     //Close session
@@ -173,16 +172,8 @@ void web_GetLanInfo(Webs *wp){
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-    cJSON_AddStringToObject(data, "eth", LanInfo.EthName);
-
-    if(LanInfo.IPAddrSrc == STATIC_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "static");
-    else if(LanInfo.IPAddrSrc == DHCP_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "DHCP");
-    else if(LanInfo.IPAddrSrc == BIOS_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "BIOS");
-    else 
-        cJSON_AddStringToObject(data, "mode", "Other");
+    cJSON_AddStringToObject(data, "eth", "eth0");
+    cJSON_AddStringToObject(data, "mode", "static");
     
     char strIp[16] = {0};
     sprintf(strIp, "%d.%d.%d.%d", LanInfo.IPAddr[0], LanInfo.IPAddr[1], 
@@ -240,6 +231,9 @@ void web_SetLanInfo(Webs *wp){
     char *strBrdCast = websGetVar(wp, "broadcast", NULL);   //192.168.0.255
     char *strMask = websGetVar(wp, "netmask", NULL);        //255.255.255.0
     char *strGw = websGetVar(wp, "defaultgw", NULL);        //192.168.0.1
+    char *strSave = websGetVar(wp, "isSave", NULL);         //0 or 1
+
+    int  isSave = atoi(strSave);
 
     if(strlen(EthName) > 20)
     {
@@ -261,27 +255,6 @@ void web_SetLanInfo(Webs *wp){
     target_addr = gIPMBAddr[wp->index];
     if(target_addr == 0x20)
     {
-        strcpy(LanInfo.EthName, EthName);
-        if((strcmp(strMode, "static") == 0) || (strcmp(strMode, "Static") == 0) 
-            || (strcmp(strMode, "STATIC") == 0))
-        {
-            LanInfo.IPAddrSrc = STATIC_IP_SOURCE;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other    
-        }
-        else if((strcmp(strMode, "DHCP") == 0) || (strcmp(strMode, "Dhcp") == 0 )
-            || (strcmp(strMode, "dhcp") == 0))
-        {
-            LanInfo.IPAddrSrc = DHCP_IP_SOURCE;    
-        }
-        else if((strcmp(strMode, "BIOS") == 0) || (strcmp(strMode, "Bios") == 0 )
-            || (strcmp(strMode, "bios") == 0))
-        {
-            LanInfo.IPAddrSrc = BIOS_IP_SOURCE;    
-        }
-        else
-        {
-            LanInfo.IPAddrSrc = BMC_OTHER_SOURCE;  
-        }
-
         LanInfo.IPAddr[0] = ip2dec(strIp, 0);
         LanInfo.IPAddr[1] = ip2dec(strIp, 1);
         LanInfo.IPAddr[2] = ip2dec(strIp, 2);
@@ -308,11 +281,17 @@ void web_SetLanInfo(Webs *wp){
         LanInfo.MACAddr[3] = mac2hex(strMac, 3);
         LanInfo.MACAddr[4] = mac2hex(strMac, 4);
         LanInfo.MACAddr[5] = mac2hex(strMac, 5);
+
+        //isSave 只能是0和1这两个值。
+        if(isSave != 1)
+        {
+            isSave = 0;
+        }
         
         //Create session
         LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-        wRet = IPMICMD_SetLanInfo(&UDSSession, index, &LanInfo, DEFAULT_TIMEOUT);
+        wRet = IPMICMD_SetLanInfo(&UDSSession, index, isSave, &LanInfo, DEFAULT_TIMEOUT);
         if(wRet != 0)
         {
             websError(wp, 404, "Reset BMC fail!");

+ 9 - 6
app/ipmitool-1.8.18/lib/ipmi_lanp.c

@@ -84,14 +84,17 @@ is_lan_channel(struct ipmi_intf * intf, uint8_t chan)
 {
 	uint8_t medium;
 
-	if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
-		return 0;
+	//jimbo modify, 固定死网络的通道号是1
+	if(chan == 1)
+		return 1;
+	// if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
+	// 	return 0;
 
-	medium = ipmi_get_channel_medium(intf, chan);
+	// medium = ipmi_get_channel_medium(intf, chan);
 
-	if (medium == IPMI_CHANNEL_MEDIUM_LAN ||
-	    medium == IPMI_CHANNEL_MEDIUM_LAN_OTHER)
-		return 1;
+	// if (medium == IPMI_CHANNEL_MEDIUM_LAN ||
+	//     medium == IPMI_CHANNEL_MEDIUM_LAN_OTHER)
+	// 	return 1;
 
 	return 0;
 }