Skip to content

Commit

Permalink
Merge pull request #1413 from xinnige/fix/disable-ip6
Browse files Browse the repository at this point in the history
Fix ip6 disable dns
  • Loading branch information
jasonlyc authored Nov 19, 2024
2 parents 83249af + fa1f942 commit 0d649b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/interface/intf_base_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,11 +989,13 @@ class InterfaceBasePlugin extends Plugin {
}

async getDns6Nameservers() {
if (!this.isIPv6Enabled()) return [];
const dns = await this.getDNSNameservers() || [];
return dns.filter(i => new Address6(i).isValid());
}

async getOrigDNS6Nameservers() {
if (!this.isIPv6Enabled()) return [];
const dns6 = await fs.readFileAsync(this._getDhcpcdFilePath(), {encoding: "utf8"}).then(content => content.trim().split("\n").filter(line => line.startsWith("nameserver")).map(line => line.replace("nameserver", "").trim())).catch((err) => null);
return dns6 || [];
}
Expand Down

0 comments on commit 0d649b8

Please sign in to comment.