From 8bea96391f790fa48156d2e26c6e75455e50138b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:28:14 +0200 Subject: So gethostbyname() does not work for ipv6, instead run both ping and ping6. That works too. --- usr/local/www/diag_ping.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'usr/local/www/diag_ping.php') diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 3715cf8..155f0f7 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -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 ""; echo "" . gettext("Ping output") . ":
"; echo('
');
-					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('
'); } -- cgit v1.1