Author: cgutman
Date: Sun Jul 12 09:21:52 2009
New Revision: 41907
URL:
http://svn.reactos.org/svn/reactos?rev=41907&view=rev
Log:
- Store the static default gateway forward entry in DHCP_ADAPTER
- Loop the adapter list backward so DhclientInfo gets linked properly
Modified:
trunk/reactos/base/services/dhcp/adapter.c
Modified: trunk/reactos/base/services/dhcp/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/adapter…
==============================================================================
--- trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] Sun Jul 12 09:21:52 2009
@@ -149,7 +149,6 @@
PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL;
NTSTATUS Status = STATUS_SUCCESS;
DWORD Error = ERROR_SUCCESS;
- MIB_IPFORWARDROW DefGatewayRow;
Adapter->DhclientState.config = &Adapter->DhclientConfig;
strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr,
@@ -181,11 +180,11 @@
DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" );
if( DefaultGateway ) {
- DefGatewayRow.dwForwardDest = 0;
- DefGatewayRow.dwForwardMask = 0;
- DefGatewayRow.dwForwardMetric1 = 1;
- DefGatewayRow.dwForwardNextHop = inet_addr(DefaultGateway);
- Error = CreateIpForwardEntry( &DefGatewayRow );
+ Adapter->RouterMib.dwForwardDest = 0;
+ Adapter->RouterMib.dwForwardMask = 0;
+ Adapter->RouterMib.dwForwardMetric1 = 1;
+ Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway);
+ Error = CreateIpForwardEntry( &Adapter->RouterMib );
if( Error )
warning("Failed to set default gateway %s: %ld\n",
DefaultGateway, Error);
@@ -212,9 +211,10 @@
void AdapterInit() {
PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE));
- DWORD Error, Size = sizeof(MIB_IFTABLE), i;
+ DWORD Error, Size = sizeof(MIB_IFTABLE);
PDHCP_ADAPTER Adapter = NULL;
struct interface_info *ifi = NULL;
+ int i;
WSAStartup(0x0101,&wsd);
@@ -233,7 +233,7 @@
DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n",
Table->dwNumEntries));
- for( i = 0; i < Table->dwNumEntries; i++ ) {
+ for( i = Table->dwNumEntries - 1; i >= 0; i-- ) {
DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n",
Table->table[i].dwIndex));
Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) +
Table->table[i].dwMtu, 1 );