Skip to content

Commit

Permalink
Fix resolvconf default dns
Browse files Browse the repository at this point in the history
  • Loading branch information
xinnige committed Nov 5, 2024
1 parent 7e036e4 commit e2badc1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/interface/intf_base_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,14 @@ class InterfaceBasePlugin extends Plugin {
let dnsservers = [];
if (this.networkConfig.nameservers && this.networkConfig.nameservers.length > 0 && this.networkConfig.nameservers.some(s => new Address4(s).isValid())) {
dnsservers = this.networkConfig.nameservers.filter(s => new Address4(s).isValid());
} else {
dnsservers = await this.getOrigDNSNameservers();
}

if (this.networkConfig.dns6Servers && this.networkConfig.dns6Servers.some(s => new Address6(s).isValid())) {
dnsservers = dnsservers.concat(this.networkConfig.dns6Servers.filter(s => new Address6(s).isValid()));
} else {
dnsservers = dnsservers.concat(await this.getOrigDNS6Nameservers());
}
if (dnsservers.length > 0) {
let nameservers = dnsservers.map((nameserver) => `nameserver ${nameserver}`).join("\n") + "\n";
Expand Down

0 comments on commit e2badc1

Please sign in to comment.