Gleb Smirnoff : iphlpapi: Account for structs inpcb and tcpcb being unavailable for userland in FreeBSD 12.

Alexandre Julliard julliard at winehq.org
Mon Aug 19 15:35:12 CDT 2019


Module: wine
Branch: master
Commit: 424e1e71cac268cc2db8483d84474f88d61b67d1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=424e1e71cac268cc2db8483d84474f88d61b67d1

Author: Gleb Smirnoff <glebius at FreeBSD.org>
Date:   Sat Aug 17 10:32:31 2019 +0200

iphlpapi: Account for structs inpcb and tcpcb being unavailable for userland in FreeBSD 12.

FreeBSD 12, specifically __FreeBSD_version 1200026 and later, no longer
exposes struct inpcb and struct tcpcb to userland.  New structs xinpcb
and xtcpcb shall be used instead.

Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/iphlpapi/ipstats.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 0b762eb..5a52753 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -2226,13 +2226,15 @@ DWORD build_tcp_table( TCP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
              pXIG->xig_len > sizeof (struct xinpgen);
              pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
         {
-            struct tcpcb *pTCPData = NULL;
-            struct inpcb *pINData;
-            struct xsocket *pSockData;
-
-            pTCPData = &((struct xtcpcb *)pXIG)->xt_tp;
-            pINData = &((struct xtcpcb *)pXIG)->xt_inp;
-            pSockData = &((struct xtcpcb *)pXIG)->xt_socket;
+#if __FreeBSD_version >= 1200026
+            struct xtcpcb *pTCPData = (struct xtcpcb *)pXIG;
+            struct xinpcb *pINData = &pTCPData->xt_inp;
+            struct xsocket *pSockData = &pINData->xi_socket;
+#else
+            struct tcpcb *pTCPData = &((struct xtcpcb *)pXIG)->xt_tp;
+            struct inpcb *pINData = &((struct xtcpcb *)pXIG)->xt_inp;
+            struct xsocket *pSockData = &((struct xtcpcb *)pXIG)->xt_socket;
+#endif
 
             /* Ignore sockets for other protocols */
             if (pSockData->xso_protocol != IPPROTO_TCP)
@@ -2538,11 +2540,13 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
              pXIG->xig_len > sizeof (struct xinpgen);
              pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
         {
-            struct inpcb *pINData;
-            struct xsocket *pSockData;
-
-            pINData = &((struct xinpcb *)pXIG)->xi_inp;
-            pSockData = &((struct xinpcb *)pXIG)->xi_socket;
+#if __FreeBSD_version >= 1200026
+            struct xinpcb *pINData = (struct xinpcb *)pXIG;
+            struct xsocket *pSockData = &pINData->xi_socket;
+#else
+            struct inpcb *pINData = &((struct xinpcb *)pXIG)->xi_inp;
+            struct xsocket *pSockData = &((struct xinpcb *)pXIG)->xi_socket;
+#endif
 
             /* Ignore sockets for other protocols */
             if (pSockData->xso_protocol != IPPROTO_UDP)




More information about the wine-cvs mailing list