From e67e9e27ba281913cd0e6b518a252e7c4c536feb Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 10 Oct 2019 16:48:58 +0200 Subject: [PATCH] Hmm somehow there seem to be different version of ping supporting or not the -4 / -6 ... let's see if this workaroud works in all contexts --- data/hooks/diagnosis/10-ip.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/data/hooks/diagnosis/10-ip.py b/data/hooks/diagnosis/10-ip.py index 9c4257306..552092fe3 100644 --- a/data/hooks/diagnosis/10-ip.py +++ b/data/hooks/diagnosis/10-ip.py @@ -113,9 +113,7 @@ class IPDiagnoser(Diagnoser): # So let's try to ping the first 4~5 resolvers (shuffled) # If we succesfully ping any of them, we conclude that we are indeed connected def ping(protocol, target): - print("ping -c1 -%s -W 3 %s >/dev/null 2>/dev/null" % (protocol, target)) - return os.system("ping -c1 -%s -W 3 %s >/dev/null 2>/dev/null" % (protocol, target)) == 0 - + return os.system("ping%s -c1 -W 3 %s >/dev/null 2>/dev/null" % ("" if protocol == 4 else "6", target)) == 0 random.shuffle(resolvers) return any(ping(protocol, resolver) for resolver in resolvers[:5])