diff options
author | jim-p <jimp@pfsense.org> | 2013-04-02 11:12:48 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-04-02 11:12:48 -0400 |
commit | 0d56c06b9b705b335361f3f7e63ab75a2bb7c34b (patch) | |
tree | 5146811f3c2e27b1709596fb4878d8e8af57b2c9 /usr/local/www/diag_ping.php | |
parent | c5e51011ab02527fb31c9bc3b0a13d0c1c1c7db9 (diff) | |
download | pfsense-0d56c06b9b705b335361f3f7e63ab75a2bb7c34b.zip pfsense-0d56c06b9b705b335361f3f7e63ab75a2bb7c34b.tar.gz |
Move some code to a function to avoid future duplication. Allow autocomplete on ping page. Add more escaping to command.
Diffstat (limited to 'usr/local/www/diag_ping.php')
-rwxr-xr-x | usr/local/www/diag_ping.php | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index a29208c..0c73f21 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -40,6 +40,7 @@ ##|*MATCH=diag_ping.php* ##|-PRIV +$allowautocomplete = true; $pgtitle = array(gettext("Diagnostics"), gettext("Ping")); require_once("guiconfig.inc"); @@ -107,30 +108,18 @@ include("head.inc"); ?> </td> </tr> <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Source Address"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("Source Address"); ?></td> <td width="78%" class="vtable"> <select name="sourceip" class="formselect"> <option value="">Any</option> - <?php $listenips = get_possible_listen_ips(); - foreach (array('server', 'client') as $mode) { - if (is_array($config['openvpn']["openvpn-{$mode}"])) { - foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) { - if (!isset($setting['disable'])) { - $vpn = array(); - $vpn['value'] = 'ovpn' . substr($mode, 0, 1) . $setting['vpnid']; - $vpn['name'] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']); - $listenips[] = $vpn; - } - } - } - } - foreach ($listenips as $lip): + <?php $sourceips = get_possible_traffic_source_addresses(); + foreach ($sourceips as $sip): $selected = ""; - if (!link_interface_to_bridge($lip['value']) && ($lip['value'] == $sourceip)) + if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip)) $selected = 'selected="selected"'; ?> - <option value="<?=$lip['value'];?>" <?=$selected;?>> - <?=htmlspecialchars($lip['name']);?> + <option value="<?=$sip['value'];?>" <?=$selected;?>> + <?=htmlspecialchars($sip['name']);?> </option> <?php endforeach; ?> </select> @@ -166,9 +155,9 @@ include("head.inc"); ?> $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); } if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) - $cmd = "{$command} -S$ifaddr -c$count " . escapeshellarg($host); + $cmd = "{$command} -S" . escapeshellarg($ifaddr) . " -c" . escapeshellarg($count) . " " . escapeshellarg($host); else - $cmd = "{$command} -c$count " . escapeshellarg($host); + $cmd = "{$command} -c" . escapeshellarg($count) . " " . escapeshellarg($host); //echo "Ping command: {$cmd}\n"; system($cmd); echo('</pre>'); |