Skip to content

IPv6 DNS Servers are broken #363

@Leseratte10

Description

@Leseratte10

This is a bug that I happened to stumble upon while reading Thunderbird's debug logs for an unrelated issue. In my /etc/resolv.conf on my machine I have two DNS servers, and the add-on does detect both (IPs censored):

console.info: DKIM_Verifier.JSDNS: "Got servers from resolv.conf: " [{server:"fdxx:xxxx:xxxx::xxxx:xxxx:x", alive:true}, {server:"10.0.xx.x", alive:true}]

However when actually querying the DNS, it skips over the IPv6 DNS:

console.info: DKIM_Verifier.JSDNS: "changed DNS Servers to :" [{server:"fdxx:xxxx:xxxx::xxxx:xxxx:x", alive:true}, {server:"10.0.xx.x", alive:true}, {server:"8.8.8.8", alive:true}]
console.info: DKIM_Verifier.JSDNS: "Resolving xxxxxxxx._domainkey.example.com TXT by querying fdxx:xxxx:xxxx::xxxx:xxxx:x"
console.debug: DKIM_Verifier.JSDNS: "Resolving xxxxxxxx._domainkey.example.com/TXT: Failed to connect to DNS server fdxx:xxxx:xxxx::xxxx:xxxx:x with error code 2152398878."
console.info: DKIM_Verifier.JSDNS: "Resolving xxxxxxxx._domainkey.example.com TXT by querying 10.0.xx.x"
console.debug: DKIM_Verifier.JSDNS: "xxxxxxxx._domainkey.example.com/TXT: Answer: v=DKIM1; k=rsa; h=sha1:sha256; p=xxxxxxxxx...xxxxxxxxx;"

I believe this bug is due to the following code in JSDNS.jsm.js:

	// allow server to be either a hostname or hostname:port
	var server_hostname = server;
	var port = 53;
	if (server.includes(":")) {
		server_hostname = server.substring(0, server.indexOf(":"));
		port = parseInt(server.substring(server.indexOf(":") + 1), 10);
	}

If there's a colon in the hostname string, it assumes by default that that's for a non-default port. However, I don't think /etc/resolv.conf even supports ports other than 53 - but it does obviously support IPv6 addresses, and I think people are way more likely to want to use an IPv6 DNS server than they are to want to use a DNS server on a nonstandard port.

Can this be updated to support IPv6 DNS servers as well? If I'm running this on a system that only has an IPv6 DNS entered (no need for IPv4 DNS, usually ...) it'll fail.

EDIT: This is happening with the default JavaScript DNS library. When I use unbound it seems to sometimes use IPv4 and sometimes IPv6 for the DNS queries but that's probably due to unbound picking a DNS server at random.

Metadata

Metadata

Assignees

Labels

enhancementImprovements or new features

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions