[PCNET]
authorCameron Gutman <aicommander@gmail.com>
Tue, 10 Jan 2012 00:44:16 +0000 (00:44 +0000)
committerCameron Gutman <aicommander@gmail.com>
Tue, 10 Jan 2012 00:44:16 +0000 (00:44 +0000)
- Apply the same hack for OID_GEN_MEDIA_CONNECT_STATUS as we did for OID_GEN_HARDWARE_STATUS (since media state detection is broken for certain adapters)
[DHCPCSVC]
- Keep the adapter thread running to handle media state changes
[TCPIP]
- Fix media state detection which was totally broken because it was using the wrong OID

svn path=/branches/wlan-bringup/; revision=54895

dll/win32/dhcpcsvc/dhcp/adapter.c
drivers/network/dd/pcnet/requests.c
drivers/network/tcpip/datalink/lan.c
lib/drivers/ip/network/interface.c

index 833d06c..59cc93c 100644 (file)
@@ -345,15 +345,12 @@ DWORD WINAPI AdapterDiscoveryThread(LPVOID Context) {
                 DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n",
                                        Table->table[i].dwIndex));
         }
-        Error = NotifyAddrChange(NULL, NULL);
 #if 0
+        Error = NotifyAddrChange(NULL, NULL);
         if (Error != NO_ERROR)
             break;
 #else
-        if (AdapterCount)
-            break;
-        else
-            Sleep(3000);
+        Sleep(3000);
 #endif
     } while (TRUE);
 
index 79faee5..5500ac0 100644 (file)
@@ -266,7 +266,7 @@ MiniportQueryInformation(
 
     case OID_GEN_MEDIA_CONNECT_STATUS:
         {
-          GenericULONG = Adapter->MediaState;
+          GenericULONG = (ULONG)NdisMediaStateConnected; /* Adapter->MediaState */
           break;
         }
 
index d833d33..955fbe3 100644 (file)
@@ -185,7 +185,9 @@ NTSTATUS TcpipLanGetDwordOid
     case OID_GEN_HARDWARE_STATUS:
         *Result = NdisHardwareStatusReady;
         return STATUS_SUCCESS;
-
+    case OID_GEN_MEDIA_CONNECT_STATUS:
+        *Result = NdisMediaStateConnected;
+        return STATUS_SUCCESS;
     default:
         return STATUS_INVALID_PARAMETER;
     }
index f61cb4d..0d127ca 100644 (file)
@@ -196,27 +196,26 @@ PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address)
     return NULL;
 }
 
-NTSTATUS GetInterfaceConnectionStatus
-( PIP_INTERFACE Interface, PULONG Result ) {
-    NTSTATUS Status = TcpipLanGetDwordOid
-        ( Interface, OID_GEN_HARDWARE_STATUS, Result );
-    if( NT_SUCCESS(Status) ) switch( *Result ) {
-    case NdisHardwareStatusReady:
+NTSTATUS GetInterfaceConnectionStatus(PIP_INTERFACE Interface, PULONG Result)
+{
+    NTSTATUS Status;
+
+    /* Query OID_GEN_MEDIA_CONNECT_STATUS for connection status information */
+    Status = TcpipLanGetDwordOid(Interface, OID_GEN_MEDIA_CONNECT_STATUS, Result);
+    if (!NT_SUCCESS(Status))
+        return Status;
+
+    /* Translate the result into MIB_IF_OPER_STATUS_XXX */
+    if (*Result == NdisMediaStateConnected)
+    {
+        /* Up and running */
         *Result = MIB_IF_OPER_STATUS_OPERATIONAL;
-        break;
-    case NdisHardwareStatusInitializing:
-        *Result = MIB_IF_OPER_STATUS_CONNECTING;
-        break;
-    case NdisHardwareStatusReset:
-        *Result = MIB_IF_OPER_STATUS_DISCONNECTED;
-        break;
-    case NdisHardwareStatusNotReady:
+    }
+    else
+    {
+        /* Down */
         *Result = MIB_IF_OPER_STATUS_DISCONNECTED;
-        break;
-    case NdisHardwareStatusClosing:
-    default:
-        *Result = MIB_IF_OPER_STATUS_NON_OPERATIONAL;
-        break;
     }
-    return Status;
+
+    return STATUS_SUCCESS;
 }