Changeset 28208 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Apr 12, 2010 2:07:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.