- Specify the interface index so the route won't get added to interface 0 (loopback)

- Warn if something tries to add a route to the loopback adapter
 - Fixes routing issues some people were having

svn path=/trunk/; revision=43350
This commit is contained in:
Cameron Gutman 2009-10-10 02:04:13 +00:00
parent 3ff3c916b3
commit 85a6f2a081
3 changed files with 8 additions and 0 deletions

View file

@ -182,6 +182,7 @@ BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) {
Adapter->RouterMib.dwForwardDest = 0;
Adapter->RouterMib.dwForwardMask = 0;
Adapter->RouterMib.dwForwardMetric1 = 1;
Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex;
Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway);
Error = CreateIpForwardEntry( &Adapter->RouterMib );
if( Error )

View file

@ -519,6 +519,7 @@ void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
Adapter->RouterMib.dwForwardDest = 0; /* Default route */
Adapter->RouterMib.dwForwardMask = 0;
Adapter->RouterMib.dwForwardMetric1 = 1;
Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex;
if( Adapter->RouterMib.dwForwardNextHop ) {
/* If we set a default route before, delete it before continuing */

View file

@ -181,6 +181,12 @@ TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PIPROUTE_ENTRY Route)
AddrInitIPv4( &Netmask, Route->Mask );
AddrInitIPv4( &Router, Route->Gw );
if (IF == Loopback)
{
DbgPrint("Failing attempt to add route to loopback adapter\n");
return TDI_INVALID_PARAMETER;
}
if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */
TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address)));
if (!RouterCreateRoute( &Address, &Netmask, &Router,