system: reorder routing calls for #1821

In order for default gateway switching to work we need to
call routing first, then set up gateways, lastly invoke
filter reload which currently chains the gateway swtich code.

While here, remove deprecation notes.
This commit is contained in:
Franco Fichtner 2018-02-27 18:13:13 +00:00
parent 4f955e4f7c
commit b30cbe1570
8 changed files with 11 additions and 25 deletions

View File

@ -323,7 +323,6 @@ function filter_configure_sync($verbose = false)
flush();
}
/* XXX deprectated feature, only called on reconfigure */
if (isset($config['system']['gw_switch_default'])) {
$gateways_status = return_gateways_status(true);
$gateways_arr = return_gateways_array();

View File

@ -554,8 +554,6 @@ function system_routing_configure($interface = '', $verbose = false)
if ($verbose) {
echo "done.\n";
}
return 0;
}

View File

@ -127,9 +127,9 @@ function filter_configure_xmlrpc()
require_once("services.inc");
require_once("rrd.inc");
filter_configure();
system_routing_configure();
setup_gateways_monitor();
filter_configure();
system_hosts_generate();
local_sync_accounts();
plugins_configure('dns');

View File

@ -43,5 +43,5 @@ foreach (glob("/tmp/delete_route_*.todo") as $filename) {
}
system_routing_configure('', true);
filter_configure_sync(true);
setup_gateways_monitor(true);
filter_configure_sync(true);

View File

@ -525,12 +525,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
plugins_configure('newwanip');
/* sync filter configuration */
system_routing_configure();
setup_gateways_monitor();
filter_configure();
rrd_configure();
if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) {
clear_subsystem_dirty('staticroutes');
}
}
@unlink('/tmp/.interfaces.apply');
header(url_safe('Location: /interfaces.php?if=%s', array($if)));

View File

@ -368,7 +368,7 @@ include("head.inc");
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?= !empty($pconfig['gw_switch_default']) ? 'checked="checked"' : '' ?> />
<strong><?=gettext("Allow default gateway switching"); ?></strong><br />
<output class="hidden" for="help_for_gw_switch_default">
<?= gettext('If the link where the default gateway resides fails switch the default gateway to another available one. This feature has been deprecated.') ?>
<?= gettext('If the link where the default gateway resides fails switch the default gateway to another available one.') ?>
</output>
</td>
</tr>

View File

@ -52,20 +52,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
exit;
}
} elseif (isset($_POST['apply'])) {
$retval = 0;
$retval = system_routing_configure();
system_routing_configure();
clear_subsystem_dirty('staticroutes');
setup_gateways_monitor();
configd_run('dyndns reload');
configd_run('rfc2136 reload');
configd_run('filter reload');
/* reconfigure our gateway monitor */
setup_gateways_monitor();
if ($retval == 0) {
clear_subsystem_dirty('staticroutes');
}
foreach ($a_gateway_groups as $gateway_group) {
$gw_subsystem = 'gwgroup.' . $gateway_group['name'];
if (is_subsystem_dirty($gw_subsystem)) {
@ -73,6 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
clear_subsystem_dirty($gw_subsystem);
}
}
header(url_safe('Location: /system_gateway_groups.php'));
exit;
}

View File

@ -129,14 +129,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
if (isset($pconfig['apply'])) {
// apply changes, reconfigure
$retval = 0;
$retval = system_routing_configure();
filter_configure();
/* reconfigure our gateway monitor */
system_routing_configure();
clear_subsystem_dirty('staticroutes');
setup_gateways_monitor();
if ($retval == 0) {
clear_subsystem_dirty('staticroutes');
}
filter_configure();
header(url_safe('Location: /system_gateways.php?displaysave=true'));
exit;
} elseif (isset($id) && isset($pconfig['act']) && $pconfig['act'] == "del") {