Changeset 30558 in vbox
- Timestamp:
- Jul 1, 2010 2:15:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r30262 r30558 222 222 static int vboxNetFltQdiscEnqueue(struct sk_buff *skb, struct Qdisc *sch) 223 223 { 224 int rc; 225 PVBOXNETQDISCPRIV pPriv = qdisc_priv(sch); 224 PVBOXNETQDISCPRIV pPriv = qdisc_priv(sch); 225 int rc; 226 226 227 #ifdef VBOXNETFLT_QDISC_ENQUEUE 227 228 if (VALID_PTR(pPriv->pVBoxNetFlt)) … … 230 231 PCRTNETETHERHDR pEtherHdr; 231 232 PINTNETTRUNKSWPORT pSwitchPort; 232 233 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(skb, 0, sizeof(abHdrBuf), &abHdrBuf[0]); 233 uint32_t cbHdrs = skb_headlen(skb); 234 235 cbHdrs = RT_MIN(cbHdrs, sizeof(abHdrBuf)); 236 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(skb, 0, cbHdrs, &abHdrBuf[0]); 234 237 if ( pEtherHdr 235 238 && (pSwitchPort = pPriv->pVBoxNetFlt->pSwitchPort) != NULL 236 239 && VALID_PTR(pSwitchPort) 237 ) 238 { 239 struct sk_buff *pBuf; 240 INTNETSWDECISION enmDecision; 241 uint32_t cbHdrs = skb_headlen(skb); 242 cbHdrs = RT_MAX(cbHdrs, sizeof(abHdrBuf)); 243 244 #if 1 245 /* Test stub due to missing implementation of pfnPreRecv */ 246 static uint8_t tmpAddr[] = { 0x08, 0x00, 0x27, 0xBB, 0x1E, 0xA0 }; 247 if (memcmp(pEtherHdr, tmpAddr, 6) != 0) 248 enmDecision = INTNETSWDECISION_BROADCAST; 249 else 250 enmDecision = INTNETSWDECISION_INTNET; 251 #else 252 enmDecision = pSwitchPort->pfnPreRecv(pSwitchPort, pEtherHdr, cbHdrs, INTNETTRUNKDIR_HOST); 253 #endif 240 && cbHdrs >= 6) 241 { 242 /** @todo consider reference counting, etc. */ 243 INTNETSWDECISION enmDecision = pSwitchPort->pfnPreRecv(pSwitchPort, pEtherHdr, cbHdrs, INTNETTRUNKDIR_HOST); 254 244 if (enmDecision == INTNETSWDECISION_INTNET) 255 245 { 256 pBuf = skb_copy(skb, GFP_ATOMIC);246 struct sk_buff *pBuf = skb_copy(skb, GFP_ATOMIC); 257 247 pBuf->pkt_type = PACKET_OUTGOING; 258 248 vboxNetFltLinuxForwardToIntNet(pPriv->pVBoxNetFlt, pBuf); … … 293 283 while ((pSkb = pPriv->pChild->dequeue(pPriv->pChild)) != NULL) 294 284 { 295 struct sk_buff *pBuf;285 struct sk_buff *pBuf; 296 286 INTNETSWDECISION enmDecision; 297 uint32_t cbHdrs = skb_headlen(pSkb);287 uint32_t cbHdrs; 298 288 299 289 --sch->q.qlen; … … 302 292 break; 303 293 304 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, sizeof(abHdrBuf), &abHdrBuf[0]); 294 cbHdrs = skb_headlen(pSkb); 295 cbHdrs = RT_MIN(cbHdrs, sizeof(abHdrBuf)); 296 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, cbHdrs, &abHdrBuf[0]); 305 297 if ( !pEtherHdr 306 298 || (pSwitchPort = pPriv->pVBoxNetFlt->pSwitchPort) == NULL 307 299 || !VALID_PTR(pSwitchPort) 308 )300 || cbHdrs < 6) 309 301 break; 310 302 311 cbHdrs = RT_MAX(cbHdrs, sizeof(abHdrBuf)); 312 313 #if 1 314 /* Test stub due to missing implementation of pfnPreRecv */ 315 static uint8_t tmpAddr[] = { 0x08, 0x00, 0x27, 0xBB, 0x1E, 0xA0 }; 316 if (memcmp(pEtherHdr, tmpAddr, 6) != 0) 317 enmDecision = INTNETSWDECISION_BROADCAST; 318 else 319 enmDecision = INTNETSWDECISION_INTNET; 320 #else 303 /** @todo consider reference counting, etc. */ 321 304 enmDecision = pSwitchPort->pfnPreRecv(pSwitchPort, pEtherHdr, cbHdrs, INTNETTRUNKDIR_HOST); 322 #endif323 305 if (enmDecision != INTNETSWDECISION_INTNET) 324 306 break; … … 834 816 PCRTNETETHERHDR pEtherHdr; 835 817 PINTNETTRUNKSWPORT pSwitchPort; 818 uint32_t cbHdrs; 836 819 837 820 … … 860 843 * drop it. 861 844 */ 862 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, sizeof(abHdrBuf), &abHdrBuf[0]); 845 cbHdrs = skb_headlen(pSkb); 846 cbHdrs = RT_MIN(cbHdrs, sizeof(abHdrBuf)); 847 pEtherHdr = (PCRTNETETHERHDR)skb_header_pointer(pSkb, 0, cbHdrs, &abHdrBuf[0]); 863 848 if ( pEtherHdr 864 849 && VALID_PTR(pOverride->pVBoxNetFlt) 865 850 && (pSwitchPort = pOverride->pVBoxNetFlt->pSwitchPort) != NULL 866 851 && VALID_PTR(pSwitchPort) 867 ) 868 { 869 INTNETSWDECISION enmDecision; 870 uint32_t cbHdrs = skb_headlen(pSkb); 871 cbHdrs = RT_MAX(cbHdrs, sizeof(abHdrBuf)); 852 && cbHdrs >= 6) 853 { 854 INTNETSWDECISION enmDecision; 872 855 873 856 /** @todo consider reference counting, etc. */
Note:
See TracChangeset
for help on using the changeset viewer.