Skip to content

Commit 6caac35

Browse files
committed
Merge pull request tariqbuilds#267 from sanderjo/master
Makes ping module ipv6-enabled.
2 parents 6ad7ad8 + 05c4ee7 commit 6caac35

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

libs/Modules/ping.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ public function getData($args=array()) {
2626
$result
2727
);
2828

29+
if (empty($result[0])) {
30+
// Empty, so maybe it's an IPv6-only host, so run ping6
31+
exec(
32+
"/bin/ping6 -qc {$pingCount} {$hosts[$i]} |" .
33+
" awk -F/ '/^rtt/ { print $5 }'",
34+
$result
35+
);
36+
} // if
37+
2938
$pingTime = (empty($result[0]))? 'could not reach host': $result[0] . ' ms';
3039

3140
$data[] = array(
@@ -36,4 +45,4 @@ public function getData($args=array()) {
3645

3746
return $data;
3847
}
39-
}
48+
}

0 commit comments

Comments
 (0)