VirtualBox

Ignore:
Timestamp:
Apr 23, 2010 5:25:58 PM (15 years ago)
Author:
vboxsync
Message:

SrvIntNet,VBoxNetFlt: Changing from getting to reporting (VBoxNetFlt reports stuff to SrvIntNet).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r28283 r28666  
    12811281
    12821282/**
     1283 * Helper that determins whether the host (ignoreing us) is operating the
     1284 * interface in promiscuous mode or not.
     1285 */
     1286static bool vboxNetFltLinuxPromiscuous(PVBOXNETFLTINS pThis)
     1287{
     1288    bool                fRc  = false;
     1289    struct net_device * pDev = vboxNetFltLinuxRetainNetDev(pThis);
     1290    if (pDev)
     1291    {
     1292        fRc = !!(pDev->promiscuity - (ASMAtomicUoReadBool(&pThis->u.s.fPromiscuousSet) & 1));
     1293        LogFlow(("vboxNetFltPortOsIsPromiscuous: returns %d, pDev->promiscuity=%d, fPromiscuousSet=%d\n",
     1294                 fRc, pDev->promiscuity, pThis->u.s.fPromiscuousSet));
     1295        vboxNetFltLinuxReleaseNetDev(pThis, pDev);
     1296    }
     1297    return fRc;
     1298}
     1299
     1300/**
    12831301 * Internal worker for vboxNetFltLinuxNotifierCallback.
    12841302 *
     
    13061324
    13071325    /* Get the mac address while we still have a valid net_device reference. */
    1308     memcpy(&pThis->u.s.Mac, pDev->dev_addr, sizeof(pThis->u.s.Mac));
     1326    memcpy(&pThis->u.s.MacAddr, pDev->dev_addr, sizeof(pThis->u.s.MacAddr));
    13091327
    13101328    /*
     
    13401358     */
    13411359    if (!pDev)
     1360    {
     1361        Assert(pThis->pSwitchPort);
    13421362        vboxNetFltLinuxReportNicGsoCapabilities(pThis);
     1363        pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     1364        pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltLinuxPromiscuous(pThis));
     1365    }
    13431366    else
    13441367    {
     
    13531376    }
    13541377
    1355     LogRel(("VBoxNetFlt: attached to '%s' / %.*Rhxs\n", pThis->szName, sizeof(pThis->u.s.Mac), &pThis->u.s.Mac));
     1378    LogRel(("VBoxNetFlt: attached to '%s' / %.*Rhxs\n", pThis->szName, sizeof(pThis->u.s.MacAddr), &pThis->u.s.MacAddr));
    13561379    return VINF_SUCCESS;
    13571380}
     
    15551578
    15561579
    1557 bool vboxNetFltPortOsIsPromiscuous(PVBOXNETFLTINS pThis)
    1558 {
    1559     bool fRc = false;
    1560     struct net_device * pDev = vboxNetFltLinuxRetainNetDev(pThis);
    1561     if (pDev)
    1562     {
    1563         fRc = !!(pDev->promiscuity - (ASMAtomicUoReadBool(&pThis->u.s.fPromiscuousSet) & 1));
    1564         LogFlow(("vboxNetFltPortOsIsPromiscuous: returns %d, pDev->promiscuity=%d, fPromiscuousSet=%d\n",
    1565                  fRc, pDev->promiscuity, pThis->u.s.fPromiscuousSet));
    1566         vboxNetFltLinuxReleaseNetDev(pThis, pDev);
    1567     }
    1568     return fRc;
    1569 }
    1570 
    1571 
    1572 void vboxNetFltPortOsGetMacAddress(PVBOXNETFLTINS pThis, PRTMAC pMac)
    1573 {
    1574     *pMac = pThis->u.s.Mac;
    1575 }
    1576 
    1577 
    1578 bool vboxNetFltPortOsIsHostMac(PVBOXNETFLTINS pThis, PCRTMAC pMac)
    1579 {
    1580     /* ASSUMES that the MAC address never changes. */
    1581     return pThis->u.s.Mac.au16[0] == pMac->au16[0]
    1582         && pThis->u.s.Mac.au16[1] == pMac->au16[1]
    1583         && pThis->u.s.Mac.au16[2] == pMac->au16[2];
    1584 }
    1585 
    1586 
    15871580void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive)
    15881581{
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