Stefan Dösinger : iphlpapi: Use the dst sa_family for the netmask too.
Alexandre Julliard
julliard at winehq.org
Wed Apr 22 15:29:28 CDT 2020
Module: wine
Branch: master
Commit: 4932eec31368dcceed9bb816fbd2da3a7fb13a65
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4932eec31368dcceed9bb816fbd2da3a7fb13a65
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sun Apr 12 14:24:56 2020 +0200
iphlpapi: Use the dst sa_family for the netmask too.
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/iphlpapi/ipstats.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 9d6a84dd33..61f3a97ec4 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -1508,6 +1508,7 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
for (next = buf; next < lim; next += rtm->rtm_msglen)
{
int i;
+ sa_family_t dst_family = AF_UNSPEC;
rtm = (struct rt_msghdr *)next;
@@ -1551,7 +1552,10 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
if (sa->sa_len == 0) {
addr = 0;
}else {
- switch(sa->sa_family) {
+ /* Apple's netstat prints the netmask together with the destination
+ * and only looks at the destination's address family. The netmask's
+ * sa_family sometimes contains the non-existent value 0xff. */
+ switch(i == RTA_NETMASK ? dst_family : sa->sa_family) {
case AF_INET: {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
addr = sin->sin_addr.s_addr;
@@ -1575,7 +1579,10 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
switch (i)
{
- case RTA_DST: row.dwForwardDest = addr; break;
+ case RTA_DST:
+ row.dwForwardDest = addr;
+ dst_family = sa->sa_family;
+ break;
case RTA_GATEWAY: row.dwForwardNextHop = addr; break;
case RTA_NETMASK: row.dwForwardMask = addr; break;
default:
More information about the wine-cvs
mailing list