儲存庫 vbox 的更動 12209
- 時間撮記:
- 2008-9-8 上午09:40:34 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r12123 r12209 67 67 /** The module name. */ 68 68 #define DEVICE_NAME "vboxflt" 69 /** The module descriptions as seen in 'modinfo'. */ 69 70 #define DEVICE_DESC_DRV "VirtualBox NetFilter Driver" 70 71 #define DEVICE_DESC_MOD "VirtualBox NetFilter Module" 71 72 72 73 73 /** @todo Remove the below hackery once done! */ … … 370 370 { 371 371 /* 372 * Initialize the globals and connect to the support driver. 373 * 374 * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) 375 * for establishing the connect to the support driver. 372 * Initialize Solaris specific globals here. 376 373 */ 377 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals)); 378 rc = vboxNetFltInitGlobals(&g_VBoxNetFltSolarisGlobals); 374 g_VBoxNetFltSolarisState.pOpenedStreams = NULL; 375 g_VBoxNetFltSolarisState.pCurInstance = NULL; 376 rc = RTSemFastMutexCreate(&g_VBoxNetFltSolarisMtx); 379 377 if (RT_SUCCESS(rc)) 380 return mod_install(&g_VBoxNetFltSolarisModLinkage); 378 { 379 /* 380 * Initialize the globals and connect to the support driver. 381 * 382 * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) 383 * for establishing the connect to the support driver. 384 */ 385 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals)); 386 rc = vboxNetFltInitGlobals(&g_VBoxNetFltSolarisGlobals); 387 if (RT_SUCCESS(rc)) 388 { 389 rc = mod_install(&g_VBoxNetFltSolarisModLinkage); 390 if (!rc) 391 return rc; 392 393 LogRel((DEVICE_NAME ":mod_install failed. rc=%d\n", rc)); 394 vboxNetFltTryDeleteGlobals(&g_VBoxNetFltSolarisGlobals); 395 } 396 else 397 LogRel((DEVICE_NAME ":failed to initialize globals.\n")); 398 399 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx); 400 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 401 } 381 402 else 382 LogRel((DEVICE_NAME ":failed to initialize globals.\n"));403 LogRel((DEVICE_NAME ":failed to create mutex.\n")); 383 404 384 405 RTR0Term(); … … 407 428 } 408 429 430 if (g_VBoxNetFltSolarisMtx != NIL_RTSEMFASTMUTEX) 431 { 432 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx); 433 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 434 } 435 409 436 RTR0Term(); 410 437 … … 440 467 case DDI_ATTACH: 441 468 { 442 int rc = RTSemFastMutexCreate(&g_VBoxNetFltSolarisMtx); 443 if (RT_SUCCESS(rc)) 469 int instance = ddi_get_instance(pDip); 470 int rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, CLONE_DEV); 471 if (rc == DDI_SUCCESS) 444 472 { 445 int instance = ddi_get_instance(pDip); 446 int rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, CLONE_DEV); 447 if (rc == DDI_SUCCESS) 448 { 449 g_VBoxNetFltSolarisState.pDip = pDip; 450 g_VBoxNetFltSolarisState.pOpenedStreams = NULL; 451 g_VBoxNetFltSolarisState.pCurInstance = NULL; 452 ddi_report_dev(pDip); 453 return DDI_SUCCESS; 454 } 455 else 456 LogRel((DEVICE_NAME ":VBoxNetFltSolarisAttach failed to create minor node. rc%d\n", rc)); 457 458 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx); 459 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 473 g_VBoxNetFltSolarisState.pDip = pDip; 474 ddi_report_dev(pDip); 475 return DDI_SUCCESS; 460 476 } 461 477 else 462 LogRel((DEVICE_NAME ":VBoxNetFltSolarisAttach failed to create m utex.rc=%d\n", rc));478 LogRel((DEVICE_NAME ":VBoxNetFltSolarisAttach failed to create minor node. rc%d\n", rc)); 463 479 return DDI_FAILURE; 464 480 } … … 492 508 int instance = ddi_get_instance(pDip); 493 509 ddi_remove_minor_node(pDip, NULL); 494 495 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx);496 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX;497 510 return DDI_SUCCESS; 498 511 } … … 652 665 */ 653 666 if (pStream->Type == kIpStream) 654 vboxNetFltSolarisPhysAddrReq(p Queue);667 vboxNetFltSolarisPhysAddrReq(pStream->pReadQueue); 655 668 656 669 /* … … 1487 1500 /** 1488 1501 * Dynamically attaches this streams module on to the host stack. 1489 * As a side-effect, this streams also gets opened during the actual1490 * insertion phase.1502 * As a side-effect, this streams also gets opened/closed during 1503 * the actual injection/ejection phase. 1491 1504 * 1492 1505 * @returns VBox status code. 1493 * @param pThis 1494 * @param f Rediscovery Rediscovery attempt, currently unused on solaris.1506 * @param pThis The instance. 1507 * @param fAttach Is this an attach or detach. 1495 1508 */ 1496 1509 static int vboxNetFltSolarisModSetup(PVBOXNETFLTINS pThis, bool fAttach) 1497 1510 { 1498 1511 LogFlow(("vboxNetFltSolarisModSetup: pThis=%p (%s) fAttach=%s\n", pThis, pThis->szName, fAttach ? "true" : "false")); 1499 1500 Assert(!g_VBoxNetFltSolarisState.pCurInstance);1501 Assert(g_VBoxNetFltSolarisState.CurType == kUndefined);1502 1512 1503 1513 /* … … 1619 1629 /* 1620 1630 * Set global data which will be grabbed by ModOpen. 1631 * There is a known (though very unlikely) race here because 1632 * of the inability to pass user data while inserting. 1621 1633 */ 1622 1634 g_VBoxNetFltSolarisState.pCurInstance = pThis; … … 2331 2343 2332 2344 2345 /** 2346 * Simple packet dump, used for internal debugging. 2347 * 2348 * @param pMsg Pointer to the message to analyze and dump. 2349 */ 2333 2350 static void vboxNetFltSolarisAnalyzeMBlk(mblk_t *pMsg) 2334 2351 { … … 2339 2356 { 2340 2357 PRTNETIPV4 pIpHdr = (PRTNETIPV4)(pEthHdr + 1); 2341 size_t cbLen = MBLK SIZE(pMsg) - sizeof(*pEthHdr);2358 size_t cbLen = MBLKL(pMsg) - sizeof(*pEthHdr); 2342 2359 if (RTNetIPv4IsHdrValid(pIpHdr, cbLen, cbLen)) 2343 2360 { … … 2397 2414 bool vboxNetFltPortOsIsHostMac(PVBOXNETFLTINS pThis, PCRTMAC pMac) 2398 2415 { 2399 /* ASSUMES that the MAC address never changes. */ 2416 /* 2417 * MAC address change acknowledgements are intercepted on the read side 2418 * hence theoritically we are always update to date with any changes. 2419 */ 2400 2420 return pThis->u.s.Mac.au16[0] == pMac->au16[0] 2401 2421 && pThis->u.s.Mac.au16[1] == pMac->au16[1] … … 2409 2429 2410 2430 /* 2411 * Enable promiscuous mode.2431 * Enable/disable promiscuous mode. 2412 2432 */ 2413 2433 vboxnetflt_stream_t *pStream = pThis->u.s.pvStream; … … 2461 2481 bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis) 2462 2482 { 2463 return true; 2483 /* 2484 * We don't support interface rediscovery on Solaris hosts because the 2485 * filter is very tightly bound to the stream. 2486 */ 2487 return false; 2464 2488 } 2465 2489
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器