|
@@ -19,7 +19,11 @@ ping_regexp = re.compile(r"time=(.*) ms")
|
|
|
|
|
|
def ping(target, nb_pings=NB_PINGS):
|
|
|
"""Returns the list of latencies towards the given target"""
|
|
|
- args = ["ping", "-n", "-c", str(nb_pings), str(target.address)]
|
|
|
+ if target.family == pf.IPAddress.IPV4:
|
|
|
+ ping = "ping"
|
|
|
+ elif target.family == pf.IPAddress.IPV6:
|
|
|
+ ping = "ping6"
|
|
|
+ args = [ping, "-n", "-c", str(nb_pings), str(target.address)]
|
|
|
try:
|
|
|
out = subprocess.check_output(args, shell=False)
|
|
|
except subprocess.CalledProcessError:
|