From a99ed3ee7ebd9d1776993532bda8ea5de2b4fb13 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 11 May 2017 10:04:15 +0200 Subject: [PATCH] rc: $configip for unified reload code later... --- src/etc/rc.newwanip | 8 +++++--- src/etc/rc.newwanipv6 | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip index f39f8c98f..8271b8476 100755 --- a/src/etc/rc.newwanip +++ b/src/etc/rc.newwanip @@ -79,13 +79,15 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn') return; } +$configip = $config['interfaces'][$interface]['ipaddr']; + $cacheip_file = "/var/db/{$interface}_cacheip"; -$ipfile = "/var/db/{$interface}_ip"; +$ip_file = "/var/db/{$interface}_ip"; /* write the current interface IP to file */ /* used in src/sbin/dhclient-script.ext */ if (is_ipaddr($ip)) { - @file_put_contents($ipfile, $ip); + @file_put_contents($ip_file, $ip); } link_interface_to_vips($interface, "update"); @@ -155,7 +157,7 @@ $cacheip = @file_get_contents($cacheip_file); * Even with the same IP the VPN software is unhappy with the IP disappearing, and we * could be failing back in which case we need to switch IPs back anyhow. */ -if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($config['interfaces'][$interface]['ipaddr'])) { +if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($configip)) { @unlink($cacheip_file); system_routing_configure($interface); diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6 index 79613f548..4183412e2 100755 --- a/src/etc/rc.newwanipv6 +++ b/src/etc/rc.newwanipv6 @@ -76,6 +76,8 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn') return; } +$configip = $config['interfaces'][$interface]['ipaddrv6']; + $searchdomain_file = "/var/etc/searchdomain_v6{$interface}"; $nameserver_file = "/var/etc/nameserver_v6{$interface}"; $cacheip_file = "/var/db/{$interface}_cacheipv6"; @@ -123,7 +125,7 @@ $cacheip = @file_get_contents($cacheip_file); * Even with the same IP the VPN software is unhappy with the IP disappearing, and we * could be failing back in which case we need to switch IPs back anyhow. */ -if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($config['interfaces'][$interface]['ipaddrv6'])) { +if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($configip)) { if (is_ipaddr($ip)) { if ($ip == $cacheip) { if (in_array($config['interfaces'][$interface]['ipaddr'], array('l2tp', 'ppp', 'pppoe', 'pptp'))) {