- Timestamp:
- Sep 21, 2008 3:20:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r12619 r12620 316 316 bool fRawMode; /* whether raw mode request was successful */ 317 317 uint32_t ModeReqId; /* track MIOCTLs for swallowing our fake request acknowledgements */ 318 PVBOXNETFLTPACKETID p LoopbackHead;/* loopback packet identifier head */319 PVBOXNETFLTPACKETID p LoopbackTail;/* loopback packet identifier tail */318 PVBOXNETFLTPACKETID pHead; /* loopback packet identifier head */ 319 PVBOXNETFLTPACKETID pTail; /* loopback packet identifier tail */ 320 320 size_t cLoopback; /* loopback queue size list */ 321 321 } vboxnetflt_promisc_stream_t; … … 1774 1774 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 1775 1775 1776 vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pThis->u.s.pvPromiscStream;1776 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream; 1777 1777 if (pPromiscStream) 1778 1778 { … … 1780 1780 * Free-up loopback buffers. 1781 1781 */ 1782 PVBOXNETFLTPACKETID pCur = pPromiscStream->p LoopbackHead;1782 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 1783 1783 while (pCur) 1784 1784 { … … 2402 2402 2403 2403 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr; 2404 PVBOXNETFLTPACKETID pHead = pPromiscStream->pLoopbackHead;2405 PVBOXNETFLTPACKETID pTail = pPromiscStream->pLoopbackTail;2406 2404 PVBOXNETFLTPACKETID pCur = NULL; 2407 2405 int rc = VINF_SUCCESS; … … 2410 2408 do 2411 2409 { 2412 if (!p Head)2410 if (!pPromiscStream->pHead) 2413 2411 { 2414 2412 pCur = RTMemAllocZ(sizeof(VBOXNETFLTPACKETID)); … … 2421 2419 vboxNetFltSolarisInitPacketId(pCur, pMsg); 2422 2420 2423 p Head = pCur;2424 p Tail =pHead;2421 pPromiscStream->pHead = pCur; 2422 pPromiscStream->pTail = pPromiscStream->pHead; 2425 2423 pPromiscStream->cLoopback++; 2424 2425 LogFlow((DEVICE_NAME ":vboxNetFltSolarisQueueLoopback initialized head. checksum=%u.\n", 2426 pPromiscStream->pHead->Checksum)); 2426 2427 break; 2427 2428 } 2428 2429 2429 if ( p Tail2430 && p Tail->cbPacket == 0)2430 if ( pPromiscStream->pTail 2431 && pPromiscStream->pTail->cbPacket == 0) 2431 2432 { 2432 pCur = p Tail;2433 pCur = pPromiscStream->pTail; 2433 2434 vboxNetFltSolarisInitPacketId(pCur, pMsg); 2435 2436 LogFlow((DEVICE_NAME ":vboxNetFltSolarisQueueLoopback re-used tail checksum=%u cLoopback=%d.\n", 2437 pCur->Checksum, pPromiscStream->cLoopback)); 2434 2438 break; 2435 2439 } … … 2442 2446 } 2443 2447 2444 p Tail->pNext = pCur;2448 pPromiscStream->pTail->pNext = pCur; 2445 2449 vboxNetFltSolarisInitPacketId(pCur, pMsg); 2446 2450 pPromiscStream->cLoopback++; 2451 2452 LogFlow((DEVICE_NAME ":vboxNetFltSolarisQueueLoopback added tail checksum=%u cLoopback=%d.\n", pCur->Checksum, 2453 pPromiscStream->cLoopback)); 2447 2454 break; 2448 2455 } while (0); … … 2453 2460 * Maximum loopback queue size reached. Re-use head as tail. 2454 2461 */ 2455 PVBOXNETFLTPACKETID pCur = p Head;2456 p Head =pHead->pNext;2457 p Tail->pNext = pCur;2458 p Tail = pCur;2462 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 2463 pPromiscStream->pHead = pPromiscStream->pHead->pNext; 2464 pPromiscStream->pTail->pNext = pCur; 2465 pPromiscStream->pTail = pCur; 2459 2466 2460 2467 pCur->pNext = NULL; 2461 2468 vboxNetFltSolarisInitPacketId(pCur, pMsg); 2469 LogFlow((DEVICE_NAME ":vboxNetFltSolarisQueueLoopback recycled head!! checksum=%u cLoopback=%d\n", pCur->Checksum, 2470 pPromiscStream->cLoopback)); 2462 2471 } 2463 2472 … … 2494 2503 return false; 2495 2504 2496 PVBOXNETFLTPACKETID pCur = pPromiscStream->pLoopbackHead; 2505 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 2506 bool fIsOur = false; 2497 2507 while (pCur) 2498 2508 { 2499 2509 if (pCur->cbPacket != cbMsg) 2500 return false; 2510 { 2511 pCur = pCur->pNext; 2512 continue; 2513 } 2501 2514 2502 2515 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr; … … 2514 2527 || pCur->DstMac.au8[5] != pEthHdr->DstMac.au8[5]) 2515 2528 { 2516 return false; 2529 pCur = pCur->pNext; 2530 continue; 2517 2531 } 2518 2532 2519 2533 uint16_t Checksum = RTCrc32(pMsg->b_rptr, cbMsg); 2520 2534 if (pCur->Checksum != Checksum) 2521 return false; 2535 { 2536 pCur = pCur->pNext; 2537 continue; 2538 } 2522 2539 2523 2540 /* 2524 * Yes, it really is our own packet. 2541 * Yes, it really is our own packet, mark it as handled 2542 * and return it's found. 2525 2543 */ 2544 pCur->cbPacket = 0; 2545 pPromiscStream->cLoopback--; 2546 LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p cLoopback=%d\n", pMsg, pPromiscStream->cLoopback)); 2526 2547 return true; 2527 2548 } 2528 2549 2550 NOREF(pThis); 2529 2551 return false; 2530 2552 } … … 2550 2572 * Don't loopback packets we transmit to the wire. 2551 2573 */ 2552 /** @todo -XXX- fix this with proper loopback handling. We must not be using unspecified flags. */2553 if ( pMsg->b_flag & MSGNOLOOP)2574 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream; 2575 if (vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg)) 2554 2576 { 2555 2577 LogFlow((DEVICE_NAME ":Avoiding packet loopback.\n")); … … 2933 2955 if (fDst & INTNETTRUNKDIR_WIRE) 2934 2956 { 2935 vboxnetflt_ stream_t *pPromiscStream = pThis->u.s.pvPromiscStream;2936 queue_t *pPromiscWriteQueue = WR(pPromiscStream-> pReadQueue);2957 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream; 2958 queue_t *pPromiscWriteQueue = WR(pPromiscStream->Stream.pReadQueue); 2937 2959 2938 2960 mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst); … … 2943 2965 } 2944 2966 2945 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_WIRE %u\n", DB_CKSUM16(pMsg))); 2946 2947 /* 2948 * Flag for avoiding loopback. (Should be fixed later) 2949 */ 2950 pMsg->b_flag |= MSGNOLOOP; 2967 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_WIRE\n")); 2968 2969 vboxNetFltSolarisQueueLoopback(pThis, pPromiscStream, pMsg); 2951 2970 putnext(pPromiscWriteQueue, pMsg); 2952 2971 }
Note:
See TracChangeset
for help on using the changeset viewer.