Commit 424e1e71 authored by Gleb Smirnoff's avatar Gleb Smirnoff Committed by Alexandre Julliard

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: 's avatarGerald Pfeifer <gerald@pfeifer.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8d555424
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment