Teach rc.initial.ping at least a little bit about ipv6.

This commit is contained in:
jim-p 2012-06-03 20:43:52 -04:00
parent 42db9f7bb8
commit 4264284ed5
1 changed files with 7 additions and 2 deletions

View File

@ -39,9 +39,14 @@
echo "\nEnter a host name or IP address: ";
$pinghost = chop(fgets($fp));
if ($pinghost) {
if (is_ipaddrv4($pinghost) || is_hostname($pinghost)) {
$command = "ping";
} elseif (is_ipaddrv6($pinghost)) {
$command = "ping6";
}
if ($command) {
echo "\n";
passthru("/sbin/ping -c 3 -n " . escapeshellarg($pinghost));
passthru("/sbin/{$command} -c 3 -n " . escapeshellarg($pinghost));
echo "\nPress ENTER to continue.\n";
fgets($fp);
}