unbound: fix dns working check

Message ID 20220219082206.5807-1-arne_f@ipfire.org
State Accepted
Commit 2ecb2784625f597c676533f63859b49e416f53a1
Headers
Series unbound: fix dns working check |

Commit Message

Arne Fitzenreiter Feb. 19, 2022, 8:22 a.m. UTC
  pool.ipfire.org cannot resolved. Now try both default dns
servers. If one works dns is working.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
---
 src/initscripts/system/unbound | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Peter Müller Feb. 19, 2022, 9:42 a.m. UTC | #1
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> pool.ipfire.org cannot resolved. Now try both default dns
> servers. If one works dns is working.
> 
> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
> ---
>  src/initscripts/system/unbound | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/initscripts/system/unbound b/src/initscripts/system/unbound
> index 1b42ac720..b959520a1 100644
> --- a/src/initscripts/system/unbound
> +++ b/src/initscripts/system/unbound
> @@ -267,7 +267,8 @@ get_memory_amount() {
>  
>  fix_time_if_dns_fails() {
>  	# If DNS is working, everything is fine
> -	if resolve "ipfire.pool.ntp.org" &>/dev/null; then
> +	if resolve "0.ipfire.pool.ntp.org" &>/dev/null || \
> +	   resolve "1.ipfire.pool.ntp.org" &>/dev/null ; then
>  		return 0
>  	fi
>
  

Patch

diff --git a/src/initscripts/system/unbound b/src/initscripts/system/unbound
index 1b42ac720..b959520a1 100644
--- a/src/initscripts/system/unbound
+++ b/src/initscripts/system/unbound
@@ -267,7 +267,8 @@  get_memory_amount() {
 
 fix_time_if_dns_fails() {
 	# If DNS is working, everything is fine
-	if resolve "ipfire.pool.ntp.org" &>/dev/null; then
+	if resolve "0.ipfire.pool.ntp.org" &>/dev/null || \
+	   resolve "1.ipfire.pool.ntp.org" &>/dev/null ; then
 		return 0
 	fi