Module: wine Branch: master Commit: 00c97a61bf2c4d47d012b5205d2a1589671d6ef8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=00c97a61bf2c4d47d012b5205d...
Author: Juan Lang juan.lang@gmail.com Date: Thu Nov 15 09:38:12 2007 -0800
iphlpapi: Default to a default gateway when choosing the best route.
---
dlls/iphlpapi/iphlpapi_main.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 74fa938..24307d6 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -853,7 +853,7 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO return ERROR_INVALID_PARAMETER;
ret = AllocateAndGetIpForwardTableFromStack(&table, FALSE, GetProcessHeap(), 0); - if (table && !ret) { + if (!ret) { DWORD ndx, matchedBits, matchedNdx = table->dwNumEntries;
for (ndx = 0, matchedBits = 0; ndx < table->dwNumEntries; ndx++) { @@ -869,6 +869,11 @@ 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 */ + matchedNdx = ndx; + } } } if (matchedNdx < table->dwNumEntries) { @@ -881,8 +886,6 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO } HeapFree(GetProcessHeap(), 0, table); } - else if (!ret) - ret = ERROR_OUTOFMEMORY; TRACE("returning %d\n", ret); return ret; }