From ce296c94d4aa24f17a045c145f94d686eca84e27 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sat, 6 Nov 2021 00:23:39 -0700 Subject: [PATCH] Make sure wifi is up before letting OLSRD run --- files/usr/local/bin/olsrd-config | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/files/usr/local/bin/olsrd-config b/files/usr/local/bin/olsrd-config index ebec7e45..b084e8f7 100755 --- a/files/usr/local/bin/olsrd-config +++ b/files/usr/local/bin/olsrd-config @@ -56,6 +56,17 @@ if ( $UCI_CONF_FILE eq "olsrd6" ) { exit 0; } +# Make sure wifi exists and is up to avoid OLSRD nameservice problems later. +# This is not the perfect place to do this, but it avoids changing more core functions. +if (system "ubus -t 10 wait_for network.interface.wifi" == 0) +{ + for ($i = 0; $i < 10; $i++) + { + chomp($wifiup = `ubus -S call network.interface.wifi status | jsonfilter -e '@.up'`); + last if ($wifiup eq "true"); + sleep 2; + } +} @names = @hosts = @services = @tunnels = ();