So gethostbyname() does not work for ipv6, instead run both ping and ping6. That works too.

This commit is contained in:
Seth Mos 2010-10-23 12:28:14 +02:00
parent 86551a0623
commit 8bea96391f

View File

@ -29,7 +29,7 @@
*/
/*
pfSense_BUILDER_BINARIES: /sbin/ping
pfSense_BUILDER_BINARIES: /sbin/ping /sbin/ping6
pfSense_MODULE: routing
*/
@ -61,7 +61,7 @@ if ($_POST || $_REQUEST['host']) {
if (!$input_errors) {
$do_ping = true;
$host = gethostbyname($_REQUEST['host']);
$host = $_REQUEST['host'];
$interface = $_REQUEST['interface'];
$count = $_POST['count'];
if (preg_match('/[^0-9]/', $count) )
@ -125,20 +125,16 @@ include("head.inc"); ?>
echo "<font face='terminal' size='2'>";
echo "<strong>" . gettext("Ping output") . ":</strong><br>";
echo('<pre>');
if(is_ipaddrv4($host)) {
$ifaddr = get_interface_ip($interface);
if ($ifaddr)
system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
else
system("/sbin/ping -c$count " . escapeshellarg($host));
}
if(is_ipaddrv6($host)) {
$ifaddr = get_interface_ipv6($interface);
if ($ifaddr)
system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
else
system("/sbin/ping6 -c$count " . escapeshellarg($host));
}
$ifaddr = get_interface_ip($interface);
if ($ifaddr)
system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
else
system("/sbin/ping -c$count " . escapeshellarg($host));
$ifaddr = get_interface_ipv6($interface);
if ($ifaddr)
system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
else
system("/sbin/ping6 -c$count " . escapeshellarg($host));
echo('</pre>');
}