mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
src: get rid of get_configured_interface_list() 1/2
This commit is contained in:
parent
6d5444f95b
commit
7c853d62a9
@ -280,9 +280,7 @@ function interfaces_create_wireless_clones($verbose = false)
|
||||
flush();
|
||||
}
|
||||
|
||||
$iflist = get_configured_interface_list();
|
||||
|
||||
foreach ($iflist as $if) {
|
||||
foreach (get_configured_interface_with_descr() as $if => $unused) {
|
||||
$realif = $config['interfaces'][$if]['if'];
|
||||
if (is_interface_wireless($realif)) {
|
||||
interface_wireless_clone(interface_get_wireless_clone($realif), $config['interfaces'][$if]);
|
||||
@ -396,7 +394,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0)
|
||||
$bridge['bridgeif'] = $bridgeif;
|
||||
}
|
||||
|
||||
$checklist = get_configured_interface_list();
|
||||
$checklist = get_configured_interface_with_descr();
|
||||
|
||||
/* Add interfaces to bridge */
|
||||
foreach ($members as $member) {
|
||||
@ -862,8 +860,7 @@ function interface_gif_configure(&$gif, $gifkey = "")
|
||||
|
||||
interfaces_bring_up($gifif);
|
||||
|
||||
$iflist = get_configured_interface_list();
|
||||
foreach ($iflist as $ifname) {
|
||||
foreach (get_configured_interface_with_descr() as $ifname => $unused) {
|
||||
if ($config['interfaces'][$ifname]['if'] == $gifif) {
|
||||
if (get_interface_gateway($ifname) || get_interface_gateway_v6($ifname)) {
|
||||
system_routing_configure(false, $ifname);
|
||||
@ -894,12 +891,11 @@ function interfaces_configure($verbose = false)
|
||||
interfaces_lagg_configure('', $verbose);
|
||||
interfaces_vlan_configure('', $verbose);
|
||||
|
||||
$iflist = get_configured_interface_with_descr();
|
||||
$delayed_list = array();
|
||||
$bridge_list = array();
|
||||
$track6_list = array();
|
||||
|
||||
foreach ($iflist as $if => $ifname) {
|
||||
foreach (get_configured_interface_with_descr() as $if => $ifname) {
|
||||
$realif = $config['interfaces'][$if]['if'];
|
||||
if (strstr($realif, "bridge")) {
|
||||
$bridge_list[$if] = $ifname;
|
||||
@ -1789,9 +1785,7 @@ function interface_sync_wireless_clones(&$ifcfg, $sync_changes = false)
|
||||
|
||||
$baseif = interface_get_wireless_base($ifcfg['if']);
|
||||
|
||||
// Sync shared settings for assigned clones
|
||||
$iflist = get_configured_interface_list(false, true);
|
||||
foreach ($iflist as $if) {
|
||||
foreach (get_configured_interface_with_descr(false, true) as $if => $unused) {
|
||||
if ($baseif == interface_get_wireless_base($config['interfaces'][$if]['if']) && $ifcfg['if'] != $config['interfaces'][$if]['if']) {
|
||||
if (isset($config['interfaces'][$if]['wireless']['standard']) || $sync_changes) {
|
||||
foreach ($shared_settings as $setting) {
|
||||
@ -2939,8 +2933,7 @@ function interface_dhcpv6_prepare($interface = 'wan', $wancfg)
|
||||
$preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
|
||||
$dhcp6cconf .= " prefix ::/{$preflen} infinity;\n";
|
||||
}
|
||||
$iflist = link_interface_to_track6($interface);
|
||||
foreach ($iflist as $friendly => $ifcfg) {
|
||||
foreach (link_interface_to_track6($interface) as $friendly => $ifcfg) {
|
||||
if (is_numeric($ifcfg['track6-prefix-id'])) {
|
||||
$realif = get_real_interface($friendly);
|
||||
$dhcp6cconf .= " prefix-interface {$realif} {\n";
|
||||
@ -3107,9 +3100,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
$id_assoc_statement_prefix .= ";\n";
|
||||
}
|
||||
|
||||
$iflist = link_interface_to_track6($interface);
|
||||
|
||||
foreach ($iflist as $friendly => $ifcfg) {
|
||||
foreach (link_interface_to_track6($interface) as $friendly => $ifcfg) {
|
||||
if (is_numeric($ifcfg['track6-prefix-id'])) {
|
||||
$realif = get_real_interface($friendly);
|
||||
$id_assoc_statement_prefix .= " prefix-interface {$realif} {\n";
|
||||
@ -3522,9 +3513,7 @@ function convert_friendly_interface_to_friendly_descr($interface)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* if list */
|
||||
$ifdescrs = get_configured_interface_with_descr(false, true);
|
||||
foreach ($ifdescrs as $if => $ifname) {
|
||||
foreach (get_configured_interface_with_descr(false, true) as $if => $ifname) {
|
||||
if ($if == $interface || $ifname == $interface) {
|
||||
return $ifname;
|
||||
}
|
||||
|
||||
@ -346,8 +346,7 @@ function system_hosts_generate($verbose = false)
|
||||
$hosts .= "{$cfgip}\t{$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
|
||||
}
|
||||
} else {
|
||||
$sysiflist = get_configured_interface_list();
|
||||
foreach ($sysiflist as $sysif) {
|
||||
foreach (get_configured_interface_with_descr() as $sysif => $unused) {
|
||||
if (!interface_has_gateway($sysif)) {
|
||||
$cfgip = get_interface_ip($sysif);
|
||||
if (is_ipaddr($cfgip)) {
|
||||
|
||||
@ -749,18 +749,12 @@ function get_configured_vips_list()
|
||||
return $alias_list;
|
||||
}
|
||||
|
||||
function get_configured_interface_list($only_opt = false, $withdisabled = false)
|
||||
function get_configured_interface_list()
|
||||
{
|
||||
$iflist = array();
|
||||
|
||||
foreach (legacy_config_get_interfaces(array('virtual' => false)) as $if => $ifdetail) {
|
||||
if ($only_opt && ($if == 'wan' || $if == 'lan')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($ifdetail['enable']) || $withdisabled == true) {
|
||||
$iflist[$if] = $if;
|
||||
}
|
||||
$iflist[$if] = $if;
|
||||
}
|
||||
|
||||
return $iflist;
|
||||
|
||||
@ -29,15 +29,16 @@
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
|
||||
|
||||
function lagg_inuse($lagg_intf) {
|
||||
function lagg_inuse($lagg_intf)
|
||||
{
|
||||
global $config;
|
||||
$iflist = get_configured_interface_list(false, true);
|
||||
foreach ($iflist as $if) {
|
||||
|
||||
foreach (get_configured_interface_with_descr(false, true) as $if => $unused) {
|
||||
if ($config['interfaces'][$if]['if'] == $lagg_intf) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['vlans']['vlan'])) {
|
||||
foreach ($config['vlans']['vlan'] as $vlan) {
|
||||
if($vlan['if'] == $lagg_intf) {
|
||||
@ -45,10 +46,11 @@ function lagg_inuse($lagg_intf) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$a_laggs = &config_read_array('laggs', 'lagg') ;
|
||||
$a_laggs = &config_read_array('laggs', 'lagg');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!empty($a_laggs[$_POST['id']])) {
|
||||
|
||||
@ -42,7 +42,7 @@ function available_interfaces($selected_id=null)
|
||||
global $config;
|
||||
// configured interfaces
|
||||
$configured_interfaces = array();
|
||||
foreach (get_configured_interface_list(false, true) as $intf) {
|
||||
foreach (get_configured_interface_with_descr(false, true) as $intf => $unused) {
|
||||
$configured_interfaces[] = get_real_interface($intf);
|
||||
}
|
||||
// lagg members from other lagg interfaces
|
||||
|
||||
@ -29,20 +29,21 @@
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
|
||||
function clone_inuse($cloneif) {
|
||||
function clone_inuse($cloneif)
|
||||
{
|
||||
global $config;
|
||||
$iflist = get_configured_interface_list(false, true);
|
||||
foreach ($iflist as $if) {
|
||||
|
||||
foreach (get_configured_interface_with_descr(false, true) as $if => $unused) {
|
||||
if ($config['interfaces'][$if]['if'] == $cloneif) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$a_clones = &config_read_array('wireless', 'clone');
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!empty($_POST['action']) && $_POST['action'] == "del" && !empty($a_clones[$_POST['id']])) {
|
||||
if (clone_inuse($a_clones[$_POST['id']]['cloneif'])) {
|
||||
|
||||
@ -30,20 +30,21 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
function clone_inuse($cloneif) {
|
||||
function clone_inuse($cloneif)
|
||||
{
|
||||
global $config;
|
||||
$iflist = get_configured_interface_list(false, true);
|
||||
foreach ($iflist as $if) {
|
||||
|
||||
foreach (get_configured_interface_with_descr() as $if => $unused) {
|
||||
if ($config['interfaces'][$if]['if'] == $cloneif) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$a_clones = &config_read_array('wireless', 'clone');
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($_GET['id']) && !empty($a_clones[$_GET['id']])) {
|
||||
$id = $_GET['id'];
|
||||
|
||||
@ -44,10 +44,7 @@ function find_ip_interface($ip, $bits = null) {
|
||||
|
||||
$isv6ip = is_ipaddrv6($ip);
|
||||
|
||||
/* if list */
|
||||
$ifdescrs = get_configured_interface_list();
|
||||
|
||||
foreach ($ifdescrs as $ifdescr => $ifname) {
|
||||
foreach (get_configured_interface_with_descr() as $ifname => $unused) {
|
||||
$ifip = ($isv6ip) ? get_interface_ipv6($ifname) : get_interface_ip($ifname);
|
||||
if (is_null($ifip))
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user