Changeset 10901 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 26, 2008 2:43:29 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r10842 r10901 5328 5328 HRESULT Console::attachToHostInterface(INetworkAdapter *networkAdapter) 5329 5329 { 5330 #if !defined(RT_OS_LINUX) 5331 /* 5332 * Nothing to do here. 5333 * 5334 * Note, the reason for this method in the first place a memory / fork 5335 * bug on linux. All this code belongs in DrvTAP and similar places. 5336 */ 5337 NOREF(networkAdapter); 5338 return S_OK; 5339 5340 #else /* RT_OS_LINUX */ 5330 5341 LogFlowThisFunc(("\n")); 5331 5342 /* sanity check */ 5332 5343 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5333 5344 5334 # ifdef DEBUG5345 # ifdef VBOX_STRICT 5335 5346 /* paranoia */ 5336 5347 NetworkAttachmentType_T attachment; 5337 5348 networkAdapter->COMGETTER(AttachmentType)(&attachment); 5338 5349 Assert(attachment == NetworkAttachmentType_HostInterface); 5339 # endif /* DEBUG*/5350 # endif /* VBOX_STRICT */ 5340 5351 5341 5352 HRESULT rc = S_OK; 5342 5353 5343 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING5344 5354 ULONG slot = 0; 5345 5355 rc = networkAdapter->COMGETTER(Slot)(&slot); … … 5367 5377 } 5368 5378 else 5369 #endif /* VBOX_WITH_UNIXY_TAP_NETWORKING */5370 5379 { 5371 5380 /* 5372 5381 * Allocate a host interface device 5373 5382 */ 5374 #ifdef RT_OS_WINDOWS5375 /* nothing to do */5376 int rcVBox = VINF_SUCCESS;5377 #elif defined(RT_OS_LINUX)5378 5383 int rcVBox = RTFileOpen(&maTapFD[slot], "/dev/net/tun", 5379 5384 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT); … … 5488 5493 } 5489 5494 } 5490 #elif defined(RT_OS_DARWIN)5491 /** @todo Implement tap networking for Darwin. */5492 int rcVBox = VERR_NOT_IMPLEMENTED;5493 #elif defined(RT_OS_FREEBSD)5494 /** @todo Implement tap networking for FreeBSD. */5495 int rcVBox = VERR_NOT_IMPLEMENTED;5496 #elif defined(RT_OS_OS2)5497 /** @todo Implement tap networking for OS/2. */5498 int rcVBox = VERR_NOT_IMPLEMENTED;5499 #elif defined(RT_OS_SOLARIS)5500 /* nothing to do */5501 int rcVBox = VINF_SUCCESS;5502 #elif defined(VBOX_WITH_UNIXY_TAP_NETWORKING)5503 # error "PORTME: Implement OS specific TAP interface open/creation."5504 #else5505 # error "Unknown host OS"5506 #endif5507 5495 /* in case of failure, cleanup. */ 5508 5496 if (VBOX_FAILURE(rcVBox) && SUCCEEDED(rc)) … … 5514 5502 LogFlowThisFunc(("rc=%d\n", rc)); 5515 5503 return rc; 5504 #endif /* RT_OS_LINUX */ 5516 5505 } 5517 5506 … … 5526 5515 HRESULT Console::detachFromHostInterface(INetworkAdapter *networkAdapter) 5527 5516 { 5517 #if !defined(RT_OS_LINUX) && !defined(RT_OS_SOLARIS) 5518 /* 5519 * Nothing to do here. 5520 */ 5521 NOREF(networkAdapter); 5522 return S_OK; 5523 5524 #else /* RT_LINUX || RT_OS_SOLARIS */ 5525 5528 5526 /* sanity check */ 5529 5527 LogFlowThisFunc(("\n")); … … 5531 5529 5532 5530 HRESULT rc = S_OK; 5533 # ifdef DEBUG5531 # ifdef VBOX_STRICT 5534 5532 /* paranoia */ 5535 5533 NetworkAttachmentType_T attachment; 5536 5534 networkAdapter->COMGETTER(AttachmentType)(&attachment); 5537 5535 Assert(attachment == NetworkAttachmentType_HostInterface); 5538 # endif /* DEBUG*/5539 5540 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING 5536 # endif /* VBOX_STRICT */ 5537 5538 /** @todo # ifdef VBOX_WITH_UNIXY_TAP_NETWORKING: why wasn't this !defined(RT_OS_SOLARIS)? */ 5541 5539 5542 5540 ULONG slot = 0; … … 5576 5574 RTStrPrintf(szCommand, sizeof(szCommand), "%s %d %s", tapTermAppUtf8.raw(), 5577 5575 isStatic ? maTapFD[slot] : 0, maTAPDeviceName[slot].raw()); 5576 /** @todo check for overflow or use RTStrAPrintf! */ 5578 5577 5579 5578 /* … … 5610 5609 maTAPDeviceName[slot] = ""; 5611 5610 } 5612 #endif5613 5611 LogFlowThisFunc(("returning %d\n", rc)); 5614 5612 return rc; 5613 #endif /* RT_OS_LINUX || RT_OS_SOLARIS */ 5615 5614 } 5616 5615
Note:
See TracChangeset
for help on using the changeset viewer.