mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
interfaces: fix clearing the dhcp config file when override file is gone #1052
This commit is contained in:
parent
3e0be39524
commit
e86885cb04
@ -3411,7 +3411,13 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
|
||||
|
||||
// DHCP6 Config File Override
|
||||
if (!empty($wancfg['adv_dhcp6_config_file_override'])) {
|
||||
$dhcp6cconf = DHCP6_Config_File_Override($wancfg, $wanif);
|
||||
$dhcp6cfile = $wancfg['adv_dhcp6_config_file_override_path'];
|
||||
if (file_exists($dhcp6cfile)) {
|
||||
$dhcp6cconf = file_get_contents($dhcp6cfile);
|
||||
$dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
|
||||
} else {
|
||||
log_error(sprintf('DHCP6 config file override does not exist: %s', $dhcp6cfile));
|
||||
}
|
||||
}
|
||||
|
||||
/* wide-dhcp6c works for now. */
|
||||
@ -3648,23 +3654,6 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
return $dhcp6cconf;
|
||||
}
|
||||
|
||||
|
||||
function DHCP6_Config_File_Override($wancfg, $wanif)
|
||||
{
|
||||
$dhcp6cfile = $wancfg['adv_dhcp6_config_file_override_path'];
|
||||
$dhcp6cconf = '';
|
||||
|
||||
if (file_exists($dhcp6cfile)) {
|
||||
$dhcp6cconf = file_get_contents($dhcp6cfile);
|
||||
$dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
|
||||
} else {
|
||||
log_error(sprintf('DHCP6 config file override does not exist: %s', $dhcp6cfile));
|
||||
}
|
||||
|
||||
return $dhcp6cconf;
|
||||
}
|
||||
|
||||
|
||||
function DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf)
|
||||
{
|
||||
$dhcp6cconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
|
||||
@ -3745,7 +3734,13 @@ EOD;
|
||||
|
||||
// DHCP Config File Override
|
||||
if (!empty($wancfg['adv_dhcp_config_file_override'])) {
|
||||
$dhclientconf = DHCP_Config_File_Override($wancfg, $wanif);
|
||||
$dhclientfile = $wancfg['adv_dhcp_config_file_override_path'];
|
||||
if (file_exists($dhclientfile)) {
|
||||
$dhclientconf = file_get_contents($dhclientfile);
|
||||
$dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
|
||||
} else {
|
||||
log_error(sprintf('DHCP config file override does not exist: %s', $dhclientfile));
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($fd, $dhclientconf);
|
||||
@ -3835,23 +3830,6 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
return $dhclientconf;
|
||||
}
|
||||
|
||||
|
||||
function DHCP_Config_File_Override($wancfg, $wanif)
|
||||
{
|
||||
$dhclientfile = $wancfg['adv_dhcp_config_file_override_path'];
|
||||
$dhclientconf = '';
|
||||
|
||||
if (file_exists($dhclientfile)) {
|
||||
$dhclientconf = file_get_contents($dhclientfile);
|
||||
$dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
|
||||
} else {
|
||||
log_error(sprintf('DHCP config file override does not exist: %s', $dhclientfile));
|
||||
}
|
||||
|
||||
return $dhclientconf;
|
||||
}
|
||||
|
||||
|
||||
function DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf)
|
||||
{
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user