- Timestamp:
- Sep 22, 2009 3:48:26 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 52691
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r23129 r23222 772 772 } 773 773 #ifdef VBOX_DYNAMIC_NET_ATTACH 774 /* here the order in which strncmp is called is important 775 * cause nictracefile can be very well compared with 776 * nictrace and nic and thus everything will always fail 777 * if the order is changed 778 */ 779 else if (!strncmp(a->argv[1], "nictracefile", 12)) 780 { 781 /* Get the number of network adapters */ 782 ULONG NetworkAdapterCount = 0; 783 ComPtr <ISystemProperties> info; 784 CHECK_ERROR_BREAK (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam())); 785 CHECK_ERROR_BREAK (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount)); 786 787 unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC"); 788 if (!n) 789 { 790 rc = E_FAIL; 791 break; 792 } 793 if (a->argc <= 2) 794 { 795 errorArgument("Missing argument to '%s'", a->argv[1]); 796 rc = E_FAIL; 797 break; 798 } 799 800 /* get the corresponding network adapter */ 801 ComPtr<INetworkAdapter> adapter; 802 CHECK_ERROR_BREAK (sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam())); 803 if (adapter) 804 { 805 BOOL fEnabled; 806 adapter->COMGETTER(Enabled)(&fEnabled); 807 if (fEnabled) 808 { 809 if (a->argv[2]) 810 { 811 CHECK_ERROR_RET(adapter, COMSETTER(TraceFile) (Bstr(a->argv[2])), 1); 812 } 813 else 814 { 815 errorArgument("Invalid filename or filename not specified for NIC %lu", n); 816 rc = E_FAIL; 817 break; 818 } 819 } 820 else 821 { 822 RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n); 823 } 824 } 825 } 826 else if (!strncmp(a->argv[1], "nictrace", 8)) 827 { 828 /* Get the number of network adapters */ 829 ULONG NetworkAdapterCount = 0; 830 ComPtr <ISystemProperties> info; 831 CHECK_ERROR_BREAK (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam())); 832 CHECK_ERROR_BREAK (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount)); 833 834 unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC"); 835 if (!n) 836 { 837 rc = E_FAIL; 838 break; 839 } 840 if (a->argc <= 2) 841 { 842 errorArgument("Missing argument to '%s'", a->argv[1]); 843 rc = E_FAIL; 844 break; 845 } 846 847 /* get the corresponding network adapter */ 848 ComPtr<INetworkAdapter> adapter; 849 CHECK_ERROR_BREAK (sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam())); 850 if (adapter) 851 { 852 BOOL fEnabled; 853 adapter->COMGETTER(Enabled)(&fEnabled); 854 if (fEnabled) 855 { 856 if (!strcmp(a->argv[2], "on")) 857 { 858 CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(TRUE), 1); 859 } 860 else if (!strcmp(a->argv[2], "off")) 861 { 862 CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(FALSE), 1); 863 } 864 else 865 { 866 errorArgument("Invalid nictrace%lu argument '%s'", n, Utf8Str(a->argv[2]).raw()); 867 rc = E_FAIL; 868 break; 869 } 870 } 871 else 872 { 873 RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n); 874 } 875 } 876 } 774 877 else if (!strncmp(a->argv[1], "nic", 3)) 775 878 { -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r23179 r23222 2055 2055 2056 2056 pLunL0 = CFGMR3GetChildF(pInst, "LUN#%u", uLun); 2057 CFGMR3RemoveNode(CFGMR3GetChildF(pLunL0, "AttachedDriver")); 2057 PCFGMNODE pLunAD = CFGMR3GetChildF(pLunL0, "AttachedDriver"); 2058 if (pLunAD) 2059 { 2060 CFGMR3RemoveNode(pLunAD); 2061 } 2062 else 2063 { 2064 CFGMR3RemoveNode(pLunL0); 2065 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 2066 rc = CFGMR3InsertString(pLunL0, "Driver", "NetSniffer"); RC_CHECK(); 2067 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK(); 2068 hrc = aNetworkAdapter->COMGETTER(TraceFile)(&str); H(); 2069 if (str) /* check convention for indicating default file. */ 2070 { 2071 rc = CFGMR3InsertStringW(pCfg, "File", str); RC_CHECK(); 2072 } 2073 STR_FREE(); 2074 } 2058 2075 } 2059 2076 else if (fAttachDetach && !fSniffer) -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r23061 r23222 639 639 alock.unlock(); 640 640 641 mParent->onNetworkAdapterChange (this, FALSE);641 mParent->onNetworkAdapterChange (this, TRUE); 642 642 } 643 643
Note:
See TracChangeset
for help on using the changeset viewer.