interfaces: OpenVPN never calls newipv6 so remove and restructure no-IP case

This commit is contained in:
Franco Fichtner 2023-03-01 08:06:40 +01:00
parent 9975cc9dad
commit ee4e53c7ac

View File

@ -58,31 +58,22 @@ if (!isset($config['interfaces'][$interface]['enable'])) {
return;
}
$interface_descr = convert_friendly_interface_to_friendly_descr($interface);
$ip = get_interface_ipv6($interface);
$cacheip_file = "/tmp/{$device}_oldipv6";
$cacheip = trim(@file_get_contents($cacheip_file));
if (!is_ipaddr($ip)) {
/*
* Take care of OpenVPN and similar if you generate the event
* to reconfigure an interface. OpenVPN might be in tap(4)
* mode and not have an IP address.
*/
if (substr($device, 0, 4) != 'ovpn') {
log_msg("Failed to detect IP for {$interface_descr}[{$interface}]", LOG_WARNING);
return;
}
/* force a non-IP value here that makes the problem explicit when debugged */
$ip = 'openvpn_xxx';
}
/* this may be required to cleanse the DNS information no longer available */
system_resolvconf_generate();
system_hosts_generate();
$interface_descr = convert_friendly_interface_to_friendly_descr($interface);
$ip = get_interface_ipv6($interface);
if (!is_ipaddr($ip)) {
/* interface is not ready */
log_msg("Failed to detect IP for {$interface_descr}[{$interface}]", LOG_INFO);
return;
}
$cacheip_file = "/tmp/{$device}_oldipv6";
$cacheip = trim(@file_get_contents($cacheip_file));
if ($force == 'no' && $ip == $cacheip) {
log_msg("No IP change detected for {$interface_descr}[{$interface}]", LOG_INFO);
return;