Changeset 22384 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 21, 2009 12:50:14 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r22375 r22384 6041 6041 * @note The caller must lock this object for writing. 6042 6042 */ 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) 6044 HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter) 6045 { 6057 6046 LogFlowThisFunc(("\n")); 6058 6047 /* sanity check */ … … 6119 6108 if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1) 6120 6109 { 6121 Log(("attachTo BridgedInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));6110 Log(("attachToTapInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw())); 6122 6111 /* 6123 6112 * Here is the right place to communicate the TAP file descriptor and … … 6161 6150 LogFlowThisFunc(("rc=%d\n", rc)); 6162 6151 return rc; 6163 #endif /* RT_OS_LINUX */ 6164 } 6152 } 6153 6165 6154 6166 6155 /** … … 6172 6161 * @note The caller must lock this object for writing. 6173 6162 */ 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 6163 HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) 6164 { 6185 6165 /* sanity check */ 6186 6166 LogFlowThisFunc(("\n")); … … 6231 6211 LogFlowThisFunc(("returning %d\n", rc)); 6232 6212 return rc; 6233 #endif /* RT_OS_LINUX */ 6234 } 6213 } 6214 #endif /* RT_OS_LINUX && !VBOX_WITH_NETFLT */ 6235 6215 6236 6216 … … 6266 6246 if (attachment == NetworkAttachmentType_Bridged) 6267 6247 { 6268 HRESULT rc2 = detachFromBridgedInterface(networkAdapter); 6248 #if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT) 6249 HRESULT rc2 = detachFromTapInterface(networkAdapter); 6269 6250 if (FAILED(rc2) && SUCCEEDED(rc)) 6270 6251 rc = rc2; 6252 #endif 6271 6253 } 6272 6254 } -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r22375 r22384 2208 2208 case NetworkAttachmentType_Bridged: 2209 2209 { 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 2211 2230 Assert ((int)pThis->maTapFD[uInstance] >= 0); 2212 2231 if ((int)pThis->maTapFD[uInstance] >= 0) … … 2224 2243 rc = CFGMR3InsertInteger(pCfg, "FileHandle", pThis->maTapFD[uInstance]); RC_CHECK(); 2225 2244 } 2245 2226 2246 #elif defined(VBOX_WITH_NETFLT) 2227 2247 /* -
trunk/src/VBox/Main/include/ConsoleImpl.h
r22375 r22384 407 407 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice, 408 408 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 411 413 HRESULT powerDownHostInterfaces(); 412 414
Note:
See TracChangeset
for help on using the changeset viewer.