[3/3] fff-hoods: create hoodfile AP earlier

Submitted by Fabian Blaese on May 6, 2020, 2:48 p.m.

Details

Message ID 20200506144803.590699-3-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese May 6, 2020, 2:48 p.m.
The hidden AP creation is moved to the end of
configurehood, so it is executed right after hoodfile
changes are processed.

When keeping the long sleep before trying to gather hoodfiles
via wireless or ethernet, this should decrease the delay after
hood changes to a minimum, as mesh nodes don't have to wait
until configurehood on VPN nodes is executed a second time.

Because hoodfiles gathered via wireless or ethernet are not
copied to hoodfilewww (which is used to deliver the active
hoodfile via ethernet or wireless), only authoritative hoodfiles
(keyxchange and gateway) trigger the creation of a hidden AP.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 .../fff-hoods/files/usr/sbin/configurehood    | 47 +++++++++----------
 1 file changed, 23 insertions(+), 24 deletions(-)

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 261b926..0722e77 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -38,30 +38,6 @@  hasInternet() {
 	return 1
 }
 
-# Hidden AP check
-
-if [ -s "$hoodfilewww" ] && isGatewayAvailable ; then
-	needwifi="0"
-	for radio in $(wifiListRadio); do
-		freq="$(wifiGetFreq $radio)"
-
-		# Break: wXconfig is up
-		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] && continue
-		# Break: No mesh interface
-		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] || continue
-		
-		# Enable configap
-		uci set wireless.w${freq}configap.disabled='0'
-		uci commit wireless
-		needwifi="1"
-	done
-
-	if [ "$needwifi" = "1" ]; then
-		reload_config
-		sleep 10
-	fi
-fi
-
 if [ -s "$hoodfilelocal" ]; then
 	# remove webroot hoodfile to prevent offering local hoodfiles to neighbours
 	rm -f "$hoodfilewww"
@@ -247,3 +223,26 @@  else
 	echo "We haven't got a file. We do nothing. We try it again in 5 minutes...";
 	exit 0
 fi
+
+# Hidden AP check
+if [ -s "$hoodfilewww" ] && isGatewayAvailable; then
+	needwifi="0"
+	for radio in $(wifiListRadio); do
+		freq="$(wifiGetFreq $radio)"
+
+		# Break: wXconfig is up
+		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] && continue
+		# Break: No mesh interface
+		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] || continue
+
+		# Enable configap
+		uci set wireless.w${freq}configap.disabled='0'
+		uci commit wireless
+		needwifi="1"
+	done
+
+	if [ "$needwifi" = "1" ]; then
+		reload_config
+		sleep 10
+	fi
+fi

Comments

Robert Langhammer June 17, 2020, 6:56 a.m.
Hi Fabian,

das hinten hin zu legen ist gut.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>

Ich überlege gerade, ob man hier das isGatewayAvailable braucht?

Am 06.05.20 um 16:48 schrieb Fabian Bläse:
> The hidden AP creation is moved to the end of
> configurehood, so it is executed right after hoodfile
> changes are processed.
>
> When keeping the long sleep before trying to gather hoodfiles
> via wireless or ethernet, this should decrease the delay after
> hood changes to a minimum, as mesh nodes don't have to wait
> until configurehood on VPN nodes is executed a second time.
>
> Because hoodfiles gathered via wireless or ethernet are not
> copied to hoodfilewww (which is used to deliver the active
> hoodfile via ethernet or wireless), only authoritative hoodfiles
> (keyxchange and gateway) trigger the creation of a hidden AP.
>
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  .../fff-hoods/files/usr/sbin/configurehood    | 47 +++++++++----------
>  1 file changed, 23 insertions(+), 24 deletions(-)
>
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 261b926..0722e77 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -38,30 +38,6 @@ hasInternet() {
>  	return 1
>  }
>
> -# Hidden AP check
> -
> -if [ -s "$hoodfilewww" ] && isGatewayAvailable ; then
> -	needwifi="0"
> -	for radio in $(wifiListRadio); do
> -		freq="$(wifiGetFreq $radio)"
> -
> -		# Break: wXconfig is up
> -		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] && continue
> -		# Break: No mesh interface
> -		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] || continue
> -
> -		# Enable configap
> -		uci set wireless.w${freq}configap.disabled='0'
> -		uci commit wireless
> -		needwifi="1"
> -	done
> -
> -	if [ "$needwifi" = "1" ]; then
> -		reload_config
> -		sleep 10
> -	fi
> -fi
> -
>  if [ -s "$hoodfilelocal" ]; then
>  	# remove webroot hoodfile to prevent offering local hoodfiles to neighbours
>  	rm -f "$hoodfilewww"
> @@ -247,3 +223,26 @@ else
>  	echo "We haven't got a file. We do nothing. We try it again in 5 minutes...";
>  	exit 0
>  fi
> +
> +# Hidden AP check
> +if [ -s "$hoodfilewww" ] && isGatewayAvailable; then
> +	needwifi="0"
> +	for radio in $(wifiListRadio); do
> +		freq="$(wifiGetFreq $radio)"
> +
> +		# Break: wXconfig is up
> +		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] && continue
> +		# Break: No mesh interface
> +		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] || continue
> +
> +		# Enable configap
> +		uci set wireless.w${freq}configap.disabled='0'
> +		uci commit wireless
> +		needwifi="1"
> +	done
> +
> +	if [ "$needwifi" = "1" ]; then
> +		reload_config
> +		sleep 10
> +	fi
> +fi
Adrian Schmutzler June 18, 2020, 10:11 a.m.
Hallo,

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Robert Langhammer
> Sent: Mittwoch, 17. Juni 2020 08:57
> To: franken-dev@freifunk.net
> Subject: Re: [PATCH 3/3] fff-hoods: create hoodfile AP earlier
> 
> Hi Fabian,
> 
> das hinten hin zu legen ist gut.

Nach hinten legen bedeutet hier aber früher ausführen!

Ich meine mich zu erinnern, der ursprüngliche Grund für das Ausführen erst nach 5 Minuten war eine gewisse Wartezeit bis Batman "bereit" ist und entsprechend isGatewayAvailable true geliefert hat. Keine Ahnung, ob das so noch relevant ist.

Grüße

Adrian

> 
> Reviewed-by: Robert Langhammer <rlanghammer@web.de>
> 
> Ich überlege gerade, ob man hier das isGatewayAvailable braucht?
> 
> Am 06.05.20 um 16:48 schrieb Fabian Bläse:
> > The hidden AP creation is moved to the end of configurehood, so it is
> > executed right after hoodfile changes are processed.
> >
> > When keeping the long sleep before trying to gather hoodfiles via
> > wireless or ethernet, this should decrease the delay after hood
> > changes to a minimum, as mesh nodes don't have to wait until
> > configurehood on VPN nodes is executed a second time.
> >
> > Because hoodfiles gathered via wireless or ethernet are not copied to
> > hoodfilewww (which is used to deliver the active hoodfile via ethernet
> > or wireless), only authoritative hoodfiles (keyxchange and gateway)
> > trigger the creation of a hidden AP.
> >
> > Signed-off-by: Fabian Bläse <fabian@blaese.de>
> > ---
> >  .../fff-hoods/files/usr/sbin/configurehood    | 47 +++++++++----------
> >  1 file changed, 23 insertions(+), 24 deletions(-)
> >
> > diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > index 261b926..0722e77 100755
> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > @@ -38,30 +38,6 @@ hasInternet() {
> >  	return 1
> >  }
> >
> > -# Hidden AP check
> > -
> > -if [ -s "$hoodfilewww" ] && isGatewayAvailable ; then
> > -	needwifi="0"
> > -	for radio in $(wifiListRadio); do
> > -		freq="$(wifiGetFreq $radio)"
> > -
> > -		# Break: wXconfig is up
> > -		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] &&
> continue
> > -		# Break: No mesh interface
> > -		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] ||
> continue
> > -
> > -		# Enable configap
> > -		uci set wireless.w${freq}configap.disabled='0'
> > -		uci commit wireless
> > -		needwifi="1"
> > -	done
> > -
> > -	if [ "$needwifi" = "1" ]; then
> > -		reload_config
> > -		sleep 10
> > -	fi
> > -fi
> > -
> >  if [ -s "$hoodfilelocal" ]; then
> >  	# remove webroot hoodfile to prevent offering local hoodfiles to
> neighbours
> >  	rm -f "$hoodfilewww"
> > @@ -247,3 +223,26 @@ else
> >  	echo "We haven't got a file. We do nothing. We try it again in 5
> minutes...";
> >  	exit 0
> >  fi
> > +
> > +# Hidden AP check
> > +if [ -s "$hoodfilewww" ] && isGatewayAvailable; then
> > +	needwifi="0"
> > +	for radio in $(wifiListRadio); do
> > +		freq="$(wifiGetFreq $radio)"
> > +
> > +		# Break: wXconfig is up
> > +		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] &&
> continue
> > +		# Break: No mesh interface
> > +		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] ||
> continue
> > +
> > +		# Enable configap
> > +		uci set wireless.w${freq}configap.disabled='0'
> > +		uci commit wireless
> > +		needwifi="1"
> > +	done
> > +
> > +	if [ "$needwifi" = "1" ]; then
> > +		reload_config
> > +		sleep 10
> > +	fi
> > +fi
Adrian Schmutzler Aug. 1, 2020, 10:12 a.m.
Applied.

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Mittwoch, 6. Mai 2020 16:48
> To: franken-dev@freifunk.net
> Subject: [PATCH 3/3] fff-hoods: create hoodfile AP earlier
> 
> The hidden AP creation is moved to the end of configurehood, so it is
> executed right after hoodfile changes are processed.
> 
> When keeping the long sleep before trying to gather hoodfiles via wireless or
> ethernet, this should decrease the delay after hood changes to a minimum,
> as mesh nodes don't have to wait until configurehood on VPN nodes is
> executed a second time.
> 
> Because hoodfiles gathered via wireless or ethernet are not copied to
> hoodfilewww (which is used to deliver the active hoodfile via ethernet or
> wireless), only authoritative hoodfiles (keyxchange and gateway) trigger the
> creation of a hidden AP.
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  .../fff-hoods/files/usr/sbin/configurehood    | 47 +++++++++----------
>  1 file changed, 23 insertions(+), 24 deletions(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 261b926..0722e77 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -38,30 +38,6 @@ hasInternet() {
>  	return 1
>  }
> 
> -# Hidden AP check
> -
> -if [ -s "$hoodfilewww" ] && isGatewayAvailable ; then
> -	needwifi="0"
> -	for radio in $(wifiListRadio); do
> -		freq="$(wifiGetFreq $radio)"
> -
> -		# Break: wXconfig is up
> -		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] &&
> continue
> -		# Break: No mesh interface
> -		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] ||
> continue
> -
> -		# Enable configap
> -		uci set wireless.w${freq}configap.disabled='0'
> -		uci commit wireless
> -		needwifi="1"
> -	done
> -
> -	if [ "$needwifi" = "1" ]; then
> -		reload_config
> -		sleep 10
> -	fi
> -fi
> -
>  if [ -s "$hoodfilelocal" ]; then
>  	# remove webroot hoodfile to prevent offering local hoodfiles to
> neighbours
>  	rm -f "$hoodfilewww"
> @@ -247,3 +223,26 @@ else
>  	echo "We haven't got a file. We do nothing. We try it again in 5
> minutes...";
>  	exit 0
>  fi
> +
> +# Hidden AP check
> +if [ -s "$hoodfilewww" ] && isGatewayAvailable; then
> +	needwifi="0"
> +	for radio in $(wifiListRadio); do
> +		freq="$(wifiGetFreq $radio)"
> +
> +		# Break: wXconfig is up
> +		[ "$(uci get "wireless.w${freq}configap.disabled")" = "0" ] &&
> continue
> +		# Break: No mesh interface
> +		[ "$(uci get "wireless.w${freq}mesh.disabled")" = "0" ] ||
> continue
> +
> +		# Enable configap
> +		uci set wireless.w${freq}configap.disabled='0'
> +		uci commit wireless
> +		needwifi="1"
> +	done
> +
> +	if [ "$needwifi" = "1" ]; then
> +		reload_config
> +		sleep 10
> +	fi
> +fi
> --
> 2.26.2