configurehood: Fix "wifi" blocking correct network status detection

Submitted by Adrian Schmutzler on Feb. 13, 2018, 12:14 p.m.

Details

Message ID 1518524071-2386-1-git-send-email-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler Feb. 13, 2018, 12:14 p.m.
In commit 5c1d3b1, conditions were changed so that "wifi" is called
almost every run directly before the network status (internet vs.
gateway contact vs. wXsta).

This causes strange effects configurehood and nodewatcher, which is
called at the same time.

The fix only does "wifi" if required and waits 10 sec. after that.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index cf79b42..3facc79 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -39,6 +39,7 @@  hasInternet() {
 # Hidden AP check
 
 if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
+	needwifi="0"
 	for radio in $(uci show wireless | sed -n 's,.*\.\([a-z0-9]*\)=wifi-device,\1,p'); do
 		freq="2"
 		if [ "$(uci get "wireless.${radio}.channel")" -gt "14" ]; then
@@ -59,9 +60,13 @@  if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
 			echo "Can't add Config interface on $radio."
 			exit 1
 		fi
+		needwifi="1"
 	done
 
-	wifi
+	if [ "$needwifi" = "1" ] ; then
+		wifi
+		sleep 10
+	fi
 fi
 
 lat=$(uci -q get fff.system.latitude)

Comments

Christian Dresel March 3, 2018, 9:09 p.m.
hi

war mir nicht bewusst das dies so kritisch ist :( Aber jetzt weiß ich wo
mein Problem liegt das mich schon einige Zeit nervt:

Reviewed-by: Christian Dresel <fff@chrisi01.de>

Danke

mfg

Christian

On 13.02.2018 13:14, Adrian Schmutzler wrote:
> In commit 5c1d3b1, conditions were changed so that "wifi" is called
> almost every run directly before the network status (internet vs.
> gateway contact vs. wXsta).
> 
> This causes strange effects configurehood and nodewatcher, which is
> called at the same time.
> 
> The fix only does "wifi" if required and waits 10 sec. after that.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index cf79b42..3facc79 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -39,6 +39,7 @@ hasInternet() {
>  # Hidden AP check
>  
>  if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
> +	needwifi="0"
>  	for radio in $(uci show wireless | sed -n 's,.*\.\([a-z0-9]*\)=wifi-device,\1,p'); do
>  		freq="2"
>  		if [ "$(uci get "wireless.${radio}.channel")" -gt "14" ]; then
> @@ -59,9 +60,13 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
>  			echo "Can't add Config interface on $radio."
>  			exit 1
>  		fi
> +		needwifi="1"
>  	done
>  
> -	wifi
> +	if [ "$needwifi" = "1" ] ; then
> +		wifi
> +		sleep 10
> +	fi
>  fi
>  
>  lat=$(uci -q get fff.system.latitude)
>
Tim Niemeyer March 3, 2018, 9:25 p.m.
Hi

Applied.

Bitte das nächste mal, wenn wir kurz vor einem Release stehen für
Release-kritische Bugs ein Mantis Ticket anlegen.

Das Thema hier hat mir jetzt n netten Berg Extra-Aufwand beschert, weil
es einfach niemand als relevant angesehen hat.

Tim

Am Dienstag, den 13.02.2018, 13:14 +0100 schrieb Adrian Schmutzler:
> In commit 5c1d3b1, conditions were changed so that "wifi" is called
> almost every run directly before the network status (internet vs.
> gateway contact vs. wXsta).
> 
> This causes strange effects configurehood and nodewatcher, which is
> called at the same time.
> 
> The fix only does "wifi" if required and waits 10 sec. after that.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index cf79b42..3facc79 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -39,6 +39,7 @@ hasInternet() {
>  # Hidden AP check
>  
>  if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
> +	needwifi="0"
>  	for radio in $(uci show wireless | sed -n 's,.*\.\([a-z0-
> 9]*\)=wifi-device,\1,p'); do
>  		freq="2"
>  		if [ "$(uci get "wireless.${radio}.channel")" -gt
> "14" ]; then
> @@ -59,9 +60,13 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ;
> then
>  			echo "Can't add Config interface on $radio."
>  			exit 1
>  		fi
> +		needwifi="1"
>  	done
>  
> -	wifi
> +	if [ "$needwifi" = "1" ] ; then
> +		wifi
> +		sleep 10
> +	fi
>  fi
>  
>  lat=$(uci -q get fff.system.latitude)
> -- 
> 2.7.4
>