Changeset 33953 in vbox
- Timestamp:
- Nov 11, 2010 7:47:27 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/libalias/alias_dns.c
r32431 r33953 86 86 } 87 87 88 static void doanswer(struct libalias *la, union dnsmsg_header *hdr, char *qname, struct ip *pip, struct hostent *h)88 static void doanswer(struct libalias *la, union dnsmsg_header *hdr, uint16_t qtype, uint16_t qclass, char *qname, struct ip *pip, struct hostent *h) 89 89 { 90 90 int i; … … 121 121 query += strlen(qname) + 1; 122 122 123 *(uint16_t *)query = htons(1);124 ((uint16_t *)query)[1] = htons(1);123 *(uint16_t *)query = qtype; 124 ((uint16_t *)query)[1] = qclass; 125 125 answers = (char *)&((uint16_t *)query)[2]; 126 126 … … 199 199 qw_qname = (char *)&hdr[1]; 200 200 Assert((ntohs(hdr->X.qdcount) == 1)); 201 if ((ntohs(hdr->X.qdcount) != 1)) 202 { 203 LogRel(("NAT:alias_dns: multiple quieries isn't supported\n")); 204 return 1; 205 } 201 206 202 207 for (i = 0; i < ntohs(hdr->X.qdcount); ++i) … … 206 211 fprintf(stderr, "qname:%s qtype:%hd qclass:%hd\n", 207 212 qw_qname, ntohs(*qw_qtype), ntohs(*qw_qclass)); 208 } 209 210 QStr2CStr(qw_qname,cname, sizeof(cname));211 cname_len = RTStrNLen(cname, sizeof(cname));212 /* Some guests like win-xp adds _dot_ after host name213 * and after domain name (not passed with host resolver)214 * that confuses host resolver.215 */216 if ( cname_len > 2217 && cname[cname_len - 1] == '.'218 && cname[cname_len - 2] == '.')219 {220 cname[cname_len - 1] = 0;221 cname[cname_len - 2] = 0;222 }223 h = gethostbyname(cname);224 fprintf(stderr, "cname:%s\n", cname);225 doanswer(la, hdr, qw_qname, pip, h);213 214 QStr2CStr(qw_qname, cname, sizeof(cname)); 215 cname_len = RTStrNLen(cname, sizeof(cname)); 216 /* Some guests like win-xp adds _dot_ after host name 217 * and after domain name (not passed with host resolver) 218 * that confuses host resolver. 219 */ 220 if ( cname_len > 2 221 && cname[cname_len - 1] == '.' 222 && cname[cname_len - 2] == '.') 223 { 224 cname[cname_len - 1] = 0; 225 cname[cname_len - 2] = 0; 226 } 227 h = gethostbyname(cname); 228 fprintf(stderr, "cname:%s\n", cname); 229 doanswer(la, hdr, *qw_qtype, *qw_qclass, qw_qname, pip, h); 230 } 226 231 227 232 /*
Note:
See TracChangeset
for help on using the changeset viewer.