mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[TCPIP]
- Fix a crash when a NIC driver indicates the media state before we're expecting it - Fixes bug 6895 svn path=/trunk/; revision=56331
This commit is contained in:
parent
be57977549
commit
4c6cc26667
|
@ -810,6 +810,10 @@ VOID NTAPI ProtocolStatus(
|
||||||
PRECONFIGURE_CONTEXT Context;
|
PRECONFIGURE_CONTEXT Context;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||||
|
|
||||||
|
/* Ignore the status indication if we have no context yet. We'll get another later */
|
||||||
|
if (!Adapter->Context)
|
||||||
|
return;
|
||||||
|
|
||||||
Context = ExAllocatePool(NonPagedPool, sizeof(RECONFIGURE_CONTEXT));
|
Context = ExAllocatePool(NonPagedPool, sizeof(RECONFIGURE_CONTEXT));
|
||||||
if (!Context)
|
if (!Context)
|
||||||
|
@ -1302,6 +1306,7 @@ BOOLEAN BindAdapter(
|
||||||
LLIP_BIND_INFO BindInfo;
|
LLIP_BIND_INFO BindInfo;
|
||||||
ULONG Lookahead = LOOKAHEAD_SIZE;
|
ULONG Lookahead = LOOKAHEAD_SIZE;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
NDIS_MEDIA_STATE MediaState;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||||
|
|
||||||
|
@ -1384,13 +1389,31 @@ BOOLEAN BindAdapter(
|
||||||
sizeof(UINT));
|
sizeof(UINT));
|
||||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Register interface with IP layer */
|
/* Register interface with IP layer */
|
||||||
IPRegisterInterface(IF);
|
IPRegisterInterface(IF);
|
||||||
|
|
||||||
/* Set adapter state */
|
/* Store adapter context */
|
||||||
Adapter->Context = IF;
|
Adapter->Context = IF;
|
||||||
|
|
||||||
|
/* Get the media state */
|
||||||
|
NdisStatus = NDISCall(Adapter,
|
||||||
|
NdisRequestQueryInformation,
|
||||||
|
OID_GEN_MEDIA_CONNECT_STATUS,
|
||||||
|
&MediaState,
|
||||||
|
sizeof(MediaState));
|
||||||
|
if (NdisStatus != NDIS_STATUS_SUCCESS) {
|
||||||
|
TI_DbgPrint(DEBUG_DATALINK, ("Could not query media status (0x%X).\n", NdisStatus));
|
||||||
|
IPUnregisterInterface(IF);
|
||||||
|
IPDestroyInterface(IF);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indicate the current media state */
|
||||||
|
ProtocolStatus(Adapter,
|
||||||
|
(MediaState == NdisMediaStateConnected) ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT,
|
||||||
|
NULL, 0);
|
||||||
|
|
||||||
/* Set packet filter so we can send and receive packets */
|
/* Set packet filter so we can send and receive packets */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestSetInformation,
|
NdisRequestSetInformation,
|
||||||
|
@ -1404,9 +1427,6 @@ BOOLEAN BindAdapter(
|
||||||
IPDestroyInterface(IF);
|
IPDestroyInterface(IF);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate media connect (our drivers are broken and don't do this) */
|
|
||||||
ProtocolStatus(Adapter, NDIS_STATUS_MEDIA_CONNECT, NULL, 0);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue