mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[TCPIP]
- Read the link state from the LAN_ADAPTER context to avoid having to block at DPC level in the send path svn path=/trunk/; revision=66777
This commit is contained in:
parent
3c9ba55a49
commit
b8e34eb9ae
3 changed files with 19 additions and 29 deletions
|
@ -10,7 +10,6 @@ UINT CountInterfaceAddresses( PIP_INTERFACE Interface );
|
||||||
NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
|
NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
|
||||||
NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
|
NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
|
||||||
UINT NameMaxLen );
|
UINT NameMaxLen );
|
||||||
NTSTATUS GetInterfaceConnectionStatus( PIP_INTERFACE Interface,
|
VOID GetInterfaceConnectionStatus( PIP_INTERFACE Interface, PULONG OperStatus );
|
||||||
PULONG OperStatus );
|
|
||||||
PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address);
|
PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address);
|
||||||
PIP_INTERFACE GetDefaultInterface(VOID);
|
PIP_INTERFACE GetDefaultInterface(VOID);
|
||||||
|
|
|
@ -51,11 +51,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
||||||
OutData->if_physaddrlen = Interface->AddressLength;
|
OutData->if_physaddrlen = Interface->AddressLength;
|
||||||
OutData->if_adminstatus = MIB_IF_ADMIN_STATUS_UP;
|
OutData->if_adminstatus = MIB_IF_ADMIN_STATUS_UP;
|
||||||
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
|
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
|
||||||
Status = GetInterfaceConnectionStatus( Interface, &OutData->if_operstatus );
|
GetInterfaceConnectionStatus( Interface, &OutData->if_operstatus );
|
||||||
|
|
||||||
/* Not sure what to do here, but not ready seems a safe bet on failure */
|
|
||||||
if( !NT_SUCCESS(Status) )
|
|
||||||
OutData->if_operstatus = NdisHardwareStatusNotReady;
|
|
||||||
|
|
||||||
IFDescr = (PCHAR)&OutData->if_descr[0];
|
IFDescr = (PCHAR)&OutData->if_descr[0];
|
||||||
|
|
||||||
|
|
|
@ -166,10 +166,12 @@ PIP_INTERFACE GetDefaultInterface(VOID)
|
||||||
ForEachInterface(CurrentIF) {
|
ForEachInterface(CurrentIF) {
|
||||||
if (CurrentIF->Context && AddrIsUnspecified(&CurrentIF->Unicast)) {
|
if (CurrentIF->Context && AddrIsUnspecified(&CurrentIF->Unicast)) {
|
||||||
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus)) &&
|
|
||||||
(IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
|
GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
|
||||||
|
if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
|
||||||
return CurrentIF;
|
return CurrentIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
}
|
}
|
||||||
} EndFor(CurrentIF);
|
} EndFor(CurrentIF);
|
||||||
|
@ -178,11 +180,13 @@ PIP_INTERFACE GetDefaultInterface(VOID)
|
||||||
ForEachInterface(CurrentIF) {
|
ForEachInterface(CurrentIF) {
|
||||||
if (CurrentIF->Context && (Index++ == NextDefaultAdapter)) {
|
if (CurrentIF->Context && (Index++ == NextDefaultAdapter)) {
|
||||||
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus)) &&
|
|
||||||
(IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
|
GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
|
||||||
|
if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
|
||||||
NextDefaultAdapter++;
|
NextDefaultAdapter++;
|
||||||
return CurrentIF;
|
return CurrentIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
}
|
}
|
||||||
} EndFor(CurrentIF);
|
} EndFor(CurrentIF);
|
||||||
|
@ -193,11 +197,13 @@ PIP_INTERFACE GetDefaultInterface(VOID)
|
||||||
if (CurrentIF->Context) {
|
if (CurrentIF->Context) {
|
||||||
Index++;
|
Index++;
|
||||||
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus)) &&
|
|
||||||
(IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
|
GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
|
||||||
|
if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
|
||||||
NextDefaultAdapter = Index;
|
NextDefaultAdapter = Index;
|
||||||
return CurrentIF;
|
return CurrentIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
}
|
}
|
||||||
} EndFor(CurrentIF);
|
} EndFor(CurrentIF);
|
||||||
|
@ -245,26 +251,15 @@ PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS GetInterfaceConnectionStatus(PIP_INTERFACE Interface, PULONG Result)
|
VOID GetInterfaceConnectionStatus(PIP_INTERFACE Interface, PULONG Result)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
PLAN_ADAPTER Adapter = Interface->Context;
|
||||||
|
|
||||||
/* Query OID_GEN_MEDIA_CONNECT_STATUS for connection status information */
|
/* Loopback has no adapter context */
|
||||||
Status = TcpipLanGetDwordOid(Interface, OID_GEN_MEDIA_CONNECT_STATUS, Result);
|
if (Adapter == NULL || Adapter->State == LAN_STATE_STARTED) {
|
||||||
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;
|
*Result = MIB_IF_OPER_STATUS_OPERATIONAL;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* Down */
|
|
||||||
*Result = MIB_IF_OPER_STATUS_DISCONNECTED;
|
*Result = MIB_IF_OPER_STATUS_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue