diff options
author | jim-p <jimp@pfsense.org> | 2013-04-02 11:28:10 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-04-02 11:50:16 -0400 |
commit | dbd182af2eeadd00897d6406e8a451e9e01d700e (patch) | |
tree | 52e07761477b025d92424d3f394da5b234f49883 /usr/local/www/diag_ping.php | |
parent | ac7f1763e1712dd85335f09d0434444cee2a6683 (diff) | |
download | pfsense-dbd182af2eeadd00897d6406e8a451e9e01d700e.zip pfsense-dbd182af2eeadd00897d6406e8a451e9e01d700e.tar.gz |
Fix/simplify some logic
Diffstat (limited to 'usr/local/www/diag_ping.php')
-rwxr-xr-x | usr/local/www/diag_ping.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 0c73f21..98a3bdd 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -150,14 +150,14 @@ include("head.inc"); ?> $command = "/sbin/ping"; if ($ipproto == "ipv6") { $command .= "6"; - $ifaddr = get_interface_ipv6($sourceip); + $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); } else { $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); } if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) - $cmd = "{$command} -S" . escapeshellarg($ifaddr) . " -c" . escapeshellarg($count) . " " . escapeshellarg($host); - else - $cmd = "{$command} -c" . escapeshellarg($count) . " " . escapeshellarg($host); + $srcip = "-S" . escapeshellarg($ifaddr); + + $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); //echo "Ping command: {$cmd}\n"; system($cmd); echo('</pre>'); |