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 6, 2024
1 parent 7e036e4 commit 02769cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion plugins/dhcp/dhcp6_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'use strict';

const pl = require('../plugin_loader.js');
const event = require('../../core/event.js');
const r = require('../../util/firerouter.js');
const fs = require('fs');
const Promise = require('bluebird');
Expand Down
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 02769cf

Please sign in to comment.