diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 14:37:02 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 14:37:42 -0300 |
commit | bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26 (patch) | |
tree | 03a7bba8624eea5c8105e5cc1a318ef0f2d5e80c /usr/local/www/diag_ping.php | |
parent | 86797a929bd6905b39cafc0c2fd138478c2a75f8 (diff) | |
download | pfsense-bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26.zip pfsense-bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26.tar.gz |
Add scope to target when it is a link-local, it helps ticket #3150
Diffstat (limited to 'usr/local/www/diag_ping.php')
-rwxr-xr-x | usr/local/www/diag_ping.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 2270264..6bb9184 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -147,15 +147,21 @@ include("head.inc"); ?> echo "<font face='terminal' size='2'>"; echo "<strong>" . gettext("Ping output") . ":</strong><br>"; echo('<pre>'); + $ifscope = ''; $command = "/sbin/ping"; if ($ipproto == "ipv6") { $command .= "6"; $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); + if (is_linklocal($ifaddr)) + $ifscope = get_ll_scope($ifaddr); } else { $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); } - if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) + if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { $srcip = "-S" . escapeshellarg($ifaddr); + if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) + $host .= "%{$ifscope}"; + } $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); //echo "Ping command: {$cmd}\n"; @@ -173,4 +179,4 @@ include("head.inc"); ?> </form> </td></tr> </table> -<?php include("fend.inc"); ?>
\ No newline at end of file +<?php include("fend.inc"); ?> |