Changeset 44824 in vbox for trunk/src/VBox
- Timestamp:
- Feb 25, 2013 6:30:42 PM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Makefile.kmk
r44807 r44824 1063 1063 # 1064 1064 ServicesR0_TEMPLATE = VBoxR0 1065 ServicesR0_DEFS = IN_INTNET_R0 IN_RT_R0 $(if $(VBOX_WITH_PCI_PASSTHROUGH),IN_PCIRAW_R0,) 1065 ServicesR0_DEFS = IN_INTNET_R0 IN_RT_R0 $(if $(VBOX_WITH_PCI_PASSTHROUGH),IN_PCIRAW_R0,) \ 1066 $(if $(VBOX_WITH_NAT_SERVICE),VBOX_WITH_NAT_SERVICE,) 1066 1067 ServicesR0_SOURCES = \ 1067 1068 Network/SrvIntNetR0.cpp \ -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r44528 r44824 4997 4997 case kIntNetTrunkType_None: 4998 4998 case kIntNetTrunkType_WhateverNone: 4999 #ifdef VBOX_WITH_NAT_SERVICE 5000 /* 5001 * Well, here we don't want load anything special, 5002 * just communicate between processes via internal network. 5003 */ 5004 case kIntNetTrunkType_SrvNat: 5005 #endif 4999 5006 return VINF_SUCCESS; 5000 5007 … … 5016 5023 #endif /* VBOXNETADP_DO_NOT_USE_NETFLT */ 5017 5024 break; 5018 case kIntNetTrunkType_SrvNat: 5019 pszName = "VBoxSrvNat"; 5025 #ifndef VBOX_WITH_NAT_SERVICE 5026 case kIntNetTrunkType_SrvNat: 5027 pszName = "VBoxSrvNat"; 5020 5028 break; 5029 #endif 5021 5030 } 5022 5031 … … 5477 5486 */ 5478 5487 int rc; 5479 if ( enmTrunkType == kIntNetTrunkType_WhateverNone 5480 || ( pCur->enmTrunkType == enmTrunkType 5481 && !strcmp(pCur->szTrunk, pszTrunk))) 5488 if ( enmTrunkType == kIntNetTrunkType_WhateverNone 5489 #ifdef VBOX_WITH_NAT_SERVICE 5490 || enmTrunkType == kIntNetTrunkType_SrvNat /* @todo: what does it mean */ 5491 #endif 5492 || ( pCur->enmTrunkType == enmTrunkType 5493 && !strcmp(pCur->szTrunk, pszTrunk))) 5482 5494 { 5483 5495 rc = intnetR0CheckOpenNetworkFlags(pCur, fFlags); … … 5575 5587 | INTNET_OPEN_FLAGS_TRUNK_WIRE_CHASTE_MODE; 5576 5588 if ( enmTrunkType == kIntNetTrunkType_WhateverNone 5589 #ifdef VBOX_WITH_NAT_SERVICE 5590 || enmTrunkType == kIntNetTrunkType_SrvNat /* simialar security */ 5591 #endif 5577 5592 || enmTrunkType == kIntNetTrunkType_None) 5578 5593 fDefFlags |= INTNET_OPEN_FLAGS_ACCESS_RESTRICTED; … … 5740 5755 case kIntNetTrunkType_None: 5741 5756 case kIntNetTrunkType_WhateverNone: 5757 #ifdef VBOX_WITH_NAT_SERVICE 5758 case kIntNetTrunkType_SrvNat: 5759 #endif 5742 5760 if (*pszTrunk) 5743 5761 return VERR_INVALID_PARAMETER; -
trunk/src/VBox/Main/Makefile.kmk
r44528 r44824 316 316 src-server/MediumImpl.cpp \ 317 317 src-server/MediumLock.cpp \ 318 $(if $(VBOX_WITH_NAT_SERVICE),src-server/NATServerImpl.cpp,) \319 318 src-server/NATEngineImpl.cpp \ 320 319 src-server/NetworkAdapterImpl.cpp \ -
trunk/src/VBox/NetworkServices/NAT/Makefile.kmk
r41477 r44824 17 17 SUB_DEPTH = ../../../.. 18 18 include $(KBUILD_PATH)/subheader.kmk 19 20 ifdef VBOX_WITH_HARDENING 21 PROGRAMS += VBoxNetNATHardened 22 DLLS += VBoxNetNAT 23 else 24 PROGRAMS += VBoxNetNAT 25 endif 19 # 20 # Disable Slirp based service. 21 #ifdef VBOX_WITH_HARDENING 22 # PROGRAMS += VBoxNetNATHardened 23 # DLLS += VBoxNetNAT 24 #else 25 # PROGRAMS += VBoxNetNAT 26 #endif 26 27 VBoxNetNAT_TEMPLATE = 27 28 VBoxNetNAT_TEMPLATE := VBOXR3$(if-expr defined(VBOX_WITH_HARDENING),,EXE) … … 35 36 #endef 36 37 37 define def_vbox_ slirp_service_sources38 VBoxNetNAT_SOURCES += $1/$(file)38 define def_vbox_nat_network_service_sources 39 $(1)_SOURCES += $2/$3 39 40 endef 41 42 define def_vbox_nat_network_service_incs 43 $(1)_INCS += $2/$3 44 endef 45 40 46 VBOX_NOT_IN_NATSERVICE = Network/DrvNAT.cpp 41 $(foreach file,$(filter-out $(VBOX_NOT_IN_NATSERVICE), $(VBOX_SLIRP_SOURCES)),$(eval $(call def_vbox_ slirp_service_sources, ../../Devices)))42 $(foreach file,$(VBOX_SLIRP_ALIAS_SOURCES),$(eval $(call def_vbox_ slirp_service_sources, ../../Devices)))43 $(foreach file,$(VBOX_SLIRP_BSD_SOURCES),$(eval $(call def_vbox_ slirp_service_sources, ../../Devices)))47 $(foreach file,$(filter-out $(VBOX_NOT_IN_NATSERVICE), $(VBOX_SLIRP_SOURCES)),$(eval $(call def_vbox_nat_network_service_sources,VBoxNetNAT,../../Devices,$(file)))) 48 $(foreach file,$(VBOX_SLIRP_ALIAS_SOURCES),$(eval $(call def_vbox_nat_network_service_sources, VBoxNetNAT,../../Devices,$(file)))) 49 $(foreach file,$(VBOX_SLIRP_BSD_SOURCES),$(eval $(call def_vbox_nat_network_service_sources, VBoxNetNAT,../../Devices,$(file)))) 44 50 45 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_BSD_SOURCES)),$(eval $(call def_vbox_slirp_cflags, 46 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_BSD_SOURCES)),$(eval $(call def_vbox_slirp_bsd_cflags, 51 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_BSD_SOURCES)),$(eval $(call def_vbox_slirp_cflags,../../Devices/Network))) 52 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_BSD_SOURCES)),$(eval $(call def_vbox_slirp_bsd_cflags,../../Devices/Network))) 47 53 $(foreach file,$(addprefix ../../Devices/, $(filter-out $(VBOX_WITH_NAT_SERVICE), $(VBOX_SLIRP_SOURCES))),$(eval $(call def_vbox_slirp_service_cflags, ../../Devices/Network))) 48 $(foreach file,$(addprefix ../../Devices/, $(filter-out $(VBOX_WITH_NAT_SERVICE), $(VBOX_SLIRP_SOURCES))),$(eval $(call def_vbox_slirp_cflags, ../../Devices/Network))) 54 $(foreach file,$(addprefix ../../Devices/, $(filter-out $(VBOX_WITH_NAT_SERVICE), $(VBOX_SLIRP_SOURCES))),$(eval $(call def_vbox_slirp_cflags,../../Devices/Network))) 55 49 56 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_ALIAS_SOURCES)),$(eval $(call def_vbox_slirp_cflags, ../../Devices/Network))) 57 58 50 59 $(foreach file,$(addprefix ../../Devices/, $(VBOX_SLIRP_ALIAS_SOURCES)),$(eval $(call def_vbox_slirp_alias_cflags, ../../Devices/Network))) 51 60 … … 56 65 VBoxNetNAT_LDFLAGS.win = /SUBSYSTEM:windows 57 66 67 ifdef VBOX_WITH_LWIP_NAT 68 69 PROGRAMS += VBoxNetLwipNAT 70 VBoxNetLwipNAT_TEMPLATE = 71 VBoxNetLwipNAT_TEMPLATE := VBOXR3$(if-expr defined(VBOX_WITH_HARDENING),,EXE) 72 #VBoxNetLwipNAT_INCS += ${LWIP_INCS} 73 VBoxNetLwipNAT_INCS += ../../Devices/Network \ 74 ../../Devices/Network/lwip-new/vbox # testproxy.h 75 VBoxNetLwipNAT_DEFS += ${LWIP_DEFS} 76 VBoxNetLwipNAT_SOURCES += VBoxNetLwipNAT.cpp \ 77 ../NetLib/VBoxNetBaseService.cpp \ 78 ../../Devices/Network/VBoxLwipCore.cpp 79 VBoxNetLwipNAT_LIBS = \ 80 $(LIB_RUNTIME) 81 VBoxNetLwipNAT_LDFLAGS.win = /SUBSYSTEM:windows 82 83 # 84 # Note: not spaces please in "Devices,$(" 85 # 86 $(foreach file,$(LWIP_SOURCES),$(eval $(call def_vbox_nat_network_service_sources, VBoxNetLwipNAT, ../../Devices,$(file)))) 87 88 $(foreach incs,$(LWIP_INCS),$(eval $(call def_vbox_nat_network_service_incs, VBoxNetLwipNAT, ../../Devices,$(incs)))) 89 90 endif 91 58 92 include $(FILE_KBUILD_SUB_FOOTER) -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
r39685 r44824 37 37 #include <VBox/sup.h> 38 38 #include <VBox/intnet.h> 39 #include <VBox/intnetinline.h> 39 40 #include <VBox/vmm/vmm.h> 40 41 #include <VBox/version.h> … … 69 70 VBoxNetBaseService::VBoxNetBaseService() 70 71 { 72 int rc = RTCritSectInit(&m_csThis); 73 AssertRC(rc); 71 74 } 72 75 VBoxNetBaseService::~VBoxNetBaseService() … … 92 95 m_pSession = NIL_RTR0PTR; 93 96 } 97 RTCritSectDelete(&m_csThis); 94 98 } 95 99 … … 97 101 { 98 102 /* numbers from DrvIntNet */ 99 m_cbSendBuf = 36* _1K;100 m_cbRecvBuf = 2 18* _1K;103 m_cbSendBuf = 128 * _1K; 104 m_cbRecvBuf = 256 * _1K; 101 105 m_hIf = INTNET_HANDLE_INVALID; 102 106 m_pIfBuf = NULL; … … 124 128 int rc = RTGetOptInit(&State, argc, argv, paOptionArray, m_vecOptionDefs.size(), 0, 0 /*fFlags*/); 125 129 AssertRCReturn(rc, 49); 130 #if 0 131 /* default initialization */ 132 m_enmTrunkType = kIntNetTrunkType_WhateverNone; 133 #endif 126 134 Log2(("BaseService: parseArgs enter\n")); 127 135 … … 309 317 } 310 318 319 int VBoxNetBaseService::waitForIntNetEvent(int cMillis) 320 { 321 int rc = VINF_SUCCESS; 322 INTNETIFWAITREQ WaitReq; 323 LogFlowFunc(("ENTER:cMillis: %d\n", cMillis)); 324 WaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 325 WaitReq.Hdr.cbReq = sizeof(WaitReq); 326 WaitReq.pSession = m_pSession; 327 WaitReq.hIf = m_hIf; 328 WaitReq.cMillies = cMillis; 329 330 rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_INTNET_IF_WAIT, 0, &WaitReq.Hdr); 331 LogFlowFuncLeaveRC(rc); 332 return rc; 333 } 334 335 /* S/G API */ 336 int VBoxNetBaseService::sendBufferOnWire(PCINTNETSEG pcSg, int cSg, size_t cbFrame) 337 { 338 int rc = VINF_SUCCESS; 339 PINTNETHDR pHdr = NULL; 340 uint8_t *pu8Frame = NULL; 341 int offFrame = 0; 342 int idxSg = 0; 343 /* Allocate frame */ 344 rc = IntNetRingAllocateFrame(&m_pIfBuf->Send, cbFrame, &pHdr, (void **)&pu8Frame); 345 AssertRCReturn(rc, rc); 346 /* Now we fill pvFrame with S/G above */ 347 for (idxSg = 0; idxSg < cSg; ++idxSg) 348 { 349 memcpy(&pu8Frame[offFrame], pcSg[idxSg].pv, pcSg[idxSg].cb); 350 offFrame+=pcSg[idxSg].cb; 351 } 352 /* Commit */ 353 IntNetRingCommitFrame(&m_pIfBuf->Send, pHdr); 354 355 LogFlowFuncLeaveRC(rc); 356 return rc; 357 } 358 /** 359 * forcible ask for send packet on the "wire" 360 */ 361 void VBoxNetBaseService::flushWire() 362 { 363 int rc = VINF_SUCCESS; 364 INTNETIFSENDREQ SendReq; 365 SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 366 SendReq.Hdr.cbReq = sizeof(SendReq); 367 SendReq.pSession = m_pSession; 368 SendReq.hIf = m_hIf; 369 rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_INTNET_IF_SEND, 0, &SendReq.Hdr); 370 AssertRCReturnVoid(rc); 371 LogFlowFuncLeave(); 372 373 } 374 311 375 /** 312 376 * Print debug message depending on the m_cVerbosity level. -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
r44529 r44824 18 18 #ifndef ___VBoxNetBaseService_h___ 19 19 #define ___VBoxNetBaseService_h___ 20 #include <iprt/critsect.h> 20 21 class VBoxNetBaseService 21 22 { … … 26 27 int tryGoOnline(void); 27 28 void shutdown(void); 29 int syncEnter() { return RTCritSectEnter(&this->m_csThis);} 30 int syncLeave() { return RTCritSectLeave(&this->m_csThis);} 31 int waitForIntNetEvent(int cMillis); 32 int sendBufferOnWire(PCINTNETSEG pSg, int cSg, size_t cbBuffer); 33 void flushWire(); 28 34 virtual void usage(void) = 0; 29 35 virtual void run(void) = 0; … … 42 48 RTMAC m_MacAddress; 43 49 RTNETADDRIPV4 m_Ipv4Address; 50 /* cs for syncing */ 51 RTCRITSECT m_csThis; 44 52 /** @} */ 45 53 /** @name The network interface
Note:
See TracChangeset
for help on using the changeset viewer.