From a4fc8e4beffe4fa91c2157721d4c28c8506bf6b1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 1 Dec 2020 20:31:53 +0100 Subject: [PATCH] Fix captive portal domain connectivity check --- netenv/online-status.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/netenv/online-status.go b/netenv/online-status.go index ba2275ca..882c56c3 100644 --- a/netenv/online-status.go +++ b/netenv/online-status.go @@ -56,8 +56,14 @@ func prepOnlineStatus() (err error) { return err } -// IsConnectivityDomain checks whether the given domain (fqdn) is used for any connectivity related network connections and should always be resolved using the network assigned DNS server. +// IsConnectivityDomain checks whether the given domain (fqdn) is used for any +// connectivity related network connections and should always be resolved using +// the network assigned DNS server. func IsConnectivityDomain(domain string) bool { + if domain == "" { + return false + } + switch domain { case SpecialCaptivePortalDomain, "one.one.one.one.", // Internal DNS Check @@ -92,10 +98,15 @@ func IsConnectivityDomain(domain string) bool { // Other "neverssl.com.", // Common Community Service - "detectportal.firefox.com.", // Firefox + "detectportal.firefox.com.": // Firefox - // Redirected Domain - GetCaptivePortal().Domain: + return true + } + + // Check for captive portal domain. + captivePortal := GetCaptivePortal() + if captivePortal.Domain != "" && + domain == captivePortal.Domain { return true }