path: root/src/etc
diff options
authormarjohn56 <>2017-08-10 07:44:32 +0100
committermarjohn56 <>2017-08-11 07:29:41 +0100
commit881fb1867e81cc396277a73e4241f7a47a86a446 (patch)
treebe5efb2cf038539367a3fdf630af27d61c347756 /src/etc
parente78d59403b45d7a5b1ea4e4bdfcfbe7a2a65f77a (diff)
Some systems - only one that I am aware of, complain that unbound is starting before dchp6 has completed leading to problems, this occurs only on boot.
Further examination did indeed show that the problem is caused by unbound starting before the dhcp6c - RTSOLD - rc.newwanipv6 have completed, making sure that these have all run before unbound is allowed to start corrects the problem. In order to fix this I have added a file creation of a file in tmp in rc.newwanipv6, this is the final function when the system is booting and ONLY when the system is booting. In I have added an unlink_if_exists () of this file, this is a "just in case" catch, should the file have been left behind due to some unforeseen event. The real work is done in, a section of code has been added that can cause up-to a ten second delay before allowing unbound to start. This is achieved by waiting for the file created by rc.newwanipv6 to exist, once it does exist then the file is deleted, the sleep loop breaks and unbound is allowed to start. If the file does not exist after 10 seconds then the sleep loop exits and unbound can start. Checks are made for the fact that WAN is using Ipv6 and dhcp6,
Diffstat (limited to 'src/etc')
3 files changed, 22 insertions, 0 deletions
diff --git a/src/etc/inc/ b/src/etc/inc/
index 472e087..c47a542 100644
--- a/src/etc/inc/
+++ b/src/etc/inc/
@@ -3515,6 +3515,9 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven
// N.B. PPP connections using PPP as the IPv6 parent interface are excluded because the ppp-ipv6 script
// calls interface_dhcpv6_configure() for these connections after IPv6CP is up, whilst rc.newwanip
// handles all non-PPP connections with 'dhcp6usev4iface' set
+ /* Remove the check file. Should not be there but just in case */
+ unlink_if_exists("/tmp/{$wanif}_dhcp6_complete");
+ log_error(gettext("calling interface_dhcpv6_configure."));
if (!(isset($wancfg['dhcp6usev4iface']) || $wancfg['ipaddr']==='ppp')) {
interface_dhcpv6_configure($interface, $wancfg);
diff --git a/src/etc/inc/ b/src/etc/inc/
index b17b088..41ec68c 100644
--- a/src/etc/inc/
+++ b/src/etc/inc/
@@ -2261,8 +2261,26 @@ function services_unbound_configure($restart_dhcp = true) {
$return = 1;
+ /* Check here for dhcp6 complete - wait upto 10 seconds */
+ if($config['interfaces']["wan"]['ipaddrv6'] == 'dhcp6') {
+ $wanif = get_real_interface("wan", "inet6");
+ if (platform_booting()) {
+ for ($i=1; $i <= 10; $i++) {
+ if (!file_exists("/tmp/{$wanif}_dhcp6_complete")) {
+ log_error(gettext("Unbound start waiting on dhcp6c."));
+ sleep(1);
+ } else {
+ unlink_if_exists("/tmp/{$wanif}_dhcp6_complete");
+ log_error(gettext("dhcp6 init complete. Continuing"));
+ break;
+ }
+ }
+ }
+ }
if (platform_booting()) {
+ log_error(gettext("sync unbound done."));
echo gettext("done.") . "\n";
diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6
index f669f5b..f41a91d 100755
--- a/src/etc/rc.newwanipv6
+++ b/src/etc/rc.newwanipv6
@@ -140,6 +140,7 @@ setup_gateways_monitor();
if (platform_booting()) {
// avoid race conditions in many of the below functions that occur during boot
+ touch("/tmp/{$interface_real}_dhcp6_complete");
OpenPOWER on IntegriCloud