VirtualBox

Changeset 85344 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Jul 14, 2020 6:46:00 PM (5 years ago)
Author:
vboxsync
Message:

VBoxNetFlt/darwin: Some adjustments for making it build against a 10.15 SDK. bugref:9790

Location:
trunk/src/VBox/HostDrivers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r85124 r85344  
    5959#include <sys/sockio.h>
    6060#include <sys/kern_event.h>
    61 #include <net/kpi_interface.h>
     61#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 /* The 10.15 SDK has a slightly butchered API deprecation attempt. */
     62# pragma clang diagnostic push
     63# pragma clang diagnostic ignored "-Wmacro-redefined"      /* Each header redefines __NKE_API_DEPRECATED. */
     64# pragma clang diagnostic ignored "-Wmissing-declarations" /* Misplaced __NKE_API_DEPRECATED; in kpi_mbuf.h. */
     65# include <sys/kpi_socket.h>
     66# include <net/kpi_interface.h>
     67# include <sys/kpi_mbuf.h>
     68# include <net/kpi_interfacefilter.h>
     69# pragma clang diagnostic pop
     70#else /* < 10.15*/
     71# include <sys/kpi_socket.h>
     72# include <net/kpi_interface.h>
    6273RT_C_DECLS_BEGIN /* Buggy 10.4 headers, fixed in 10.5. */
    63 #include <sys/kpi_mbuf.h>
    64 #include <net/kpi_interfacefilter.h>
     74# include <sys/kpi_mbuf.h>
     75# include <net/kpi_interfacefilter.h>
    6576RT_C_DECLS_END
    66 
    67 #include <sys/kpi_socket.h>
     77#endif /* < 10.15*/
     78
     79
    6880#include <net/if.h>
    6981#include <net/if_var.h>
     
    13751387    if (pThis->u.s.pSysSock != NULL)
    13761388    {
     1389        RT_GCC_NO_WARN_DEPRECATED_BEGIN
     1390
    13771391        sock_close(pThis->u.s.pSysSock);
    13781392        pThis->u.s.pSysSock = NULL;
     1393
     1394        RT_GCC_NO_WARN_DEPRECATED_END
    13791395    }
    13801396
     
    14061422    errno_t error;
    14071423
     1424    /** @todo Figure out how to replace the socket stuff we use to detect
     1425     *        addresses here as 10.5 deprecates it. */
     1426    RT_GCC_NO_WARN_DEPRECATED_BEGIN
     1427
    14081428    /** @todo reorg code to not have numerous returns with duplicate code... */
     1429    /** @todo reorg code to not have numerous returns with duplicate code... */
     1430    /** @todo reorg code to not have numerous returns with duplicate code... */
     1431    /** @todo reorg code to not have numerous returns with duplicate code... */
     1432    /** @todo reorg code to not have numerous returns with duplicate code... */
     1433    /** @todo reorg code to not have numerous returns with duplicate code... */
     1434    /** @todo reorg code to not have numerous returns with duplicate code... */
     1435    /** @todo reorg code to not have numerous returns with duplicate code... */
     1436    /** @todo reorg code to not have numerous returns with duplicate code... */
     1437
    14091438    error = sock_socket(PF_SYSTEM, SOCK_RAW, SYSPROTO_EVENT,
    14101439                        vboxNetFltDarwinSysSockUpcall, pThis,
     
    14481477        return rc;
    14491478    }
     1479    RT_GCC_NO_WARN_DEPRECATED_END
    14501480
    14511481    ifnet_t pIfNet = pThis->u.s.pIfNet; /* already retained */
     
    15271557    if (RT_UNLIKELY(pSysSock != pThis->u.s.pSysSock))
    15281558    {
    1529         Log(("vboxNetFltDarwinSysSockUpcall: %p != %p?\n",
    1530              pSysSock, pThis->u.s.pSysSock));
     1559        Log(("vboxNetFltDarwinSysSockUpcall: %p != %p?\n", pSysSock, pThis->u.s.pSysSock));
    15311560        return;
    15321561    }
     
    15411570        size_t len = sizeof(struct kern_event_msg) - sizeof(u_int32_t) + sizeof(struct kev_in6_data);
    15421571
     1572        RT_GCC_NO_WARN_DEPRECATED_BEGIN
    15431573        error = sock_receivembuf(pSysSock, NULL, &m, 0, &len);
     1574        RT_GCC_NO_WARN_DEPRECATED_END
    15441575        if (error != 0)
    15451576        {
     
    15661597            if (len - (sizeof(struct kern_event_msg) - sizeof(u_int32_t)) < sizeof(struct kev_in_data))
    15671598            {
    1568                 Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short for KEV_INET_SUBCLASS\n",
    1569                      (unsigned int)len));
     1599                Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short for KEV_INET_SUBCLASS\n", (unsigned int)len));
    15701600                mbuf_freem(m);
    15711601                return;
     
    16131643            {
    16141644                Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short for KEV_INET6_SUBCLASS\n",
    1615                         (unsigned int)len));
     1645                     (unsigned int)len));
    16161646                mbuf_freem(m);
    16171647                return;
     
    16531683
    16541684                kev_inet6_new:
    1655                     pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
    1656                         /* :fAdded */ true, kIntNetAddrType_IPv6, pAddr);
     1685                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, true /*fAdded*/, kIntNetAddrType_IPv6, pAddr);
    16571686                    break;
    16581687
     
    16611690                         IFNAMSIZ, link->if_name, link->if_unit, pAddr));
    16621691
    1663                     pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
    1664                         /* :fAdded */ false, kIntNetAddrType_IPv6, pAddr);
     1692                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, false /*fAdded*/, kIntNetAddrType_IPv6, pAddr);
    16651693                    break;
    16661694
  • trunk/src/VBox/HostDrivers/darwin/VBoxNetSend.h

    r82968 r85344  
    4040
    4141# include <sys/socket.h>
    42 # include <net/kpi_interface.h>
     42# if MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 /* The 10.15 SDK has a slightly butchered API deprecation attempt. */
     43#  pragma clang diagnostic push
     44#  pragma clang diagnostic ignored "-Wmacro-redefined"      /* Each header redefines __NKE_API_DEPRECATED. */
     45#  pragma clang diagnostic ignored "-Wmissing-declarations" /* Misplaced __NKE_API_DEPRECATED; in kpi_mbuf.h. */
     46#  include <net/kpi_interface.h>
     47#  include <sys/kpi_mbuf.h>
     48#  include <net/if.h>
     49#  pragma clang diagnostic pop
     50# else /* < 10.15 */
     51#  include <net/kpi_interface.h>
    4352RT_C_DECLS_BEGIN /* Buggy 10.4 headers, fixed in 10.5. */
    44 # include <sys/kpi_mbuf.h>
     53#  include <sys/kpi_mbuf.h>
    4554RT_C_DECLS_END
    46 # include <net/if.h>
     55#  include <net/if.h>
     56# endif /* < 10.15 */
     57
    4758
    4859RT_C_DECLS_BEGIN
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette