configurehood: Wait for the config AP to build when in sta mode

Submitted by Adrian Schmutzler on Nov. 23, 2017, 9:50 p.m.

Details

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

Commit Message

Adrian Schmutzler Nov. 23, 2017, 9:50 p.m.
The configurehood script is started at the same time for all
routers. Thus, if one router sets up its configap, another may
just go into wXsta at the very same moment. This creates a race
condition between configap setup and wXsta download.

To circumvent this, we add a sleep to the wXsta routine, so the
wXsta always comes later, but is still run every 5 minutes.

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

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 7d86247..b04c9bd 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -81,6 +81,8 @@  else
 		rm -f "$hoodfilecopy" # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
 		rm -f "$sectorcopy" # always delete: no broadcast for isolated device
 		rm -f "$sectortmp"
+		
+		sleep 30 # Wait for the config AP, which may be created at the same time as this script has started
 
 		if ! wifiDelIface; then
 			echo "Can't delete current wifi setup"

Comments

Fabian Blaese Dec. 3, 2017, 9:58 p.m.
Gefällt mir an sich soweit.
Wir müssen da nur aufpassen, dass das Skript mit den ganzen Wartezeiten nicht irgendwann mal über 5 Minuten läuft, das wäre nicht so schick.

Reviewed-by: Fabian Bläse <fabian@blaese.de>

Fabian

> On 23. Nov 2017, at 22:50, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:
> 
> The configurehood script is started at the same time for all
> routers. Thus, if one router sets up its configap, another may
> just go into wXsta at the very same moment. This creates a race
> condition between configap setup and wXsta download.
> 
> To circumvent this, we add a sleep to the wXsta routine, so the
> wXsta always comes later, but is still run every 5 minutes.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
> src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 7d86247..b04c9bd 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -81,6 +81,8 @@ else
> 		rm -f "$hoodfilecopy" # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
> 		rm -f "$sectorcopy" # always delete: no broadcast for isolated device
> 		rm -f "$sectortmp"
> +
> +		sleep 30 # Wait for the config AP, which may be created at the same time as this script has started
> 
> 		if ! wifiDelIface; then
> 			echo "Can't delete current wifi setup"
> --
> 2.7.4
> 
> --
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Tim Niemeyer Dec. 23, 2017, 12:26 p.m.
Hi

Und applied.

Danke
Tim

Am Donnerstag, den 23.11.2017, 22:50 +0100 schrieb Adrian Schmutzler:
> The configurehood script is started at the same time for all
> routers. Thus, if one router sets up its configap, another may
> just go into wXsta at the very same moment. This creates a race
> condition between configap setup and wXsta download.
> 
> To circumvent this, we add a sleep to the wXsta routine, so the
> wXsta always comes later, but is still run every 5 minutes.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 7d86247..b04c9bd 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -81,6 +81,8 @@ else
>  		rm -f "$hoodfilecopy" # delete this, so interfaces
> are recreated if reconnect with unchanged hood file takes place
>  		rm -f "$sectorcopy" # always delete: no broadcast
> for isolated device
>  		rm -f "$sectortmp"
> +		
> +		sleep 30 # Wait for the config AP, which may be
> created at the same time as this script has started
>  
>  		if ! wifiDelIface; then
>  			echo "Can't delete current wifi setup"
> -- 
> 2.7.4
>