mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
interfaces: sync groups between possible create/destroy operations
Had to tiptope around f2769fe099 which seems useful but counter- intuitive. Renaming live groups is a bad concept. PR: https://github.com/opnsense/core/issues/5189
This commit is contained in:
parent
ba505fb122
commit
0d5ef68694
@ -145,6 +145,12 @@ foreach (array_keys($restartifs) as $ifname) {
|
||||
system_routing_configure(false, $ifname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interface reconfigure finished here so sync
|
||||
* firewall groups in case of destroy/create use.
|
||||
*/
|
||||
ifgroup_setup();
|
||||
|
||||
$cacheip = @file_get_contents($cacheip_file);
|
||||
|
||||
if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($configip)) {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
$a_bridges = &config_read_array('bridges', 'bridged');
|
||||
|
||||
@ -143,25 +144,28 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
if (count($input_errors) == 0) {
|
||||
$bridge = array();
|
||||
$bridge = [];
|
||||
|
||||
// booleans
|
||||
foreach (['enablestp', 'linklocal'] as $fieldname) {
|
||||
if (!empty($pconfig[$fieldname])) {
|
||||
$bridge[$fieldname] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 1 on 1 copy
|
||||
$copy_fields = array('descr', 'maxaddr', 'timeout', 'bridgeif', 'maxage','fwdelay', 'hellotime', 'priority', 'proto', 'holdcnt');
|
||||
foreach ($copy_fields as $fieldname) {
|
||||
if (isset($pconfig[$fieldname]) && $pconfig[$fieldname] != "") {
|
||||
if (isset($pconfig[$fieldname]) && $pconfig[$fieldname] != '') {
|
||||
$bridge[$fieldname] = $pconfig[$fieldname];
|
||||
} else {
|
||||
$bridge[$fieldname] = null;
|
||||
}
|
||||
}
|
||||
if ($pconfig['span'] != "none") {
|
||||
if ($pconfig['span'] != 'none') {
|
||||
$bridge['span'] = $pconfig['span'];
|
||||
}
|
||||
|
||||
// simple array fields
|
||||
$array_fields = array('members', 'stp', 'edge', 'autoedge', 'ptp', 'autoptp', 'static', 'private');
|
||||
foreach ($array_fields as $fieldname) {
|
||||
@ -169,25 +173,27 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$bridge[$fieldname] = implode(',', $pconfig[$fieldname]);
|
||||
}
|
||||
}
|
||||
|
||||
// array key/value sets
|
||||
$bridge['ifpriority'] = "";
|
||||
$bridge['ifpathcost'] = "";
|
||||
$bridge['ifpriority'] = '';
|
||||
$bridge['ifpathcost'] = '';
|
||||
foreach ($ifacelist as $ifn => $ifdescr) {
|
||||
if (isset($pconfig['ifpriority_'.$ifn]) && $pconfig['ifpriority_'.$ifn] != "") {
|
||||
if (!empty($bridge['ifpriority'])) {
|
||||
$bridge['ifpriority'] .= ',';
|
||||
}
|
||||
$bridge['ifpriority'] .= $ifn.":".$pconfig['ifpriority_'.$ifn];
|
||||
}
|
||||
if (isset($pconfig['ifpathcost_'.$ifn]) && $pconfig['ifpathcost_'.$ifn] != "") {
|
||||
if (!empty($bridge['ifpathcost'])) {
|
||||
$bridge['ifpathcost'] .= ',';
|
||||
}
|
||||
$bridge['ifpathcost'] .= $ifn.":".$pconfig['ifpathcost_'.$ifn];
|
||||
}
|
||||
if (isset($pconfig['ifpriority_'.$ifn]) && $pconfig['ifpriority_' . $ifn] != '') {
|
||||
if (!empty($bridge['ifpriority'])) {
|
||||
$bridge['ifpriority'] .= ',';
|
||||
}
|
||||
$bridge['ifpriority'] .= $ifn . ':' . $pconfig['ifpriority_' . $ifn];
|
||||
}
|
||||
if (isset($pconfig['ifpathcost_' . $ifn]) && $pconfig['ifpathcost_' . $ifn] != '') {
|
||||
if (!empty($bridge['ifpathcost'])) {
|
||||
$bridge['ifpathcost'] .= ',';
|
||||
}
|
||||
$bridge['ifpathcost'] .= $ifn . ':' . $pconfig['ifpathcost_' . $ifn];
|
||||
}
|
||||
}
|
||||
|
||||
interface_bridge_configure($bridge);
|
||||
ifgroup_setup();
|
||||
if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge")) {
|
||||
$input_errors[] = gettext("Error occurred creating interface, please retry.");
|
||||
} else {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
$a_gifs = &config_read_array('gifs', 'gif');
|
||||
|
||||
@ -114,6 +115,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
$gif['gifif'] = interface_gif_configure($gif);
|
||||
ifgroup_setup();
|
||||
if ($gif['gifif'] == "" || !stristr($gif['gifif'], "gif")) {
|
||||
$input_errors[] = gettext("Error occurred creating interface, please retry.");
|
||||
} else {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
$a_gres = &config_read_array('gres', 'gre');
|
||||
|
||||
@ -89,6 +90,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
|
||||
$gre['greif'] = interface_gre_configure($gre);
|
||||
ifgroup_setup();
|
||||
if ($gre['greif'] == "" || !stristr($gre['greif'], "gre")) {
|
||||
$input_errors[] = gettext("Error occurred creating interface, please retry.");
|
||||
} else {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
$a_vlans = &config_read_array('vlans', 'vlan');
|
||||
|
||||
@ -111,6 +112,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
} else {
|
||||
$vlan['vlanif'] = interface_vlan_configure($vlan);
|
||||
}
|
||||
ifgroup_setup();
|
||||
if ($vlan['vlanif'] == "" || !stristr($vlan['vlanif'], "vlan")) {
|
||||
$input_errors[] = gettext("Error occurred creating interface, please retry.");
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user