diff options
-rw-r--r-- | etc/inc/system.inc | 17 | ||||
-rwxr-xr-x | usr/local/www/diag_ping.php | 29 |
2 files changed, 26 insertions, 20 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index d895d2f..6299922 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1615,4 +1615,21 @@ function get_possible_listen_ips() { return $listenips; } +function get_possible_traffic_source_addresses() { + global $config; + $sourceips = 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']); + $sourceips[] = $vpn; + } + } + } + } + return $sourceips; +} ?> 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>'); |