interfaces: polish main log message in renew, variable rename

This commit is contained in:
Franco Fichtner 2022-11-09 09:50:52 +02:00
parent a273028b14
commit ac6e109fcf
2 changed files with 14 additions and 14 deletions

View File

@ -46,21 +46,21 @@ exit_on_bootup(function ($argument) {
if (empty($argument)) {
$interface = 'wan';
$interface_real = get_real_interface($interface);
$device = get_real_interface($interface);
} else {
$interface = convert_real_interface_to_friendly_interface_name($argument);
$interface_real = $argument;
$device = $argument;
}
if (!isset($config['interfaces'][$interface]['enable'])) {
log_msg("Interface '{$interface}' ($interface_real) is disabled or empty, nothing to do.", LOG_WARNING);
log_msg("Interface '{$interface}' ($device) is disabled or empty, nothing to do.", LOG_WARNING);
return;
}
$interface_descr = convert_friendly_interface_to_friendly_descr($interface);
$ip = get_interface_ip($interface);
$cacheip_file = "/tmp/{$interface_real}_oldip";
$cacheip_file = "/tmp/{$device}_oldip";
if (!is_ipaddr($ip)) {
/* remove previously cached IP since it is gone */
@ -71,7 +71,7 @@ if (!is_ipaddr($ip)) {
* to reconfigure an interface. OpenVPN might be in tap(4)
* mode and not have an IP address.
*/
if (substr($interface_real, 0, 4) != 'ovpn') {
if (substr($device, 0, 4) != 'ovpn') {
log_msg("Failed to detect IP for {$interface_descr}[{$interface}]", LOG_WARNING);
return;
}
@ -87,7 +87,7 @@ if ($ip == $cacheip) {
return;
}
log_msg("On (IP address: {$ip} vs. ${cacheip}) (interface: {$interface_descr}[{$interface}]) (real interface: {$interface_real}).");
log_msg("IP renwal starting (new: {$ip}, old: ${cacheip}, interface: {$interface_descr}[{$interface}], device: {$device})");
interfaces_vips_configure($interface, 4);
@ -104,7 +104,7 @@ foreach ($gifs as $gif) {
$bridge = link_interface_to_bridge($interface);
if (!empty($bridge)) {
/* XXX _interfaces_bridge_configure() is probably cleaner */
interface_bridge_add_member($bridge, $interface_real);
interface_bridge_add_member($bridge, $device);
}
if (isset($config['interfaces'][$interface]['ipaddrv6'])) {
@ -159,7 +159,7 @@ foreach (array_keys($restartifs) as $ifname) {
*/
ifgroup_setup();
$cacheip_file = "/tmp/{$interface_real}_oldip";
$cacheip_file = "/tmp/{$device}_oldip";
$cacheip = trim(@file_get_contents($cacheip_file));
$intf_ipaddr = $config['interfaces'][$interface]['ipaddr'];

View File

@ -46,21 +46,21 @@ exit_on_bootup(function ($argument) {
if (empty($argument)) {
$interface = 'wan';
$interface_real = get_real_interface($interface, 'inet6');
$device = get_real_interface($interface, 'inet6');
} else {
$interface = convert_real_interface_to_friendly_interface_name($argument);
$interface_real = $argument;
$device = $argument;
}
if (!isset($config['interfaces'][$interface]['enable'])) {
log_msg("Interface '{$interface}' ($interface_real) is disabled or empty, nothing to do.", LOG_WARNING);
log_msg("Interface '{$interface}' ($device) is disabled or empty, nothing to do.", LOG_WARNING);
return;
}
$interface_descr = convert_friendly_interface_to_friendly_descr($interface);
$ip = get_interface_ipv6($interface);
$cacheip_file = "/tmp/{$interface_real}_oldipv6";
$cacheip_file = "/tmp/{$device}_oldipv6";
if (!is_ipaddr($ip)) {
/* remove previously cached IP since it is gone */
@ -71,7 +71,7 @@ if (!is_ipaddr($ip)) {
* to reconfigure an interface. OpenVPN might be in tap(4)
* mode and not have an IP address.
*/
if (substr($interface_real, 0, 4) != 'ovpn') {
if (substr($device, 0, 4) != 'ovpn') {
log_msg("Failed to detect IP for {$interface_descr}[{$interface}]", LOG_WARNING);
return;
}
@ -87,7 +87,7 @@ if ($ip == $cacheip) {
return;
}
log_msg("On (IP address: {$ip} vs. ${cacheip}) (interface: {$interface_descr}[{$interface}]) (real interface: {$interface_real}).");
log_msg("IP renwal starting (new: {$ip}, old: ${cacheip}, interface: {$interface_descr}[{$interface}], device: {$device})");
interfaces_vips_configure($interface, 6);