- Specify the interface index so the route won't get added to interface 0 (loopback)
authorCameron Gutman <aicommander@gmail.com>
Sat, 10 Oct 2009 02:04:13 +0000 (02:04 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 10 Oct 2009 02:04:13 +0000 (02:04 +0000)
 - Warn if something tries to add a route to the loopback adapter
 - Fixes routing issues some people were having

svn path=/trunk/; revision=43350

reactos/base/services/dhcp/adapter.c
reactos/base/services/dhcp/dhclient.c
reactos/drivers/network/tcpip/tcpip/ninfo.c

index a7e56be..18d52d2 100644 (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 )
index eee8e26..8b18010 100644 (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 */
index 968fe5c..f312b83 100644 (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,