Commit e86885cb authored by Franco Fichtner's avatar Franco Fichtner

interfaces: fix clearing the dhcp config file when override file is gone #1052

parent 3e0be395
...@@ -3411,7 +3411,13 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg) ...@@ -3411,7 +3411,13 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
// DHCP6 Config File Override // DHCP6 Config File Override
if (!empty($wancfg['adv_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. */ /* wide-dhcp6c works for now. */
...@@ -3648,23 +3654,6 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) ...@@ -3648,23 +3654,6 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
return $dhcp6cconf; 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) function DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf)
{ {
$dhcp6cconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf); $dhcp6cconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
...@@ -3745,7 +3734,13 @@ EOD; ...@@ -3745,7 +3734,13 @@ EOD;
// DHCP Config File Override // DHCP Config File Override
if (!empty($wancfg['adv_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); fwrite($fd, $dhclientconf);
...@@ -3835,23 +3830,6 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) ...@@ -3835,23 +3830,6 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif)
return $dhclientconf; 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) function DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment