summaryrefslogtreecommitdiffstats
path: root/etc/rc.newwanipv6
diff options
context:
space:
mode:
Diffstat (limited to 'etc/rc.newwanipv6')
-rwxr-xr-xetc/rc.newwanipv617
1 files changed, 12 insertions, 5 deletions
diff --git a/etc/rc.newwanipv6 b/etc/rc.newwanipv6
index 92fe5ea..3da6ac9 100755
--- a/etc/rc.newwanipv6
+++ b/etc/rc.newwanipv6
@@ -59,7 +59,7 @@ $argument = trim($argv[1], " \n\t");
log_error("rc.newwanipv6: Informational is starting {$argument}.");
-if(empty($argument)) {
+if (empty($argument)) {
$interface = "wan";
$interface_real = get_real_interface($interface, "inet6");
$curwanipv6 = get_interface_ipv6($interface, true);
@@ -69,6 +69,8 @@ if(empty($argument)) {
$curwanipv6 = get_interface_ipv6($interface, true);
}
+$interface_descr = convert_friendly_interface_to_friendly_descr($interface);
+
if (empty($interface)) {
filter_configure();
// restart_packages();
@@ -79,8 +81,12 @@ if (empty($interface)) {
if ($g['booting'] && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6")
exit;
+/*
+ * NOTE: Take care of openvpn and similar if you generate the event to reconfigure an interface.
+ * i.e. OpenVPN might be in tap mode and not have an ip.
+ */
if (empty($curwanipv6) || !is_ipaddrv6($curwanipv6)) {
- log_error("rc.newwanipv6: Failed to update {$interface} IPv6, restarting...");
+ log_error("rc.newwanipv6: Failed to update {$interface_descr}[{$interface}] IPv6, restarting...");
// send_event("interface reconfigure {$interface}");
exit;
}
@@ -100,7 +106,8 @@ if (!empty($_ENV['new_domain_name']))
file_put_contents("{$g['varetc_path']}/searchdomain_v6{$interface}", $_ENV['new_domain_name']);
/* write current WAN IPv6 to file */
-file_put_contents("{$g['vardb_path']}/{$interface}_ipv6", $curwanipv6);
+if (is_ipaddrv6($curwanipv6))
+ @file_put_contents("{$g['vardb_path']}/{$interface}_ipv6", $curwanipv6);
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real}).");
@@ -140,9 +147,9 @@ if (is_ipaddrv6($oldipv6)) {
exit;
} else if (does_interface_exist($interface_real))
mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete");
-}
-file_put_contents("{$g['vardb_path']}/{$interface}_cacheipv6", $curwanipv6);
+ file_put_contents("{$g['vardb_path']}/{$interface}_cacheipv6", $curwanipv6);
+}
/* perform RFC 2136 DNS update */
services_dnsupdate_process($interface);
OpenPOWER on IntegriCloud