diff options
| author | roy <roy@NetBSD.org> | 2015-10-15 16:14:40 +0000 |
|---|---|---|
| committer | roy <roy@NetBSD.org> | 2015-10-15 16:14:40 +0000 |
| commit | d4873c1cf30b592aafa82330b60554a993e7f8d2 (patch) | |
| tree | 0daa48b92b889a6c2ad9e9269612d04cfc0f71cc /external/apache2 | |
| parent | 72f0c07a350e1f9af5ca58814c10f9e25d5fe31b (diff) | |
Add support for parsing IPv6 nameservers found in resolv.conf.
Fixes PR bin/42196.
Diffstat (limited to 'external/apache2')
| -rwxr-xr-x | external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c b/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c index 8411159ee99..5a31916a384 100755 --- a/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c +++ b/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c @@ -494,10 +494,11 @@ mDNSexport int ParseDNSServers(mDNS *m, const char *filePath) 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, const char *filePath) 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; } |
