From 94ca4e0d47cf61b8e8c812ca3dc18356fc166fb0 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 11 Mar 2013 10:44:42 -0400 Subject: Be more careful when performing a ping to use the correct ping type if an IP address is entered. --- usr/local/www/diag_ping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index a84810e..655de94 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -126,12 +126,12 @@ include("head.inc"); ?> echo "" . gettext("Ping output") . ":
"; echo('
');
 					$ifaddr = get_interface_ip($interface);
-					if ($ifaddr)
+					if ($ifaddr && (is_ipaddrv4($host) || is_hostname($host)))
 						system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
 					else
 						system("/sbin/ping -c$count " . escapeshellarg($host));
 					$ifaddr = get_interface_ipv6($interface);
-					if ($ifaddr)
+					if ($ifaddr && (is_ipaddrv6($host) || is_hostname($host)))
 						system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
 					else
 						system("/sbin/ping6 -c$count " . escapeshellarg($host));
-- 
cgit v1.1