VirtualBox

Changeset 38408 in vbox


Ignore:
Timestamp:
Aug 10, 2011 8:07:04 PM (13 years ago)
Author:
vboxsync
Message:

vboxnetflt: partial BPF support for bridged interfaces (#5817)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c

    r38370 r38408  
    11971197    for (i = 0; i < RT_ELEMENTS(g_aAdapters); i++)
    11981198    {
    1199         g_aAdapters[i].uMagic   = VBOXNETADP_MAGIC;
    12001199        g_aAdapters[i].enmState = kVBoxNetAdpState_Invalid;
    12011200        g_aAdapters[i].iUnit    = -1;
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h

    r38389 r38408  
    3030typedef struct VBOXNETADPGLOBALS *PVBOXNETADPGLOBALS;
    3131
    32 /* WARNING! There a copy of VBOXNETADP_MAGIC in VBoxNetFlt/VBoxNetFltInternal.h! */
    33 /*                                   v b n a */
    34 #define VBOXNETADP_MAGIC           0x56424e41
    3532#define VBOXNETADP_MAX_INSTANCES   8
    3633#define VBOXNETADP_MAX_UNITS       128
     
    8683struct VBoxNetAdapter
    8784{
    88     /** Magic id to tell vboxnetX interfaces apart. */
    89     uint32_t          uMagic;
    9085    /** Denotes availability of this slot in adapter array. */
    9186    VBOXNETADPSTATE   enmState;
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp

    r38371 r38408  
    295295            {
    296296                ifnet_set_mtu(pThis->u.s.pIface, VBOXNETADP_MTU);
    297                 Log2(("vboxnetadp: created interface %s (%p), pThis=%p, pMagic=%p, *pMagic=%x(%x)\n",
    298                         pThis->szName, pThis->u.s.pIface, pThis, ifnet_softc(pThis->u.s.pIface), *(uint32_t*)ifnet_softc(pThis->u.s.pIface), pThis->uMagic));
    299297                return VINF_SUCCESS;
    300298            }
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h

    r38370 r38408  
    2424#include <iprt/assert.h>
    2525
    26 /* Copied from VBoxNetAdp/VBoxNetAdpInternal.h */
    27 #define VBOXNETADP_MAGIC           0x56424e41
    2826
    2927RT_C_DECLS_BEGIN
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r38370 r38408  
    787787 * @param   fSrc            Where the packet (allegedly) comes from, one INTNETTRUNKDIR_* value.
    788788 * @param   eProtocol       The protocol.
    789  * @param   pIfNet          The network interface.
    790789 */
    791790static errno_t vboxNetFltDarwinIffInputOutputWorker(PVBOXNETFLTINS pThis, mbuf_t pMBuf, void *pvFrame,
    792                                                     uint32_t fSrc, protocol_family_t eProtocol,
    793                                                     ifnet_t pIfNet)
     791                                                    uint32_t fSrc, protocol_family_t eProtocol)
    794792{
    795793    /*
     
    842840        {
    843841            /*
    844              * Check is this interface belongs to vboxnetadp. We should not drop
    845              * any packets before they get to vboxnetadp as it passes them to tap
     842             * Check if this interface is in promiscuous mode. We should not drop
     843             * any packets before they get to the driver as it passes them to tap
    846844             * callbacks in order for BPF to work properly.
    847845             */
    848             uint32_t *pMagic = (uint32_t *)ifnet_softc(pIfNet);
    849             Log2(("vboxnetflt: pMagic=%p *pMagic=%x\n", pMagic, pMagic ? *pMagic : -1));
    850             if (pMagic && *pMagic == VBOXNETADP_MAGIC)
     846            if (vboxNetFltDarwinIsPromiscuous(pThis))
    851847                fDropIt = false;
    852848            else
     
    871867
    872868    NOREF(eProtocol);
    873     return vboxNetFltDarwinIffInputOutputWorker((PVBOXNETFLTINS)pvThis, *ppMBuf, NULL, INTNETTRUNKDIR_HOST, eProtocol, pIfNet);
     869    NOREF(pIfNet);
     870    return vboxNetFltDarwinIffInputOutputWorker((PVBOXNETFLTINS)pvThis, *ppMBuf, NULL, INTNETTRUNKDIR_HOST, eProtocol);
    874871}
    875872
     
    883880{
    884881    NOREF(eProtocol);
    885     return vboxNetFltDarwinIffInputOutputWorker((PVBOXNETFLTINS)pvThis, *ppMBuf, *ppchFrame, INTNETTRUNKDIR_WIRE, eProtocol, pIfNet);
     882    NOREF(pIfNet);
     883    return vboxNetFltDarwinIffInputOutputWorker((PVBOXNETFLTINS)pvThis, *ppMBuf, *ppchFrame, INTNETTRUNKDIR_WIRE, eProtocol);
    886884}
    887885
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