儲存庫 vbox 的更動 18584
- 時間撮記:
- 2009-3-31 下午07:04:22 (16 年 以前)
- 位置:
- trunk/src/VBox/Devices/Network/slirp
- 檔案:
-
- 修改 3 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Network/slirp/bootp.c
r18447 r18584 275 275 #ifdef VBOX_WITH_MULTI_DNS 276 276 struct dns_entry *de = NULL; 277 struct dns_domain_entry *dd = NULL; 278 int added = 0; 277 279 #endif 278 280 uint32_t lease_time = htonl(LEASE_TIME); … … 298 300 FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &de->de_addr.s_addr); 299 301 } 302 LIST_FOREACH(dd, &pData->dns_domain_list_head, dd_list) 303 { 304 305 if (dd->dd_pszDomain == NULL) 306 continue; 307 if (added != 0) 308 FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, ","); /* never meet valid separator here in RFC1533*/ 309 else 310 added = 1; 311 val = (int)strlen(dd->dd_pszDomain); 312 FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, val, dd->dd_pszDomain); 313 } 300 314 #endif 301 315 … … 308 322 } 309 323 324 #ifndef VBOX_WITH_MULTI_DNS 310 325 if (pData->pszDomain && pData->fPassDomain) 311 326 { … … 313 328 FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, val, pData->pszDomain); 314 329 } 330 #endif 315 331 } 316 332 *q++ = RFC1533_END; -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r18419 r18584 336 336 char *suffix; 337 337 struct dns_entry *da = NULL; 338 struct dns_domain_entry *dd = NULL; 338 339 ULONG ret = ERROR_SUCCESS; 339 340 … … 369 370 while(addr != NULL) 370 371 { 371 #if 1 372 size_t buff_size; 373 #endif 372 int found; 374 373 if (addr->OperStatus != IfOperStatusUp) 375 374 goto next; … … 396 395 } 397 396 LIST_INSERT_HEAD(&pData->dns_list_head, da, de_list); 397 398 if (addr->DnsSuffix == NULL) 399 goto next_dns; 400 401 /*uniq*/ 402 RTUtf16ToUtf8(addr->DnsSuffix, &suffix); 403 found = 0; 404 LIST_FOREACH(dd, &pData->dns_domain_list_head, dd_list) 405 { 406 if ( dd->dd_pszDomain != NULL 407 && strcmp(dd->dd_pszDomain, suffix) == 0) 408 { 409 found = 1; 410 break; 411 } 412 } 413 if (found == 0) 414 { 415 dd = RTMemAllocZ(sizeof(struct dns_domain_entry)); 416 if (dd == NULL) 417 { 418 LogRel(("NAT: not enought memory\n")); 419 return VERR_NO_MEMORY; 420 } 421 dd->dd_pszDomain = suffix; 422 LogRel(("NAT: adding domain name %s to search list\n", dd->dd_pszDomain)); 423 LIST_INSERT_HEAD(&pData->dns_domain_list_head, dd, dd_list); 424 } 398 425 next_dns: 399 426 dns = dns->Next; 400 427 } 401 #if 1402 buff_size = wcstombs(NULL, addr->DnsSuffix, 0);403 if (buff_size == 0 || buff_size == (size_t)-1)404 goto next;405 suffix = RTMemAllocZ(buff_size + 1);406 wcstombs(suffix, addr->DnsSuffix, buff_size);407 suffix[buff_size] = '\0';408 LogRel(("NAT: adding %s to DNS suffix list\n", suffix));409 *ppszDomain = suffix; /* may leak memory */410 #else /** @todo r=bird: try this (no time to test for BETA2). Btw. what happend to suffix 'adding', the code above doesn't do what the LogRel() says... */411 /* add the first one only. */412 if (ppszDomain && !*ppszDomain)413 RTUtf16ToUtf8(addr->DnsSuffix, ppszDomain);414 #endif415 428 next: 416 429 addr = addr->Next; 417 430 } 418 /** @todo add dns suffix if required */419 if (ppszDomain && *ppszDomain)420 LogRel(("NAT: DNS suffix %s\n", *ppszDomain));421 431 return 0; 422 432 } … … 502 512 found++; 503 513 } 514 #ifndef VBOX_WITH_MULTI_DNS 504 515 if ( ppszDomain 505 516 && (!strncmp(buff, "domain", 6) || !strncmp(buff, "search", 6))) … … 524 535 } 525 536 } 537 #else 538 if ((!strncmp(buff, "domain", 6) || !strncmp(buff, "search", 6))) 539 { 540 char *tok; 541 char *saveptr; 542 struct dns_domain_entry *dd = NULL; 543 int found = 0; 544 tok = strtok_r(&buff[6], " \t\n", &saveptr); 545 LIST_FOREACH(dd, &pData->dns_domain_list_head, dd_list) 546 { 547 if( tok != NULL 548 && strcmp(tok, dd->dd_pszDomain) == 0) 549 { 550 found = 1; 551 break; 552 } 553 } 554 if (tok != NULL && found == 0) { 555 dd = RTMemAllocZ(sizeof(struct dns_domain_entry)); 556 if (dd == NULL) 557 { 558 LogRel(("NAT: not enought memory to add domain list\n")); 559 return VERR_NO_MEMORY; 560 } 561 dd->dd_pszDomain = RTStrDup(tok); 562 LogRel(("NAT: adding domain name %s to search list\n", dd->dd_pszDomain)); 563 LIST_INSERT_HEAD(&pData->dns_domain_list_head, dd, dd_list); 564 } 565 } 566 #endif 526 567 } 527 568 fclose(f); … … 536 577 { 537 578 LIST_INIT(&pData->dns_list_head); 538 return get_dns_addr_domain(pData, true, NULL, &pData->pszDomain); 539 } 579 LIST_INIT(&pData->dns_domain_list_head); 580 return get_dns_addr_domain(pData, true, NULL, NULL); 581 } 582 540 583 static void slirp_release_dns_list(PNATState pData) 541 584 { 542 585 struct dns_entry *de = NULL; 543 while(!LIST_EMPTY(&pData->dns_list_head)) { 544 de = LIST_FIRST(&pData->dns_list_head); 545 LIST_REMOVE(de, de_list); 546 RTMemFree(de); 586 struct dns_domain_entry *dd = NULL; 587 while(!LIST_EMPTY(&pData->dns_domain_list_head)) { 588 dd = LIST_FIRST(&pData->dns_domain_list_head); 589 LIST_REMOVE(dd, dd_list); 590 if (dd->dd_pszDomain != NULL) 591 RTStrFree(dd->dd_pszDomain); 592 RTMemFree(dd); 593 } 594 while(!LIST_EMPTY(&pData->dns_domain_list_head)) { 595 dd = LIST_FIRST(&pData->dns_domain_list_head); 596 LIST_REMOVE(dd, dd_list); 597 if (dd->dd_pszDomain != NULL) 598 RTStrFree(dd->dd_pszDomain); 599 RTMemFree(dd); 547 600 } 548 601 } … … 677 730 void slirp_term(PNATState pData) 678 731 { 732 #ifndef VBOX_WITH_MULTI_DNS 679 733 if (pData->pszDomain) 680 734 RTStrFree((char *)(void *)pData->pszDomain); 735 #endif 681 736 682 737 #ifdef RT_OS_WINDOWS -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r17436 r18584 57 57 58 58 #ifdef VBOX_WITH_MULTI_DNS 59 struct dns_domain_entry 60 { 61 char *dd_pszDomain; 62 LIST_ENTRY(dns_domain_entry) dd_list; 63 }; 64 LIST_HEAD(dns_domain_list_head, dns_domain_entry); 65 59 66 struct dns_entry 60 67 { … … 114 121 # endif 115 122 struct dns_list_head dns_list_head; 123 struct dns_domain_list_head dns_domain_list_head; 116 124 #endif 117 125 struct in_addr tftp_server; … … 122 130 char slirp_hostname[33]; 123 131 bool fPassDomain; 132 #ifndef VBOX_WITH_MULTI_DNS 124 133 const char *pszDomain; 134 #endif 125 135 /* Stuff from tcp_input.c */ 126 136 struct socket tcb;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器