Changeset 25698 in vbox
- Timestamp:
- Jan 8, 2010 11:23:51 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r25589 r25698 6191 6191 6192 6192 #endif /* VBOX_WITH_USB */ 6193 #if ( defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT)6193 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) 6194 6194 6195 6195 /** -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r25672 r25698 87 87 # include <sys/socket.h> 88 88 # include <net/if.h> 89 # include <net80211/ieee80211_ioctl.h> 89 90 #endif 90 91 … … 2407 2408 2408 2409 # elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) 2410 # if defined(RT_OS_FREEBSD) 2411 /* 2412 * If we bridge to a tap interface open it the `old' direct way. 2413 * This works and performs better than bridging a physical 2414 * interface via the current FreeBSD vboxnetflt implementation. 2415 */ 2416 if (!strncmp(pszHifName, "tap", sizeof "tap" - 1)) { 2417 hrc = pThis->attachToTapInterface(aNetworkAdapter); 2418 if (FAILED(hrc)) 2419 { 2420 switch (hrc) 2421 { 2422 case VERR_ACCESS_DENIED: 2423 return VMSetError(pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 2424 "Failed to open '/dev/%s' for read/write access. Please check the " 2425 "permissions of that node, and that the net.link.tap.user_open " 2426 "sysctl is set. Either run 'chmod 0666 /dev/%s' or " 2427 "change the group of that node to vboxusers and make yourself " 2428 "a member of that group. Make sure that these changes are permanent."), pszHifName, pszHifName); 2429 default: 2430 AssertMsgFailed(("Could not attach to tap interface! Bad!\n")); 2431 return VMSetError(pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 2432 "Failed to initialize Host Interface Networking")); 2433 } 2434 } 2435 2436 Assert ((int)pThis->maTapFD[uInstance] >= 0); 2437 if ((int)pThis->maTapFD[uInstance] >= 0) 2438 { 2439 rc = CFGMR3InsertString(pLunL0, "Driver", "HostInterface"); RC_CHECK(); 2440 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK(); 2441 rc = CFGMR3InsertInteger(pCfg, "FileHandle", pThis->maTapFD[uInstance]); RC_CHECK(); 2442 } 2443 break; 2444 } 2445 # endif 2409 2446 /** @todo Check for malformed names. */ 2410 2447 const char *pszTrunk = pszHifName; … … 2461 2498 strncpy(WRq.ifr_name, pszHifName, IFNAMSIZ); 2462 2499 bool fSharedMacOnWire = ioctl(iSock, SIOCGIWNAME, &WRq) >= 0; 2500 close(iSock); 2501 if (fSharedMacOnWire) 2502 { 2503 rc = CFGMR3InsertInteger(pCfg, "SharedMacOnWire", true); 2504 RC_CHECK(); 2505 Log(("Set SharedMacOnWire\n")); 2506 } 2507 else 2508 Log(("Failed to get wireless name\n")); 2509 } 2510 else 2511 Log(("Failed to open wireless socket\n")); 2512 # elif defined(RT_OS_FREEBSD) 2513 int iSock = socket(AF_INET, SOCK_DGRAM, 0); 2514 if (iSock >= 0) 2515 { 2516 struct ieee80211req WReq; 2517 uint8_t abData[32]; 2518 2519 memset(&WReq, 0, sizeof(WReq)); 2520 strncpy(WReq.i_name, pszHifName, sizeof(WReq.i_name)); 2521 WReq.i_type = IEEE80211_IOC_SSID; 2522 WReq.i_val = -1; 2523 WReq.i_data = abData; 2524 WReq.i_len = sizeof(abData); 2525 2526 bool fSharedMacOnWire = ioctl(iSock, SIOCG80211, &WReq) >= 0; 2463 2527 close(iSock); 2464 2528 if (fSharedMacOnWire) -
trunk/src/VBox/Main/include/ConsoleImpl.h
r25150 r25698 411 411 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice, 412 412 Bstr &tapSetupApplication); 413 #if ( defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT)413 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) 414 414 HRESULT attachToTapInterface(INetworkAdapter *networkAdapter); 415 415 HRESULT detachFromTapInterface(INetworkAdapter *networkAdapter); … … 583 583 PPDMLED mapSharedFolderLed; 584 584 PPDMLED mapUSBLed[2]; 585 #if !defined(VBOX_WITH_NETFLT) && (defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD))585 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) 586 586 Utf8Str maTAPDeviceName[8]; 587 587 RTFILE maTapFD[8];
Note:
See TracChangeset
for help on using the changeset viewer.