firewall: err what, second part of prevous not staged #5517

This commit is contained in:
Franco Fichtner 2022-02-01 13:09:47 +01:00
parent 973dfb1cfd
commit add23ab496
2 changed files with 15 additions and 11 deletions

View File

@ -4512,7 +4512,11 @@ function interfaces_addresses($interfaces, $as_subnet = false, $ifconfig_details
foreach ($result as &$info) {
foreach (config_read_array('virtualip', 'vip') as $vip) {
if (empty($info['interface']) || $info['interface'] != $vip['interface'] || $vip['mode'] != 'ipalias') {
if (empty($info['interface']) || $info['interface'] != $vip['interface']) {
continue;
}
if ($vip['mode'] != 'ipalias' && $vip['mode'] != 'carp') {
continue;
}

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2014-2021 Deciso B.V.
* Copyright (C) 2014-2022 Deciso B.V.
* Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>
* Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>
* Copyright (C) 2004-2005 Scott Ullrich <sullrich@gmail.com>
@ -93,7 +93,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input_errors = array();
$input_errors = [];
$pconfig = $_POST;
// input record id, if valid
@ -103,11 +103,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($config['interfaces'][$pconfig['interface']]) && !empty($config['interfaces'][$pconfig['interface']]['if'])) {
$selected_interface = $config['interfaces'][$pconfig['interface']]['if'];
} else {
$selected_interface = array();
$selected_interface = [];
}
// perform form validations
$reqdfields = array("mode");
$reqdfieldsn = array(gettext("Type"));
$reqdfields = ['mode'];
$reqdfieldsn = [gettext('Type')];
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
if (isset($id) && $pconfig['mode'] != $a_vip[$id]['mode']) {
@ -193,7 +193,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$vipent['noexpand'] = true;
}
if (empty($pconfig['bind'])) {
// nobind, only used for alias or carp
// nobind, only used for ipalias/carp
$vipent['nobind'] = true;
}
@ -204,14 +204,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (file_exists('/tmp/.firewall_virtual_ip.apply')) {
$toapplylist = unserialize(file_get_contents('/tmp/.firewall_virtual_ip.apply'));
} else {
$toapplylist = array();
$toapplylist = [];
}
if (isset($id)) {
// save existing content before changing it
$toapplylist[$id] = $a_vip[$id];
} else {
// new entry, no old data
$toapplylist[count($a_vip)] = array();
$toapplylist[count($a_vip)] = [];
}
if (isset($id)) {
@ -357,8 +357,8 @@ $( document ).ready(function() {
<td>
<select name="interface" class="selectpicker" data-width="auto">
<?php
$interfaces = legacy_config_get_interfaces(array('virtual' => false));
$interfaces['lo0'] = array('descr' => 'Loopback');
$interfaces = legacy_config_get_interfaces(['virtual' => false]);
$interfaces['lo0'] = ['descr' => 'Loopback'];
foreach ($interfaces as $iface => $ifcfg): ?>
<option value="<?=$iface;?>" <?= $iface == $pconfig['interface'] ? 'selected="selected"' : '' ?>>
<?= htmlspecialchars($ifcfg['descr']) ?>