VirtualBox

Changeset 22384 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 21, 2009 12:50:14 PM (15 years ago)
Author:
vboxsync
Message:

Main: repair RT_OS_LINUX=1 VBOX_WITH_NETFLT=

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r22375 r22384  
    60416041 *  @note The caller must lock this object for writing.
    60426042 */
    6043 HRESULT Console::attachToBridgedInterface(INetworkAdapter *networkAdapter)
    6044 {
    6045 #if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT)
    6046     /*
    6047      * Nothing to do here.
    6048      *
    6049      * Note, the reason for this method in the first place a memory / fork
    6050      * bug on linux. All this code belongs in DrvTAP and similar places.
    6051      */
    6052     NOREF(networkAdapter);
    6053     return S_OK;
    6054 
    6055 #else /* RT_OS_LINUX && !VBOX_WITH_NETFLT */
    6056 
     6043#if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)
     6044HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
     6045{
    60576046    LogFlowThisFunc(("\n"));
    60586047    /* sanity check */
     
    61196108            if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1)
    61206109            {
    6121                 Log(("attachToBridgedInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
     6110                Log(("attachToTapInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
    61226111                /*
    61236112                 * Here is the right place to communicate the TAP file descriptor and
     
    61616150    LogFlowThisFunc(("rc=%d\n", rc));
    61626151    return rc;
    6163 #endif /* RT_OS_LINUX */
    6164 }
     6152}
     6153
    61656154
    61666155/**
     
    61726161 *  @note The caller must lock this object for writing.
    61736162 */
    6174 HRESULT Console::detachFromBridgedInterface(INetworkAdapter *networkAdapter)
    6175 {
    6176 #if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT)
    6177     /*
    6178      * Nothing to do here.
    6179      */
    6180     NOREF(networkAdapter);
    6181     return S_OK;
    6182 
    6183 #else /* RT_OS_LINUX */
    6184 
     6163HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter)
     6164{
    61856165    /* sanity check */
    61866166    LogFlowThisFunc(("\n"));
     
    62316211    LogFlowThisFunc(("returning %d\n", rc));
    62326212    return rc;
    6233 #endif /* RT_OS_LINUX */
    6234 }
     6213}
     6214#endif /* RT_OS_LINUX && !VBOX_WITH_NETFLT */
    62356215
    62366216
     
    62666246        if (attachment == NetworkAttachmentType_Bridged)
    62676247        {
    6268             HRESULT rc2 = detachFromBridgedInterface(networkAdapter);
     6248#if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)
     6249            HRESULT rc2 = detachFromTapInterface(networkAdapter);
    62696250            if (FAILED(rc2) && SUCCEEDED(rc))
    62706251                rc = rc2;
     6252#endif
    62716253        }
    62726254    }
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r22375 r22384  
    22082208        case NetworkAttachmentType_Bridged:
    22092209        {
    2210 #if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
     2210#if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)
     2211            hrc = pThis->attachToTapInterface(aNetworkAdapter);
     2212            if (FAILED(hrc))
     2213            {
     2214                switch (hrc)
     2215                {
     2216                    case VERR_ACCESS_DENIED:
     2217                        return VMSetError(pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS,  N_(
     2218                                         "Failed to open '/dev/net/tun' for read/write access. Please check the "
     2219                                         "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or "
     2220                                         "change the group of that node and make yourself a member of that group. Make "
     2221                                         "sure that these changes are permanent, especially if you are "
     2222                                         "using udev"));
     2223                    default:
     2224                        AssertMsgFailed(("Could not attach to host interface! Bad!\n"));
     2225                        return VMSetError(pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(
     2226                                         "Failed to initialize Host Interface Networking"));
     2227                }
     2228            }
     2229
    22112230            Assert ((int)pThis->maTapFD[uInstance] >= 0);
    22122231            if ((int)pThis->maTapFD[uInstance] >= 0)
     
    22242243                rc = CFGMR3InsertInteger(pCfg, "FileHandle", pThis->maTapFD[uInstance]);    RC_CHECK();
    22252244            }
     2245
    22262246#elif defined(VBOX_WITH_NETFLT)
    22272247            /*
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r22375 r22384  
    407407    HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
    408408                                    Bstr &tapSetupApplication);
    409     HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter);
    410     HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter);
     409#if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)
     410    HRESULT attachToTapInterface(INetworkAdapter *networkAdapter);
     411    HRESULT detachFromTapInterface(INetworkAdapter *networkAdapter);
     412#endif
    411413    HRESULT powerDownHostInterfaces();
    412414
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette