Module Name: src Committed By: roy Date: Thu Oct 15 16:14:40 UTC 2015
Modified Files: src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSPosix.c Log Message: Add support for parsing IPv6 nameservers found in resolv.conf. Fixes PR bin/42196. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.9 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.10 --- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.9 Mon Oct 12 09:29:25 2015 +++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c Thu Oct 15 16:14:40 2015 @@ -494,10 +494,11 @@ mDNSexport int ParseDNSServers(mDNS *m, while (fgets(line,sizeof(line),fp)) { struct in_addr ina; + struct in6_addr ina6; line[255]='\0'; // just to be safe if (sscanf(line,"%10s %15s", keyword, nameserver) != 2) continue; // it will skip whitespaces if (strncasecmp(keyword,"nameserver",10)) continue; - if (inet_aton(nameserver, (struct in_addr *)&ina) != 0) + if (inet_pton(AF_INET, nameserver, &ina) == 1) { mDNSAddr DNSAddr; DNSAddr.type = mDNSAddrType_IPv4; @@ -505,7 +506,15 @@ mDNSexport int ParseDNSServers(mDNS *m, mDNS_AddDNSServer(m, NULL, mDNSInterface_Any, &DNSAddr, UnicastDNSPort, mDNSfalse, 0); numOfServers++; } - } + else if (inet_pton(AF_INET6, nameserver, &ina6) == 1) + { + mDNSAddr DNSAddr; + DNSAddr.type = mDNSAddrType_IPv6; + DNSAddr.ip.v6 = *(mDNSv6Addr *)&ina6; + mDNS_AddDNSServer(m, NULL, mDNSInterface_Any, &DNSAddr, UnicastDNSPort, mDNSfalse, 0); + numOfServers++; + } + } fclose(fp); return (numOfServers > 0) ? 0 : -1; }