Changeset 28666 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/linux
- Timestamp:
- Apr 23, 2010 5:25:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r28283 r28666 1281 1281 1282 1282 /** 1283 * Helper that determins whether the host (ignoreing us) is operating the 1284 * interface in promiscuous mode or not. 1285 */ 1286 static 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 /** 1283 1301 * Internal worker for vboxNetFltLinuxNotifierCallback. 1284 1302 * … … 1306 1324 1307 1325 /* 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)); 1309 1327 1310 1328 /* … … 1340 1358 */ 1341 1359 if (!pDev) 1360 { 1361 Assert(pThis->pSwitchPort); 1342 1362 vboxNetFltLinuxReportNicGsoCapabilities(pThis); 1363 pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr); 1364 pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltLinuxPromiscuous(pThis)); 1365 } 1343 1366 else 1344 1367 { … … 1353 1376 } 1354 1377 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)); 1356 1379 return VINF_SUCCESS; 1357 1380 } … … 1555 1578 1556 1579 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 1587 1580 void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive) 1588 1581 {
Note:
See TracChangeset
for help on using the changeset viewer.