Changeset 16226 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jan 26, 2009 1:05:01 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/bootp.c
r16214 r16226 270 270 || dhcp_msg_type == DHCPREQUEST)) 271 271 { 272 #ifdef VBOX_WITH_MULTI_DNS 273 struct dns_entry *de = NULL; 274 #endif 272 275 uint32_t lease_time = htonl(LEASE_TIME); 273 276 uint32_t netmask = htonl(pData->netmask); … … 276 279 FILL_BOOTP_EXT(q, RFC1533_GATEWAY, 4, &saddr.sin_addr); 277 280 281 #ifndef VBOX_WITH_MULTI_DNS 278 282 dns_addr_dhcp.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_DNS); 279 283 FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &dns_addr_dhcp.s_addr); 284 #else 285 LIST_FOREACH(de, &pData->dns_list_head, de_list) 286 { 287 FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &de->de_addr.s_addr); 288 } 289 #endif 280 290 281 291 FILL_BOOTP_EXT(q, RFC2132_LEASE_TIME, 4, &lease_time); -
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15890 r16226 356 356 { 357 357 case CTL_DNS: 358 #ifndef VBOX_WITH_MULTI_DNS 358 359 addr.sin_addr = dns_addr; 359 360 break; 361 #endif 360 362 case CTL_ALIAS: 361 363 default: -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r16213 r16226 152 152 IP_ADDR_STRING *pIPAddr; 153 153 struct in_addr tmp_addr; 154 #ifdef VBOX_WITH_MULTI_DNS 155 struct in_addr local_mask; 156 struct in_addr local_network; 157 #endif 154 158 155 159 FixedInfo = (FIXED_INFO *)GlobalAlloc(GPTR, sizeof(FIXED_INFO)); … … 181 185 } 182 186 187 #ifndef VBOX_WITH_MULTI_DNS 183 188 pIPAddr = &(FixedInfo->DnsServerList); 184 189 inet_aton(pIPAddr->IpAddress.String, &tmp_addr); … … 195 200 pIPAddr = pIPAddr ->Next; 196 201 } 202 #else 203 /*localhost mask */ 204 inet_aton("255.0.0.0", &local_mask); 205 inet_aton("127.0.0.0", &local_network); 206 for (pIPAddr = &FixedInfo->DnsServerList; pIPAddr != NULL; pIPAddr = pIPAddr->Next) 207 { 208 struct dns_entry *da = RTMemAllocZ(sizeof (struct dns_entry)); 209 if (da == NULL) 210 { 211 LogRel(("can't alloc memory for DNS entry\n")); 212 return -1; 213 } 214 /*check */ 215 inet_aton(pIPAddr->IpAddress.String, &da->de_addr); 216 if ((ntohl(da->de_addr.s_addr) & ntohl(local_mask.s_addr)) == ntohl(local_network.s_addr)) { 217 da->de_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 218 } 219 LIST_INSERT_HEAD(&pData->dns_list_head, da, de_list); 220 } 221 #endif 197 222 if (FixedInfo) 198 223 { … … 370 395 m_init(pData); 371 396 397 inet_aton(pszNetAddr, &special_addr); 398 alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS); 399 372 400 /* set default addresses */ 373 401 inet_aton("127.0.0.1", &loopback_addr); 402 #ifndef VBOX_WITH_MULTI_DNS 374 403 inet_aton("127.0.0.1", &dns_addr); 375 404 376 405 if (get_dns_addr_domain(pData, true, &dns_addr, &pData->pszDomain) < 0) 406 #else 407 if (get_dns_addr_domain(pData, true, NULL, &pData->pszDomain) < 0) 408 #endif 377 409 fNATfailed = 1; 378 410 379 inet_aton(pszNetAddr, &special_addr);380 alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);381 411 getouraddr(pData); 382 412 return fNATfailed ? VINF_NAT_DNS : VINF_SUCCESS; -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r15793 r16226 339 339 #endif 340 340 341 #ifndef VBOX_WITH_MULTI_DNS 341 342 #define DO_ALIAS(paddr) \ 342 343 do { \ … … 346 347 } \ 347 348 } while(0) 348 #endif 349 #else 350 #define DO_ALIAS(paddr) do {} while (0) 351 #endif 352 #endif -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r15672 r16226 52 52 }; 53 53 54 #ifdef VBOX_WITH_MULTI_DNS 55 struct dns_entry 56 { 57 struct in_addr de_addr; 58 LIST_ENTRY(dns_entry) de_list; 59 }; 60 LIST_HEAD(dns_list_head, dns_entry); 61 #endif 54 62 55 63 /** Main state/configuration structure for slirp NAT. */ … … 92 100 struct in_addr alias_addr; 93 101 struct in_addr special_addr; 102 #ifndef VBOX_WITH_MULTI_DNS 94 103 struct in_addr dns_addr; 104 #else 105 struct dns_list_head dns_list_head; 106 #endif 95 107 struct in_addr loopback_addr; 96 108 uint32_t netmask; -
trunk/src/VBox/Devices/Network/slirp/socket.c
r15925 r16226 573 573 #endif 574 574 case CTL_DNS: 575 #ifndef VBOX_WITH_MULTI_DNS 575 576 if (!get_dns_addr(pData, &dns_addr)) 576 577 addr.sin_addr = dns_addr; … … 578 579 addr.sin_addr = loopback_addr; 579 580 break; 581 #endif 580 582 case CTL_ALIAS: 581 583 default: -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r16071 r16226 395 395 { 396 396 case CTL_DNS: 397 #ifndef VBOX_WITH_MULTI_DNS 397 398 if (!get_dns_addr(pData, &dns_addr)) 398 399 addr.sin_addr = dns_addr; … … 400 401 addr.sin_addr = loopback_addr; 401 402 break; 403 #endif 402 404 case CTL_ALIAS: 403 405 default:
Note:
See TracChangeset
for help on using the changeset viewer.