mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix console set interface IP address
Problem as per forum https://forum.pfsense.org/index.php?topic=83651.0
The problem comes whenever services_dhcpd_configure is called - the global $config gets reset from the actual current config, and any pending changes in the current process are lost.
It was introduced by commit 86ce2df
in which services_dhcpdv4_configure() does:
require_once('pkg-utils.inc')
and pkg-utils.inc does various stuff like:
if(file_exists("/cf/conf/use_xmlreader"))
require_once("xmlreader.inc");
else
require_once("xmlparse.inc");
which seems to cause a reset of the $config variable, thus losing the pending changes the user has entered at the console.
The top-level code in rc.initial.setlanip really does not need to (and should not) implement any changes along the way - it should collect all the answers from the user, then write_config and then make all the necessary calls to routines to implement the changes on the running system. This fixes it - defer any calls to services_dhcpd_configure() until after all questions are answered and write_config has happened.
This commit is contained in:
parent
ec2904649f
commit
ba667cc6f4
@ -397,14 +397,12 @@ function console_configure_dhcpd($version = 4) {
|
||||
} else {
|
||||
/* TODO - this line is causing a "Fatal error: Cannot unset
|
||||
string offsets in /etc/rc.initial.setlanip" on below line
|
||||
number */
|
||||
if($config[$dhcpd][$interface])
|
||||
number - Nov 2014 - is it really? */
|
||||
if($config[$dhcpd][$interface]) {
|
||||
unset($config[$dhcpd][$interface]['enable']);
|
||||
echo "Disabling DHCPD...";
|
||||
if (!$dry_run) {
|
||||
services_dhcpd_configure();
|
||||
printf(gettext("Disabling %s DHCPD..."), $label_IPvX);
|
||||
$restart_dhcpd = true;
|
||||
}
|
||||
echo "Done!\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,7 +452,7 @@ if(!$config['interfaces']['lan']) {
|
||||
unset($config['nat']);
|
||||
if (!$dry_run) {
|
||||
system("rm /var/dhcpd/var/db/* >/dev/null 2>/dev/null");
|
||||
services_dhcpd_configure();
|
||||
$restart_dhcpd = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user