Commit 0ea03eef authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) ditch get_possible_traffic_source_addresses(),...

(legacy) ditch get_possible_traffic_source_addresses(), https://github.com/opnsense/core/issues/1257

(cherry picked from commit 18a991be)
parent 105d5d9c
...@@ -1370,6 +1370,7 @@ function system_arp_wrong_if() ...@@ -1370,6 +1370,7 @@ function system_arp_wrong_if()
} }
function get_possible_listen_ips($include_ipv6_link_local = false, $include_loopback = true) { function get_possible_listen_ips($include_ipv6_link_local = false, $include_loopback = true) {
global $config;
$interfaces = get_configured_interface_with_descr(); $interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list(); $carplist = get_configured_carp_interface_list();
$listenips = array(); $listenips = array();
...@@ -1398,12 +1399,6 @@ function get_possible_listen_ips($include_ipv6_link_local = false, $include_loop ...@@ -1398,12 +1399,6 @@ function get_possible_listen_ips($include_ipv6_link_local = false, $include_loop
$tmp["value"] = "lo0"; $tmp["value"] = "lo0";
$listenips[] = $tmp; $listenips[] = $tmp;
} }
return $listenips;
}
function get_possible_traffic_source_addresses($include_ipv6_link_local=false) {
global $config;
$sourceips = get_possible_listen_ips($include_ipv6_link_local);
foreach (array('server', 'client') as $mode) { foreach (array('server', 'client') as $mode) {
if (isset($config['openvpn']["openvpn-{$mode}"]) && is_array($config['openvpn']["openvpn-{$mode}"])) { if (isset($config['openvpn']["openvpn-{$mode}"]) && is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) { foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
...@@ -1411,12 +1406,12 @@ function get_possible_traffic_source_addresses($include_ipv6_link_local=false) { ...@@ -1411,12 +1406,12 @@ function get_possible_traffic_source_addresses($include_ipv6_link_local=false) {
$vpn = array(); $vpn = array();
$vpn['value'] = 'ovpn' . substr($mode, 0, 1) . $setting['vpnid']; $vpn['value'] = 'ovpn' . substr($mode, 0, 1) . $setting['vpnid'];
$vpn['name'] = "OpenVPN {$mode}: " . htmlspecialchars($setting['description']); $vpn['name'] = "OpenVPN {$mode}: " . htmlspecialchars($setting['description']);
$sourceips[] = $vpn; $listenips[] = $vpn;
} }
} }
} }
} }
return $sourceips; return $listenips;
} }
function load_crypto_module() function load_crypto_module()
......
...@@ -436,7 +436,7 @@ $(document).ready(function() { ...@@ -436,7 +436,7 @@ $(document).ready(function() {
<select name="sourceip" class="form-control"> <select name="sourceip" class="form-control">
<option value=""><?=gettext('Default (any)') ?></option> <option value=""><?=gettext('Default (any)') ?></option>
<?php <?php
foreach (get_possible_traffic_source_addresses(false) as $sip):?> foreach (get_possible_listen_ips(false) as $sip):?>
<option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>> <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($sip['name']);?> <?=htmlspecialchars($sip['name']);?>
</option> </option>
......
...@@ -126,7 +126,7 @@ include("head.inc"); ?> ...@@ -126,7 +126,7 @@ include("head.inc"); ?>
<select name="sourceip" class="selectpicker"> <select name="sourceip" class="selectpicker">
<option value=""><?= gettext('Default') ?></option> <option value=""><?= gettext('Default') ?></option>
<?php <?php
foreach (get_possible_traffic_source_addresses(true) as $sip):?> foreach (get_possible_listen_ips(true) as $sip):?>
<option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>> <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($sip['name']);?> <?=htmlspecialchars($sip['name']);?>
</option> </option>
......
...@@ -187,7 +187,7 @@ include("head.inc"); ?> ...@@ -187,7 +187,7 @@ include("head.inc"); ?>
<select name="sourceip" class="selectpicker" data-size="5" data-live-search="true"> <select name="sourceip" class="selectpicker" data-size="5" data-live-search="true">
<option value=""><?= gettext('Any') ?></option> <option value=""><?= gettext('Any') ?></option>
<?php <?php
foreach (get_possible_traffic_source_addresses(true) as $sip):?> foreach (get_possible_listen_ips(true) as $sip):?>
<option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip) ? "selected=\"selected\"" : "";?>> <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip) ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($sip['name']);?> <?=htmlspecialchars($sip['name']);?>
</option> </option>
......
...@@ -128,7 +128,7 @@ include("head.inc"); ...@@ -128,7 +128,7 @@ include("head.inc");
<select name="sourceip" class="selectpicker"> <select name="sourceip" class="selectpicker">
<option value=""><?= gettext('Any') ?></option> <option value=""><?= gettext('Any') ?></option>
<?php <?php
foreach (get_possible_traffic_source_addresses(true) as $sip):?> foreach (get_possible_listen_ips(true) as $sip):?>
<option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>> <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($sip['name']);?> <?=htmlspecialchars($sip['name']);?>
</option> </option>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment