|
@@ -20,6 +20,9 @@ const DNS_UNREACHABLE_ERROR = "nameserver unreachable"
|
|
|
// SetDNSWithRetry - Attempt setting dns, if it fails return true (to reset dns)
|
|
|
func SetDNSWithRetry(node models.Node, address string) bool {
|
|
|
var reachable bool
|
|
|
+ if !hasPrereqs() {
|
|
|
+ return true
|
|
|
+ }
|
|
|
for counter := 0; !reachable && counter < 5; counter++ {
|
|
|
reachable = IsDNSReachable(address)
|
|
|
time.Sleep(time.Second << 1)
|
|
@@ -62,6 +65,14 @@ func SetDNS(nameserver string) error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
+func hasPrereqs() bool {
|
|
|
+ if !ncutils.IsLinux() {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ _, err := exec.LookPath("resolvectl")
|
|
|
+ return err == nil
|
|
|
+}
|
|
|
+
|
|
|
// UpdateDNS - updates local DNS of client
|
|
|
func UpdateDNS(ifacename string, network string, nameserver string) error {
|
|
|
if !ncutils.IsLinux() {
|