mirror of
https://github.com/opnsense/core.git
synced 2026-06-09 08:56:31 -04:00
interfaces: a few "foreach ($config" iterations switched to config_read_array()
This commit is contained in:
parent
138bff55b5
commit
7caec8a921
2 changed files with 12 additions and 9 deletions
|
|
@ -86,15 +86,19 @@ foreach (glob("/tmp/delete_vip_*.todo") as $filename) {
|
|||
unlink($filename);
|
||||
}
|
||||
|
||||
$virtualip_vips = config_read_array('virtualip', 'vip', false);
|
||||
|
||||
// diff model and actual ifconfig
|
||||
if (!empty($config['virtualip']['vip'])) {
|
||||
if (count($virtualip_vips)) {
|
||||
$interfaces = [];
|
||||
|
||||
foreach (legacy_config_get_interfaces() as $interfaceKey => $itf) {
|
||||
if (!empty($itf['if']) && ($itf['type'] ?? '') != 'group') {
|
||||
$interfaces[$interfaceKey] = $itf['if'];
|
||||
}
|
||||
}
|
||||
foreach ($config['virtualip']['vip'] as $vipent) {
|
||||
|
||||
foreach ($virtualip_vips as $vipent) {
|
||||
if (!empty($vipent['interface']) && !empty($interfaces[$vipent['interface']])) {
|
||||
$if = $interfaces[$vipent['interface']];
|
||||
$subnet = $vipent['subnet'];
|
||||
|
|
|
|||
|
|
@ -50,15 +50,14 @@ if (file_exists($vfilename) && filesize($vfilename) > 0) {
|
|||
flock($handle, LOCK_UN);
|
||||
}
|
||||
}
|
||||
|
||||
/* merge configured vlans */
|
||||
if (!empty($config['vlans']['vlan'])) {
|
||||
foreach ($config['vlans']['vlan'] as $vlan) {
|
||||
$all_vlans[$vlan['vlanif']] = $vlan;
|
||||
if (!isset($all_parents[$vlan['if']])) {
|
||||
$all_parents[$vlan['if']] = 0;
|
||||
}
|
||||
$all_parents[$vlan['if']]++;
|
||||
foreach (config_read_array('vlans', 'vlan', false) as $vlan) {
|
||||
$all_vlans[$vlan['vlanif']] = $vlan;
|
||||
if (!isset($all_parents[$vlan['if']])) {
|
||||
$all_parents[$vlan['if']] = 0;
|
||||
}
|
||||
$all_parents[$vlan['if']]++;
|
||||
}
|
||||
|
||||
/* handle existing vlans */
|
||||
|
|
|
|||
Loading…
Reference in a new issue