- Merge aicom-network-fixes up to r39943

svn path=/trunk/; revision=39964
This commit is contained in:
Cameron Gutman 2009-03-11 22:15:12 +00:00
parent 9a03c978ce
commit d37359e14f
9 changed files with 45 additions and 66 deletions

View file

@ -235,6 +235,9 @@ static NDIS_STATUS NTAPI MiniportInitialize(
UINT i;
NDIS_STATUS Status;
PNIC_ADAPTER Adapter;
NDIS_HANDLE ConfigurationHandle;
UINT *RegNetworkAddress = 0;
UINT RegNetworkAddressLength = 0;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
@ -281,10 +284,7 @@ static NDIS_STATUS NTAPI MiniportInitialize(
if (Status != NDIS_STATUS_SUCCESS)
{
PNDIS_CONFIGURATION_PARAMETER ConfigurationParameter;
NDIS_HANDLE ConfigurationHandle;
UNICODE_STRING Keyword;
UINT *RegNetworkAddress = 0;
UINT RegNetworkAddressLength = 0;
NdisOpenConfiguration(&Status, &ConfigurationHandle, WrapperConfigurationContext);
if (Status == NDIS_STATUS_SUCCESS)
@ -308,18 +308,6 @@ static NDIS_STATUS NTAPI MiniportInitialize(
Adapter->IoBaseAddress = ConfigurationParameter->ParameterData.IntegerData;
}
/* the returned copy of the data is owned by NDIS and will be released on NdisCloseConfiguration */
NdisReadNetworkAddress(&Status, (PVOID *)&RegNetworkAddress, &RegNetworkAddressLength, ConfigurationHandle);
if(Status == NDIS_STATUS_SUCCESS && RegNetworkAddressLength == DRIVER_LENGTH_OF_ADDRESS)
{
int i;
NDIS_DbgPrint(MID_TRACE,("NdisReadNetworkAddress returned successfully, address %x:%x:%x:%x:%x:%x\n",
RegNetworkAddress[0], RegNetworkAddress[1], RegNetworkAddress[2], RegNetworkAddress[3],
RegNetworkAddress[4], RegNetworkAddress[5]));
for(i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
Adapter->StationAddress[i] = RegNetworkAddress[i];
}
NdisCloseConfiguration(ConfigurationHandle);
}
else
@ -368,6 +356,30 @@ static NDIS_STATUS NTAPI MiniportInitialize(
return Status;
}
NdisOpenConfiguration(&Status, &ConfigurationHandle, WrapperConfigurationContext);
if (Status == NDIS_STATUS_SUCCESS)
{
NdisReadNetworkAddress(&Status, (PVOID *)&RegNetworkAddress, &RegNetworkAddressLength, ConfigurationHandle);
if(Status == NDIS_STATUS_SUCCESS && RegNetworkAddressLength == DRIVER_LENGTH_OF_ADDRESS)
{
int i;
NDIS_DbgPrint(MID_TRACE,("NdisReadNetworkAddress returned successfully, address %x:%x:%x:%x:%x:%x\n",
RegNetworkAddress[0], RegNetworkAddress[1], RegNetworkAddress[2], RegNetworkAddress[3],
RegNetworkAddress[4], RegNetworkAddress[5]));
for(i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
Adapter->StationAddress[i] = RegNetworkAddress[i];
}
NdisCloseConfiguration(ConfigurationHandle);
}
if (Status != NDIS_STATUS_SUCCESS)
{
int i;
for (i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
Adapter->StationAddress[i] = Adapter->PermanentAddress[i];
}
NDIS_DbgPrint(MID_TRACE, ("BOARDDATA:\n"));
for (i = 0; i < 4; i++) {
NDIS_DbgPrint(MID_TRACE, ("%02X %02X %02X %02X\n",
@ -659,11 +671,19 @@ static NDIS_STATUS NTAPI MiniportReset(
* Status of operation
*/
{
NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
ASSERT_IRQL_EQUAL(DISPATCH_LEVEL);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
return NDIS_STATUS_FAILURE;
#ifndef NOCARD
NdisStatus = NICReset((PNIC_ADAPTER)MiniportAdapterContext);
#endif
*AddressingReset = TRUE;
return NdisStatus;
}

View file

@ -699,16 +699,7 @@ NdisReadNetworkAddress(
PNDIS_CONFIGURATION_PARAMETER ParameterValue = NULL;
NDIS_STRING Keyword;
UINT *IntArray = 0;
int i;
/* FIXME - We don't quite support this yet due to buggy code below */
{
*Status = NDIS_STATUS_FAILURE;
return;
}
*NetworkAddress = NULL;
*NetworkAddressLength = 6;/* XXX magic constant */
UINT i,j = 0;
NdisInitUnicodeString(&Keyword, L"NetworkAddress");
NdisReadConfiguration(Status, &ParameterValue, ConfigurationHandle, &Keyword, NdisParameterString);
@ -718,8 +709,11 @@ NdisReadNetworkAddress(
return;
}
/* 6 bytes for ethernet, tokenring, fddi, everything else? */
IntArray = ExAllocatePool(PagedPool, 6*sizeof(UINT));
while (ParameterValue->ParameterData.StringData.Buffer[j] != '\0') j++;
*NetworkAddressLength = (UINT)((j/2)+0.5);
IntArray = ExAllocatePool(PagedPool, (*NetworkAddressLength)*sizeof(UINT));
if(!IntArray)
{
NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
@ -742,7 +736,7 @@ NdisReadNetworkAddress(
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
/* convert from string to bytes */
for(i=0; i<6; i++)
for(i=0; i<(*NetworkAddressLength); i++)
{
IntArray[i] = (UnicodeToHexByte((ParameterValue->ParameterData.StringData.Buffer)[2*i]) << 4) +
UnicodeToHexByte((ParameterValue->ParameterData.StringData.Buffer)[2*i+1]);

View file

@ -1,6 +0,0 @@
#ifndef _TCPIP_BUG_H
#define _TCPIP_BUG_H
VOID TcpipBugCheck( ULONG BugCode );
#endif/*_TCPIP_BUG_H*/

View file

@ -30,7 +30,6 @@
#include <fileobjs.h>
#include <lock.h>
#include <wait.h>
#include <bug.h>
#include <memtrack.h>
#include <oskittcp.h>
#include <interface.h>

View file

@ -26,7 +26,6 @@
</directory>
<directory name="tcpip">
<file>buffer.c</file>
<file>bug.c</file>
<file>dispatch.c</file>
<file>fileobjs.c</file>
<file>iinfo.c</file>

View file

@ -1,11 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS TCP/IP protocol driver
* FILE: tcpip/bug.c
* PURPOSE: Bugcheck
* PROGRAMMERS: Art Yerkes
* REVISIONS:
*/
#include "precomp.h"
VOID TcpipBugCheck( ULONG BugCode ) { KeBugCheck( BugCode ); }

View file

@ -1,14 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS TCP/IP protocol driver
* FILE: tcpip/bug.c
* PURPOSE: Bugcheck
* PROGRAMMERS: Art Yerkes
* REVISIONS:
*/
#include "precomp.h"
VOID TcpipBugCheck( ULONG BugCode ) {
DbgPrint("BugCheck called: %x\n", BugCode);
ASSERT(0);
}

View file

@ -124,7 +124,7 @@ VOID UntrackFL( PCHAR File, ULONG Line, PVOID Thing, ULONG Tag ) {
if ( ThingInList->Tag != Tag ) {
DbgPrint("UNTRACK: TAG DOES NOT MATCH (%x)\n", Thing);
ShowTrackedThing("Tag Mismatch (Item in list)", ThingInList, TRUE);
TcpipBugCheck( 0 );
ASSERT( FALSE );
}
ExFreeToNPagedLookasideList( &AllocatedObjectsLookasideList,
@ -139,7 +139,7 @@ VOID UntrackFL( PCHAR File, ULONG Line, PVOID Thing, ULONG Tag ) {
}
TcpipReleaseSpinLock( &AllocatedObjectsLock, OldIrql );
DbgPrint("UNTRACK: SPECIFIED ALREADY FREE ITEM %x\n", Thing);
TcpipBugCheck( 0 );
ASSERT( FALSE );
}
VOID TrackDumpFL( PCHAR File, ULONG Line ) {

View file

@ -77,8 +77,6 @@ int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) {
return OSK_EINVAL;
}
RemoteAddress.Type = LocalAddress.Type = IP_ADDRESS_V4;
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
TI_DbgPrint(MIN_TRACE,("No route to %s\n", A2S(&RemoteAddress)));
return OSK_EADDRNOTAVAIL;