Revision bd6ff328
Added by Renato Botelho almost 12 years ago
usr/local/www/diag_ping.php | ||
---|---|---|
147 | 147 |
echo "<font face='terminal' size='2'>"; |
148 | 148 |
echo "<strong>" . gettext("Ping output") . ":</strong><br>"; |
149 | 149 |
echo('<pre>'); |
150 |
$ifscope = ''; |
|
150 | 151 |
$command = "/sbin/ping"; |
151 | 152 |
if ($ipproto == "ipv6") { |
152 | 153 |
$command .= "6"; |
153 | 154 |
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); |
155 |
if (is_linklocal($ifaddr)) |
|
156 |
$ifscope = get_ll_scope($ifaddr); |
|
154 | 157 |
} else { |
155 | 158 |
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); |
156 | 159 |
} |
157 |
if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) |
|
160 |
if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
|
|
158 | 161 |
$srcip = "-S" . escapeshellarg($ifaddr); |
162 |
if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) |
|
163 |
$host .= "%{$ifscope}"; |
|
164 |
} |
|
159 | 165 |
|
160 | 166 |
$cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); |
161 | 167 |
//echo "Ping command: {$cmd}\n"; |
... | ... | |
173 | 179 |
</form> |
174 | 180 |
</td></tr> |
175 | 181 |
</table> |
176 |
<?php include("fend.inc"); ?> |
|
182 |
<?php include("fend.inc"); ?> |
Also available in: Unified diff
Add scope to target when it is a link-local, it helps ticket #3150