Changeset 2938 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- May 30, 2007 4:30:42 PM (18 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/bootp.c
r1076 r2938 263 263 q += val; 264 264 } 265 266 if (pData->pszDomain && pData->fPassDomain) 267 { 268 val = strlen(pData->pszDomain); 269 *q++ = RFC1533_DOMAINNAME; 270 *q++ = val; 271 memcpy(q, pData->pszDomain, val); 272 q += val; 273 } 265 274 } 266 275 *q++ = RFC1533_END; -
trunk/src/VBox/Devices/Network/slirp/libslirp.h
r1076 r2938 27 27 #endif 28 28 29 int slirp_init(PNATState *, const char *, void *);29 int slirp_init(PNATState *, const char *, bool, void *); 30 30 void slirp_term(PNATState); 31 31 void slirp_link_up(PNATState); -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r2566 r2938 13 13 #ifdef _WIN32 14 14 15 static int get_dns_addr(PNATState pData, struct in_addr *pdns_addr) 15 static int get_dns_addr_domain(PNATState pData, struct in_addr *pdns_addr, 16 const char **ppszDomain) 16 17 { 17 18 FIXED_INFO *FixedInfo=NULL; … … 20 21 IP_ADDR_STRING *pIPAddr; 21 22 struct in_addr tmp_addr; 23 24 *ppszDomain = NULL; 25 /** @todo implement search list for Windows host. */ 22 26 23 27 FixedInfo = (FIXED_INFO *)GlobalAlloc(GPTR, sizeof(FIXED_INFO)); … … 61 65 #else 62 66 63 static int get_dns_addr(PNATState pData, struct in_addr *pdns_addr) 67 static int get_dns_addr_domain(PNATState pData, struct in_addr *pdns_addr, 68 const char **ppszDomain) 64 69 { 65 70 char buff[512]; … … 92 97 return -1; 93 98 99 *ppszDomain = NULL; 94 100 Log(("nat: IP address of your DNS(s): \n")); 95 101 while (fgets(buff, 512, f) != NULL) { … … 108 114 Log(("nat: %s\n", inet_ntoa(tmp_addr))); 109 115 } 116 if (!strncmp(buff, "domain", 6) || !strncmp(buff, "search", 6)) 117 { 118 /* Domain name/search list present. Pick first entry */ 119 if (*ppszDomain == NULL) 120 { 121 char *tok; 122 tok = strtok(&buff[6], " \t\n"); 123 *ppszDomain = RTStrDup(tok); 124 if (pData->fPassDomain) 125 LogRel(("NAT: passing domain name %s\n", tok)); 126 else 127 Log(("nat: ignoring domain %s\n", tok)); 128 } 129 } 110 130 } 111 131 fclose(f); … … 117 137 #endif 118 138 119 int slirp_init(PNATState *ppData, const char *pszNetAddr, void *pvUser)139 int slirp_init(PNATState *ppData, const char *pszNetAddr, bool fPassDomain, void *pvUser) 120 140 { 121 141 int fNATfailed = 0; … … 125 145 return VERR_NO_MEMORY; 126 146 memset(pData, '\0', sizeof(NATState)); 147 pData->fPassDomain = fPassDomain; 127 148 pData->pvUser = pvUser; 128 149 #if ARCH_BITS == 64 … … 150 171 inet_aton("127.0.0.1", &dns_addr); 151 172 152 if (get_dns_addr (pData, &dns_addr) < 0)173 if (get_dns_addr_domain(pData, &dns_addr, &pData->pszDomain) < 0) 153 174 fNATfailed = 1; 154 175 … … 193 214 void slirp_term(PNATState pData) 194 215 { 216 if (pData->pszDomain) 217 RTStrFree((char *)(void *)pData->pszDomain); 218 195 219 #if ARCH_BITS == 64 196 220 LogRel(("NAT: cpvHashUsed=%RU32 cpvHashCollisions=%RU32 cpvHashInserts=%RU64 cpvHashDone=%RU64\n", -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r1300 r2938 91 91 struct ex_list *exec_list; 92 92 char slirp_hostname[33]; 93 bool fPassDomain; 94 const char *pszDomain; 93 95 /* Stuff from tcp_input.c */ 94 96 struct socket tcb;
Note:
See TracChangeset
for help on using the changeset viewer.