Changeset 16509 in vbox
- Timestamp:
- Feb 4, 2009 11:26:01 AM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r16485 r16509 361 361 " [-floppy disabled|empty|<uuid>|\n" 362 362 " <filename>|host:<drive>]\n" 363 #ifdef RT_OS_LINUX 364 " [-nic<1-N> none|null|nat|hostif|intnet|hostonly]\n" 365 #else /* !RT_OS_LINUX */ 363 366 " [-nic<1-N> none|null|nat|hostif|intnet]\n" 367 #endif /* !RT_OS_LINUX */ 364 368 " [-nictype<1-N> Am79C970A|Am79C973" 365 369 #ifdef VBOX_WITH_E1000 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r16052 r16509 699 699 break; 700 700 } 701 case NetworkAttachmentType_HostOnly: 702 { 703 if (details == VMINFO_MACHINEREADABLE) 704 { 705 strAttachment = "hostonly"; 706 } 707 else 708 strAttachment = "Host-only Network"; 709 break; 710 } 701 711 default: 702 712 strAttachment = "unknown"; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r16491 r16509 1388 1388 CHECK_ERROR_RET(nic, AttachToInternalNetwork(), 1); 1389 1389 } 1390 #ifdef RT_OS_LINUX 1391 else if (strcmp(nics[n], "hostonly") == 0) 1392 { 1393 CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1); 1394 CHECK_ERROR_RET(nic, AttachToHostOnlyNetwork(), 1); 1395 } 1396 #endif /* RT_OS_LINUX */ 1390 1397 else 1391 1398 { -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r16469 r16509 3421 3421 mNetworkAttachmentTypes [KNetworkAttachmentType_Internal] = 3422 3422 tr ("Internal Network", "NetworkAttachmentType"); 3423 mNetworkAttachmentTypes [KNetworkAttachmentType_HostOnly] = 3424 tr ("Host-only Network", "NetworkAttachmentType"); 3423 3425 3424 3426 mClipboardTypes [KClipboardMode_Disabled] = -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
r16112 r16509 143 143 case KNetworkAttachmentType_Internal: 144 144 mAdapter.AttachToInternalNetwork(); 145 break; 146 case KNetworkAttachmentType_HostOnly: 147 mAdapter.AttachToHostOnlyNetwork(); 145 148 break; 146 149 default: … … 352 355 mCbNAType->setItemData (3, 353 356 mCbNAType->itemText(3), Qt::ToolTipRole); 357 #ifdef RT_OS_LINUX 358 mCbNAType->insertItem (4, 359 vboxGlobal().toString (KNetworkAttachmentType_HostOnly)); 360 mCbNAType->setItemData (4, 361 mCbNAType->itemText(4), Qt::ToolTipRole); 362 #endif /* RT_OS_LINUX */ 354 363 /* Set the old value */ 355 364 mCbNAType->setCurrentIndex (currentAttachment); -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r16183 r16509 158 158 159 159 160 /* 161 * TAP-related part 162 */ 163 164 #define VBOX_TAP_NAME "vboxnet%d" 165 166 struct net_device *g_pNetDev; 167 168 struct VBoxTapPriv 169 { 170 struct net_device_stats Stats; 171 }; 172 typedef struct VBoxTapPriv VBOXTAPPRIV; 173 typedef VBOXTAPPRIV *PVBOXTAPPRIV; 174 175 static int vboxTapOpen(struct net_device *pNetDev) 176 { 177 netif_start_queue(pNetDev); 178 printk("vboxTapOpen returns 0\n"); 179 return 0; 180 } 181 182 static int vboxTapStop(struct net_device *pNetDev) 183 { 184 netif_stop_queue(pNetDev); 185 return 0; 186 } 187 188 static int vboxTapXmit(struct sk_buff *pSkb, struct net_device *pNetDev) 189 { 190 PVBOXTAPPRIV pPriv = netdev_priv(pNetDev); 191 192 /* Update the stats. */ 193 pPriv->Stats.tx_packets++; 194 pPriv->Stats.tx_bytes += pSkb->len; 195 /* Update transmission time stamp. */ 196 pNetDev->trans_start = jiffies; 197 /* Nothing else to do, just free the sk_buff. */ 198 dev_kfree_skb(pSkb); 199 return 0; 200 } 201 202 struct net_device_stats *vboxTapGetStats(struct net_device *pNetDev) 203 { 204 PVBOXTAPPRIV pPriv = netdev_priv(pNetDev); 205 return &pPriv->Stats; 206 } 207 208 static int vboxTapValidateAddr(struct net_device *dev) 209 { 210 Log(("vboxTapValidateAddr: %02x:%02x:%02x:%02x:%02x:%02x\n", 211 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], 212 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5])); 213 return -EADDRNOTAVAIL; 214 } 215 216 static void vboxTapNetDevInit(struct net_device *pNetDev) 217 { 218 PVBOXTAPPRIV pPriv; 219 220 ether_setup(pNetDev); 221 /// @todo Use Sun vendor id 222 memcpy(pNetDev->dev_addr, "\0vbnet", ETH_ALEN); 223 Log(("vboxTapNetDevInit: pNetDev->dev_addr = %.6Rhxd\n", pNetDev->dev_addr)); 224 pNetDev->open = vboxTapOpen; 225 pNetDev->stop = vboxTapStop; 226 pNetDev->hard_start_xmit = vboxTapXmit; 227 pNetDev->get_stats = vboxTapGetStats; 228 //pNetDev->validate_addr = vboxTapValidateAddr; 229 /* pNetDev-> = vboxTap; 230 pNetDev-> = vboxTap; 231 pNetDev-> = vboxTap; 232 pNetDev-> = vboxTap; 233 pNetDev-> = vboxTap;*/ 234 235 pPriv = netdev_priv(pNetDev); 236 memset(pPriv, 0, sizeof(*pPriv)); 237 } 238 239 static int vboxTapRegisterNetDev(void) 240 { 241 int rc; 242 struct net_device *pNetDev; 243 244 /* No need for private data. */ 245 pNetDev = alloc_netdev(sizeof(VBOXTAPPRIV), VBOX_TAP_NAME, vboxTapNetDevInit); 246 if (pNetDev) 247 { 248 int err = register_netdev(pNetDev); 249 if (!err) 250 { 251 g_pNetDev = pNetDev; 252 return VINF_SUCCESS; 253 } 254 free_netdev(pNetDev); 255 rc = RTErrConvertFromErrno(err); 256 } 257 return rc; 258 } 259 260 static int vboxTapUnregisterNetDev(void) 261 { 262 unregister_netdev(g_pNetDev); 263 free_netdev(g_pNetDev); 264 g_pNetDev = NULL; 265 return VINF_SUCCESS; 266 } 267 160 268 /** 161 269 * Initialize module. … … 192 300 if (RT_SUCCESS(rc)) 193 301 { 194 LogRel(("VBoxNetFlt: Successfully started.\n")); 195 return 0; 196 } 197 198 LogRel(("VBoxNetFlt: failed to initialize device extension (rc=%d)\n", rc)); 302 rc = vboxTapRegisterNetDev(); 303 if (RT_SUCCESS(rc)) 304 { 305 LogRel(("VBoxNetFlt: Successfully started.\n")); 306 return 0; 307 } 308 else 309 LogRel(("VBoxNetFlt: failed to register device (rc=%d)\n", rc)); 310 } 311 else 312 LogRel(("VBoxNetFlt: failed to initialize device extension (rc=%d)\n", rc)); 199 313 RTR0Term(); 200 314 } … … 221 335 * Undo the work done during start (in reverse order). 222 336 */ 337 rc = vboxTapUnregisterNetDev(); 338 AssertRC(rc); 223 339 rc = vboxNetFltTryDeleteGlobals(&g_VBoxNetFltGlobals); 224 340 AssertRC(rc); NOREF(rc); -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r16246 r16509 1598 1598 } 1599 1599 1600 case NetworkAttachmentType_HostOnly: 1601 { 1602 if (fSniffer) 1603 { 1604 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL0); RC_CHECK(); 1605 } 1606 else 1607 { 1608 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 1609 } 1610 1611 rc = CFGMR3InsertString(pLunL0, "Driver", "IntNet"); RC_CHECK(); 1612 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK(); 1613 rc = CFGMR3InsertString(pCfg, "Trunk", "vboxnet0"); RC_CHECK(); 1614 rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_NetFlt); RC_CHECK(); 1615 rc = CFGMR3InsertString(pCfg, "Network", "HostInterfaceNetworking-vboxnet0"); RC_CHECK(); 1616 break; 1617 } 1618 1600 1619 default: 1601 1620 AssertMsgFailed(("should not get here!\n")); -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r15708 r16509 780 780 } 781 781 782 STDMETHODIMP NetworkAdapter::AttachToHostOnlyNetwork() 783 { 784 AutoCaller autoCaller (this); 785 CheckComRCReturnRC (autoCaller.rc()); 786 787 /* the machine needs to be mutable */ 788 Machine::AutoMutableStateDependency adep (mParent); 789 CheckComRCReturnRC (adep.rc()); 790 791 AutoWriteLock alock (this); 792 793 /* don't do anything if we're already host interface attached */ 794 if (mData->mAttachmentType != NetworkAttachmentType_HostOnly) 795 { 796 mData.backup(); 797 798 /* first detach the current attachment */ 799 detach(); 800 801 mData->mAttachmentType = NetworkAttachmentType_HostOnly; 802 803 /* leave the lock before informing callbacks */ 804 alock.unlock(); 805 806 mParent->onNetworkAdapterChange (this); 807 } 808 809 return S_OK; 810 } 811 782 812 STDMETHODIMP NetworkAdapter::Detach() 783 813 { … … 910 940 } 911 941 else 942 if (!(attachmentNode = aAdapterNode.findKey ("HostOnlyNetwork")).isNull()) 943 { 944 /* Host Interface Networking */ 945 rc = AttachToHostOnlyNetwork(); 946 CheckComRCReturnRC (rc); 947 } 948 else 912 949 { 913 950 /* Adapter has no children */ … … 1001 1038 break; 1002 1039 } 1040 case NetworkAttachmentType_HostOnly: 1041 { 1042 Key attachmentNode = aAdapterNode.createKey ("HostOnlyNetwork"); 1043 break; 1044 } 1003 1045 default: 1004 1046 { … … 1153 1195 { 1154 1196 mData->mInternalNetwork.setNull(); 1197 break; 1198 } 1199 case NetworkAttachmentType_HostOnly: 1200 { 1155 1201 break; 1156 1202 } -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r16503 r16509 10226 10226 <enum 10227 10227 name="NetworkAttachmentType" 10228 uuid=" 8730d899-d036-4925-bc63-e58f3486f4bf"10228 uuid="64e770dc-dd1d-4879-9f12-5bd6bc879b78" 10229 10229 > 10230 10230 <desc> … … 10238 10238 <const name="HostInterface" value="2"/> 10239 10239 <const name="Internal" value="3"/> 10240 <const name="HostOnly" value="4"/> 10240 10241 </enum> 10241 10242 … … 10259 10260 <interface 10260 10261 name="INetworkAdapter" extends="$unknown" 10261 uuid=" a876d9b1-68d9-43b1-9c68-ddea0a473663"10262 uuid="4a1ee64e-6c5f-47dd-acfa-f834d7cb74fb" 10262 10263 wsmap="managed" 10263 10264 > … … 10356 10357 <desc> 10357 10358 Attach the network adapter to an internal network. 10359 </desc> 10360 </method> 10361 10362 <method name="attachToHostOnlyNetwork"> 10363 <desc> 10364 Attach the network adapter to the host-only network. 10358 10365 </desc> 10359 10366 </method> -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r15708 r16509 129 129 STDMETHOD(AttachToHostInterface)(); 130 130 STDMETHOD(AttachToInternalNetwork)(); 131 STDMETHOD(AttachToHostOnlyNetwork)(); 131 132 STDMETHOD(Detach)(); 132 133 -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r15968 r16509 605 605 </xsd:complexType> 606 606 </xsd:element> 607 <xsd:element name="HostOnlyNetwork"> 608 <xsd:complexType> 609 </xsd:complexType> 610 </xsd:element> 607 611 </xsd:choice> 608 612 <xsd:attribute name="type" type="TNetworkAdapterType" default="Am79C970A"/>
Note:
See TracChangeset
for help on using the changeset viewer.