diff options
author | Christian Hesse <mail@eworm.de> | 2023-05-31 15:12:14 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-06-01 09:53:33 +0200 |
commit | 007d1ff7b8dbe78d39216ef501ddcb8a76e372bc (patch) | |
tree | ffbc5d70a19c26736c183690a1418184cae62aa1 /netwatch-dns.rsc | |
parent | f416b0e59dfebdd852bd7fba782eb9de54044ea6 (diff) |
netwatch-dns: handle status 'up' only
Diffstat (limited to 'netwatch-dns.rsc')
-rw-r--r-- | netwatch-dns.rsc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/netwatch-dns.rsc b/netwatch-dns.rsc index 4eb3285..eb6cb6c 100644 --- a/netwatch-dns.rsc +++ b/netwatch-dns.rsc @@ -26,11 +26,11 @@ $ScriptLock $0; :local DnsFallback ({}); :local DnsCurrent [ /ip/dns/get servers ]; -:foreach Host in=[ /tool/netwatch/find where comment~"dns" !disabled ] do={ +:foreach Host in=[ /tool/netwatch/find where comment~"dns" status="up" ] do={ :local HostVal [ /tool/netwatch/get $Host ]; :local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ]; - :if ($HostVal->"status" = "up" && $HostInfo->"disabled" != true) do={ + :if ($HostInfo->"disabled" != true) do={ :if ($HostInfo->"dns" = true) do={ :set DnsServers ($DnsServers, $HostVal->"host"); } @@ -61,12 +61,11 @@ $ScriptLock $0; :local DohCurrent [ /ip/dns/get use-doh-server ]; :local DohCert ""; -:foreach Host in=[ /tool/netwatch/find where comment~"doh" !disabled ] do={ +:foreach Host in=[ /tool/netwatch/find where comment~"doh" status="up" ] do={ :local HostVal [ /tool/netwatch/get $Host ]; :local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ]; - :if ($HostVal->"status" = "up" && $HostInfo->"doh" = true && \ - $HostInfo->"disabled" != true && $DohServer = "") do={ + :if ($HostInfo->"doh" = true && $HostInfo->"disabled" != true && $DohServer = "") do={ :set DohServer [ $EitherOr ($HostInfo->"doh-url") \ ("https://" . $HostVal->"host" . "/dns-query") ]; :set DohCert ($HostInfo->"doh-cert"); |