Explorar o código

Z991239-4916 #comment 取网卡状态信息

oilyang hai 1 ano
pai
achega
9423949f1e
Modificáronse 2 ficheiros con 7 adicións e 5 borrados
  1. 5 4
      Module/include/CommEntityUtil.hpp
  2. 2 1
      Module/mod_vtmloader/VtmLoaderFSM.cpp

+ 5 - 4
Module/include/CommEntityUtil.hpp

@@ -18,7 +18,8 @@
 #define streq stricmp
 
 #else
-
+#include <linux/ethtool.h>
+#include <linux/sockios.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -879,7 +880,7 @@ static ErrorCodeEnum GetINETMacAddresses(CAutoArray<NetworkAdapterItem> &netList
                         Dbg("HWaddr %s", mac);
                         inteMacs[buf[i].ifr_name] = mac;
                     }
-					if (ioctl(fd, SIOCEHTOOL, (char*)& buf[i]) == -1) {
+					if (ioctl(fd, SIOCETHTOOL, (char*)& buf[i]) == -1) {
 						//up down
 						inteStatus[buf[i].ifr_name] = 0;
 					}
@@ -905,13 +906,13 @@ static ErrorCodeEnum GetINETMacAddresses(CAutoArray<NetworkAdapterItem> &netList
         if (tmpip.Compare("127.0.0.1") == 0 && tmpmac.Compare("00:00:00:00:00:00") == 0) {
             //skip
         } else {
-			tmpname = map_it->first;
+			tmpname = map_it->first.c_str();
 			netItem.friend_name = "";//oiltmp
 			netItem.description = tmpname;
 			netItem.mac = tmpmac;
 			netItem.ip = tmpip;
 			netItem.operStatus = inteStatus[map_it->first];
-			netItem.type = IF_TYPE_ETHERNET_CSMACD;
+			netItem.type = 6;//oiltest haven't find the in linux
 			netLists.Append(&netItem, 0, 1);
         }
         ++map_it;

+ 2 - 1
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -833,7 +833,8 @@ BOOL CVtmLoaderFSM::DetectNetworkLegality(CSimpleStringA& strInfo)
 				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("mac(%d):%s", i, netList[i].mac.c_str());
 				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("operStatus(%d):%d", i, netList[i].operStatus);
 				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("type(%d):%d", i, netList[i].type);
-				if (netList[i].type == IF_TYPE_ETHERNET_CSMACD && netList[i].operStatus == IfOperStatusUp)
+				//if (netList[i].type == IF_TYPE_ETHERNET_CSMACD && netList[i].operStatus == IfOperStatusUp)
+				if (netList[i].type == 6 && netList[i].operStatus == 1)//oiltest
 				{
 					fLocalLANConnected = TRUE;
 					break;