iphlpapi: Allow both direct and indirect default routes in GetBestRoute.

Hans Leidekker hans at codeweavers.com
Mon Oct 12 06:39:30 CDT 2009


Fix for a situation like this:

$ route 
Kernel IP routing table 
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 
12.34.56.78     *               255.255.255.255 UH    0      0        0 ppp0 
default         *               0.0.0.0         U     0      0        0 ppp0

I.e. there's a default route but it's not a gateway.

 -Hans

---
 dlls/iphlpapi/iphlpapi_main.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 522d1d5..011e21a 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -869,9 +869,7 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO
           matchedBits = numShifts;
           matchedNdx = ndx;
         }
-        else if (!matchedBits && table->table[ndx].dwForwardType ==
-         MIB_IPROUTE_TYPE_INDIRECT) {
-          /* default to a default gateway */
+        else if (!matchedBits) {
           matchedNdx = ndx;
         }
       }
-- 
1.6.3.3





More information about the wine-patches mailing list