Changeset 28208 in vbox for trunk/src/VBox
- Timestamp:
- Apr 12, 2010 2:07:33 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r28134 r28208 135 135 #ifdef IN_RING3 136 136 137 /* -=-=-=-=- PDMINETWORKUP -=-=-=-=- */138 139 137 140 138 /** … … 192 190 } 193 191 192 /* -=-=-=-=- PDMINETWORKUP -=-=-=-=- */ 194 193 195 194 /** -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r28156 r28208 3329 3329 3330 3330 3331 /** @copydoc INTNETTRUNKSWPORT::pfnPreRecv */ 3332 static DECLCALLBACK(INTNETSWDECISION) intnetR0TrunkIfPortPreRecv(PINTNETTRUNKSWPORT pSwitchPort, 3333 void const *pvSrc, size_t cbSrc, uint32_t fSrc) 3334 { 3335 PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort); 3336 PINTNETNETWORK pNetwork = pThis->pNetwork; 3337 3338 /* assert some sanity */ 3339 AssertPtrReturn(pNetwork, INTNETSWDECISION_TRUNK); 3340 AssertReturn(pNetwork->FastMutex != NIL_RTSEMFASTMUTEX, INTNETSWDECISION_TRUNK); 3341 AssertPtr(pvSrc); 3342 AssertPtr(cbSrc >= 6); 3343 Assert(fSrc); 3344 3345 /** @todo implement the switch table. */ 3346 3347 return INTNETSWDECISION_BROADCAST; 3348 } 3349 3350 3331 3351 /** @copydoc INTNETTRUNKSWPORT::pfnRecv */ 3332 3352 static DECLCALLBACK(bool) intnetR0TrunkIfPortRecv(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG, uint32_t fSrc) … … 3612 3632 return VERR_NO_MEMORY; 3613 3633 pTrunkIF->SwitchPort.u32Version = INTNETTRUNKSWPORT_VERSION; 3634 pTrunkIF->SwitchPort.pfnPreRecv = intnetR0TrunkIfPortPreRecv; 3614 3635 pTrunkIF->SwitchPort.pfnRecv = intnetR0TrunkIfPortRecv; 3615 3636 pTrunkIF->SwitchPort.pfnSGRetain = intnetR0TrunkIfPortSGRetain; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r28202 r28208 250 250 /** Our overridden ops. */ 251 251 struct net_device_ops Ops; 252 /** Magic word. */ 253 uint32_t u32Magic; 252 254 /** Pointer to the original ops. */ 253 255 struct net_device_ops const *pOrgOps; 254 /** Magic word. */255 uint32_t u32Magic;256 /** Pointer to the net filter instance. */ 257 PVBOXNETFLTINS pVBoxNetFlt; 256 258 /** The number of filtered packages. */ 257 259 uint64_t cFiltered; … … 273 275 { 274 276 PVBOXNETDEVICEOPSOVERRIDE pOverride = (PVBOXNETDEVICEOPSOVERRIDE)pDev->netdev_ops; 275 RTNETETHERHDR EtherHdrBuf;277 uint8_t abHdrBuf[sizeof(RTNETETHERHDR) + sizeof(uint32_t) + RTNETIPV4_MIN_LEN]; 276 278 PCRTNETETHERHDR pEtherHdr; 279 PINTNETTRUNKSWPORT pSwitchPort; 280 277 281 278 282 /* … … 300 304 * drop it. 301 305 */ 302 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, sizeof( EtherHdrBuf), &EtherHdrBuf);303 if ( 304 && pEtherHdr->DstMac.au8[0] == 0x08305 && pEtherHdr->DstMac.au8[1] == 0x00306 && pEtherHdr->DstMac.au8[2] == 0x27306 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, sizeof(abHdrBuf), &abHdrBuf[0]); 307 if ( pEtherHdr 308 && VALID_PTR(pOverride->pVBoxNetFlt) 309 && (pSwitchPort = pOverride->pVBoxNetFlt->pSwitchPort) != NULL 310 && VALID_PTR(pSwitchPort) 307 311 ) 308 312 { 309 dev_kfree_skb(pSkb); 310 pOverride->cFiltered++; 311 return NETDEV_TX_OK; 313 INTNETSWDECISION enmDecision; 314 uint32_t cbHdrs = skb_headlen(pSkb); 315 cbHdrs = RT_MAX(cbHdrs, sizeof(abHdrBuf)); 316 317 /** @todo consider reference counting, etc. */ 318 enmDecision = pSwitchPort->pfnPreRecv(pSwitchPort, pEtherHdr, cbHdrs, INTNETTRUNKDIR_HOST); 319 if (enmDecision == INTNETSWDECISION_INTNET) 320 { 321 dev_kfree_skb(pSkb); 322 pOverride->cFiltered++; 323 return NETDEV_TX_OK; 324 } 312 325 } 313 326 … … 333 346 pOverride->Ops.ndo_start_xmit = vboxNetFltLinuxStartXmitFilter; 334 347 pOverride->u32Magic = VBOXNETDEVICEOPSOVERRIDE_MAGIC; 348 pOverride->cTotal = 0; 349 pOverride->cFiltered = 0; 350 pOverride->pVBoxNetFlt = pThis; 335 351 336 352 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); /* (this isn't necessary, but so what) */
Note:
See TracChangeset
for help on using the changeset viewer.