儲存庫 vbox 的更動 17855
- 時間撮記:
- 2009-3-13 下午06:28:26 (16 年 以前)
- 位置:
- trunk/src/apps
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/apps/Makefile.kmk
r17826 r17855 33 33 endif 34 34 endif 35 if1of ($(KBUILD_TARGET),darwin solaris )35 if1of ($(KBUILD_TARGET),darwin solaris linux) 36 36 ifneq ($(wildcard $(PATH_SUB_CURRENT)/adpctl),) 37 37 include $(PATH_SUB_CURRENT)/adpctl/Makefile.kmk -
trunk/src/apps/adpctl/VBoxNetAdpCtl.cpp
r17851 r17855 34 34 #define VBOXADPCTL_IFCONFIG_PATH "/sbin/ifconfig" 35 35 36 #ifdef RT_OS_LINUX 37 #define VBOXADPCTL_DEL_CMD "del" 38 #else 39 #define VBOXADPCTL_DEL_CMD "delete" 40 #endif 41 36 42 static void showUsage(void) 37 43 { … … 42 48 const char *pcszArg2 = NULL, 43 49 const char *pcszArg3 = NULL, 44 const char *pcszArg4 = NULL) 50 const char *pcszArg4 = NULL, 51 const char *pcszArg5 = NULL) 45 52 { 46 53 const char * const argv[] = … … 52 59 pcszArg3, /* ['netmask'] */ 53 60 pcszArg4, /* [network mask] */ 61 pcszArg5, /* [network mask] */ 54 62 NULL /* terminator */ 55 63 }; … … 100 108 if (!pszWord || strcmp(pszWord, "inet6")) 101 109 continue; 110 #ifdef RT_OS_LINUX 111 pszWord = strtok(NULL, " "); 112 /* Skip "addr:". */ 113 if (!pszWord || strcmp(pszWord, "addr:")) 114 continue; 115 #endif 102 116 pszWord = strtok(NULL, " "); 103 117 /* Skip link-local addresses. */ … … 110 124 for (int i = 0; i < cAddrs; i++) 111 125 { 112 if (executeIfconfig(pszAdapterName, "inet6", aszAddresses[i], "remove") != EXIT_SUCCESS)126 if (executeIfconfig(pszAdapterName, "inet6", VBOXADPCTL_DEL_CMD, aszAddresses[i]) != EXIT_SUCCESS) 113 127 return false; 114 128 } … … 126 140 const char *pszOption = NULL; 127 141 int rc = EXIT_SUCCESS; 142 bool fRemove = false; 128 143 129 144 switch (argc) … … 148 163 return 1; 149 164 } 150 pszOption = "remove";165 fRemove = true; 151 166 pszAdapterName = argv[1]; 152 167 pszAddress = argv[2]; … … 170 185 } 171 186 172 if (strchr(pszAddress, ':')) 173 { 174 /* 175 * Before we set IPv6 address we'd like to remove 176 * all previously assigned addresses except the 177 * self-assigned one. 178 */ 179 if (pszOption && !strcmp(pszOption, "remove")) 180 rc = executeIfconfig(pszAdapterName, "inet6", pszAddress, pszOption); 181 else if (!removeAddresses(pszAdapterName)) 182 rc = EXIT_FAILURE; 187 if (fRemove) 188 { 189 if (strchr(pszAddress, ':')) 190 rc = executeIfconfig(pszAdapterName, "inet6", VBOXADPCTL_DEL_CMD, pszAddress); 183 191 else 184 rc = executeIfconfig(pszAdapterName, "inet6", pszAddress, pszOption, pszNetworkMask); 192 { 193 #ifdef RT_OS_LINUX 194 rc = executeIfconfig(pszAdapterName, "0.0.0.0"); 195 #else 196 rc = executeIfconfig(pszAdapterName, "delete", pszAddress); 197 #endif 198 } 185 199 } 186 200 else 187 rc = executeIfconfig(pszAdapterName, pszAddress, pszOption, pszNetworkMask); 201 { 202 /* We are setting/replacing address. */ 203 if (strchr(pszAddress, ':')) 204 { 205 /* 206 * Before we set IPv6 address we'd like to remove 207 * all previously assigned addresses except the 208 * self-assigned one. 209 */ 210 if (!removeAddresses(pszAdapterName)) 211 rc = EXIT_FAILURE; 212 else 213 rc = executeIfconfig(pszAdapterName, "inet6", "add", pszAddress, pszOption, pszNetworkMask); 214 } 215 else 216 rc = executeIfconfig(pszAdapterName, pszAddress, pszOption, pszNetworkMask); 217 } 188 218 return rc; 189 219 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器